public abstract class QuadModel extends AbstractCollection<org.openrdf.model.Statement> implements org.openrdf.model.Graph, Serializable
Modifier and Type | Field and Description |
---|---|
protected static org.openrdf.model.Resource[] |
CTX_ANY |
protected static org.openrdf.model.Resource[] |
CTX_DEFAULT |
Constructor and Description |
---|
QuadModel() |
Modifier and Type | Method and Description |
---|---|
boolean |
add(org.openrdf.model.Resource subj,
org.openrdf.model.URI pred,
org.openrdf.model.Value obj) |
boolean |
add(org.openrdf.model.Resource subj,
org.openrdf.model.URI pred,
org.openrdf.model.Value obj,
org.openrdf.model.Resource... ctxs)
Adds one or more statements to the quad model.
|
boolean |
add(org.openrdf.model.Statement stmt) |
void |
clear() |
boolean |
clear(org.openrdf.model.Resource... contexts)
Removes statements with the specified context existing in this quad model.
|
boolean |
contains(Object object) |
boolean |
contains(org.openrdf.model.Resource subj,
org.openrdf.model.URI pred,
org.openrdf.model.Value obj) |
boolean |
contains(org.openrdf.model.Resource subj,
org.openrdf.model.URI pred,
org.openrdf.model.Value obj,
org.openrdf.model.Resource... ctxs)
Determines if statements with the specified subject, predicate, object and (optionally)
context exist in this model.
|
Set<org.openrdf.model.Resource> |
contexts()
Returns a
Set view of the contexts contained in this model. |
static QuadModel |
create() |
static QuadModel |
create(Iterable<org.openrdf.model.Statement> statements) |
protected abstract boolean |
doAdd(org.openrdf.model.Resource subj,
org.openrdf.model.URI pred,
org.openrdf.model.Value obj,
org.openrdf.model.Resource[] ctxs) |
protected Iterator<org.openrdf.query.BindingSet> |
doEvaluate(org.openrdf.query.algebra.TupleExpr expr,
org.openrdf.query.Dataset dataset,
org.openrdf.query.BindingSet bindings) |
protected abstract org.openrdf.model.Namespace |
doGetNamespace(String prefix) |
protected abstract Set<org.openrdf.model.Namespace> |
doGetNamespaces() |
protected abstract Iterator<org.openrdf.model.Statement> |
doIterator(org.openrdf.model.Resource subj,
org.openrdf.model.URI pred,
org.openrdf.model.Value obj,
org.openrdf.model.Resource[] ctxs) |
protected org.openrdf.model.Value |
doNormalize(org.openrdf.model.Value value) |
protected abstract boolean |
doRemove(org.openrdf.model.Resource subj,
org.openrdf.model.URI pred,
org.openrdf.model.Value obj,
org.openrdf.model.Resource[] ctxs) |
protected abstract org.openrdf.model.Namespace |
doSetNamespace(String prefix,
String name) |
protected abstract int |
doSize(org.openrdf.model.Resource subj,
org.openrdf.model.URI pred,
org.openrdf.model.Value obj,
org.openrdf.model.Resource[] ctxs) |
protected int |
doSizeEstimate(org.openrdf.model.Resource subj,
org.openrdf.model.URI pred,
org.openrdf.model.Value obj,
org.openrdf.model.Resource ctx) |
Iterator<org.openrdf.query.BindingSet> |
evaluate(org.openrdf.query.algebra.TupleExpr expr,
org.openrdf.query.Dataset dataset,
org.openrdf.query.BindingSet bindings) |
QuadModel |
filter(Collection<org.openrdf.model.Statement> statements)
Returns an immutable view of a subset of this model, containing the specified
statements.
|
QuadModel |
filter(org.openrdf.model.Resource subj,
org.openrdf.model.URI pred,
org.openrdf.model.Value obj,
org.openrdf.model.Resource... ctxs)
Returns a view of the statements with the specified subject, predicate, object and
(optionally) context.
|
org.openrdf.query.algebra.evaluation.impl.EvaluationStatistics |
getEvaluationStatistics() |
org.openrdf.model.Namespace |
getNamespace(String prefix)
Gets the namespace for the specified prefix, if any.
|
Set<org.openrdf.model.Namespace> |
getNamespaces()
Gets the namespaces associated to this quad model.
|
org.openrdf.query.algebra.evaluation.TripleSource |
getTripleSource() |
org.openrdf.model.ValueFactory |
getValueFactory()
Deprecated.
|
Function<org.openrdf.model.Value,org.openrdf.model.Value> |
getValueNormalizer() |
boolean |
isEmpty() |
Iterator<org.openrdf.model.Statement> |
iterator() |
Iterator<org.openrdf.model.Statement> |
iterator(org.openrdf.model.Resource subj,
org.openrdf.model.URI pred,
org.openrdf.model.Value obj) |
Iterator<org.openrdf.model.Statement> |
iterator(org.openrdf.model.Resource subj,
org.openrdf.model.URI pred,
org.openrdf.model.Value obj,
org.openrdf.model.Resource... contexts) |
Iterator<org.openrdf.model.Statement> |
match(org.openrdf.model.Resource subj,
org.openrdf.model.URI pred,
org.openrdf.model.Value obj,
org.openrdf.model.Resource... contexts)
Deprecated.
|
<T extends org.openrdf.model.Value> |
normalize(T value) |
org.openrdf.model.Literal |
objectLiteral()
Utility method that casts the return value of
objectValue() to a Literal, or
throws a ModelException if that value is not a Literal. |
org.openrdf.model.Resource |
objectResource()
Utility method that casts the return value of
objectValue() to a Resource, or
throws a ModelException if that value is not a Resource. |
Set<org.openrdf.model.Value> |
objects()
Returns a
Set view of the objects contained in this model. |
String |
objectString()
Utility method that returns the string value of
objectValue() . |
org.openrdf.model.URI |
objectURI()
Utility method that casts the return value of
objectValue() to a URI, or throws a
ModelException if that value is not a URI. |
org.openrdf.model.Value |
objectValue()
Gets the object of the statement(s).
|
Set<org.openrdf.model.URI> |
predicates()
Returns a
Set view of the predicates contained in this model. |
boolean |
remove(Object object) |
boolean |
remove(org.openrdf.model.Resource subj,
org.openrdf.model.URI pred,
org.openrdf.model.Value obj) |
boolean |
remove(org.openrdf.model.Resource subj,
org.openrdf.model.URI pred,
org.openrdf.model.Value obj,
org.openrdf.model.Resource... ctxs)
Removes statements with the specified subject, predicate, object and (optionally) context
existing in this model.
|
boolean |
removeAll(Collection<?> c) |
org.openrdf.model.Namespace |
removeNamespace(String prefix)
Removes a namespace declaration.
|
void |
setNamespace(org.openrdf.model.Namespace namespace)
Sets the prefix for a namespace.
|
org.openrdf.model.Namespace |
setNamespace(String prefix,
String name)
Sets the prefix for a namespace.
|
int |
size() |
int |
size(org.openrdf.model.Resource subj,
org.openrdf.model.URI pred,
org.openrdf.model.Value obj) |
int |
size(org.openrdf.model.Resource subj,
org.openrdf.model.URI pred,
org.openrdf.model.Value obj,
org.openrdf.model.Resource... contexts) |
int |
sizeEstimate(org.openrdf.model.Resource subj,
org.openrdf.model.URI pred,
org.openrdf.model.Value obj,
org.openrdf.model.Resource... contexts) |
Set<org.openrdf.model.Resource> |
subjects()
Returns a
Set view of the subjects contained in this model. |
QuadModel |
unmodifiable() |
static QuadModel |
wrap(org.openrdf.model.Model model) |
static QuadModel |
wrap(org.openrdf.repository.RepositoryConnection connection,
boolean trackChanges) |
static QuadModel |
wrap(org.openrdf.sail.SailConnection connection,
boolean trackChanges)
Returns a
QuadModel view of the supplied SailConnection . |
addAll, containsAll, retainAll, toArray, toArray, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addAll, containsAll, equals, hashCode, parallelStream, removeIf, retainAll, spliterator, stream, toArray, toArray
protected static final org.openrdf.model.Resource[] CTX_ANY
protected static final org.openrdf.model.Resource[] CTX_DEFAULT
public static QuadModel create()
public static QuadModel wrap(org.openrdf.sail.SailConnection connection, boolean trackChanges)
QuadModel
view of the supplied SailConnection
. Given to the use
of internal locks in some SAIL implementations (e.g., the MemoryStore), the returned view
should be used only inside a thread, similarly to the SailConnection it wraps. Parameter
trackChanges
enables or disables the checks performed each time a statement is
added or removed that the model was changed.connection
- the connection to wraptrackChanges
- true, if addition/deletion operations should return true or false based on
whether the model was actually changed by the operation; if false, the check is
skipped and all modification operations return trueQuadModel
viewpublic static QuadModel wrap(org.openrdf.repository.RepositoryConnection connection, boolean trackChanges)
public static QuadModel wrap(org.openrdf.model.Model model)
protected abstract Set<org.openrdf.model.Namespace> doGetNamespaces()
@Nullable protected abstract org.openrdf.model.Namespace doGetNamespace(String prefix)
@Nullable protected abstract org.openrdf.model.Namespace doSetNamespace(String prefix, String name)
protected abstract int doSize(@Nullable org.openrdf.model.Resource subj, @Nullable org.openrdf.model.URI pred, @Nullable org.openrdf.model.Value obj, org.openrdf.model.Resource[] ctxs)
protected int doSizeEstimate(@Nullable org.openrdf.model.Resource subj, @Nullable org.openrdf.model.URI pred, @Nullable org.openrdf.model.Value obj, @Nullable org.openrdf.model.Resource ctx)
protected abstract Iterator<org.openrdf.model.Statement> doIterator(@Nullable org.openrdf.model.Resource subj, @Nullable org.openrdf.model.URI pred, @Nullable org.openrdf.model.Value obj, org.openrdf.model.Resource[] ctxs)
protected abstract boolean doAdd(@Nullable org.openrdf.model.Resource subj, @Nullable org.openrdf.model.URI pred, @Nullable org.openrdf.model.Value obj, org.openrdf.model.Resource[] ctxs)
protected abstract boolean doRemove(@Nullable org.openrdf.model.Resource subj, @Nullable org.openrdf.model.URI pred, @Nullable org.openrdf.model.Value obj, org.openrdf.model.Resource[] ctxs)
protected Iterator<org.openrdf.query.BindingSet> doEvaluate(org.openrdf.query.algebra.TupleExpr expr, @Nullable org.openrdf.query.Dataset dataset, @Nullable org.openrdf.query.BindingSet bindings)
protected org.openrdf.model.Value doNormalize(@Nullable org.openrdf.model.Value value)
public final QuadModel unmodifiable()
public final Set<org.openrdf.model.Namespace> getNamespaces()
@Nullable public final org.openrdf.model.Namespace getNamespace(String prefix)
prefix
- the namespace prefixpublic final org.openrdf.model.Namespace setNamespace(String prefix, String name)
prefix
- the prefixname
- the namespace that the prefix maps toNamespace
object for the given namespacepublic final void setNamespace(org.openrdf.model.Namespace namespace)
namespace
- a Namespace
object to use in this Model.@Nullable public final org.openrdf.model.Namespace removeNamespace(String prefix)
prefix
- the prefixpublic final boolean isEmpty()
isEmpty
in interface Collection<org.openrdf.model.Statement>
isEmpty
in class AbstractCollection<org.openrdf.model.Statement>
public final int size()
size
in interface Collection<org.openrdf.model.Statement>
size
in class AbstractCollection<org.openrdf.model.Statement>
public final int size(@Nullable org.openrdf.model.Resource subj, @Nullable org.openrdf.model.URI pred, @Nullable org.openrdf.model.Value obj)
public final int size(@Nullable org.openrdf.model.Resource subj, @Nullable org.openrdf.model.URI pred, @Nullable org.openrdf.model.Value obj, org.openrdf.model.Resource... contexts)
public final int sizeEstimate(@Nullable org.openrdf.model.Resource subj, @Nullable org.openrdf.model.URI pred, @Nullable org.openrdf.model.Value obj, org.openrdf.model.Resource... contexts)
public final Iterator<org.openrdf.model.Statement> iterator()
iterator
in interface Iterable<org.openrdf.model.Statement>
iterator
in interface Collection<org.openrdf.model.Statement>
iterator
in class AbstractCollection<org.openrdf.model.Statement>
public final Iterator<org.openrdf.model.Statement> iterator(@Nullable org.openrdf.model.Resource subj, @Nullable org.openrdf.model.URI pred, @Nullable org.openrdf.model.Value obj)
public final Iterator<org.openrdf.model.Statement> iterator(@Nullable org.openrdf.model.Resource subj, @Nullable org.openrdf.model.URI pred, @Nullable org.openrdf.model.Value obj, org.openrdf.model.Resource... contexts)
public final Iterator<org.openrdf.query.BindingSet> evaluate(org.openrdf.query.algebra.TupleExpr expr, @Nullable org.openrdf.query.Dataset dataset, @Nullable org.openrdf.query.BindingSet bindings)
public final boolean contains(@Nullable Object object)
contains
in interface Collection<org.openrdf.model.Statement>
contains
in class AbstractCollection<org.openrdf.model.Statement>
public final boolean contains(@Nullable org.openrdf.model.Resource subj, @Nullable org.openrdf.model.URI pred, @Nullable org.openrdf.model.Value obj)
public final boolean contains(@Nullable org.openrdf.model.Resource subj, @Nullable org.openrdf.model.URI pred, @Nullable org.openrdf.model.Value obj, org.openrdf.model.Resource... ctxs)
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
.subj
- the subject to match, or null to match any subjectpred
- the predicate to match, or null to match any predicateobj
- the object to match, or null to match any objectctxs
- the contexts to match; if empty, any statement context will be matchedpublic final boolean add(org.openrdf.model.Statement stmt)
add
in interface Collection<org.openrdf.model.Statement>
add
in class AbstractCollection<org.openrdf.model.Statement>
public final boolean add(@Nullable org.openrdf.model.Resource subj, @Nullable org.openrdf.model.URI pred, @Nullable org.openrdf.model.Value obj)
public final boolean add(@Nullable org.openrdf.model.Resource subj, @Nullable org.openrdf.model.URI pred, @Nullable org.openrdf.model.Value obj, org.openrdf.model.Resource... ctxs)
add
in interface org.openrdf.model.Graph
subj
- the subjectpred
- the predicateobj
- the object.ctxs
- the contexts to add statements to.IllegalArgumentException
- if this quad model cannot store the given statement, because it is filtered out
of this view.UnsupportedOperationException
- if this quad model cannot accept any statements, because it is filtered to the
empty set.public final void clear()
clear
in interface Collection<org.openrdf.model.Statement>
clear
in class AbstractCollection<org.openrdf.model.Statement>
public final boolean clear(org.openrdf.model.Resource... contexts)
contexts
- the contexts of the statements to removepublic final boolean remove(@Nullable Object object)
remove
in interface Collection<org.openrdf.model.Statement>
remove
in class AbstractCollection<org.openrdf.model.Statement>
public final boolean remove(@Nullable org.openrdf.model.Resource subj, @Nullable org.openrdf.model.URI pred, @Nullable org.openrdf.model.Value obj)
public final boolean remove(@Nullable org.openrdf.model.Resource subj, @Nullable org.openrdf.model.URI pred, @Nullable org.openrdf.model.Value obj, org.openrdf.model.Resource... ctxs)
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 context is 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
.subj
- the subject to match, or null to match any subjectpred
- the predicate to match, or null to match any predicateobj
- the object to match, or null to match any objectctxs
- the contexts to match; if empty, any statement context will be matchedpublic boolean removeAll(Collection<?> c)
removeAll
in interface Collection<org.openrdf.model.Statement>
removeAll
in class AbstractCollection<org.openrdf.model.Statement>
public QuadModel filter(@Nullable org.openrdf.model.Resource subj, @Nullable org.openrdf.model.URI pred, @Nullable org.openrdf.model.Value obj, org.openrdf.model.Resource... ctxs)
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 context is 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 quad model is
backed by this model, so changes to this model are reflected in the returned model, and
vice-versa. If this quad 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 returned quad model supports element removal, which removes
the corresponding statement from this model. Statements can be added to the returned quad
model only if they match the filter pattern.subj
- the subject to match, or null to match any subjectpred
- the predicate to match, or null to match any predicateobj
- the object to match, or null to match any objectctxs
- the contexts to match; if empty, any statement context will be matchedpublic QuadModel filter(Collection<org.openrdf.model.Statement> statements)
statements
- the statements of this model to include in the returned immutable view, without
duplicatespublic final Set<org.openrdf.model.Resource> subjects()
Set
view of the subjects contained in this model. The set is backed by
this model, so changes to this 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 the corresponding statement from the model. It does not
support element addition, unless this quad model is a filtered quad model with non-null
pred
and obj
filter parameteres.public final Set<org.openrdf.model.URI> predicates()
Set
view of the predicates contained in this model. The set is backed by
this model, so changes to this 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 the corresponding statement from the model. It does not
support element addition, unless this is a filtered quad model with non-null subj
and obj
filter parameters.public final Set<org.openrdf.model.Value> objects()
Set
view of the objects contained in this model. The set is backed by
this model, so changes to this 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 the corresponding statement from the model. It does not
support element addition, unless this is a filtered quad model with non-null subj
and pred
filter parameters.public final Set<org.openrdf.model.Resource> contexts()
Set
view of the contexts contained in this model. The set is backed by
this model, so changes to this 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 the corresponding statement from the model. It does not
support element addition, unless this is a filtered quad model with non-null subj
,
pred
and obj
filter parameters.@Nullable public final org.openrdf.model.Value objectValue() throws org.openrdf.model.util.ModelException
ModelException
is thrown if this is
not the case.org.openrdf.model.util.ModelException
- if multiple objects are present@Nullable public final org.openrdf.model.Literal objectLiteral() throws org.openrdf.model.util.ModelException
objectValue()
to a Literal, or
throws a ModelException if that value is not a Literal.org.openrdf.model.util.ModelException
- if multiple objects are present, or if the unique object is not a Literal@Nullable public final org.openrdf.model.Resource objectResource() throws org.openrdf.model.util.ModelException
objectValue()
to a Resource, or
throws a ModelException if that value is not a Resource.org.openrdf.model.util.ModelException
- if multiple objects are present, or if the unique object is not a resource@Nullable public final org.openrdf.model.URI objectURI() throws org.openrdf.model.util.ModelException
objectValue()
to a URI, or throws a
ModelException if that value is not a URI.org.openrdf.model.util.ModelException
- if multiple objects are present, or if the unique object is not a URI@Nullable public final String objectString() throws org.openrdf.model.util.ModelException
objectValue()
.org.openrdf.model.util.ModelException
- if multiple objects are present@Deprecated public final Iterator<org.openrdf.model.Statement> match(@Nullable org.openrdf.model.Resource subj, @Nullable org.openrdf.model.URI pred, @Nullable org.openrdf.model.Value obj, org.openrdf.model.Resource... contexts)
match
in interface org.openrdf.model.Graph
@Deprecated public final org.openrdf.model.ValueFactory getValueFactory()
getValueFactory
in interface org.openrdf.model.Graph
public final org.openrdf.query.algebra.evaluation.TripleSource getTripleSource()
public final org.openrdf.query.algebra.evaluation.impl.EvaluationStatistics getEvaluationStatistics()
public final Function<org.openrdf.model.Value,org.openrdf.model.Value> getValueNormalizer()
public <T extends org.openrdf.model.Value> T normalize(T value)
Copyright © 2015–2016 FBK-irst. All rights reserved.