org.pelds.store
Class NamedGraphStore

java.lang.Object
  extended by org.pelds.store.DbInterface
      extended by org.pelds.store.NamedGraphStore

public class NamedGraphStore
extends DbInterface

Named graph storage, uses NG4J. Provides methods for graph creation, loading, storing, locating

Author:
Hannes Muehleisen (hannes@muehleisen.org)

Field Summary
static java.lang.String TABLE_PREFIX
           
 
Constructor Summary
NamedGraphStore()
           
 
Method Summary
 void closeGraphSet()
          Close NG4Js database connection
 java.util.Collection<java.lang.String> findDatasetForResource(java.lang.String resUri)
          Find all datasets mentioning either mentioning the given resource as name or as graph identifier.
 de.fuberlin.wiwiss.ng4j.NamedGraphSet getGraphSet()
          Create a NG4J graph set with the current database connection
 com.hp.hpl.jena.rdf.model.Model loadModel(java.lang.String uri)
          Retrieves a RDF graph / model from the graph store by the graph name.
 com.hp.hpl.jena.rdf.model.Model loadOrCreateModel(java.lang.String uri, java.util.Collection<java.lang.String> authenticatedIds)
          Retrieves a RDF graph / model from the graph store by the graph name.
 void saveGraph(java.lang.String uri, com.hp.hpl.jena.graph.Graph m)
          Stores a graph to the database
 
Methods inherited from class org.pelds.store.DbInterface
closeConnection, getConfig, getConnection, setConfig
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TABLE_PREFIX

public static final java.lang.String TABLE_PREFIX
See Also:
Constant Field Values
Constructor Detail

NamedGraphStore

public NamedGraphStore()
Method Detail

getGraphSet

public de.fuberlin.wiwiss.ng4j.NamedGraphSet getGraphSet()
Create a NG4J graph set with the current database connection

Returns:
a NG4J graph set

loadOrCreateModel

public com.hp.hpl.jena.rdf.model.Model loadOrCreateModel(java.lang.String uri,
                                                         java.util.Collection<java.lang.String> authenticatedIds)
Retrieves a RDF graph / model from the graph store by the graph name. If a graph with that name does not exist, it gets created.

Parameters:
uri - named graph identifier in form of an URI
authenticatedIds - Web IDs of the authenticated client
Returns:
a RDF graph / model

loadModel

public com.hp.hpl.jena.rdf.model.Model loadModel(java.lang.String uri)
Retrieves a RDF graph / model from the graph store by the graph name.

Parameters:
uri - named graph identifier in form of an URI
Returns:
a RDF graph / model

saveGraph

public void saveGraph(java.lang.String uri,
                      com.hp.hpl.jena.graph.Graph m)
Stores a graph to the database

Parameters:
uri - named graph identifier in form of an URI
m - changed RDF graph

closeGraphSet

public void closeGraphSet()
Close NG4Js database connection


findDatasetForResource

public java.util.Collection<java.lang.String> findDatasetForResource(java.lang.String resUri)
Find all datasets mentioning either mentioning the given resource as name or as graph identifier.

Parameters:
resUri - a RDF resource URI
Returns:
Collection of RDF graph identifiers