org.eclipse.rdf4j.model.impl

## Class AbstractModel

- java.lang.Object
- - java.util.AbstractCollection<E>
  - - java.util.AbstractSet<Statement>
    - - org.eclipse.rdf4j.model.impl.AbstractModel

- All Implemented Interfaces:
    Serializable, Iterable<Statement>, Collection<Statement>, Set<Statement>, Graph, Model, NamespaceAware
  Direct Known Subclasses:
    EmptyModel, FilteredModel, LinkedHashModel, SailModel, TreeModel

      public abstract class AbstractModel
      extends AbstractSet<Statement>
      implements Model

  Provides basic operations that are common to all Models.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractModel()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `add(Statement st)`
    `boolean` | `addAll(Collection<? extends Statement> c)`
    `void` | `clear()`
    `boolean` | `clear(Resource... contexts)` Removes statements with the specified context exist in this model.
    `protected void` | `closeIterator(Iterator<?> iter)` Cleans up any resources used by this iterator.
    `boolean` | `contains(Object o)`
    `boolean` | `containsAll(Collection<?> c)`
    `Set<Resource>` | `contexts()` Returns a `Set` view of the contexts contained in this model.
    `boolean` | `equals(Object o)`
    `ValueFactory` | `getValueFactory()` Deprecated.
    `int` | `hashCode()`
    `boolean` | `isEmpty()`
    `Iterator<Statement>` | `match(Resource subj, IRI pred, Value obj, Resource... contexts)` Deprecated.
    `Set<Value>` | `objects()` Returns a `Set` view of the objects contained in this model.
    `Set<IRI>` | `predicates()` Returns a `Set` view of the predicates contained in this model.
    `boolean` | `remove(Object o)`
    `boolean` | `removeAll(Collection<?> c)`
    `abstract void` | `removeTermIteration(Iterator<Statement> iter, Resource subj, IRI pred, Value obj, Resource... contexts)` Called by aggregate sets when a term has been removed from a term iterator.
    `boolean` | `retainAll(Collection<?> c)`
    `Set<Resource>` | `subjects()` Returns a `Set` view of the subjects contained in this model.
    `Object[]` | `toArray()`
    `<T> T[]` | `toArray(T[] a)`
    `Model` | `unmodifiable()` Returns an unmodifiable view of this model.

    - ### Methods inherited from class java.util.AbstractCollection

      `iterator, size, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.eclipse.rdf4j.model.Model

      `add, add, contains, contains, filter, filter, objectIRI, objectLiteral, objectResource, objectString, objectURI, objectValue, remove, remove, removeNamespace, setNamespace, setNamespace, subjectBNode, subjectIRI, subjectResource, subjectURI`

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

      `iterator, size, spliterator`

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

      `parallelStream, removeIf, stream`

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

      `forEach`

    - ### Methods inherited from interface org.eclipse.rdf4j.model.NamespaceAware

      `getNamespace, getNamespaces`

- - ### Constructor Detail

    - #### AbstractModel

          public AbstractModel()

  - ### Method Detail

    - #### unmodifiable

          public Model unmodifiable()

      Description copied from interface: `Model`
      Returns an unmodifiable view of this model. This method provides "read-only" access to this model. Query operations on the returned model "read through" to this model, and attempts to modify the returned model, whether direct or via its iterator, result in an `UnsupportedOperationException`.

      Specified by:
        `unmodifiable` in interface `Model`
      Returns:
        an unmodifiable view of the specified set.

    - #### add

          public boolean add(Statement st)

      Specified by:
        `add` in interface `Collection<Statement>`
      Specified by:
        `add` in interface `Set<Statement>`
      Overrides:
        `add` in class `AbstractCollection<Statement>`

    - #### isEmpty

          public boolean isEmpty()

      Specified by:
        `isEmpty` in interface `Collection<Statement>`
      Specified by:
        `isEmpty` in interface `Set<Statement>`
      Overrides:
        `isEmpty` in class `AbstractCollection<Statement>`

    - #### containsAll

          public boolean containsAll(Collection<?> c)

      Specified by:
        `containsAll` in interface `Collection<Statement>`
      Specified by:
        `containsAll` in interface `Set<Statement>`
      Overrides:
        `containsAll` in class `AbstractCollection<Statement>`

    - #### removeAll

          public boolean removeAll(Collection<?> c)

      Specified by:
        `removeAll` in interface `Collection<Statement>`
      Specified by:
        `removeAll` in interface `Set<Statement>`
      Overrides:
        `removeAll` in class `AbstractSet<Statement>`

    - #### toArray

          public Object[] toArray()

      Specified by:
        `toArray` in interface `Collection<Statement>`
      Specified by:
        `toArray` in interface `Set<Statement>`
      Overrides:
        `toArray` in class `AbstractCollection<Statement>`

    - #### toArray

          public <T> T[] toArray(T[] a)

      Specified by:
        `toArray` in interface `Collection<Statement>`
      Specified by:
        `toArray` in interface `Set<Statement>`
      Overrides:
        `toArray` in class `AbstractCollection<Statement>`

    - #### addAll

          public boolean addAll(Collection<? extends Statement> c)

      Specified by:
        `addAll` in interface `Collection<Statement>`
      Specified by:
        `addAll` in interface `Set<Statement>`
      Overrides:
        `addAll` in class `AbstractCollection<Statement>`

    - #### retainAll

          public boolean retainAll(Collection<?> c)

      Specified by:
        `retainAll` in interface `Collection<Statement>`
      Specified by:
        `retainAll` in interface `Set<Statement>`
      Overrides:
        `retainAll` in class `AbstractCollection<Statement>`

    - #### clear

          public void clear()

      Specified by:
        `clear` in interface `Collection<Statement>`
      Specified by:
        `clear` in interface `Set<Statement>`
      Overrides:
        `clear` in class `AbstractCollection<Statement>`

    - #### clear

          public boolean clear(Resource... contexts)

      Description copied from interface: `Model`
      Removes statements with the specified context exist in this model.
      Specified by:
        `clear` in interface `Model`
      Parameters:
        `contexts` - The context of the statements to remove.
      Returns:
        `true` if one or more statements have been removed.

    - #### remove

          public boolean remove(Object o)

      Specified by:
        `remove` in interface `Collection<Statement>`
      Specified by:
        `remove` in interface `Set<Statement>`
      Overrides:
        `remove` in class `AbstractCollection<Statement>`

    - #### contains

          public boolean contains(Object o)

      Specified by:
        `contains` in interface `Collection<Statement>`
      Specified by:
        `contains` in interface `Set<Statement>`
      Overrides:
        `contains` in class `AbstractCollection<Statement>`

    - #### hashCode

          public int hashCode()

      Specified by:
        `hashCode` in interface `Collection<Statement>`
      Specified by:
        `hashCode` in interface `Set<Statement>`
      Overrides:
        `hashCode` in class `AbstractSet<Statement>`

    - #### equals

          public boolean equals(Object o)

      Specified by:
        `equals` in interface `Collection<Statement>`
      Specified by:
        `equals` in interface `Set<Statement>`
      Overrides:
        `equals` in class `AbstractSet<Statement>`

    - #### subjects

          public Set<Resource> subjects()

      Description copied from interface: `Model`
      Returns a `Set` view of the subjects contained in this model. The set is backed by the model, so changes to the model are reflected in the set, and vice-versa. If the model is modified while an iteration over the set is in progress (except through the iterator's own `remove` operation), the results of the iteration are undefined. The set supports element removal, which removes all statements from the model for which that element is a subject value, via the `Iterator.remove`, `Set.remove`, `removeAll`, `retainAll`, and `clear` operations. It does not support the `add` or `addAll` operations if the parameters `pred` or `obj` are null.
      Specified by:
        `subjects` in interface `Model`
      Returns:
        a set view of the subjects contained in this model

    - #### predicates

          public Set<IRI> predicates()

      Description copied from interface: `Model`
      Returns a `Set` view of the predicates contained in this model. The set is backed by the model, so changes to the model are reflected in the set, and vice-versa. If the model is modified while an iteration over the set is in progress (except through the iterator's own `remove` operation), the results of the iteration are undefined. The set supports element removal, which removes all statements from the model for which that element is a predicate value, via the `Iterator.remove`, `Set.remove`, `removeAll`, `retainAll`, and `clear` operations. It does not support the `add` or `addAll` operations if the parameters `subj` or `obj` are null.
      Specified by:
        `predicates` in interface `Model`
      Returns:
        a set view of the predicates contained in this model

    - #### objects

          public Set<Value> objects()

      Description copied from interface: `Model`
      Returns a `Set` view of the objects contained in this model. The set is backed by the model, so changes to the model are reflected in the set, and vice-versa. If the model is modified while an iteration over the set is in progress (except through the iterator's own `remove` operation), the results of the iteration are undefined. The set supports element removal, which removes all statements from the model for which that element is an object value, via the `Iterator.remove`, `Set.remove`, `removeAll`, `retainAll`, and `clear` operations. It does not support the `add` or `addAll` operations if the parameters `subj` or `pred` are null.
      Specified by:
        `objects` in interface `Model`
      Returns:
        a set view of the objects contained in this model

    - #### contexts

          public Set<Resource> contexts()

      Description copied from interface: `Model`
      Returns a `Set` view of the contexts contained in this model. The set is backed by the model, so changes to the model are reflected in the set, and vice-versa. If the model is modified while an iteration over the set is in progress (except through the iterator's own `remove` operation), the results of the iteration are undefined. The set supports element removal, which removes all statements from the model for which that element is a context value, via the `Iterator.remove`, `Set.remove`, `removeAll`, `retainAll`, and `clear` operations. It does not support the `add` or `addAll` operations if the parameters `subj` , `pred` or `obj` are null.
      Specified by:
        `contexts` in interface `Model`
      Returns:
        a set view of the contexts contained in this model

    - #### removeTermIteration

          public abstract void removeTermIteration(Iterator<Statement> iter,
                                                   Resource subj,
                                                   IRI pred,
                                                   Value obj,
                                                   Resource... contexts)

      Called by aggregate sets when a term has been removed from a term iterator. Exactly one of the last four terms will be non-empty.
      Parameters:
        `iter` - The iterator used to navigate the live set (never null)
        `subj` - the subject term to be removed or null
        `pred` - the predicate term to be removed or null
        `obj` - the object term to be removed or null
        `contexts` - an array of one context term to be removed or an empty array

    - #### closeIterator

          protected void closeIterator(Iterator<?> iter)

      Cleans up any resources used by this iterator. After this call the given iterator should not be used.
      Parameters:
        `iter` - Iterator to clean up

    - #### match

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

      Deprecated.
      Description copied from interface: `Graph`
      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`.

      Specified by:
        `match` in interface `Graph`
      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.

    - #### getValueFactory

          @Deprecated
          public ValueFactory getValueFactory()

      Deprecated.
      Description copied from interface: `Graph`
      Gets the value factory for this graph.
      Specified by:
        `getValueFactory` in interface `Graph`

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