|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openrdf.repository.base.RepositoryConnectionBase
org.openrdf.repository.base.RepositoryConnectionWrapper
org.openrdf.repository.contextaware.ContextAwareConnection
public class ContextAwareConnection
Allows contexts to be specified at the connection level or the method level.
| Field Summary |
|---|
| Fields inherited from class org.openrdf.repository.base.RepositoryConnectionBase |
|---|
logger |
| Constructor Summary | |
|---|---|
ContextAwareConnection(Repository repository)
|
|
ContextAwareConnection(Repository repository,
RepositoryConnection connection)
|
|
| Method Summary | |
|---|---|
void |
add(File file,
String baseURI,
RDFFormat dataFormat)
Adds RDF data from the specified file to a specific contexts in the repository. |
void |
add(InputStream in,
String baseURI,
RDFFormat dataFormat)
Adds RDF data from an InputStream to the repository, optionally to one or more named contexts. |
void |
add(Iterable<? extends Statement> statements)
Adds the supplied statements to this repository, optionally to one or more named contexts. |
void |
add(Iteration<? extends Statement,RepositoryException> statementIter)
Adds the supplied statements to this repository, optionally to one or more named contexts. |
void |
add(Reader reader,
String baseURI,
RDFFormat dataFormat)
Adds RDF data from a Reader to the repository, optionally to one or more named contexts. |
void |
add(Resource subject,
URI predicate,
Value object)
Adds a statement with the specified subject, predicate and object to this repository, optionally to one or more named contexts. |
void |
add(Statement st)
Adds the supplied statement to this repository, optionally to one or more named contexts. |
void |
add(URL url,
String baseURI,
RDFFormat dataFormat)
Adds the RDF data that can be found at the specified URL to the repository, optionally to one or more named contexts. |
void |
clear()
Removes all statements from a specific contexts in the repository. |
void |
export(RDFHandler handler)
Exports all explicit statements in the specified contexts to the supplied RDFHandler. |
void |
exportStatements(Resource subj,
URI pred,
Value obj,
RDFHandler hander)
Exports all statements with a specific subject, predicate and/or object from the repository, optionally from the specified contexts. |
Resource[] |
getAddContexts()
The contexts to add the statements to. |
Resource[] |
getArchiveContexts()
Before Statements are removed, they are first copied to these contexts. |
QueryLanguage |
getQueryLanguage()
|
Resource[] |
getReadContexts()
The context(s) to get the data from. |
Resource[] |
getRemoveContexts()
The context(s) to remove the data from. |
RepositoryResult<Statement> |
getStatements(Resource subj,
URI pred,
Value obj)
Gets all statements with a specific subject, predicate and/or object from the repository. |
boolean |
hasStatement(Resource subj,
URI pred,
Value obj)
Checks whether the repository contains statements with a specific subject, predicate and/or object, optionally in the specified contexts. |
boolean |
hasStatement(Statement st)
Checks whether the repository contains the specified statement, optionally in the specified contexts. |
protected boolean |
isDelegatingRemove()
|
boolean |
isIncludeInferred()
if false, no inferred statements are considered; if true, inferred statements are considered if available |
BooleanQuery |
prepareBooleanQuery(QueryLanguage ql,
String query)
|
BooleanQuery |
prepareBooleanQuery(QueryLanguage ql,
String query,
String baseURI)
|
GraphQuery |
prepareGraphQuery(QueryLanguage ql,
String query)
|
GraphQuery |
prepareGraphQuery(QueryLanguage ql,
String query,
String baseURI)
|
GraphQuery |
prepareGraphQuery(String query)
|
GraphQuery |
prepareGraphQueryWithinContext(QueryLanguage qlang,
String query,
String baseURI)
|
GraphQuery |
prepareGraphQueryWithinContext(String query)
|
Query |
prepareQuery(QueryLanguage ql,
String query)
|
Query |
prepareQuery(QueryLanguage ql,
String query,
String baseURI)
|
Query |
prepareQuery(String query)
|
Query |
prepareQueryWithinContext(QueryLanguage qlang,
String query,
String baseURI)
|
Query |
prepareQueryWithinContext(String query)
|
TupleQuery |
prepareTupleQuery(QueryLanguage ql,
String query)
|
TupleQuery |
prepareTupleQuery(QueryLanguage ql,
String query,
String baseURI)
|
TupleQuery |
prepareTupleQuery(String query)
|
TupleQuery |
prepareTupleQueryWithinContext(QueryLanguage qlang,
String query,
String baseURI)
|
TupleQuery |
prepareTupleQueryWithinContext(String query)
|
void |
remove(Iterable<? extends Statement> statements)
Removes the supplied statements from the specified contexts in this repository. |
void |
remove(Iteration<? extends Statement,RepositoryException> statementIter)
Removes the supplied statements from a specific context in this repository, ignoring any context information carried by the statements themselves. |
void |
remove(Resource subject,
URI predicate,
Value object)
Removes the statement with the specified subject, predicate and object from the repository, optionally restricted to the specified contexts. |
void |
remove(Statement st)
Removes the supplied statement from the specified contexts in the repository. |
protected void |
removeWithoutCommit(Resource subject,
URI predicate,
Value object,
Resource... contexts)
|
void |
setAddContexts(Resource... addContexts)
The contexts to add the statements to. |
void |
setArchiveContexts(Resource... archiveContexts)
Before Statements are removed, they are first copied to these contexts. |
void |
setIncludeInferred(boolean includeInferred)
if false, no inferred statements are considered; if true, inferred statements are considered if available |
void |
setQueryLanguage(QueryLanguage ql)
|
void |
setReadContexts(Resource... readContexts)
The context(s) to get the data from. |
void |
setRemoveContexts(Resource... removeContexts)
The context(s) to remove the data from. |
long |
size()
Returns the number of (explicit) statements that are in the specified contexts in this repository. |
| Methods inherited from class org.openrdf.repository.base.RepositoryConnectionWrapper |
|---|
add, add, add, add, add, add, add, add, addWithoutCommit, clear, clearNamespaces, close, commit, exportStatements, exportStatements, getContextIDs, getDelegate, getNamespace, getNamespaces, getStatements, hasStatement, hasStatement, isAutoCommit, isDelegatingAdd, isDelegatingRead, isEmpty, isOpen, remove, remove, remove, remove, removeNamespace, rollback, setAutoCommit, setDelegate, setNamespace, size |
| Methods inherited from class org.openrdf.repository.base.RepositoryConnectionBase |
|---|
addInputStreamOrReader, addWithoutCommit, autoCommit, export, finalize, getRepository, removeWithoutCommit |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.openrdf.repository.RepositoryConnection |
|---|
export, getRepository |
| Constructor Detail |
|---|
public ContextAwareConnection(Repository repository)
throws RepositoryException
RepositoryException
public ContextAwareConnection(Repository repository,
RepositoryConnection connection)
| Method Detail |
|---|
protected boolean isDelegatingRemove()
isDelegatingRemove in class RepositoryConnectionWrapperpublic boolean isIncludeInferred()
public void setIncludeInferred(boolean includeInferred)
public QueryLanguage getQueryLanguage()
public void setQueryLanguage(QueryLanguage ql)
public Resource[] getReadContexts()
public void setReadContexts(Resource... readContexts)
public Resource[] getAddContexts()
public void setAddContexts(Resource... addContexts)
public Resource[] getRemoveContexts()
public void setRemoveContexts(Resource... removeContexts)
public Resource[] getArchiveContexts()
public void setArchiveContexts(Resource... archiveContexts)
public void add(File file,
String baseURI,
RDFFormat dataFormat)
throws IOException,
RDFParseException,
RepositoryException
file - A file containing RDF data.baseURI - The base URI to resolve any relative URIs that are in the data
against. This defaults to the value of
file.toURI() if the value is set to
null.dataFormat - The serialization format of the data.
IOException - If an I/O error occurred while reading from the file.
UnsupportedRDFormatException - If no parser is available for the specified RDF format.
RDFParseException - If an error was found while parsing the RDF data.
RepositoryException - If the data could not be added to the repository, for example
because the repository is not writable.getAddContexts()
public void add(InputStream in,
String baseURI,
RDFFormat dataFormat)
throws IOException,
RDFParseException,
RepositoryException
in - An InputStream from which RDF data can be read.baseURI - The base URI to resolve any relative URIs that are in the data
against.dataFormat - The serialization format of the data.
IOException - If an I/O error occurred while reading from the input stream.
UnsupportedRDFormatException - If no parser is available for the specified RDF format.
RDFParseException - If an error was found while parsing the RDF data.
RepositoryException - If the data could not be added to the repository, for example
because the repository is not writable.getAddContexts()
public void add(Iterable<? extends Statement> statements)
throws RepositoryException
statements - The statements that should be added.
RepositoryException - If the statements could not be added to the repository, for
example because the repository is not writable.getAddContexts()
public void add(Iteration<? extends Statement,RepositoryException> statementIter)
throws RepositoryException
statementIter - The statements to add. In case the iterator is a
CloseableIteration, it will be closed before this method
returns.
RepositoryException - If the statements could not be added to the repository, for
example because the repository is not writable.getAddContexts()
public void add(Reader reader,
String baseURI,
RDFFormat dataFormat)
throws IOException,
RDFParseException,
RepositoryException
reader - A Reader from which RDF data can be read.baseURI - The base URI to resolve any relative URIs that are in the data
against.dataFormat - The serialization format of the data.
IOException - If an I/O error occurred while reading from the reader.
UnsupportedRDFormatException - If no parser is available for the specified RDF format.
RDFParseException - If an error was found while parsing the RDF data.
RepositoryException - If the data could not be added to the repository, for example
because the repository is not writable.getAddContexts()
public void add(Resource subject,
URI predicate,
Value object)
throws RepositoryException
subject - The statement's subject.predicate - The statement's predicate.object - The statement's object.
RepositoryException - If the data could not be added to the repository, for example
because the repository is not writable.getAddContexts()
public void add(Statement st)
throws RepositoryException
st - The statement to add.
RepositoryException - If the statement could not be added to the repository, for example
because the repository is not writable.getAddContexts()
public void add(URL url,
String baseURI,
RDFFormat dataFormat)
throws IOException,
RDFParseException,
RepositoryException
url - The URL of the RDF data.baseURI - The base URI to resolve any relative URIs that are in the data
against. This defaults to the value of url.toExternalForm() if the value is
set to null.dataFormat - The serialization format of the data.
IOException - If an I/O error occurred while reading from the URL.
UnsupportedRDFormatException - If no parser is available for the specified RDF format.
RDFParseException - If an error was found while parsing the RDF data.
RepositoryException - If the data could not be added to the repository, for example
because the repository is not writable.getAddContexts()
public void clear()
throws RepositoryException
RepositoryException - If the statements could not be removed from the repository, for
example because the repository is not writable.getRemoveContexts()
public void export(RDFHandler handler)
throws RepositoryException,
RDFHandlerException
handler - The handler that will handle the RDF data.
RDFHandlerException - If the handler encounters an unrecoverable error.
RepositoryExceptiongetReadContexts()
public void exportStatements(Resource subj,
URI pred,
Value obj,
RDFHandler hander)
throws RepositoryException,
RDFHandlerException
subj - The subject, or null if the subject doesn't matter.pred - The predicate, or null if the predicate doesn't matter.obj - The object, or null if the object doesn't matter.handler - The handler that will handle the RDF data.
RDFHandlerException - If the handler encounters an unrecoverable error.
RepositoryExceptiongetReadContexts(),
isIncludeInferred()
public RepositoryResult<Statement> getStatements(Resource subj,
URI pred,
Value obj)
throws RepositoryException
subj - A Resource specifying the subject, or null for a
wildcard.pred - A URI specifying the predicate, or null for a wildcard.obj - A Value specifying the object, or null for a wildcard.
RepositoryResult object, a lazy Iterator-like object
containing Statements and optionally throwing a
RepositoryException when an error when a problem occurs
during retrieval.
RepositoryExceptiongetReadContexts(),
isIncludeInferred()
public boolean hasStatement(Resource subj,
URI pred,
Value obj)
throws RepositoryException
subj - A Resource specifying the subject, or null for a
wildcard.pred - A URI specifying the predicate, or null for a wildcard.obj - A Value specifying the object, or null for a wildcard.
RepositoryExceptiongetReadContexts(),
isIncludeInferred()
public boolean hasStatement(Statement st)
throws RepositoryException
st - The statement to look for. Context information in the statement is
ignored.
RepositoryExceptiongetReadContexts(),
isIncludeInferred()
public GraphQuery prepareGraphQueryWithinContext(String query)
throws MalformedQueryException,
RepositoryException
MalformedQueryException
RepositoryException
public Query prepareQueryWithinContext(String query)
throws MalformedQueryException,
RepositoryException
MalformedQueryException
RepositoryException
public TupleQuery prepareTupleQueryWithinContext(String query)
throws MalformedQueryException,
RepositoryException
MalformedQueryException
RepositoryException
public GraphQuery prepareGraphQueryWithinContext(QueryLanguage qlang,
String query,
String baseURI)
throws MalformedQueryException,
RepositoryException
MalformedQueryException
RepositoryException
public Query prepareQueryWithinContext(QueryLanguage qlang,
String query,
String baseURI)
throws MalformedQueryException,
RepositoryException
MalformedQueryException
RepositoryException
public TupleQuery prepareTupleQueryWithinContext(QueryLanguage qlang,
String query,
String baseURI)
throws MalformedQueryException,
RepositoryException
MalformedQueryException
RepositoryException
public GraphQuery prepareGraphQuery(String query)
throws MalformedQueryException,
RepositoryException
MalformedQueryException
RepositoryException
public Query prepareQuery(String query)
throws MalformedQueryException,
RepositoryException
MalformedQueryException
RepositoryException
public TupleQuery prepareTupleQuery(String query)
throws MalformedQueryException,
RepositoryException
MalformedQueryException
RepositoryException
public GraphQuery prepareGraphQuery(QueryLanguage ql,
String query)
throws MalformedQueryException,
RepositoryException
prepareGraphQuery in interface RepositoryConnectionprepareGraphQuery in class RepositoryConnectionBaseMalformedQueryException
RepositoryException
public Query prepareQuery(QueryLanguage ql,
String query)
throws MalformedQueryException,
RepositoryException
prepareQuery in interface RepositoryConnectionprepareQuery in class RepositoryConnectionBaseMalformedQueryException
RepositoryException
public TupleQuery prepareTupleQuery(QueryLanguage ql,
String query)
throws MalformedQueryException,
RepositoryException
prepareTupleQuery in interface RepositoryConnectionprepareTupleQuery in class RepositoryConnectionBaseMalformedQueryException
RepositoryException
public BooleanQuery prepareBooleanQuery(QueryLanguage ql,
String query)
throws MalformedQueryException,
RepositoryException
prepareBooleanQuery in interface RepositoryConnectionprepareBooleanQuery in class RepositoryConnectionBaseMalformedQueryException
RepositoryException
public GraphQuery prepareGraphQuery(QueryLanguage ql,
String query,
String baseURI)
throws MalformedQueryException,