getObjects method

List<RdfObject> getObjects(
  1. RdfSubject subject,
  2. RdfPredicate predicate
)

Get all objects for a given subject and predicate

This is a convenience method when you're looking for the value(s) of a particular property for a resource. It returns all objects from triples where the subject and predicate match the specified values.

In RDF terms, this retrieves all values for a particular property of a resource, which is a common operation in semantic data processing.

Parameters:

  • subject The subject resource to query properties for
  • predicate The property (predicate) to retrieve values of

Returns: An unmodifiable list of all object values that match the pattern. The list may be empty if no matching triples exist.

Example:

// Get all John's email addresses
final johnEmails = graph.getObjects(john, email);

// Get all of John's known associates
final johnsContacts = graph.getObjects(john, knows);

// Check if John has any type information
final types = graph.getObjects(john, rdf.type);

Implementation

List<RdfObject> getObjects(RdfSubject subject, RdfPredicate predicate) {
  return List.unmodifiable(
    findTriples(
      subject: subject,
      predicate: predicate,
    ).map((triple) => triple.object),
  );
}