Class LinkedHashModel
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<Statement>
-
- org.eclipse.rdf4j.model.impl.AbstractModel
-
- org.eclipse.rdf4j.model.impl.LinkedHashModel
-
- All Implemented Interfaces:
Serializable,Iterable<Statement>,Collection<Statement>,Set<Statement>,Model,NamespaceAware
public class LinkedHashModel extends AbstractModel
Hash table based implementation of theModelinterface.This implementation provides constant-time performance for filters using a single term, assuming the hash function disperses the elements properly among the buckets. Each term is indexed using a
HashMap. When multiple terms are provided in a filter the index, of the term that reduces the possibleStatements the most, is used and a sequential scan is used to filter additional terms.Note that this implementation is not synchronized. If multiple threads access a model concurrently, and at least one of the threads modifies the model, it must be synchronized externally. This is typically accomplished by synchronizing on some object that naturally encapsulates the model. If no such object exists, the set should be "wrapped" using the * Models.synchronizedModel method.
- Author:
- James Leigh
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLinkedHashModel.ModelStatement
-
Constructor Summary
Constructors Constructor Description LinkedHashModel()LinkedHashModel(int size)LinkedHashModel(Collection<? extends Statement> c)LinkedHashModel(Set<Namespace> namespaces)LinkedHashModel(Set<Namespace> namespaces, int size)LinkedHashModel(Set<Namespace> namespaces, Collection<? extends Statement> c)LinkedHashModel(Model model)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(Resource subj, IRI pred, Value obj, Resource... contexts)booleanadd(Statement statement)voidclear()booleancontains(Object o)booleancontains(Resource subj, IRI pred, Value obj, Resource... contexts)Modelfilter(Resource subj, IRI pred, Value obj, Resource... contexts)Optional<Namespace>getNamespace(String prefix)Set<Namespace>getNamespaces()booleanisEmpty()Iteratoriterator()booleanremove(Resource subj, IRI pred, Value obj, Resource... contexts)Optional<Namespace>removeNamespace(String prefix)voidremoveTermIteration(Iterator iterator, Resource subj, IRI pred, Value obj, Resource... contexts)Called by aggregate sets when a term has been removed from a term iterator.NamespacesetNamespace(String prefix, String name)voidsetNamespace(Namespace namespace)intsize()-
Methods inherited from class org.eclipse.rdf4j.model.impl.AbstractModel
addAll, clear, closeIterator, containsAll, contexts, objects, predicates, remove, removeAll, retainAll, subjects, toArray, toArray, unmodifiable
-
Methods inherited from class java.util.AbstractSet
equals, hashCode
-
Methods inherited from class java.util.AbstractCollection
toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface org.eclipse.rdf4j.model.Model
getStatements
-
Methods inherited from interface java.util.Set
equals, hashCode, spliterator
-
-
-
-
Constructor Detail
-
LinkedHashModel
public LinkedHashModel()
-
LinkedHashModel
public LinkedHashModel(Model model)
-
LinkedHashModel
public LinkedHashModel(Collection<? extends Statement> c)
-
LinkedHashModel
public LinkedHashModel(int size)
-
LinkedHashModel
public LinkedHashModel(Set<Namespace> namespaces, Collection<? extends Statement> c)
-
-
Method Detail
-
setNamespace
public void setNamespace(Namespace namespace)
-
size
public int size()
- Specified by:
sizein interfaceCollection<Statement>- Specified by:
sizein interfaceSet<Statement>- Specified by:
sizein classAbstractCollection<Statement>
-
add
public boolean add(Statement statement)
- Specified by:
addin interfaceCollection<Statement>- Specified by:
addin interfaceSet<Statement>- Overrides:
addin classAbstractModel
-
clear
public void clear()
- Specified by:
clearin interfaceCollection<Statement>- Specified by:
clearin interfaceSet<Statement>- Overrides:
clearin classAbstractModel
-
contains
public boolean contains(Object o)
- Specified by:
containsin interfaceCollection<Statement>- Specified by:
containsin interfaceSet<Statement>- Overrides:
containsin classAbstractModel
-
iterator
public Iterator iterator()
-
removeTermIteration
public void removeTermIteration(Iterator iterator, Resource subj, IRI pred, Value obj, Resource... contexts)
Description copied from class:AbstractModelCalled by aggregate sets when a term has been removed from a term iterator. Exactly one of the last four terms will be non-empty.- Specified by:
removeTermIterationin classAbstractModel- Parameters:
iterator- 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
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceCollection<Statement>- Specified by:
isEmptyin interfaceSet<Statement>- Overrides:
isEmptyin classAbstractModel
-
-