org.openrdf.sesame.repository
Interface SesameRepository

All Known Implementing Classes:
HTTPRepository, LocalRepository

public interface SesameRepository

Interface for access to a single Sesame repository. This interface defines a generic entry point for application developers to Sesame repositories. Implementations of this interface exist that supply client-server access, as well as local access.

Author:
Jeen Broekstra, Arjohn Kampman

Method Summary
 void addData(File dataFile, String baseURI, RDFFormat format, boolean verifyData, AdminListener listener)
          Adds RDF data from the specified file to the repository.
 void addData(InputStream data, String baseURI, RDFFormat format, boolean verifyData, AdminListener listener)
          Adds RDF data from an InputStream to the repository.
 void addData(Reader data, String baseURI, RDFFormat format, boolean verifyData, AdminListener listener)
          Adds RDF data from a Reader to the repository.
 void addData(SesameRepository repository, AdminListener listener)
          Adds the contents of the supplied SesameRepository to this repository.
 void addData(String data, String baseURI, RDFFormat format, boolean verifyData, AdminListener listener)
          Adds an RDF document to the repository.
 void addData(URL dataURL, String baseURI, RDFFormat format, boolean verifyData, AdminListener listener)
          Adds the RDF data that can be found at the specified URL to the repository.
 void addGraph(Graph graph)
          Adds the contents of the supplied graph to the repository.
 void addGraph(Graph graph, boolean joinBlankNodes)
          Adds the contents of the supplied graph to the repository.
 void addGraph(QueryLanguage language, String query)
          Adds the contents of the graph specified by the supplied graph query to the repository.
 void addGraph(QueryLanguage language, String query, boolean joinBlankNodes)
          Adds the contents of the graph specified by the supplied graph query to the repository.
 void clear(AdminListener listener)
          Clears the repository.
 InputStream extractRDF(RDFFormat format, boolean ontology, boolean instances, boolean explicitOnly, boolean niceOutput)
          Extracts data from the repository and returns it in the requested format.
 String getRepositoryId()
          retrieves the repository id string for this repository.
 Graph performGraphQuery(QueryLanguage language, String query)
          Evaluates a graph query and reports the resulting statements to the specified listener.
 void performGraphQuery(QueryLanguage language, String query, GraphQueryResultListener listener)
          Evaluates a graph query and reports the resulting statements to the specified listener.
 QueryResultsTable performTableQuery(QueryLanguage language, String query)
          Evaluates a query and returns the results in a QueryResultsTable.
 void performTableQuery(QueryLanguage language, String query, TableQueryResultListener listener)
          Evaluates a query and reports the results as rows in a table to the supplied listener.
 void removeGraph(Graph graph)
          Removes the contents of the supplied graph from the repository.
 void removeGraph(QueryLanguage language, String query)
          Removes the contents of the graph specified by the supplied graph query from the repository.
 void removeStatements(Resource subject, URI predicate, Value object, AdminListener listener)
          Removes statements from the repository.
 

Method Detail

performTableQuery

public void performTableQuery(QueryLanguage language,
                              String query,
                              TableQueryResultListener listener)
                       throws IOException,
                              MalformedQueryException,
                              QueryEvaluationException,
                              AccessDeniedException
Evaluates a query and reports the results as rows in a table to the supplied listener.

Parameters:
language - the query language in which the query is formulated.
query - the query.
listener - the result listener
Throws:
IOException - In case an I/O error occurs while sending the query to, or retrieving the result from a Sesame server.
MalformedQueryException - If the supplied query is malformed.
QueryEvaluationException - If a problem occurs during evaluation of the query.
AccessDeniedException - In case the current user does not have read access on this repository.
UnsupportedOperationException - If this repository does not support the specified action.
See Also:
QueryLanguage

performTableQuery

public QueryResultsTable performTableQuery(QueryLanguage language,
                                           String query)
                                    throws IOException,
                                           MalformedQueryException,
                                           QueryEvaluationException,
                                           AccessDeniedException
Evaluates a query and returns the results in a QueryResultsTable.

Parameters:
language - The query language in which the query is formulated.
query - The query.
Returns:
A QueryResultsTable object that contains the query result. Note: if the query returned no results, an empty QueryResultsTable will be returned.
Throws:
IOException - In case an I/O error occurs while sending the query to, or retrieving the result from a Sesame server.
MalformedQueryException - If the supplied query is malformed.
QueryEvaluationException - If a problem occurs during evaluation of the query.
AccessDeniedException - In case the current user does not have read access on this repository.
UnsupportedOperationException - If this repository does not support the specified action.
See Also:
QueryLanguage

performGraphQuery

public void performGraphQuery(QueryLanguage language,
                              String query,
                              GraphQueryResultListener listener)
                       throws IOException,
                              MalformedQueryException,
                              QueryEvaluationException,
                              AccessDeniedException
Evaluates a graph query and reports the resulting statements to the specified listener.

Parameters:
language - The query language in which the query is formulated. Currently, only SeRQL supports graph queries and QueryLanguage.SERQL is the only legal value.
query - The query.
listener - A listener for the query result.
Throws:
IOException - In case an I/O error occurs while sending the query to, or retrieving the result from a Sesame server.
MalformedQueryException - If the supplied query is malformed.
QueryEvaluationException - If a problem occurs during evaluation of the query.
AccessDeniedException - In case the current user does not have read access on this repository.
UnsupportedOperationException - If this repository does not support the specified action.
See Also:
QueryLanguage

performGraphQuery

public Graph performGraphQuery(QueryLanguage language,
                               String query)
                        throws IOException,
                               MalformedQueryException,
                               QueryEvaluationException,
                               AccessDeniedException
Evaluates a graph query and reports the resulting statements to the specified listener.

Parameters:
language - The query language in which the query is formulated. Currently, only SeRQL supports graph queries and QueryLanguage.SERQL is the only legal value.
query - The query.
Returns:
A Graph object that contains the query result.
Throws:
IOException - In case an I/O error occurs while sending the query to, or retrieving the result from a Sesame server.
MalformedQueryException - If the supplied query is malformed.
QueryEvaluationException - If a problem occurs during evaluation of the query.
AccessDeniedException - In case the current user does not have read access on this repository.
UnsupportedOperationException - If this repository does not support the specified action.
See Also:
QueryLanguage

addData

public void addData(URL dataURL,
                    String baseURI,
                    RDFFormat format,
                    boolean verifyData,
                    AdminListener listener)
             throws IOException,
                    AccessDeniedException
Adds the RDF data that can be found at the specified URL to the repository.

Parameters:
dataURL - the URL of the RDF data.
baseURI - the base URI to resolve any relative URIs against. This defaults to the value of dataURL if the value is set to null.
format - the serialization format of the data (one of RDFFormat.RDFXML, RDFFormat.NTRIPLES).
verifyData - if set to 'true', the RDF parser will verify the data before adding it to the repository.
listener - an AdminListener that will receive error- and progress messages.
Throws:
IOException - In case an I/O error occurs.
AccessDeniedException - In case the current user does not have write access on this repository.
UnsupportedOperationException - If this repository does not support the specified action.
See Also:
RDFFormat

addData

public void addData(File dataFile,
                    String baseURI,
                    RDFFormat format,
                    boolean verifyData,
                    AdminListener listener)
             throws FileNotFoundException,
                    IOException,
                    AccessDeniedException
Adds RDF data from the specified file to the repository.

Parameters:
dataFile - a file containing RDF data.
baseURI - the base URI to resolve any relative URIs against.
format - the serialization format of the data (one of RDFFormat.RDFXML, RDFFormat.NTRIPLES).
verifyData - if set to 'true', the RDF parser will verify the data before adding it to the repository.
listener - an AdminListener that will receive error- and progress messages.
Throws:
FileNotFoundException - In case the file could not be found.
IOException - In case an I/O error occurs.
AccessDeniedException - In case the current user does not have write access on this repository.
UnsupportedOperationException - If this repository does not support the specified action.
See Also:
RDFFormat

addData

public void addData(String data,
                    String baseURI,
                    RDFFormat format,
                    boolean verifyData,
                    AdminListener listener)
             throws IOException,
                    AccessDeniedException
Adds an RDF document to the repository.

Parameters:
data - an RDF document.
baseURI - the base URI to resolve any relative URIs against.
format - the serialization format of the data (one of RDFFormat.RDFXML, RDFFormat.NTRIPLES).
verifyData - if set to 'true', the RDF parser will verify the data before adding it to the repository.
listener - an AdminListener that will receive error- and progress messages.
Throws:
IOException - In case an I/O error occurs.
AccessDeniedException - In case the current user does not have write access on this repository.
UnsupportedOperationException - If this repository does not support the specified action.
See Also:
RDFFormat

addData

public void addData(SesameRepository repository,
                    AdminListener listener)
             throws IOException,
                    AccessDeniedException
Adds the contents of the supplied SesameRepository to this repository.

Parameters:
repository - a SesameRepository.
listener - an AdminListener that will receive error- and progress messages.
Throws:
IOException - In case an I/O error occurs.
AccessDeniedException - In case the current user does not have write access on this repository.
UnsupportedOperationException - If this repository does not support the specified action.
See Also:
RDFFormat

addData

public void addData(Reader data,
                    String baseURI,
                    RDFFormat format,
                    boolean verifyData,
                    AdminListener listener)
             throws IOException,
                    AccessDeniedException
Adds RDF data from a Reader to the repository. Note: uploading XML-encoded RDF using a Reader can destroy the character encoding of the data. Using an InputStream can prevent this.

Parameters:
data - a Reader from which RDF data can be read.
baseURI - the base URI to resolve any relative URIs against.
format - the serialization format of the data (one of RDFFormat.RDFXML, RDFFormat.NTRIPLES).
verifyData - if set to 'true', the RDF parser will verify the data before adding it to the repository.
listener - an AdminListener that will receive error- and progress messages.
Throws:
IOException - In case an I/O error occurs.
AccessDeniedException - In case the current user does not have write access on this repository.
UnsupportedOperationException - If this repository does not support the specified action.
See Also:
RDFFormat

addData

public void addData(InputStream data,
                    String baseURI,
                    RDFFormat format,
                    boolean verifyData,
                    AdminListener listener)
             throws IOException,
                    AccessDeniedException
Adds RDF data from an InputStream to the repository.

Parameters:
data - an InputStream from which RDF data can be read.
baseURI - the base URI to resolve any relative URIs against.
format - the serialization format of the data (one of RDFFormat.RDFXML, RDFFormat.NTRIPLES).
verifyData - if set to 'true', the RDF parser will verify the data before adding it to the repository.
listener - an AdminListener that will receive error- and progress messages.
Throws:
IOException - In case an I/O error occurs.
AccessDeniedException - In case the current user does not have write access on this repository.
UnsupportedOperationException - If this repository does not support the specified action.
See Also:
RDFFormat

addGraph

public void addGraph(Graph graph)
              throws IOException,
                     AccessDeniedException
Adds the contents of the supplied graph to the repository. Blank nodes in the supplied graph that originate from this repository are reused.

Parameters:
graph - a Graph containing the RDF statements to be added.
Throws:
IOException - in case an I/O error occurs.
AccessDeniedException - In case the current user does not have write access on this repository.
UnsupportedOperationException - If this repository does not support the specified action.
See Also:
Graph

addGraph

public void addGraph(Graph graph,
                     boolean joinBlankNodes)
              throws IOException,
                     AccessDeniedException
Adds the contents of the supplied graph to the repository.

Parameters:
graph - a Graph containing the RDF statements to be added.
joinBlankNodes - indicates adding behavior. If set to true, blank nodes in the supplied graph that originate from this repository are reused. If set to false, new blank nodes are created for each blank node in the supplied graph.
Throws:
IOException - in case an I/O error occurs.
AccessDeniedException - In case the current user does not have write access on this repository.
UnsupportedOperationException - If this repository does not support the specified action.
See Also:
Graph

addGraph

public void addGraph(QueryLanguage language,
                     String query)
              throws IOException,
                     AccessDeniedException
Adds the contents of the graph specified by the supplied graph query to the repository. Blank nodes in the supplied graph that originate from this repository are reused.

Parameters:
language - the query language in which the query is formulated.
query - the query. Note that the query must be of a form that has an RDF graph as its result (e.g. a SeRQL CONSTRUCT query)
Throws:
IOException - in case an I/O error occurs
AccessDeniedException - in case the current user does not have write access on this repository.
MalformedQueryException - In case the supplied query is incorrect.
QueryEvaluationException - In case an error occurs during query evaluation.

addGraph

public void addGraph(QueryLanguage language,
                     String query,
                     boolean joinBlankNodes)
              throws IOException,
                     AccessDeniedException
Adds the contents of the graph specified by the supplied graph query to the repository.

Parameters:
language - the query language in which the query is formulated.
query - the query. Note that the query must be of a form that has an RDF graph as its result (e.g. a SeRQL CONSTRUCT query)
joinBlankNodes - indicates adding behavior. If set to true, blank nodes in the supplied graph that originate from this repository are reused. If set to false, new blank nodes are created for each blank node in the supplied graph.
Throws:
IOException - in case an I/O error occurs
AccessDeniedException - in case the current user does not have write access on this repository.
MalformedQueryException - In case the supplied query is incorrect.
QueryEvaluationException - In case an error occurs during query evaluation.

removeGraph

public void removeGraph(Graph graph)
                 throws IOException,
                        AccessDeniedException
Removes the contents of the supplied graph from the repository. All statements in the graph are removed from the repository. Blank nodes in the supplied graph that originate from this repository are reused.

Parameters:
graph - a Graph containing RDF statements that are to be removed.
Throws:
IOException - in case an I/O error occurs.
AccessDeniedException - In case the current user does not have write access on this repository.
UnsupportedOperationException - If this repository does not support the specified action.
See Also:
Graph

removeGraph

public void removeGraph(QueryLanguage language,
                        String query)
                 throws IOException,
                        AccessDeniedException
Removes the contents of the graph specified by the supplied graph query from the repository. Blank nodes in the supplied graph that originate from this repository are reused.

Parameters:
language - the query language in which the query is formulated.
query - the query. Note that the query must be of a form that has an RDF graph as its result (e.g. a SeRQL CONSTRUCT query)
Throws:
IOException - in case an I/O error occurs
AccessDeniedException - in case the current user does not have write access on this repository.

extractRDF

public InputStream extractRDF(RDFFormat format,
                              boolean ontology,
                              boolean instances,
                              boolean explicitOnly,
                              boolean niceOutput)
                       throws IOException,
                              AccessDeniedException
Extracts data from the repository and returns it in the requested format. You can either extract the ontological data, the instance data, or both. For any of these, you can specify whether you want to extract all statements, or only the ones that were explicitly added.

Parameters:
format - The serialization format that should be used (one of RDFFormat.RDFXML, RDFFormat.NTRIPLES, RDFFormat.N3).
ontology - If true, the ontological part of the data will be extracted.
instances - If true, the instances part of the data will be extracted.
explicitOnly - If true, only explicitely added statements will be extracted, i.e. the inferred statements will be skipped.
niceOutput - If true, the server will try its best to make the data as much readable for humans as possible. Note that this will cost extra processing time, and it should be set to 'false' if not necessary.
Throws:
IOException - In case an I/O error occurs.
AccessDeniedException - In case the current user does not have read access on this repository.
UnsupportedOperationException - If this repository does not support the specified action.
See Also:
RDFFormat

removeStatements

public void removeStatements(Resource subject,
                             URI predicate,
                             Value object,
                             AdminListener listener)
                      throws IOException,
                             AccessDeniedException
Removes statements from the repository. Statements that match the pattern specified by the parameters subject, predicate and object will be removed from the repository. null values for these parameters indicate wildcards. So calling removeStatements(mySubject, null, null, l) will remove all statements with a subject equal to mySubject.

Parameters:
subject - The subject of the statements that should be removed, or null if the subject is allowed to be anything.
predicate - The predicate of the statements that should be removed, or null if the predicate is allowed to be anything.
object - The object of the statements that should be removed, or null if the object is allowed to be anything.
listener - An AdminListener that will receive error- and progress messages.
Throws:
IOException - In case an I/O error occurs.
AccessDeniedException - In case the current user does not have write access on this repository.
UnsupportedOperationException - If this repository does not support the specified action.

clear

public void clear(AdminListener listener)
           throws IOException,
                  AccessDeniedException
Clears the repository. All statements will be removed.

Parameters:
listener - An AdminListener that will receive error- and progress messages.
Throws:
IOException - In case an I/O error occurs.
AccessDeniedException - In case the current user does not have write access on this repository.
UnsupportedOperationException - If this repository does not support the specified action.

getRepositoryId

public String getRepositoryId()
retrieves the repository id string for this repository.

Returns:
the id of the repository.


Copyright © 2002-2006 Aduna BV, GNU LGPL License applies.