- All Superinterfaces:
AutoCloseable,LinkDatasetGraph,LinkDatasetGraphAccess,LinkSparqlQuery,LinkSparqlUpdate,org.apache.jena.sparql.core.Transactional
- All Known Implementing Classes:
RDFLinkAdapter,RDFLinkDataset,RDFLinkFuseki,RDFLinkHTTP,RDFLinkModular
- query (
LinkSparqlQuery) - update (
LinkSparqlUpdate) - graph store protocol (
LinkDatasetGraphand read-onlyLinkDatasetGraphAccess).
RDFLink provides 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
org.apache.jena.sparql.core.Transactional.Promote -
Method Summary
Modifier and TypeMethodDescriptionvoidClear the dataset - remove all named graphs, clear the default graph.voidclose()Close this connection.static RDFLinkCreate a connection to a remote location by URL.static RDFLinkconnect(org.apache.jena.sparql.core.DatasetGraph dataset) Connect to a local (same JVM) dataset.static RDFLinkConnect to a local (same JVM) dataset.static RDFLinkMake a remote RDFConnection to the URL, with user and password for the client access using basic auth.voiddelete()Remove all data from the default graph.voiddelete(org.apache.jena.graph.Node graphName) Delete a graph from the dataset.org.apache.jena.graph.Graphget()Fetch the default graph.default org.apache.jena.graph.GraphFetch a named graph.org.apache.jena.graph.Graphget(org.apache.jena.graph.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.voidSend file - this merges the file RDF into the default graph of a dataset.voidload(org.apache.jena.graph.Graph graph) Load (add, append) RDF into the default graph of a dataset.voidLoad (add, append) RDF into a named graph in a dataset.voidload(org.apache.jena.graph.Node graphName, org.apache.jena.graph.Graph graph) Load (add, append) RDF into a named graph in a dataset.voidloadDataset(String file) voidloadDataset(org.apache.jena.sparql.core.DatasetGraph dataset) org.apache.jena.sparql.exec.QueryExecBuildernewQuery()Return aQueryExecBuilderthat is initially configured for this link setup and type.org.apache.jena.sparql.exec.UpdateExecBuilderReturn aUpdateExecBuilderthat is initially configured for this link setup and type.voidSet the contents of the default graph of a dataset.voidput(org.apache.jena.graph.Graph graph) Set the contents of the default graph of a dataset.voidSet the contents of a named graph of a dataset.voidput(org.apache.jena.graph.Node graphName, org.apache.jena.graph.Graph graph) Set the contents of a named graph of a dataset.voidputDataset(String file) voidputDataset(org.apache.jena.sparql.core.DatasetGraph dataset) default org.apache.jena.sparql.exec.QueryExecSetup a SPARQL query execution.org.apache.jena.sparql.exec.QueryExecquery(org.apache.jena.query.Query query) Setup a SPARQL query execution.default booleanExecute a ASK query and return a booleandefault booleanqueryAsk(org.apache.jena.query.Query query) Execute a ASK query and return a booleanstatic RDFLinkqueryConnect(String queryServiceURL) Create a connection to a remote location for SPARQL query requestsdefault org.apache.jena.graph.GraphqueryConstruct(String queryString) Execute a CONSTRUCT query and return as a Graphdefault org.apache.jena.graph.GraphqueryConstruct(org.apache.jena.query.Query query) Execute a CONSTRUCT query and return as a Graphdefault org.apache.jena.sparql.core.DatasetGraphqueryConstructDataset(String queryString) Execute a CONSTRUCT query and return as a Graphdefault org.apache.jena.sparql.core.DatasetGraphqueryConstructDataset(org.apache.jena.query.Query query) Execute a CONSTRUCT query and return as a DatasetGraphdefault org.apache.jena.graph.GraphqueryDescribe(String queryString) Execute a DESCRIBE query and return as a Graphdefault org.apache.jena.graph.GraphqueryDescribe(org.apache.jena.query.Query query) Execute a DESCRIBE query and return as a Graphdefault voidqueryRowSet(String queryString, Consumer<org.apache.jena.sparql.exec.RowSet> rowSetAction) Execute a SELECT query and process the RowSet with the handler code.default voidqueryRowSet(org.apache.jena.query.Query query, Consumer<org.apache.jena.sparql.exec.RowSet> rowSetAction) Execute a SELECT query and process the RowSet with the handler code.default voidquerySelect(String queryString, Consumer<org.apache.jena.sparql.engine.binding.Binding> rowAction) Execute a SELECT query and process the rows of the results with the handler code.default voidquerySelect(org.apache.jena.query.Query query, Consumer<org.apache.jena.sparql.engine.binding.Binding> rowAction) Execute a SELECT query and process the rows of the results with the handler code.default voidExecute a SPARQL Update.default voidupdate(org.apache.jena.update.Update update) Execute a SPARQL Update.voidupdate(org.apache.jena.update.UpdateRequest update) Execute a SPARQL Update.Methods inherited from interface org.apache.jena.rdflink.LinkDatasetGraphAccess
getDatasetMethods 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 Details
-
connect
Connect to a local (same JVM) dataset. The default isolation isNONE. Seeconnect(DatasetGraph, Isolation)to select an isolation mode.- Parameters:
dataset-- Returns:
- RDFLink
- See Also:
-
connect
Connect to a local (same JVM) dataset.Multiple levels of
Isolationare provided, The defaultCOPYlevel makes a localRDFLinkbehave like a remote connection. See the documentation for more details.COPY–Models andDatasets are copied. This is most like a remote connection.READONLY– Read-only wrappers are added but changes to the underlying model or dataset will be seen.NONE(default) – Changes to the returnedModels orDatasets act on the original object.
- Parameters:
dataset-isolation-- Returns:
- RDFConnection
-
queryConnect
Create a connection to a remote location for SPARQL query requests- Parameters:
queryServiceURL-- Returns:
- RDFConnection
-
connect
Create a connection to a remote location by URL. This is the URL for the dataset.This is the URL for the dataset. Other names can be specified using
RDFLinkHTTP.newBuilder()and setting the endpoint URLs.RDFConnectionRemote.newBuilder() .queryEndpoint(queryServiceEndpoint) .updateEndpoint(updateServiceEndpoint) .gspEndpoint(graphStoreProtocolEndpoint) .build();- Parameters:
serviceURL-- Returns:
- RDFConnection
-
connectPW
Make a remote RDFConnection to the URL, with user and password for the client access using basic auth. Use with care – basic auth over plain HTTP reveals the password on the network.- Parameters:
URL-user-password-- Returns:
- RDFConnection
-
queryRowSet
default void queryRowSet(String queryString, Consumer<org.apache.jena.sparql.exec.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(org.apache.jena.query.Query query, Consumer<org.apache.jena.sparql.exec.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(String queryString, Consumer<org.apache.jena.sparql.engine.binding.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(org.apache.jena.query.Query query, Consumer<org.apache.jena.sparql.engine.binding.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
Execute a CONSTRUCT query and return as a Graph- Specified by:
queryConstructin interfaceLinkSparqlQuery
-
queryConstructDataset
default org.apache.jena.sparql.core.DatasetGraph queryConstructDataset(org.apache.jena.query.Query query) Execute a CONSTRUCT query and return as a DatasetGraph -
queryConstructDataset
Execute a CONSTRUCT query and return as a Graph -
queryConstruct
default org.apache.jena.graph.Graph queryConstruct(org.apache.jena.query.Query query) Execute a CONSTRUCT query and return as a Graph- Specified by:
queryConstructin interfaceLinkSparqlQuery
-
queryDescribe
Execute a DESCRIBE query and return as a Graph- Specified by:
queryDescribein interfaceLinkSparqlQuery
-
queryDescribe
default org.apache.jena.graph.Graph queryDescribe(org.apache.jena.query.Query query) Execute a DESCRIBE query and return as a Graph- Specified by:
queryDescribein interfaceLinkSparqlQuery
-
queryAsk
Execute a ASK query and return a boolean- Specified by:
queryAskin interfaceLinkSparqlQuery
-
queryAsk
default boolean queryAsk(org.apache.jena.query.Query query) Execute a ASK query and return a boolean- Specified by:
queryAskin interfaceLinkSparqlQuery
-
query
org.apache.jena.sparql.exec.QueryExec query(org.apache.jena.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
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
org.apache.jena.sparql.exec.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
-
newUpdate
org.apache.jena.sparql.exec.UpdateExecBuilder newUpdate()Return aUpdateExecBuilderthat is initially configured for this link setup and type. The update built will be set to go to the same dataset/remote endpoint as the other RDFLink operations.- Specified by:
newUpdatein interfaceLinkSparqlUpdate- Returns:
- UpdateExecBuilder
-
update
default void update(org.apache.jena.update.Update update) Execute a SPARQL Update.- Specified by:
updatein interfaceLinkSparqlUpdate- Parameters:
update-
-
update
void update(org.apache.jena.update.UpdateRequest update) Execute a SPARQL Update.- Specified by:
updatein interfaceLinkSparqlUpdate- Parameters:
update-
-
update
Execute a SPARQL Update.- Specified by:
updatein interfaceLinkSparqlUpdate- Parameters:
updateString-
-
get
org.apache.jena.graph.Graph get()Fetch the default graph. This is SPARQL Graph Store Protocol HTTP GET or equivalent.- Specified by:
getin interfaceLinkDatasetGraphAccess- Returns:
- Graph
-
get
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
-
get
org.apache.jena.graph.Graph get(org.apache.jena.graph.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
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
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(org.apache.jena.graph.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(org.apache.jena.graph.Node graphName, org.apache.jena.graph.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
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
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(org.apache.jena.graph.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(org.apache.jena.graph.Node graphName, org.apache.jena.graph.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(org.apache.jena.graph.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
- Specified by:
loadDatasetin interfaceLinkDatasetGraph
-
loadDataset
void loadDataset(org.apache.jena.sparql.core.DatasetGraph dataset) - Specified by:
loadDatasetin interfaceLinkDatasetGraph
-
putDataset
- Specified by:
putDatasetin interfaceLinkDatasetGraph
-
putDataset
void putDataset(org.apache.jena.sparql.core.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 interfaceAutoCloseable- Specified by:
closein interfaceLinkDatasetGraph- Specified by:
closein interfaceLinkDatasetGraphAccess- Specified by:
closein interfaceLinkSparqlQuery- Specified by:
closein interfaceLinkSparqlUpdate
-