|
||||||||||
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.db.NamedGraphSetDB
public class NamedGraphSetDB
A NamedGraphSet
implementation backed by a relational database.
The real work is done by a QuadDB
instance. This class provides a
NamedGraphSet view onto the QuadDB.
Constructor Summary | |
---|---|
NamedGraphSetDB(Connection connection)
Creates a persistent NamedGraphSet from a database connection. |
|
NamedGraphSetDB(Connection connection,
String tablePrefix)
Creates a persistent NamedGraphSet from a database connection using a table prefix. |
|
NamedGraphSetDB(QuadDB db)
Creates a new NamedGraphSet. |
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. |
static void |
delete(Connection connection)
Drops the persistent NamedGraphSet from the database. |
static void |
delete(Connection connection,
String tablePrefix)
Drops a persistent NamedGraphSet from a database. |
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 NamedGraphSetDB(QuadDB db)
db
- A QuadDB instance which provides persistence for this NamedGraphSet.public NamedGraphSetDB(Connection connection)
connection
- A connection to an SQL databasepublic NamedGraphSetDB(Connection connection, String tablePrefix)
connection
- A connection to an SQL databasetablePrefix
- a prefix for all tables used by the new NamedGraphSetMethod Detail |
---|
public static void delete(Connection connection)
connection
- A connection to an SQL databasepublic static void delete(Connection connection, String tablePrefix)
connection
- A connection to an SQL databasetablePrefix
- The prefix of the tables used by the NamedGraphSetpublic void addGraph(NamedGraph graph)
NamedGraphSet
addGraph
in interface NamedGraphSet
graph
- The NamedGraph to be addedpublic 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 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 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 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 Iterator listGraphs()
NamedGraphSet
NamedGraph
s in the set.
listGraphs
in interface NamedGraphSet
public long countGraphs()
NamedGraphSet
countGraphs
in interface NamedGraphSet
public boolean isEmpty()
NamedGraphSet
isEmpty
in interface NamedGraphSet
public 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 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 int countQuads()
NamedGraphSet
countQuads
in interface NamedGraphSet
public Iterator findQuads(Quad pattern)
NamedGraphSet
Node.ANY
).
findQuads
in interface NamedGraphSet
pattern
- A quad or quad pattern
Quad
s that match the patternpublic 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 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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |