Interface StorageRDF
-
- All Known Implementing Classes:
StorageSimpleMem,StorageTuples
public interface StorageRDFA minimal interface for RDF storage. This is less thatDatasetGraphor any of it's derived classes and it just concerned withTriples andQuads, notGraphs nor prefixes.Storage is split into the triples for the default graph and quads for the named graphs. In
find(Node, Node, Node, Node)(findon the named graphs),nullfor 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 notnull,Node.ANYnor a named variable. AnyTripleorQuadmust 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. AnyTripleorQuadcan useANY.Pattern operations do not match named variables. Using
Node.ANYrather thannullis preferred in pattern operations but both are acceptable.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidadd(Node s, Node p, Node o)Add a triple to the default graph.voidadd(Node g, Node s, Node p, Node o)Add to a named graph.default voidadd(Triple triple)Add a triple to the default graph.default voidadd(Quad quad)Add a quad.booleancontains(Node s, Node p, Node o)Test whether the default graph contains the triple.booleancontains(Node g, Node s, Node p, Node o)Test whether any named graph matches the quad.default booleancontains(Triple triple)Test whether the default graph contains the triple.default booleancontains(Quad quad)Test whether any named graph matches the quad.voiddelete(Node s, Node p, Node o)Delete from the default graph.voiddelete(Node g, Node s, Node p, Node o)Delete from a named graph.default voiddelete(Triple triple)Delete a triple from the default graph.default voiddelete(Quad quad)Delete a quad from the default graph.java.util.Iterator<Triple>find(Node s, Node p, Node o)Find in the default graph.java.util.Iterator<Quad>find(Node g, Node s, Node p, Node o)Find in named graphs: does not look in the default graph.default java.util.Iterator<Triple>find(Triple triple)Find in the default graph.default java.util.Iterator<Quad>find(Quad quad)Find in named graphs: does not look in the default graph.default java.util.Iterator<Triple>findUnionGraph(Node s, Node p, Node o)Find in the union graph (union of all named graphs, not the default graph).default voidremoveAll(Node s, Node p, Node o)Delete all triples matching afind-like pattern.default voidremoveAll(Node g, Node s, Node p, Node o)Delete all quads matching afind-like pattern.default java.util.stream.Stream<Triple>stream(Node s, Node p, Node o)Find in the default graph.default java.util.stream.Stream<Quad>stream(Node g, Node s, Node p, Node o)Find in named graphs: does not look in the default graph.default java.util.stream.Stream<Triple>stream(Triple triple)Find in the default graph.default java.util.stream.Stream<Quad>stream(Quad quad)Find in named graphs: does not look in the default graph.default java.util.stream.Stream<Triple>streamUnionGraph(Node s, Node p, Node o)
-
-
-
Method Detail
-
add
default void add(Triple triple)
Add a triple to the default graph.Concrete operation.
-
add
default void add(Quad quad)
Add a quad.Concrete operation.
-
delete
default void delete(Triple triple)
Delete a triple from the default graph.Concrete operation.
-
delete
default void delete(Quad quad)
Delete a quad from the default graph. All terms are concrete, and notNode#ANY. For delete-by-pattern, seeremoveAll(Node, Node, Node, Node).Concrete operation.
-
delete
void delete(Node s, Node p, Node o)
Delete from the default graph.s,p,oare all concrete.Concrete operation.
See
removeAll(Node, Node, Node)for remove by pattern.
-
delete
void delete(Node g, Node s, Node p, Node o)
Delete from a named graph.s,p,oare all concrete.Concrete operation.
See
removeAll(Node, Node, Node, Node)for remove by pattern.
-
removeAll
default void removeAll(Node s, Node p, Node o)
Delete all triples matching afind-like pattern.Pattern operation.
-
removeAll
default void removeAll(Node g, Node s, Node p, Node o)
Delete all quads matching afind-like pattern.Pattern operation.
-
findUnionGraph
default java.util.Iterator<Triple> findUnionGraph(Node s, Node p, Node o)
Find in the union graph (union of all named graphs, not the default graph). An RDF graph is a set of triples - the union graph does not shows duplicates even if more than one named graph contains a given triple.- Implementation Note:
- The default implementation of this operation involves the use of
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
distinctto remove duplicates.Pattern operation.
-
find
default java.util.Iterator<Quad> find(Quad quad)
Find in named graphs: does not look in the default graph.Pattern operation.
-
find
java.util.Iterator<Quad> find(Node g, Node s, Node p, Node o)
Find in named graphs: does not look in the default graph.Pattern operation.
-
find
default java.util.Iterator<Triple> find(Triple triple)
Find in the default graph.Pattern operation.
-
find
java.util.Iterator<Triple> find(Node s, Node p, Node o)
Find in the default graph.Pattern operation.
-
stream
default java.util.stream.Stream<Quad> stream(Quad quad)
Find in named graphs: does not look in the default graph.Pattern operation.
-
stream
default java.util.stream.Stream<Quad> stream(Node g, Node s, Node p, Node o)
Find in named graphs: does not look in the default graph.Pattern operation.
-
stream
default java.util.stream.Stream<Triple> stream(Triple triple)
Find in the default graph.Pattern operations.
-
stream
default java.util.stream.Stream<Triple> stream(Node s, Node p, Node o)
Find in the default graph.Pattern operation.
-
contains
default boolean contains(Triple triple)
Test whether the default graph contains the triple.Pattern operation.
Equivalent to
find(triple).hasNext()orstream(triple).findAny().isPresent().
-
contains
boolean contains(Node s, Node p, Node o)
Test whether the default graph contains the triple.Pattern operation.
Equivalent to
find(s,p,o).hasNext().
-
contains
default boolean contains(Quad quad)
Test whether any named graph matches the quad.Pattern operation.
Equivalent to
find(quad).hasNext()orstream(quad).findAny().isPresent().
-
-