org.eclipse.rdf4j.model

## Interface Graph

- All Superinterfaces:
    Collection<Statement>, Iterable<Statement>, Serializable
  All Known Subinterfaces:
    Model
  All Known Implementing Classes:
    AbstractModel, EmptyModel, FilteredModel, GraphImpl, LinkedHashModel, SailModel, TreeModel

  Deprecated.
  Use `Model` instead.

      @Deprecated
      public interface Graph
      extends Collection<Statement>, Serializable

  An RDF graph, represented as a collection of `Statement`s.
  Author:
    Arjohn Kampman
  See Also:
    `GraphUtil`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `add(Resource subj, IRI pred, Value obj, Resource... contexts)` Deprecated. Adds one or more statements to the graph.
    `ValueFactory` | `getValueFactory()` Deprecated. `SimpleValueFactory.getInstance()` will obtain a default value factory implementation. If you are working with the Repository API, then `Repository` instances also supply a `getValueFactory()` method.
    `Iterator<Statement>` | `match(Resource subj, IRI pred, Value obj, Resource... contexts)` Deprecated. The preferred alternative is `Model.filter(org.eclipse.rdf4j.model.Resource, org.eclipse.rdf4j.model.IRI, org.eclipse.rdf4j.model.Value, org.eclipse.rdf4j.model.Resource...)`.iterator().

    - ### Methods inherited from interface java.util.Collection

      `add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach`

- - ### Method Detail

    - #### getValueFactory

          @Deprecated
          ValueFactory getValueFactory()

      Deprecated. `SimpleValueFactory.getInstance()` will obtain a default value factory implementation. If you are working with the Repository API, then `Repository` instances also supply a `getValueFactory()` method.
      Gets the value factory for this graph.

    - #### add

          boolean add(Resource subj,
                      IRI pred,
                      Value obj,
                      Resource... contexts)

      Deprecated.
      Adds one or more statements to the graph. This method creates a statement for each specified context and adds those to the graph. If no contexts are specified, a single statement with no associated context is added.
      Parameters:
        `subj` - The statement's subject, must not be `null`.
        `pred` - The statement's predicate, must not be `null`.
        `obj` - The statement's object, must not be `null`.
        `contexts` - The contexts to add statements to.

    - #### match

          @Deprecated
          Iterator<Statement> match(Resource subj,
                                                IRI pred,
                                                Value obj,
                                                Resource... contexts)

      Deprecated. The preferred alternative is `Model.filter(org.eclipse.rdf4j.model.Resource, org.eclipse.rdf4j.model.IRI, org.eclipse.rdf4j.model.Value, org.eclipse.rdf4j.model.Resource...)`.iterator().
      Gets the statements with the specified subject, predicate, object and (optionally) context. The `subject`, `predicate` and `object` parameters can be `null` to indicate wildcards. The `contexts` parameter is a wildcard and accepts zero or more values. If no contexts are specified, statements will match disregarding their context. If one or more contexts are specified, statements with a context matching one of these will match. Note: to match statements without an associated context, specify the value `null` and explicitly cast it to type `Resource`.

      Examples: `graph.match(s1, null, null)` matches all statements that have subject `s1`,
      `graph.match(null, null, null, c1)` matches all statements that have context `c1`,
      `graph.match(null, null, null, (Resource)null)` matches all statements that have no associated context,
      `graph.match(null, null, null, c1, c2, c3)` matches all statements that have context `c1` , `c2` or `c3`.

      Parameters:
        `subj` - The subject of the statements to match, `null` to match statements with any subject.
        `pred` - The predicate of the statements to match, `null` to match statements with any predicate.
        `obj` - The object of the statements to match, `null` to match statements with any object.
        `contexts` - The contexts of the statements to match. If no contexts are specified, statements will match disregarding their context. If one or more contexts are specified, statements with a context matching one of these will match.
      Returns:
        The statements that match the specified pattern.
      Throws:
        `IllegalArgumentException` - If a `null`-array is specified as the value for `contexts`. See `OpenRDFUtil.verifyContextNotNull(Resource[])` for more info.

Copyright © 2015-2020 Eclipse Foundation. All Rights Reserved.