edu.cornell.mannlib.vitro.webapp.rdfservice
Interface RDFService


public interface RDFService

Interface for API to write, read, and update Vitro's RDF store, with support to allow listening, logging and auditing.


Nested Class Summary
static class RDFService.ModelSerializationFormat
           
static class RDFService.ResultFormat
           
static class RDFService.SPARQLQueryType
           
 
Method Summary
 boolean changeSetUpdate(ChangeSet changeSet)
          Performs a series of additions to and or removals from specified graphs in the RDF store.
 void close()
          Frees any resources held by this RDFService object The implementation of this method should be idempotent so that multiple invocations do not cause an error.
 java.lang.String getDefaultWriteGraphURI()
          Returns the URI of the default write graph
 void getGraphMetadata()
          To be determined.
 java.util.List<java.lang.String> getGraphURIs()
          Returns a list of all the graph URIs in the RDF store.
 ChangeSet manufactureChangeSet()
          Creates a ChangeSet object
 void newIndividual(java.lang.String individualURI, java.lang.String individualTypeURI)
          If the given individual already exists in the default write graph, throws an RDFServiceException, otherwise adds one type assertion to the default write graph.
 void newIndividual(java.lang.String individualURI, java.lang.String individualTypeURI, java.lang.String graphURI)
          If the given individual already exists in the given graph, throws an RDFServiceException, otherwise adds one type assertion to the given graph.
 void registerListener(ChangeListener changeListener)
          Registers a listener to listen to changes in any graph in the RDF store.
 boolean sparqlAskQuery(java.lang.String query)
          Performs a SPARQL ASK query against the knowledge base.
 java.io.InputStream sparqlConstructQuery(java.lang.String query, RDFService.ModelSerializationFormat resultFormat)
          Performs a SPARQL construct query against the knowledge base.
 java.io.InputStream sparqlDescribeQuery(java.lang.String query, RDFService.ModelSerializationFormat resultFormat)
          Performs a SPARQL describe query against the knowledge base.
 java.io.InputStream sparqlSelectQuery(java.lang.String query, RDFService.ResultFormat resultFormat)
          Performs a SPARQL select query against the knowledge base.
 void unregisterListener(ChangeListener changeListener)
          Unregisters a listener from listening to changes in any graph in the RDF store
 

Method Detail

changeSetUpdate

boolean changeSetUpdate(ChangeSet changeSet)
                        throws RDFServiceException
Performs a series of additions to and or removals from specified graphs in the RDF store. preConditionSparql is executed against the union of all the graphs in the knowledge base before any updates are made. If the precondition query returns a non-empty result, no updates are made made.

Parameters:
changeSet - - a set of changes to be performed on the RDF store.
Returns:
boolean - indicates whether the precondition was satisfied
Throws:
RDFServiceException

newIndividual

void newIndividual(java.lang.String individualURI,
                   java.lang.String individualTypeURI)
                   throws RDFServiceException
If the given individual already exists in the default write graph, throws an RDFServiceException, otherwise adds one type assertion to the default write graph.

Parameters:
individualURI - - URI of the individual to be added
individualTypeURI - - URI of the type for the individual
Throws:
RDFServiceException

newIndividual

void newIndividual(java.lang.String individualURI,
                   java.lang.String individualTypeURI,
                   java.lang.String graphURI)
                   throws RDFServiceException
If the given individual already exists in the given graph, throws an RDFServiceException, otherwise adds one type assertion to the given graph.

Parameters:
individualURI - - URI of the individual to be added
individualTypeURI - - URI of the type for the individual
graphURI - - URI of the graph to which to add the individual
Throws:
RDFServiceException

sparqlConstructQuery

java.io.InputStream sparqlConstructQuery(java.lang.String query,
                                         RDFService.ModelSerializationFormat resultFormat)
                                         throws RDFServiceException
Performs a SPARQL construct query against the knowledge base. The query may have an embedded graph identifier. If the query does not contain a graph identifier the query is executed against the union of all named and unnamed graphs in the store.

Parameters:
query - - the SPARQL query to be executed against the RDF store
resultFormat - - type of serialization for RDF result of the SPARQL query
Returns:
InputStream - the result of the query
Throws:
RDFServiceException

sparqlDescribeQuery

java.io.InputStream sparqlDescribeQuery(java.lang.String query,
                                        RDFService.ModelSerializationFormat resultFormat)
                                        throws RDFServiceException
Performs a SPARQL describe query against the knowledge base. The query may have an embedded graph identifier. If the query does not contain a graph identifier the query is executed against the union of all named and unnamed graphs in the store.

Parameters:
query - - the SPARQL query to be executed against the RDF store
resultFormat - - type of serialization for RDF result of the SPARQL query
Returns:
InputStream - the result of the query
Throws:
RDFServiceException

sparqlSelectQuery

java.io.InputStream sparqlSelectQuery(java.lang.String query,
                                      RDFService.ResultFormat resultFormat)
                                      throws RDFServiceException
Performs a SPARQL select query against the knowledge base. The query may have an embedded graph identifier. If the query does not contain a graph identifier the query is executed against the union of all named and unnamed graphs in the store.

Parameters:
query - - the SPARQL query to be executed against the RDF store
resultFormat - - format for the result of the Select query
Returns:
InputStream - the result of the query
Throws:
RDFServiceException

sparqlAskQuery

boolean sparqlAskQuery(java.lang.String query)
                       throws RDFServiceException
Performs a SPARQL ASK query against the knowledge base. The query may have an embedded graph identifier. If the query does not contain a graph identifier the query is executed against the union of all named and unnamed graphs in the store.

Parameters:
query - - the SPARQL ASK query to be executed against the RDF store
Returns:
boolean - the result of the SPARQL ASK query
Throws:
RDFServiceException

getGraphURIs

java.util.List<java.lang.String> getGraphURIs()
                                              throws RDFServiceException
Returns a list of all the graph URIs in the RDF store.

Returns:
List - list of all the named graph URIs in the RDF store. Return an empty list of there no named graphs in the store.
Throws:
RDFServiceException

getGraphMetadata

void getGraphMetadata()
                      throws RDFServiceException
To be determined. This is a place holder and is not implemented in current implementations.

Throws:
RDFServiceException

getDefaultWriteGraphURI

java.lang.String getDefaultWriteGraphURI()
                                         throws RDFServiceException
Returns the URI of the default write graph

Returns:
String URI of default write graph. Returns null if no default write graph has been set.
Throws:
RDFServiceException

registerListener

void registerListener(ChangeListener changeListener)
                      throws RDFServiceException
Registers a listener to listen to changes in any graph in the RDF store.

Parameters:
changeListener - - the change listener
Throws:
RDFServiceException

unregisterListener

void unregisterListener(ChangeListener changeListener)
                        throws RDFServiceException
Unregisters a listener from listening to changes in any graph in the RDF store

Parameters:
changeListener - - the change listener
Throws:
RDFServiceException

manufactureChangeSet

ChangeSet manufactureChangeSet()
Creates a ChangeSet object

Returns:
ChangeSet an empty ChangeSet object

close

void close()
Frees any resources held by this RDFService object The implementation of this method should be idempotent so that multiple invocations do not cause an error.