public abstract class FilteredModel extends AbstractModel
| Modifier and Type | Field and Description |
|---|---|
protected Resource[] |
contexts |
protected Value |
obj |
protected IRI |
pred |
protected Resource |
subj |
| Modifier | Constructor and Description |
|---|---|
protected |
FilteredModel(AbstractModel model,
Resource subj,
IRI pred,
Value obj,
Resource... contexts) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(Resource s,
IRI p,
Value o,
Resource... c)
Adds one or more statements to the model.
|
boolean |
contains(Resource s,
IRI p,
Value o,
Resource... c)
Determines if statements with the specified subject, predicate, object and (optionally) context exist in this
model.
|
Model |
filter(Resource s,
IRI p,
Value o,
Resource... c)
Returns a filtered view of the statements with the specified subject, predicate, object and (optionally) context.
|
Optional<Namespace> |
getNamespace(String prefix)
Gets the namespace that is associated with the specified prefix, if any.
|
Set<Namespace> |
getNamespaces()
Gets the set that contains the assigned namespaces.
|
boolean |
remove(Resource s,
IRI p,
Value o,
Resource... c)
Removes statements with the specified subject, predicate, object and (optionally) context exist in this model.
|
protected abstract void |
removeFilteredTermIteration(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.
|
Optional<Namespace> |
removeNamespace(String prefix)
Removes a namespace declaration by removing the association between a prefix and a namespace name.
|
void |
removeTermIteration(Iterator<Statement> iter,
Resource s,
IRI p,
Value o,
Resource... c)
Called by aggregate sets when a term has been removed from a term iterator.
|
void |
setNamespace(Namespace namespace)
Sets the prefix for a namespace.
|
Namespace |
setNamespace(String prefix,
String name)
Sets the prefix for a namespace.
|
int |
size() |
add, addAll, clear, clear, closeIterator, contains, containsAll, contexts, equals, hashCode, isEmpty, objects, predicates, remove, removeAll, retainAll, subjects, toArray, toArray, unmodifiableiterator, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitadd, contains, filter, getStatements, removeiterator, spliteratorparallelStream, removeIf, streamprotected Resource subj
protected IRI pred
protected Value obj
protected Resource[] contexts
protected FilteredModel(AbstractModel model, Resource subj, IRI pred, Value obj, Resource... contexts)
public Optional<Namespace> getNamespace(String prefix)
NamespaceAwareprefix - A namespace prefix.Optional.empty() if there is
no such namespace.public Set<Namespace> getNamespaces()
NamespaceAwarepublic Namespace setNamespace(String prefix, String name)
Modelprefix - The new prefix.name - The namespace name that the prefix maps to.Namespace object for the given namespace.public void setNamespace(Namespace namespace)
Modelnamespace - A Namespace object to use in this Model.public Optional<Namespace> removeNamespace(String prefix)
Modelprefix - The namespace prefix of which the assocation with a namespace name is to be removed.Optional.empty()public int size()
size in interface Collection<Statement>size in interface Set<Statement>size in class AbstractCollection<Statement>public boolean add(Resource s, IRI p, Value o, Resource... c)
Models - The statement's subject.p - The statement's predicate.o - The statement's object.c - The contexts to add statements to.public boolean remove(Resource s, IRI p, Value o, Resource... c)
Modelsubject, 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 be removed disregarding their context. If one or more contexts are specified, statements with a
context matching one of these will be removed. Note: to remove statements without an associated context, specify
the value null and explicitly cast it to type Resource.
Examples: model.remove(s1, null, null) removes any statements in this model have subject s1,
model.remove(null, null, null, c1) removes any statements in this model have context c1 ,
model.remove(null, null, null, (Resource)null) removes any statements in this model have no associated
context,
model.remove(null, null, null, c1, c2, c3) removes any statements in this model have context c1,
c2 or c3.
s - The subject of the statements to remove, null to remove statements with any subject.p - The predicate of the statements to remove, null to remove statements with any predicate.o - The object of the statements to remove, null to remove statements with any object.c - The contexts of the statements to remove. If no contexts are specified, statements will be
removed disregarding their context. If one or more contexts are specified, statements with a
context matching one of these will be removed.true if one or more statements have been removed.public boolean contains(Resource s, IRI p, Value o, Resource... c)
Modelsubject, 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: model.contains(s1, null, null) is true if any statements in this model have subject
s1,
model.contains(null, null, null, c1) is true if any statements in this model have context c1,
model.contains(null, null, null, (Resource)null) is true if any statements in this model have no
associated context,
model.contains(null, null, null, c1, c2, c3) is true if any statements in this model have context
c1, c2 or c3 .
s - The subject of the statements to match, null to match statements with any subject.p - The predicate of the statements to match, null to match statements with any predicate.o - The object of the statements to match, null to match statements with any object.c - 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.true if statements match the specified pattern.public Model filter(Resource s, IRI p, Value o, Resource... c)
Modelsubject, 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.
The returned model is backed by this Model, so changes to this Model are reflected in the returned model, and
vice-versa. If this Model is modified while an iteration over the returned model is in progress (except through
the iterator's own remove operation), the results of the iteration are undefined. The model supports
element removal, which removes the corresponding statement from this Model, via the Iterator.remove,
Set.remove, removeAll, retainAll, and clear operations. The statements passed to
the add and addAll operations must match the parameter pattern.
Examples: model.filter(s1, null, null) matches all statements that have subject s1,
model.filter(null, null, null, c1) matches all statements that have context c1,
model.filter(null, null, null, (Resource)null) matches all statements that have no associated
context,
model.filter(null, null, null, c1, c2, c3) matches all statements that have context c1,
c2 or c3.
s - The subject of the statements to match, null to match statements with any subject.p - The predicate of the statements to match, null to match statements with any predicate.o - The object of the statements to match, null to match statements with any object.c - 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.Model.getStatements(Resource, IRI, Value, Resource...)public final void removeTermIteration(Iterator<Statement> iter, Resource s, IRI p, Value o, Resource... c)
AbstractModelremoveTermIteration in class AbstractModeliter - The iterator used to navigate the live set (never null)s - the subject term to be removed or nullp - the predicate term to be removed or nullo - the object term to be removed or nullc - an array of one context term to be removed or an empty arrayprotected abstract void removeFilteredTermIteration(Iterator<Statement> iter, Resource subj, IRI pred, Value obj, Resource... contexts)
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 arrayCopyright © 2015-2020 Eclipse Foundation. All Rights Reserved.