public class GraphUtil extends Object
Modifier and Type | Method and Description |
---|---|
static void |
add(Graph graph,
Iterator<Triple> it) |
static void |
add(Graph graph,
List<Triple> triples) |
static void |
add(Graph graph,
Triple[] triples) |
static void |
addInto(Graph dstGraph,
Graph srcGraph)
Add triples into the destination (arg 1) from the source (arg 2)
|
static boolean |
containsNode(Graph graph,
Node node)
Does the graph use the node anywhere as a subject, predicate or object?
|
static void |
delete(Graph graph,
Iterator<Triple> it) |
static void |
delete(Graph graph,
List<Triple> triples) |
static void |
delete(Graph graph,
Triple[] triples) |
static void |
deleteFrom(Graph dstGraph,
Graph srcGraph)
Delete triples in the destination (arg 1) as given in the source (arg 2).
|
static void |
deleteLoopDst(Graph dstGraph,
Graph srcGraph)
Delete the triple in
srcGraph from dstGraph
by checking the contents of dsgGraph against the srcGraph . |
static void |
deleteLoopSrc(Graph dstGraph,
Graph srcGraph)
Delete triples in
srcGraph from dstGraph
by looping on srcGraph . |
static ExtendedIterator<Triple> |
findAll(Graph g)
Answer an iterator covering all the triples in the specified graph.
|
static ExtendedIterator<Node> |
listObjects(Graph g,
Node s,
Node p)
Return an iterator over the unique objects with a given subject and object.
|
static ExtendedIterator<Node> |
listPredicates(Graph g,
Node s,
Node o)
Return an iterator over the unique predicate between s and o.
|
static ExtendedIterator<Node> |
listSubjects(Graph g,
Node p,
Node o)
Return an iterator over the unique subjects with predicate p and object o.
|
static void |
remove(Graph g,
Node s,
Node p,
Node o)
A safe and cautious remove() function that converts the remove to
a number of
Graph.delete(Triple) operations. |
public static ExtendedIterator<Node> listSubjects(Graph g, Node p, Node o)
g
- Graphp
- Predicate - may be Node.ANYo
- Object - may be Node.ANYpublic static ExtendedIterator<Node> listPredicates(Graph g, Node s, Node o)
g
- Graphs
- Subject - may be Node.ANYo
- Object - may be Node.ANYpublic static ExtendedIterator<Node> listObjects(Graph g, Node s, Node p)
g
- Graphs
- Subject - may be Node.ANYp
- Predicate - may be Node.ANYpublic static boolean containsNode(Graph graph, Node node)
public static ExtendedIterator<Triple> findAll(Graph g)
g
- the graph from which to extract triplespublic static void addInto(Graph dstGraph, Graph srcGraph)
public static void remove(Graph g, Node s, Node p, Node o)
Graph.delete(Triple)
operations.
To avoid any possible ConcurrentModificationExceptions, it finds batches of triples, deletes them and tries again until no more triples matching the input can be found.
public static void deleteLoopSrc(Graph dstGraph, Graph srcGraph)
srcGraph
from dstGraph
by looping on srcGraph
.public static void deleteLoopDst(Graph dstGraph, Graph srcGraph)
srcGraph
from dstGraph
by checking the contents of dsgGraph
against the srcGraph
.
This involves calling srcGraph.contains
.Licenced under the Apache License, Version 2.0