-
- All Superinterfaces:
java.lang.AutoCloseable,LinkDatasetGraph,LinkDatasetGraphAccess,LinkSparqlQuery,LinkSparqlUpdate,Transactional
- All Known Implementing Classes:
RDFLinkAdapter,RDFLinkDataset,RDFLinkFuseki,RDFLinkHTTP,RDFLinkModular
public interface RDFLink extends LinkSparqlQuery, LinkSparqlUpdate, LinkDatasetGraph, Transactional, java.lang.AutoCloseable
Interface for SPARQL operations on a dataset, whether local or remote. Operations can be performed via this interface or via the various interfaces for a subset of the operations.- query (
LinkSparqlQuery) - update (
LinkSparqlUpdate) - graph store protocol (
LinkDatasetGraphand read-onlyLinkDatasetGraphAccess).
RDFLinkprovides 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 voidclearDataset()Clear the dataset - remove all named graphs, clear the default graph.voidclose()Close this connection.voiddelete()Remove all data from the default graph.voiddelete(Node graphName)Delete a graph from the dataset.Graphget()Fetch the default graph.Graphget(Node graphName)Fetch a named graph.booleanisClosed()Test whether this connection is closed or notdefault booleanisRemote()Whether this RDFLink is to a remote server or not.voidload(java.lang.String file)Send file - this merges the file RDF into the default graph of a dataset.voidload(Graph graph)Load (add, append) RDF into the default graph of a dataset.voidload(Node graphName, java.lang.String file)Load (add, append) RDF into a named graph in a dataset.voidload(Node graphName, Graph graph)Load (add, append) RDF into a named graph in a dataset.voidloadDataset(java.lang.String file)voidloadDataset(DatasetGraph dataset)QueryExecBuildernewQuery()Return aQueryExecBuilderthat is initially configured for this link setup and type.voidput(java.lang.String file)Set the contents of the default graph of a dataset.voidput(Graph graph)Set the contents of the default graph of a dataset.voidput(Node graphName, java.lang.String file)Set the contents of a named graph of a dataset.voidput(Node graphName, Graph graph)Set the contents of a named graph of a dataset.voidputDataset(java.lang.String file)voidputDataset(DatasetGraph dataset)default QueryExecquery(java.lang.String queryString)Setup a SPARQL query execution.QueryExecquery(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 GraphqueryConstruct(java.lang.String queryString)Execute a CONSTRUCT query and return as a Graphdefault GraphqueryConstruct(Query query)Execute a CONSTRUCT query and return as a Graphdefault DatasetGraphqueryConstructDataset(java.lang.String queryString)Execute a CONSTRUCT query and return as a Graphdefault DatasetGraphqueryConstructDataset(Query query)Execute a CONSTRUCT query and return as a DatasetGraphdefault GraphqueryDescribe(java.lang.String queryString)Execute a DESCRIBE query and return as a Graphdefault GraphqueryDescribe(Query query)Execute a DESCRIBE query and return as a Graphdefault voidqueryRowSet(java.lang.String queryString, java.util.function.Consumer<RowSet> rowSetAction)Execute a SELECT query and process the RowSet with the handler code.default voidqueryRowSet(Query query, java.util.function.Consumer<RowSet> rowSetAction)Execute a SELECT query and process the RowSet with the handler code.default voidquerySelect(java.lang.String queryString, java.util.function.Consumer<Binding> rowAction)Execute a SELECT query and process the rows of the results with the handler code.default voidquerySelect(Query query, java.util.function.Consumer<Binding> 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.rdflink.LinkDatasetGraphAccess
getDataset
-
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
-
queryRowSet
default void queryRowSet(java.lang.String queryString, java.util.function.Consumer<RowSet> rowSetAction)Execute a SELECT query and process the RowSet with the handler code.- Specified by:
queryRowSetin interfaceLinkSparqlQuery- Parameters:
queryString-rowSetAction-
-
queryRowSet
default void queryRowSet(Query query, java.util.function.Consumer<RowSet> rowSetAction)
Execute a SELECT query and process the RowSet with the handler code.- Specified by:
queryRowSetin interfaceLinkSparqlQuery- Parameters:
query-rowSetAction-
-
querySelect
default void querySelect(java.lang.String queryString, java.util.function.Consumer<Binding> rowAction)Execute a SELECT query and process the rows of the results with the handler code.- Specified by:
querySelectin interfaceLinkSparqlQuery- Parameters:
queryString-rowAction-
-
querySelect
default void querySelect(Query query, java.util.function.Consumer<Binding> rowAction)
Execute a SELECT query and process the rows of the results with the handler code.- Specified by:
querySelectin interfaceLinkSparqlQuery- Parameters:
query-rowAction-
-
queryConstruct
default Graph queryConstruct(java.lang.String queryString)
Execute a CONSTRUCT query and return as a Graph- Specified by:
queryConstructin interfaceLinkSparqlQuery
-
queryConstructDataset
default DatasetGraph queryConstructDataset(Query query)
Execute a CONSTRUCT query and return as a DatasetGraph
-
queryConstructDataset
default DatasetGraph queryConstructDataset(java.lang.String queryString)
Execute a CONSTRUCT query and return as a Graph
-
queryConstruct
default Graph queryConstruct(Query query)
Execute a CONSTRUCT query and return as a Graph- Specified by:
queryConstructin interfaceLinkSparqlQuery
-
queryDescribe
default Graph queryDescribe(java.lang.String queryString)
Execute a DESCRIBE query and return as a Graph- Specified by:
queryDescribein interfaceLinkSparqlQuery
-
queryDescribe
default Graph queryDescribe(Query query)
Execute a DESCRIBE query and return as a Graph- Specified by:
queryDescribein interfaceLinkSparqlQuery
-
queryAsk
default boolean queryAsk(java.lang.String queryString)
Execute a ASK query and return a boolean- Specified by:
queryAskin interfaceLinkSparqlQuery
-
queryAsk
default boolean queryAsk(Query query)
Execute a ASK query and return a boolean- Specified by:
queryAskin interfaceLinkSparqlQuery
-
query
QueryExec 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 interfaceLinkSparqlQuery- Parameters:
query-- Returns:
- QueryExecution
-
query
default QueryExec query(java.lang.String queryString)
Setup a SPARQL query execution.This is a low-level operation. Handling the
QueryExecutionshould be done with try-resource. SomeQueryExecutions, such as ones connecting to a remote server, need to be properly closed to release system resources.See also
querySelect(String, Consumer),queryConstruct(String),queryDescribe(String),queryAsk(String)for ways to execute queries of a specific form.- Specified by:
queryin interfaceLinkSparqlQuery- Parameters:
queryString-- Returns:
- QueryExecution
-
newQuery
QueryExecBuilder newQuery()
Return aQueryExecBuilderthat is initially configured for this link setup and type. The query built will be set to go to the same dataset/remote endpoint as the other RDFLink operations.- Specified by:
newQueryin interfaceLinkSparqlQuery- Returns:
- QueryExecBuilder
-
update
default void update(Update update)
Execute a SPARQL Update.- Specified by:
updatein interfaceLinkSparqlUpdate- Parameters:
update-
-
update
void update(UpdateRequest update)
Execute a SPARQL Update.- Specified by:
updatein interfaceLinkSparqlUpdate- Parameters:
update-
-
update
default void update(java.lang.String updateString)
Execute a SPARQL Update.- Specified by:
updatein interfaceLinkSparqlUpdate- Parameters:
updateString-
-
get
Graph get()
Fetch the default graph. This is SPARQL Graph Store Protocol HTTP GET or equivalent.- Specified by:
getin interfaceLinkDatasetGraphAccess- Returns:
- Graph
-
get
Graph get(Node graphName)
Fetch a named graph. This is SPARQL Graph Store Protocol HTTP GET or equivalent.- Specified by:
getin interfaceLinkDatasetGraphAccess- Parameters:
graphName- URI string for the graph name (null orQuad.defaultGraphIRIfor the default graph)- Returns:
- Graph
-
load
void load(java.lang.String file)
Send file - this merges the file RDF into the default graph of a dataset. This is SPARQL Graph Store Protocol HTTP POST or equivalent.If this is a remote connection:
- The file is sent as-is and not parsed in the RDFLink
- The Content-Type is determined by the filename
- Specified by:
loadin interfaceLinkDatasetGraph- Parameters:
file- File of the data.
-
load
void load(Node 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.If this is a remote connection:
- The file is sent as-is and not parsed in the RDFLink
- The Content-Type is determined by the filename
- Specified by:
loadin interfaceLinkDatasetGraph- Parameters:
graphName- Graph name (null orQuad.defaultGraphIRIfor the default graph)file- File of the data.
-
load
void load(Graph graph)
Load (add, append) RDF into the default graph of a dataset. This is SPARQL Graph Store Protocol HTTP POST or equivalent.- Specified by:
loadin interfaceLinkDatasetGraph- Parameters:
graph- Data.
-
load
void load(Node graphName, Graph graph)
Load (add, append) RDF into a named graph in a dataset. This is SPARQL Graph Store Protocol HTTP POST or equivalent.- Specified by:
loadin interfaceLinkDatasetGraph- Parameters:
graphName- Graph name (null orQuad.defaultGraphIRIfor the default graph)graph- 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.If this is a remote connection:
- The file is sent as-is and not parsed in the RDFLink
- The Content-Type is determined by the filename
- Specified by:
putin interfaceLinkDatasetGraph- Parameters:
file- File of the data.
-
put
void put(Node 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 interfaceLinkDatasetGraph- Parameters:
graphName- Graph name (null orQuad.defaultGraphIRIfor the default graph)file- File of the data.
-
put
void put(Graph graph)
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.If this is a remote connection:
- The file is sent as-is and not parsed in the RDFLink
- The Content-Type is determined by the filename
- Specified by:
putin interfaceLinkDatasetGraph- Parameters:
graph- Data.
-
put
void put(Node graphName, Graph graph)
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 interfaceLinkDatasetGraph- Parameters:
graphName- Graph name (null orQuad.defaultGraphIRIfor the default graph)graph- Data.
-
delete
void delete(Node graphName)
Delete a graph from the dataset. Null orQuad.defaultGraphIRImeans the default graph, which is cleared, not removed.- Specified by:
deletein interfaceLinkDatasetGraph- Parameters:
graphName-
-
delete
void delete()
Remove all data from the default graph.- Specified by:
deletein interfaceLinkDatasetGraph
-
loadDataset
void loadDataset(java.lang.String file)
- Specified by:
loadDatasetin interfaceLinkDatasetGraph
-
loadDataset
void loadDataset(DatasetGraph dataset)
- Specified by:
loadDatasetin interfaceLinkDatasetGraph
-
putDataset
void putDataset(java.lang.String file)
- Specified by:
putDatasetin interfaceLinkDatasetGraph
-
putDataset
void putDataset(DatasetGraph dataset)
- Specified by:
putDatasetin interfaceLinkDatasetGraph
-
clearDataset
void clearDataset()
Clear the dataset - remove all named graphs, clear the default graph.- Specified by:
clearDatasetin interfaceLinkDatasetGraph
-
isClosed
boolean isClosed()
Test whether this connection is closed or not- Specified by:
isClosedin interfaceLinkDatasetGraph- Specified by:
isClosedin interfaceLinkDatasetGraphAccess
-
isRemote
default boolean isRemote()
Whether this RDFLink is to a remote server or not.
-
close
void close()
Close this connection. Use with try-resource.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfaceLinkDatasetGraph- Specified by:
closein interfaceLinkDatasetGraphAccess- Specified by:
closein interfaceLinkSparqlQuery- Specified by:
closein interfaceLinkSparqlUpdate
-
-