|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.fuberlin.wiwiss.ng4j.impl.NamedGraphSetIO de.fuberlin.wiwiss.ng4j.impl.NamedGraphSetImpl
public class NamedGraphSetImpl
Implementation of the NamedGraphSet
interface based on a
set of in-memory NamedGraph
s. For details about Named Graphs see
http://www.w3.org/2004/03/trix/.
Constructor Summary | |
---|---|
NamedGraphSetImpl()
|
Method Summary | |
---|---|
void |
addGraph(NamedGraph graph)
Adds a NamedGraph to the set. |
void |
addQuad(Quad quad)
Adds a quad to the NamedGraphSet. |
Graph |
asJenaGraph(Node defaultGraphForAdding)
Returns the union graph of the NamedGraphSet. |
NamedGraphModel |
asJenaModel(String defaultGraphForAdding)
Returns a Jena Model view on the NamedGraphSet, equivalent to the union graph of all graphs in the graph set. |
void |
clear()
Deletes all NamedGraphs from the set. |
void |
close()
Closes the NamedGraphSet and frees up resources held. |
boolean |
containsGraph(Node graphName)
Tells wether the NamedGraphSet contains a NamedGraph. |
boolean |
containsGraph(String graphNameURI)
Tells wether the NamedGraphSet contains a NamedGraph. |
boolean |
containsQuad(Quad pattern)
Tells wether the NamedGraphSet contains a quad or quads matching a pattern. |
long |
countGraphs()
Returns the number of NamedGraphs in the set. |
int |
countQuads()
Counts the Quads in the NamedGraphSet. |
NamedGraph |
createGraph(Node graphName)
Creates a new NamedGraph and adds it to the set. |
NamedGraph |
createGraph(String graphNameURI)
Creates a new NamedGraph and adds it to the set. |
protected NamedGraph |
createNamedGraphInstance(Node graphName)
|
Iterator |
findQuads(Node graphName,
Node subject,
Node predicate,
Node object)
Finds Quads that match a pattern. |
Iterator |
findQuads(Quad pattern)
Finds Quads that match a quad pattern. |
NamedGraph |
getGraph(Node graphName)
Returns the NamedGraph with a specific name from the GraphSet. |
NamedGraph |
getGraph(String graphNameURI)
Returns the NamedGraph with a specific name from the GraphSet. |
boolean |
isEmpty()
Tells wether the set contains any NamedGraphs. |
Iterator |
listGraphs()
Returns an iterator over all NamedGraph s in the set. |
void |
removeGraph(Node graphName)
Removes a NamedGraph from the set. |
void |
removeGraph(String graphNameURI)
Removes the NamedGraph with a specific name. |
void |
removeQuad(Quad pattern)
Deletes Quads from the NamedGraphSet. |
Methods inherited from class de.fuberlin.wiwiss.ng4j.impl.NamedGraphSetIO |
---|
read, read, read, write, write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface de.fuberlin.wiwiss.ng4j.NamedGraphSet |
---|
read, read, read, write, write |
Constructor Detail |
---|
public NamedGraphSetImpl()
Method Detail |
---|
public void addGraph(NamedGraph graph)
NamedGraphSet
addGraph
in interface NamedGraphSet
graph
- The NamedGraph to be addedpublic boolean containsGraph(Node graphName)
NamedGraphSet
containsGraph
in interface NamedGraphSet
graphName
- The name of a NamedGraph
public boolean containsGraph(String graphNameURI)
NamedGraphSet
containsGraph
in interface NamedGraphSet
graphNameURI
- The name of a NamedGraph
public long countGraphs()
NamedGraphSet
countGraphs
in interface NamedGraphSet
public NamedGraph createGraph(Node graphName)
NamedGraphSet
createGraph
in interface NamedGraphSet
graphName
- The name of the NamedGraph to be created;
must be an URI node
public NamedGraph createGraph(String graphNameURI)
NamedGraphSet
createGraph
in interface NamedGraphSet
graphNameURI
- The name of the NamedGraph to be created;
must be an URI
public NamedGraph getGraph(Node graphName)
NamedGraphSet
getGraph
in interface NamedGraphSet
graphName
- The name of the NamedGraph to be returned
public NamedGraph getGraph(String graphNameURI)
NamedGraphSet
getGraph
in interface NamedGraphSet
graphNameURI
- The name of the NamedGraph to be returned
public boolean isEmpty()
NamedGraphSet
isEmpty
in interface NamedGraphSet
public Iterator listGraphs()
NamedGraphSet
NamedGraph
s in the set.
listGraphs
in interface NamedGraphSet
public void removeGraph(Node graphName)
NamedGraphSet
removeGraph
in interface NamedGraphSet
graphName
- The name of the NamedGraph to be removedpublic void removeGraph(String graphNameURI)
NamedGraphSet
removeGraph
in interface NamedGraphSet
graphNameURI
- The name of the NamedGraph to be removedpublic void clear()
NamedGraphSet
clear
in interface NamedGraphSet
public void addQuad(Quad quad)
NamedGraphSet
addQuad
in interface NamedGraphSet
quad
- A quad to be added to the NamedGraphSetpublic boolean containsQuad(Quad pattern)
NamedGraphSet
Quad
instances with Node.ANY
in one or more positions.
containsQuad
in interface NamedGraphSet
pattern
- A quad or quad pattern
public int countQuads()
NamedGraphSet
countQuads
in interface NamedGraphSet
public Iterator findQuads(Node graphName, Node subject, Node predicate, Node object)
NamedGraphSet
Node.ANY
to match everything in that position.
findQuads
in interface NamedGraphSet
graphName
- The graph to find triples fromsubject
- The subject to be matchedpredicate
- The predicate to be matchedobject
- The object to be matched
Quad
s that match the patternpublic Iterator findQuads(Quad pattern)
NamedGraphSet
Node.ANY
).
findQuads
in interface NamedGraphSet
pattern
- A quad or quad pattern
Quad
s that match the patternpublic void removeQuad(Quad pattern)
NamedGraphSet
Node.ANY
).
All matching Quads will be deleted. If no Quads match, nothing
happens. This operation will not delete any NamedGraphs from the set.
Empty NamedGraphs will be retained.
removeQuad
in interface NamedGraphSet
pattern
- A quad or quad pattern to be deletedpublic Graph asJenaGraph(Node defaultGraphForAdding)
NamedGraphSet
Add operations to the union graph are all written to the default graph specified as the argument.
Delete operations remove the triple from all NamedGraphs.
asJenaGraph
in interface NamedGraphSet
defaultGraphForAdding
- The name of the default graph used for
adding triples; must be an URI
public NamedGraphModel asJenaModel(String defaultGraphForAdding)
NamedGraphSet
Add operations on the returned model are all written to the default graph.
Read and write operations one the returned
model have the behaviour of NamedGraphSet.read(String, String)
and
NamedGraphSet.write(OutputStream, String, String)
.
All Statements returned by the NamedGraphModel can be casted to
NamedGraphStatement
to access information about the graphs
they are contained in.
asJenaModel
in interface NamedGraphSet
defaultGraphForAdding
- The name of the default graph used for
adding triples; must be an URI
public void close()
NamedGraphSet
close
in interface NamedGraphSet
protected NamedGraph createNamedGraphInstance(Node graphName)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |