de.fuberlin.wiwiss.ng4j.db
Class QuadDB

java.lang.Object
  extended by de.fuberlin.wiwiss.ng4j.db.QuadDB

public class QuadDB
extends Object

Database persistence for a set of Quads and a set of graph names, with a Node based interface. The class manages two collections of objects: a set of quads, and a set of graph names. The latter is needed because we want to support empty graphs.

All operations but insert(com.hp.hpl.jena.graph.Node, com.hp.hpl.jena.graph.Node, com.hp.hpl.jena.graph.Node, com.hp.hpl.jena.graph.Node) allow Node.ANY wildcards.

The implementation is na•ve: a graphs table and a quads table. A table prefix can be supplied in order to support multiple QuadDBs in a single database.

TODO: Factor out DB-specific stuff, e.g. table creation.

Author:
Richard Cyganiak (richard@cyganiak.de)

Field Summary
static int HSQL_TYPE
           
static int MYSQL_TYPE
           
static int POSTGRESQL_TYPE
           
 
Constructor Summary
QuadDB(Connection connection, String tablePrefix)
           
 
Method Summary
 void close()
           
 boolean containsGraphName(Node graphName)
           
 int count()
           
 int countGraphNames()
           
 void createTables()
           
 void delete(Node g, Node s, Node p, Node o)
           
 void deleteGraphName(Node graphName)
           
 void deleteTables()
           
 Iterator find(Node g, Node s, Node p, Node o)
           
 void insert(Node g, Node s, Node p, Node o)
           
 void insertGraphName(Node graphName)
           
 Iterator listGraphNames()
           
 boolean tablesExist()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HSQL_TYPE

public static final int HSQL_TYPE
See Also:
Constant Field Values

MYSQL_TYPE

public static final int MYSQL_TYPE
See Also:
Constant Field Values

POSTGRESQL_TYPE

public static final int POSTGRESQL_TYPE
See Also:
Constant Field Values
Constructor Detail

QuadDB

public QuadDB(Connection connection,
              String tablePrefix)
Method Detail

insert

public void insert(Node g,
                   Node s,
                   Node p,
                   Node o)

delete

public void delete(Node g,
                   Node s,
                   Node p,
                   Node o)

find

public Iterator find(Node g,
                     Node s,
                     Node p,
                     Node o)

count

public int count()

insertGraphName

public void insertGraphName(Node graphName)

deleteGraphName

public void deleteGraphName(Node graphName)

containsGraphName

public boolean containsGraphName(Node graphName)

listGraphNames

public Iterator listGraphNames()

countGraphNames

public int countGraphNames()

createTables

public void createTables()

deleteTables

public void deleteTables()

tablesExist

public boolean tablesExist()

close

public void close()