Package org.apache.jena.rdfconnection
Interface RDFConnection
-
- All Superinterfaces:
java.lang.AutoCloseable,RDFDatasetAccessConnection,RDFDatasetConnection,SparqlQueryConnection,SparqlUpdateConnection,Transactional
- All Known Implementing Classes:
RDFConnectionFuseki,RDFConnectionLocal,RDFConnectionModular,RDFConnectionRemote,RDFConnectionWrapper
public interface RDFConnection extends SparqlQueryConnection, SparqlUpdateConnection, RDFDatasetConnection, Transactional, java.lang.AutoCloseable
Interface for SPARQL operations on a datasets, whether local or remote. Operations can performed via this interface or via the various interfaces for a subset of the operations.- query (
SparqlQueryConnection) - update (
SparqlUpdateConnection) - graph store protocol (
RDFDatasetConnection).
RDFConnectionprovides transaction boundaries. If not in a transaction, an implicit transactional wrapper is applied ("autocommit"). Remote SPARQL operations are atomic but without additional capabilities from the remote server, multiple operations are not combined into a single transaction. Not all implementations may implement all operations. See the implementation notes for details.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.jena.sparql.core.Transactional
Transactional.Promote
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidclose()Close this connection.voiddelete()Remove all data from the default graph.voiddelete(java.lang.String graphName)Delete a graph from the dataset.Modelfetch()Fetch the default graph.Modelfetch(java.lang.String graphName)Fetch a named graph.DatasetfetchDataset()Fetch the contents of the datasetbooleanisClosed()Test whether this connection is closed or notvoidload(java.lang.String file)Load (add, append) RDF into the default graph of a dataset.voidload(java.lang.String graphName, java.lang.String file)Load (add, append) RDF into a named graph in a dataset.voidload(java.lang.String graphName, Model model)Load (add, append) RDF into a named graph in a dataset.voidload(Model model)Load (add, append) RDF into the default graph of a dataset.voidloadDataset(java.lang.String file)voidloadDataset(Dataset dataset)voidput(java.lang.String file)Set the contents of the default graph of a dataset.voidput(java.lang.String graphName, java.lang.String file)Set the contents of a named graph of a dataset.voidput(java.lang.String graphName, Model model)Set the contents of a named graph of a dataset.voidput(Model model)Set the contents of the default graph of a dataset.voidputDataset(java.lang.String file)voidputDataset(Dataset dataset)default QueryExecutionquery(java.lang.String queryString)Setup a SPARQL query execution.QueryExecutionquery(Query query)Setup a SPARQL query execution.default booleanqueryAsk(java.lang.String queryString)Execute a ASK query and return a booleandefault booleanqueryAsk(Query query)Execute a ASK query and return a booleandefault ModelqueryConstruct(java.lang.String queryString)Execute a CONSTRUCT query and return as a Modeldefault ModelqueryConstruct(Query query)Execute a CONSTRUCT query and return as a Modeldefault ModelqueryDescribe(java.lang.String queryString)Execute a DESCRIBE query and return as a Modeldefault ModelqueryDescribe(Query query)Execute a DESCRIBE query and return as a Modeldefault voidqueryResultSet(java.lang.String queryString, java.util.function.Consumer<ResultSet> resultSetAction)Execute a SELECT query and process the ResultSet with the handler code.default voidqueryResultSet(Query query, java.util.function.Consumer<ResultSet> resultSetAction)Execute a SELECT query and process the ResultSet with the handler code.default voidquerySelect(java.lang.String queryString, java.util.function.Consumer<QuerySolution> rowAction)Execute a SELECT query and process the rows of the results with the handler code.default voidquerySelect(Query query, java.util.function.Consumer<QuerySolution> rowAction)Execute a SELECT query and process the rows of the results with the handler code.default voidupdate(java.lang.String updateString)Execute a SPARQL Update.default voidupdate(Update update)Execute a SPARQL Update.voidupdate(UpdateRequest update)Execute a SPARQL Update.-
Methods inherited from interface org.apache.jena.sparql.core.Transactional
abort, begin, begin, begin, calc, calculate, calculateRead, calculateWrite, commit, end, exec, execute, executeRead, executeWrite, isInTransaction, promote, promote, transactionMode, transactionType
-
-
-
-
Method Detail
-
queryResultSet
default void queryResultSet(java.lang.String queryString, java.util.function.Consumer<ResultSet> resultSetAction)Execute a SELECT query and process the ResultSet with the handler code.- Specified by:
queryResultSetin interfaceSparqlQueryConnection- Parameters:
queryString-resultSetAction-
-
queryResultSet
default void queryResultSet(Query query, java.util.function.Consumer<ResultSet> resultSetAction)
Execute a SELECT query and process the ResultSet with the handler code.- Specified by:
queryResultSetin interfaceSparqlQueryConnection- Parameters:
query-resultSetAction-
-
querySelect
default void querySelect(java.lang.String queryString, java.util.function.Consumer<QuerySolution> rowAction)Execute a SELECT query and process the rows of the results with the handler code.- Specified by:
querySelectin interfaceSparqlQueryConnection- Parameters:
queryString-rowAction-
-
querySelect
default void querySelect(Query query, java.util.function.Consumer<QuerySolution> rowAction)
Execute a SELECT query and process the rows of the results with the handler code.- Specified by:
querySelectin interfaceSparqlQueryConnection- Parameters:
query-rowAction-
-
queryConstruct
default Model queryConstruct(java.lang.String queryString)
Execute a CONSTRUCT query and return as a Model- Specified by:
queryConstructin interfaceSparqlQueryConnection
-
queryConstruct
default Model queryConstruct(Query query)
Execute a CONSTRUCT query and return as a Model- Specified by:
queryConstructin interfaceSparqlQueryConnection
-
queryDescribe
default Model queryDescribe(java.lang.String queryString)
Execute a DESCRIBE query and return as a Model- Specified by:
queryDescribein interfaceSparqlQueryConnection
-
queryDescribe
default Model queryDescribe(Query query)
Execute a DESCRIBE query and return as a Model- Specified by:
queryDescribein interfaceSparqlQueryConnection
-
queryAsk
default boolean queryAsk(java.lang.String queryString)
Execute a ASK query and return a boolean- Specified by:
queryAskin interfaceSparqlQueryConnection
-
queryAsk
default boolean queryAsk(Query query)
Execute a ASK query and return a boolean- Specified by:
queryAskin interfaceSparqlQueryConnection
-
query
QueryExecution query(Query query)
Setup a SPARQL query execution. See alsoquerySelect(Query, Consumer),queryConstruct(Query),queryDescribe(Query),queryAsk(Query)for ways to execute queries for of a specific form.- Specified by:
queryin interfaceSparqlQueryConnection- Parameters:
query-- Returns:
- QueryExecution
-
query
default QueryExecution query(java.lang.String queryString)
Setup a SPARQL query execution. This is a low-level operation. Handling theQueryExecutionshould be done with try-resource. SomeQueryExecutions, such as ones connecting to a remote server, need to be properly closed to release system resources. See alsoquerySelect(String, Consumer),queryConstruct(String),queryDescribe(String),queryAsk(String)for ways to execute queries of a specific form.- Specified by:
queryin interfaceSparqlQueryConnection- Parameters:
queryString-- Returns:
- QueryExecution
-
update
default void update(Update update)
Execute a SPARQL Update.- Specified by:
updatein interfaceSparqlUpdateConnection- Parameters:
update-
-
update
void update(UpdateRequest update)
Execute a SPARQL Update.- Specified by:
updatein interfaceSparqlUpdateConnection- Parameters:
update-
-
update
default void update(java.lang.String updateString)
Execute a SPARQL Update.- Specified by:
updatein interfaceSparqlUpdateConnection- Parameters:
updateString-
-
fetch
Model fetch(java.lang.String graphName)
Fetch a named graph. This is SPARQL Graph Store Protocol HTTP GET or equivalent.- Specified by:
fetchin interfaceRDFDatasetAccessConnection- Parameters:
graphName- URI string for the graph name (null or "default" for the default graph)- Returns:
- Model
-
fetch
Model fetch()
Fetch the default graph. This is SPARQL Graph Store Protocol HTTP GET or equivalent.- Specified by:
fetchin interfaceRDFDatasetAccessConnection- Returns:
- Model
-
fetchDataset
Dataset fetchDataset()
Fetch the contents of the dataset- Specified by:
fetchDatasetin interfaceRDFDatasetAccessConnection
-
load
void load(java.lang.String graphName, java.lang.String file)Load (add, append) RDF into a named graph in a dataset. This is SPARQL Graph Store Protocol HTTP POST or equivalent.- Specified by:
loadin interfaceRDFDatasetConnection- Parameters:
graphName- Graph name (null or "default" for the default graph)file- File of the data.
-
load
void load(java.lang.String file)
Load (add, append) RDF into the default graph of a dataset. This is SPARQL Graph Store Protocol HTTP POST or equivalent.- Specified by:
loadin interfaceRDFDatasetConnection- Parameters:
file- File of the data.
-
load
void load(java.lang.String graphName, Model model)Load (add, append) RDF into a named graph in a dataset. This is SPARQL Graph Store Protocol HTTP POST or equivalent.- Specified by:
loadin interfaceRDFDatasetConnection- Parameters:
graphName- Graph name (null or "default" for the default graph)model- Data.
-
load
void load(Model model)
Load (add, append) RDF into the default graph of a dataset. This is SPARQL Graph Store Protocol HTTP POST or equivalent.- Specified by:
loadin interfaceRDFDatasetConnection- Parameters:
model- Data.
-
put
void put(java.lang.String graphName, java.lang.String file)Set the contents of a named graph of a dataset. Any existing data is lost. This is SPARQL Graph Store Protocol HTTP PUT or equivalent.- Specified by:
putin interfaceRDFDatasetConnection- Parameters:
graphName- Graph name (null or "default" for the default graph)file- File of the data.
-
put
void put(java.lang.String file)
Set the contents of the default graph of a dataset. Any existing data is lost. This is SPARQL Graph Store Protocol HTTP PUT or equivalent.- Specified by:
putin interfaceRDFDatasetConnection- Parameters:
file- File of the data.
-
put
void put(java.lang.String graphName, Model model)Set the contents of a named graph of a dataset. Any existing data is lost. This is SPARQL Graph Store Protocol HTTP PUT or equivalent.- Specified by:
putin interfaceRDFDatasetConnection- Parameters:
graphName- Graph name (null or "default" for the default graph)model- Data.
-
put
void put(Model model)
Set the contents of the default graph of a dataset. Any existing data is lost. This is SPARQL Graph Store Protocol HTTP PUT or equivalent.- Specified by:
putin interfaceRDFDatasetConnection- Parameters:
model- Data.
-
delete
void delete(java.lang.String graphName)
Delete a graph from the dataset. Null or "default" means the default graph, which is cleared, not removed.- Specified by:
deletein interfaceRDFDatasetConnection- Parameters:
graphName-
-
delete
void delete()
Remove all data from the default graph.- Specified by:
deletein interfaceRDFDatasetConnection
-
loadDataset
void loadDataset(java.lang.String file)
- Specified by:
loadDatasetin interfaceRDFDatasetConnection
-
loadDataset
void loadDataset(Dataset dataset)
- Specified by:
loadDatasetin interfaceRDFDatasetConnection
-
putDataset
void putDataset(java.lang.String file)
- Specified by:
putDatasetin interfaceRDFDatasetConnection
-
putDataset
void putDataset(Dataset dataset)
- Specified by:
putDatasetin interfaceRDFDatasetConnection
-
isClosed
boolean isClosed()
Test whether this connection is closed or not- Specified by:
isClosedin interfaceRDFDatasetAccessConnection- Specified by:
isClosedin interfaceRDFDatasetConnection
-
close
void close()
Close this connection. Use with try-resource.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfaceRDFDatasetAccessConnection- Specified by:
closein interfaceRDFDatasetConnection- Specified by:
closein interfaceSparqlQueryConnection- Specified by:
closein interfaceSparqlUpdateConnection
-
-