|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface NamedGraphSet
A set of NamedGraph
s and the core part of the
Named Graphs for Jena API. For details about Named Graphs see
http://www.w3.org/2004/03/trix/.
A set of named graphs is a collection of RDF graphs where each graph has a unique URI name. The collection can be accessed and modified
NamedGraph
instances,
Quad
s (RDF triples with
an additional graph name),
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. |
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 |
read(InputStream source,
String lang,
String baseURI)
Read Named Graphs from an InputStream into the NamedGraphSet. |
void |
read(Reader source,
String lang,
String baseURI)
Read Named Graphs from a Reader into the NamedGraphSet. |
void |
read(String url,
String lang)
Read Named Graphs from an URL into the NamedGraphSet. |
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. |
void |
write(OutputStream out,
String lang,
String baseURI)
Writes a serialized represention of the NamedGraphSet to an OutputStream. |
void |
write(Writer out,
String lang,
String baseURI)
Writes a serialized represention of the NamedGraphSet to a Writer. |
Method Detail |
---|
void addGraph(NamedGraph graph)
graph
- The NamedGraph to be addedvoid removeGraph(Node graphName)
graphName
- The name of the NamedGraph to be removedvoid removeGraph(String graphNameURI)
graphNameURI
- The name of the NamedGraph to be removedboolean containsGraph(Node graphName)
graphName
- The name of a NamedGraph
boolean containsGraph(String graphNameURI)
graphNameURI
- The name of a NamedGraph
NamedGraph getGraph(Node graphName)
graphName
- The name of the NamedGraph to be returned
NamedGraph getGraph(String graphNameURI)
graphNameURI
- The name of the NamedGraph to be returned
NamedGraph createGraph(Node graphName)
graphName
- The name of the NamedGraph to be created;
must be an URI node
NamedGraph createGraph(String graphNameURI)
graphNameURI
- The name of the NamedGraph to be created;
must be an URI
Iterator listGraphs()
NamedGraph
s in the set.
void clear()
long countGraphs()
boolean isEmpty()
void addQuad(Quad quad)
quad
- A quad to be added to the NamedGraphSetboolean containsQuad(Quad pattern)
Quad
instances with Node.ANY
in one or more positions.
pattern
- A quad or quad pattern
void removeQuad(Quad pattern)
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.
pattern
- A quad or quad pattern to be deletedint countQuads()
Iterator findQuads(Quad pattern)
Node.ANY
).
pattern
- A quad or quad pattern
Quad
s that match the patternIterator findQuads(Node graphName, Node subject, Node predicate, Node object)
Node.ANY
to match everything in that position.
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 patternGraph asJenaGraph(Node defaultGraphForAdding)
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.
defaultGraphForAdding
- The name of the default graph used for
adding triples; must be an URI
NamedGraphModel asJenaModel(String defaultGraphForAdding)
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 read(String, String)
and
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.
defaultGraphForAdding
- The name of the default graph used for
adding triples; must be an URI
void close()
void read(String url, String lang)
Serialization languages that support named graphs (like TriX) will take the graph name(s) from the serialization. Other languages will take the URL as the name of the graph.
If some of the graph names from the source are already used in the NamedGraphSet, then the statements from the old graphs will be replaced by those from the source.
url
- The source of the input serializationlang
- The RDF serialization language of the inputvoid read(InputStream source, String lang, String baseURI)
Serialization languages that support named graphs (like TriX) will take the graph name(s) from the serialization. Other languages will take the base URI as the name of the graph.
If some of the graph names from the source are already used in the NamedGraphSet, then the statements from the old graphs will be replaced by those from the source.
source
- The source of the input serializationlang
- The RDF serialization language of the inputbaseURI
- The URI from where the input was readvoid read(Reader source, String lang, String baseURI)
Serialization languages that support named graphs (like TriX) will take the graph name(s) from the serialization. Other languages will take the base URI as the name of the graph.
If some of the graph names from the source are already used in the NamedGraphSet, then the statements from the old graphs will be replaced by those from the source.
source
- The source of the input serializationbaseURI
- The URI from where the input was readlang
- The RDF serialization language of the inputvoid write(OutputStream out, String lang, String baseURI)
If the specified serialization language doesn't support named graphs, then the union graph will be serialized, and knowledge about the graph name of each statement is lost. Only TriX supports named graphs.
The serialization will be UTF-8 encoded. There is currently no way to select a different encoding.
out
- The stream into which the serialization will be writtenlang
- The RDF serialization language to be usedbaseURI
- The base URI of the output file, or null if don't carevoid write(Writer out, String lang, String baseURI)
If the specified serialization language doesn't support named graphs, then the union graph will be serialized, and knowledge about the graph name of each statement is lost. Only TriX supports named graphs.
Note that this method might generate wrong results if the Writer
is translated to bytes using anything but the system's default
encoding. For this reason, write(OutputStream, String, String)
should be used if possible.
out
- The stream into which the serialization will be writtenlang
- The RDF serialization language to be usedbaseURI
- The base URI of the output file, or null if don't care
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |