Package 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:
java.io.Serializable,java.lang.Iterable<Statement>,java.util.Collection<Statement>,java.util.Set<Statement>,Model,NamespaceAware
- Direct Known Subclasses:
EmptyModel,FilteredModel,LinkedHashModel,SailModel,TreeModel,UnmodifiableModel
public abstract class AbstractModel extends java.util.AbstractSet<Statement> implements Model
Provides basic operations that are common to all Models.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classAbstractModel.ValueSet<V extends Value>
-
Field Summary
Fields Modifier and Type Field Description private static longserialVersionUID
-
Constructor Summary
Constructors Constructor Description AbstractModel()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanadd(Statement st)booleanaddAll(java.util.Collection<? extends Statement> c)voidclear()booleanclear(Resource... contexts)Removes statements with the specified context exist in this model.private voidcloseIterator(java.util.Collection<?> c, java.util.Iterator<?> e)protected voidcloseIterator(java.util.Iterator<?> iter)Cleans up any resources used by this iterator.booleancontains(java.lang.Object o)booleancontainsAll(java.util.Collection<?> c)java.util.Set<Resource>contexts()Returns aSetview of the contexts contained in this model.booleanisEmpty()java.util.Set<Value>objects()Returns aSetview of the objects contained in this model.java.util.Set<IRI>predicates()Returns aSetview of the predicates contained in this model.booleanremove(java.lang.Object o)booleanremoveAll(java.util.Collection<?> c)abstract voidremoveTermIteration(java.util.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.booleanretainAll(java.util.Collection<?> c)java.util.Set<Resource>subjects()Returns aSetview of the subjects contained in this model.java.lang.Object[]toArray()<T> T[]toArray(T[] a)Modelunmodifiable()Returns an unmodifiable view of this model.-
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, contains, filter, getStatements, remove, removeNamespace, setNamespace, setNamespace
-
Methods inherited from interface org.eclipse.rdf4j.model.NamespaceAware
getNamespace, getNamespaces
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Method Detail
-
unmodifiable
public Model unmodifiable()
Description copied from interface:ModelReturns 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 anUnsupportedOperationException.- Specified by:
unmodifiablein interfaceModel- Returns:
- an unmodifiable view of the specified set.
-
add
public boolean add(Statement st)
-
isEmpty
public boolean isEmpty()
-
containsAll
public boolean containsAll(java.util.Collection<?> c)
-
removeAll
public boolean removeAll(java.util.Collection<?> c)
-
toArray
public java.lang.Object[] toArray()
-
toArray
public <T> T[] toArray(T[] a)
-
addAll
public boolean addAll(java.util.Collection<? extends Statement> c)
-
retainAll
public boolean retainAll(java.util.Collection<?> c)
-
clear
public void clear()
-
clear
public boolean clear(Resource... contexts)
Description copied from interface:ModelRemoves statements with the specified context exist in this model.
-
remove
public boolean remove(java.lang.Object o)
-
contains
public boolean contains(java.lang.Object o)
-
subjects
public java.util.Set<Resource> subjects()
Description copied from interface:ModelReturns aSetview 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 ownremoveoperation), 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 theIterator.remove,Set.remove,removeAll,retainAll, andclearoperations. It does not support theaddoraddAlloperations if the parameterspredorobjare null.
-
predicates
public java.util.Set<IRI> predicates()
Description copied from interface:ModelReturns aSetview 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 ownremoveoperation), 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 theIterator.remove,Set.remove,removeAll,retainAll, andclearoperations. It does not support theaddoraddAlloperations if the parameterssubjorobjare null.- Specified by:
predicatesin interfaceModel- Returns:
- a set view of the predicates contained in this model
-
objects
public java.util.Set<Value> objects()
Description copied from interface:ModelReturns aSetview 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 ownremoveoperation), 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 theIterator.remove,Set.remove,removeAll,retainAll, andclearoperations. It does not support theaddoraddAlloperations if the parameterssubjorpredare null.
-
contexts
public java.util.Set<Resource> contexts()
Description copied from interface:ModelReturns aSetview 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 ownremoveoperation), 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 theIterator.remove,Set.remove,removeAll,retainAll, andclearoperations. It does not support theaddoraddAlloperations if the parameterssubj,predorobjare null.
-
removeTermIteration
public abstract void removeTermIteration(java.util.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 nullpred- the predicate term to be removed or nullobj- the object term to be removed or nullcontexts- an array of one context term to be removed or an empty array
-
closeIterator
protected void closeIterator(java.util.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
-
closeIterator
private void closeIterator(java.util.Collection<?> c, java.util.Iterator<?> e)
-
-