|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.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 NamedGraphs 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 database
public NamedGraphSetDB(Connection connection,
String tablePrefix)
connection - A connection to an SQL databasetablePrefix - a prefix for all tables used by the new NamedGraphSet| Method Detail |
|---|
public static void delete(Connection connection)
connection - A connection to an SQL database
public 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 NamedGraphSetgraph - The NamedGraph to be addedpublic void removeGraph(Node graphName)
NamedGraphSet
removeGraph in interface NamedGraphSetgraphName - The name of the NamedGraph to be removedpublic void removeGraph(String graphNameURI)
NamedGraphSet
removeGraph in interface NamedGraphSetgraphNameURI - The name of the NamedGraph to be removedpublic boolean containsGraph(Node graphName)
NamedGraphSet
containsGraph in interface NamedGraphSetgraphName - The name of a NamedGraph
public boolean containsGraph(String graphNameURI)
NamedGraphSet
containsGraph in interface NamedGraphSetgraphNameURI - The name of a NamedGraph
public NamedGraph getGraph(Node graphName)
NamedGraphSet
getGraph in interface NamedGraphSetgraphName - The name of the NamedGraph to be returned
public NamedGraph getGraph(String graphNameURI)
NamedGraphSet
getGraph in interface NamedGraphSetgraphNameURI - The name of the NamedGraph to be returned
public NamedGraph createGraph(Node graphName)
NamedGraphSet
createGraph in interface NamedGraphSetgraphName - The name of the NamedGraph to be created;
must be an URI node
public NamedGraph createGraph(String graphNameURI)
NamedGraphSet
createGraph in interface NamedGraphSetgraphNameURI - The name of the NamedGraph to be created;
must be an URI
public Iterator listGraphs()
NamedGraphSetNamedGraphs in the set.
listGraphs in interface NamedGraphSetpublic long countGraphs()
NamedGraphSet
countGraphs in interface NamedGraphSetpublic boolean isEmpty()
NamedGraphSet
isEmpty in interface NamedGraphSetpublic void clear()
NamedGraphSet
clear in interface NamedGraphSetpublic void addQuad(Quad quad)
NamedGraphSet
addQuad in interface NamedGraphSetquad - A quad to be added to the NamedGraphSetpublic boolean containsQuad(Quad pattern)
NamedGraphSetQuad
instances with Node.ANY in one or more positions.
containsQuad in interface NamedGraphSetpattern - A quad or quad pattern
public void removeQuad(Quad pattern)
NamedGraphSetNode.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 NamedGraphSetpattern - A quad or quad pattern to be deletedpublic int countQuads()
NamedGraphSet
countQuads in interface NamedGraphSetpublic Iterator findQuads(Quad pattern)
NamedGraphSetNode.ANY).
findQuads in interface NamedGraphSetpattern - A quad or quad pattern
Quads that match the pattern
public Iterator findQuads(Node graphName,
Node subject,
Node predicate,
Node object)
NamedGraphSetNode.ANY to match everything in that position.
findQuads in interface NamedGraphSetgraphName - The graph to find triples fromsubject - The subject to be matchedpredicate - The predicate to be matchedobject - The object to be matched
Quads that match the patternpublic Graph asJenaGraph(Node defaultGraphForAdding)
NamedGraphSetAdd 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 NamedGraphSetdefaultGraphForAdding - The name of the default graph used for
adding triples; must be an URI
public NamedGraphModel asJenaModel(String defaultGraphForAdding)
NamedGraphSetAdd 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 NamedGraphSetdefaultGraphForAdding - 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 | |||||||||