public interface StorageRDF
DatasetGraph or any of it's
derived classes and it just concerned with Triples and Quads, not
Graphs nor prefixes.
Storage is split into the triples for the default graph and quads for the named graphs.
In find(Node, Node, Node, Node) (find on the named graphs),
null for the graph slot does not match the default graph.
Concrete and Pattern Operations.
Various API operations work on "concrete" terms. For example, add. These are
marked "concrete operation" in their javadoc. They are not matching operations. A
concrete term is one of a URI, blank node or literal. It is not null,
Node#ANY nor a named variable. Any Triple or Quad must be
composed of concrete terms.
A pattern operation is one where the arguments are concrete terms or wildcard
ANY. Such an operation will match zero or more triples or quads.
Any Triple or Quad can use .
Pattern operations do not match named variables.
Using Node#ANY rather than null is preferred in pattern operations but
both are acceptable.
| Modifier and Type | Method and Description |
|---|---|
void |
add(Node s,
Node p,
Node o)
Add a triple to the default graph.
|
void |
add(Node g,
Node s,
Node p,
Node o)
Add to a named graph.
|
default void |
add(Quad quad)
Add a quad.
|
default void |
add(Triple triple)
Add a triple to the default graph.
|
boolean |
contains(Node s,
Node p,
Node o)
Test whether the default graph contains the triple.
|
boolean |
contains(Node g,
Node s,
Node p,
Node o)
Test whether any named graph matches the quad.
|
default boolean |
contains(Quad quad)
Test whether any named graph matches the quad.
|
default boolean |
contains(Triple triple)
Test whether the default graph contains the triple.
|
void |
delete(Node s,
Node p,
Node o)
Delete from the default graph.
|
void |
delete(Node g,
Node s,
Node p,
Node o)
Delete from a named graph.
|
default void |
delete(Quad quad)
Delete a quad from the default graph.
|
default void |
delete(Triple triple)
Delete a triple from the default graph.
|
Iterator<Triple> |
find(Node s,
Node p,
Node o)
Find in the default graph.
|
Iterator<Quad> |
find(Node g,
Node s,
Node p,
Node o)
Find in named graphs: does not look in the default graph.
|
default Iterator<Quad> |
find(Quad quad)
Find in named graphs: does not look in the default graph.
|
default Iterator<Triple> |
find(Triple triple)
Find in the default graph.
|
default Iterator<Triple> |
findUnionGraph(Node s,
Node p,
Node o)
Find in the union graph (union of all named graphs, not the default graph).
|
default void |
removeAll(Node s,
Node p,
Node o)
Delete all triples matching a
find-like pattern. |
default void |
removeAll(Node g,
Node s,
Node p,
Node o)
Delete all quads matching a
find-like pattern. |
default Stream<Triple> |
stream(Node s,
Node p,
Node o)
Find in the default graph.
|
default Stream<Quad> |
stream(Node g,
Node s,
Node p,
Node o)
Find in named graphs: does not look in the default graph.
|
default Stream<Quad> |
stream(Quad quad)
Find in named graphs: does not look in the default graph.
|
default Stream<Triple> |
stream(Triple triple)
Find in the default graph.
|
default Stream<Triple> |
streamUnionGraph(Node s,
Node p,
Node o)
|
default void add(Triple triple)
Concrete operation.
default void add(Quad quad)
Concrete operation.
default void delete(Triple triple)
Concrete operation.
default void delete(Quad quad)
Node#ANY.
For delete-by-pattern, see removeAll(Node, Node, Node, Node).
Concrete operation.
void delete(Node s, Node p, Node o)
s, p, o are all concrete.
Concrete operation.
See removeAll(Node, Node, Node) for remove by pattern.
void delete(Node g, Node s, Node p, Node o)
s, p, o are all concrete.
Concrete operation.
See removeAll(Node, Node, Node, Node) for remove by pattern.
default void removeAll(Node s, Node p, Node o)
find-like pattern.
Pattern operation.
default void removeAll(Node g, Node s, Node p, Node o)
find-like pattern.
Pattern operation.
default Iterator<Triple> findUnionGraph(Node s, Node p, Node o)
Stream.distinct()
which is a stateful
intermediate operation. Without additional internal knowledge,
it is necessary to remember all triples in the stream
so far to know whether the next triple is a duplicate or not.
This can be a significant amount of intermediate space.
An implementation may be able to exploit its internal representation to
means that this operation can be implemented more efficient, for example,
knowing that duplicate triples (same triple, from different graphs) will
be adjacent in the stream so not requires the full cost of distinct
to remove duplicates.
Pattern operation.
default Iterator<Quad> find(Quad quad)
Pattern operation.
Iterator<Quad> find(Node g, Node s, Node p, Node o)
Pattern operation.
default Stream<Quad> stream(Quad quad)
Pattern operation.
default Stream<Quad> stream(Node g, Node s, Node p, Node o)
Pattern operation.
default Stream<Triple> stream(Node s, Node p, Node o)
Pattern operation.
default boolean contains(Triple triple)
Pattern operation.
Equivalent to find(triple).hasNext() or stream(triple).findAny().isPresent().
boolean contains(Node s, Node p, Node o)
Pattern operation.
Equivalent to find(s,p,o).hasNext().
default boolean contains(Quad quad)
Pattern operation.
Equivalent to find(quad).hasNext() or stream(quad).findAny().isPresent().
Licensed under the Apache License, Version 2.0