- java.lang.Object
-
- org.apache.jena.rdflink.RDFLinkHTTP
-
- All Implemented Interfaces:
java.lang.AutoCloseable,LinkDatasetGraph,LinkDatasetGraphAccess,LinkSparqlQuery,LinkSparqlUpdate,RDFLink,Transactional
- Direct Known Subclasses:
RDFLinkFuseki
public class RDFLinkHTTP extends java.lang.Object implements RDFLink
Implementation of theRDFLinkinterface using remote SPARQL operations.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.jena.sparql.core.Transactional
Transactional.Promote
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabort()voidbegin()voidbegin(ReadWrite mode)voidbegin(TxnType txnType)voidclearDataset()Clear the dataset - remove all named graphs, clear the default graph.voidclose()Close this connection.voidcommit()voiddelete()Remove all data from the default graph.voiddelete(Node graphName)Delete a graph from the dataset.voidend()static RDFLinkHTTPBuilderfrom(RDFLinkHTTP base)Create aRDFLinkHTTPBuilderinitialized with the settings of anotherRDFLinkRemote.Graphget()Fetch the default graph.Graphget(Node graphName)Fetch a named graph.DatasetGraphgetDataset()Fetch the contents of the datasetjava.lang.StringgetDestination()Return the destination URL for the connection.java.lang.StringgetGraphStoreEndpoint()java.net.http.HttpClientgetHttpClient()Return theHttpClientin-use.java.lang.StringgetQueryEndpoint()java.lang.StringgetUpdateEndpoint()booleanisClosed()Test whether this connection is closed or notbooleanisInTransaction()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)static RDFLinkHTTPBuildernewBuilder()Create aRDFLinkHTTPBuilder.QueryExecBuildernewQuery()Return aQueryExecBuilderthat is initially configured for this link setup and type.booleanpromote(Transactional.Promote promote)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)QueryExecquery(java.lang.String queryString)Setup a SPARQL query execution.QueryExecquery(Query query)Setup a SPARQL query execution.booleanqueryAsk(java.lang.String queryString)Execute a ASK query and return a booleanGraphqueryConstruct(java.lang.String queryString)Execute a CONSTRUCT query and return as a GraphGraphqueryDescribe(java.lang.String queryString)Execute a DESCRIBE query and return as a GraphvoidqueryRowSet(java.lang.String queryString, java.util.function.Consumer<RowSet> rowSetAction)Execute a SELECT query and process the RowSet with the handler code.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.static RDFLinkHTTPBuilderservice(java.lang.String destinationURL)Create aRDFLinkHTTPBuilder.ReadWritetransactionMode()TxnTypetransactionType()voidupdate(java.lang.String updateString)Execute a SPARQL Update.voidupdate(UpdateRequest update)Execute a SPARQL Update.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.jena.rdflink.RDFLink
queryAsk, queryConstruct, queryConstructDataset, queryConstructDataset, queryDescribe, queryRowSet, querySelect, update
-
Methods inherited from interface org.apache.jena.sparql.core.Transactional
calc, calculate, calculateRead, calculateWrite, exec, execute, executeRead, executeWrite, promote
-
-
-
-
Method Detail
-
newBuilder
public static RDFLinkHTTPBuilder newBuilder()
Create aRDFLinkHTTPBuilder.
-
service
public static RDFLinkHTTPBuilder service(java.lang.String destinationURL)
Create aRDFLinkHTTPBuilder.
-
from
public static RDFLinkHTTPBuilder from(RDFLinkHTTP base)
Create aRDFLinkHTTPBuilderinitialized with the settings of anotherRDFLinkRemote.
-
isRemote
public boolean isRemote()
Description copied from interface:RDFLinkWhether this RDFLink is to a remote server or not.
-
getHttpClient
public java.net.http.HttpClient getHttpClient()
Return theHttpClientin-use.
-
getDestination
public java.lang.String getDestination()
Return the destination URL for the connection.
-
getQueryEndpoint
public java.lang.String getQueryEndpoint()
-
getUpdateEndpoint
public java.lang.String getUpdateEndpoint()
-
getGraphStoreEndpoint
public java.lang.String getGraphStoreEndpoint()
-
queryRowSet
public 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- Specified by:
queryRowSetin interfaceRDFLink- Parameters:
queryString-rowSetAction-
-
querySelect
public 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- Specified by:
querySelectin interfaceRDFLink- Parameters:
queryString-rowAction-
-
queryConstruct
public Graph queryConstruct(java.lang.String queryString)
Execute a CONSTRUCT query and return as a Graph- Specified by:
queryConstructin interfaceLinkSparqlQuery- Specified by:
queryConstructin interfaceRDFLink
-
queryDescribe
public Graph queryDescribe(java.lang.String queryString)
Execute a DESCRIBE query and return as a Graph- Specified by:
queryDescribein interfaceLinkSparqlQuery- Specified by:
queryDescribein interfaceRDFLink
-
queryAsk
public boolean queryAsk(java.lang.String queryString)
Execute a ASK query and return a boolean- Specified by:
queryAskin interfaceLinkSparqlQuery- Specified by:
queryAskin interfaceRDFLink
-
query
public QueryExec query(java.lang.String queryString)
Description copied from interface:RDFLinkSetup 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
RDFLink.querySelect(String, Consumer),RDFLink.queryConstruct(String),RDFLink.queryDescribe(String),RDFLink.queryAsk(String)for ways to execute queries of a specific form.- Specified by:
queryin interfaceLinkSparqlQuery- Specified by:
queryin interfaceRDFLink- Returns:
- QueryExecution
-
query
public QueryExec query(Query query)
Description copied from interface:RDFLinkSetup a SPARQL query execution. See alsoRDFLink.querySelect(Query, Consumer),RDFLink.queryConstruct(Query),RDFLink.queryDescribe(Query),RDFLink.queryAsk(Query)for ways to execute queries for of a specific form.- Specified by:
queryin interfaceLinkSparqlQuery- Specified by:
queryin interfaceRDFLink- Returns:
- QueryExecution
-
newQuery
public QueryExecBuilder newQuery()
Description copied from interface:RDFLinkReturn 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- Specified by:
newQueryin interfaceRDFLink- Returns:
- QueryExecBuilder
-
update
public void update(java.lang.String updateString)
Description copied from interface:RDFLinkExecute a SPARQL Update.- Specified by:
updatein interfaceLinkSparqlUpdate- Specified by:
updatein interfaceRDFLink
-
update
public void update(UpdateRequest update)
Description copied from interface:RDFLinkExecute a SPARQL Update.- Specified by:
updatein interfaceLinkSparqlUpdate- Specified by:
updatein interfaceRDFLink
-
get
public Graph get(Node graphName)
Fetch a named graph. This is SPARQL Graph Store Protocol HTTP GET or equivalent.- Specified by:
getin interfaceLinkDatasetGraphAccess- Specified by:
getin interfaceRDFLink- Parameters:
graphName- URI string for the graph name (null orQuad.defaultGraphIRIfor the default graph)- Returns:
- Graph
-
get
public Graph get()
Description copied from interface:RDFLinkFetch the default graph. This is SPARQL Graph Store Protocol HTTP GET or equivalent.- Specified by:
getin interfaceLinkDatasetGraphAccess- Specified by:
getin interfaceRDFLink- Returns:
- Graph
-
load
public void load(java.lang.String file)
Description copied from interface:RDFLinkSend 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- Specified by:
loadin interfaceRDFLink- Parameters:
file- File of the data.
-
load
public void load(Node graphName, java.lang.String file)
Description copied from interface:RDFLinkLoad (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- Specified by:
loadin interfaceRDFLink- Parameters:
graphName- Graph name (null orQuad.defaultGraphIRIfor the default graph)file- File of the data.
-
load
public void load(Graph graph)
Description copied from interface:RDFLinkLoad (add, append) RDF into the default graph of a dataset. This is SPARQL Graph Store Protocol HTTP POST or equivalent.- Specified by:
loadin interfaceLinkDatasetGraph- Specified by:
loadin interfaceRDFLink- Parameters:
graph- Data.
-
load
public void load(Node graphName, Graph graph)
Description copied from interface:RDFLinkLoad (add, append) RDF into a named graph in a dataset. This is SPARQL Graph Store Protocol HTTP POST or equivalent.- Specified by:
loadin interfaceLinkDatasetGraph- Specified by:
loadin interfaceRDFLink- Parameters:
graphName- Graph name (null orQuad.defaultGraphIRIfor the default graph)graph- Data.
-
put
public void put(java.lang.String file)
Description copied from interface:RDFLinkSet 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- Specified by:
putin interfaceRDFLink- Parameters:
file- File of the data.
-
put
public void put(Node graphName, java.lang.String file)
Description copied from interface:RDFLinkSet 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- Specified by:
putin interfaceRDFLink- Parameters:
graphName- Graph name (null orQuad.defaultGraphIRIfor the default graph)file- File of the data.
-
put
public void put(Graph graph)
Description copied from interface:RDFLinkSet 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- Specified by:
putin interfaceRDFLink- Parameters:
graph- Data.
-
put
public void put(Node graphName, Graph graph)
Description copied from interface:RDFLinkSet 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- Specified by:
putin interfaceRDFLink- Parameters:
graphName- Graph name (null orQuad.defaultGraphIRIfor the default graph)graph- Data.
-
delete
public void delete(Node graphName)
Description copied from interface:RDFLinkDelete a graph from the dataset. Null orQuad.defaultGraphIRImeans the default graph, which is cleared, not removed.- Specified by:
deletein interfaceLinkDatasetGraph- Specified by:
deletein interfaceRDFLink
-
delete
public void delete()
Description copied from interface:RDFLinkRemove all data from the default graph.- Specified by:
deletein interfaceLinkDatasetGraph- Specified by:
deletein interfaceRDFLink
-
getDataset
public DatasetGraph getDataset()
Description copied from interface:LinkDatasetGraphAccessFetch the contents of the dataset- Specified by:
getDatasetin interfaceLinkDatasetGraphAccess
-
loadDataset
public void loadDataset(java.lang.String file)
- Specified by:
loadDatasetin interfaceLinkDatasetGraph- Specified by:
loadDatasetin interfaceRDFLink
-
loadDataset
public void loadDataset(DatasetGraph dataset)
- Specified by:
loadDatasetin interfaceLinkDatasetGraph- Specified by:
loadDatasetin interfaceRDFLink
-
putDataset
public void putDataset(java.lang.String file)
- Specified by:
putDatasetin interfaceLinkDatasetGraph- Specified by:
putDatasetin interfaceRDFLink
-
putDataset
public void putDataset(DatasetGraph dataset)
- Specified by:
putDatasetin interfaceLinkDatasetGraph- Specified by:
putDatasetin interfaceRDFLink
-
clearDataset
public void clearDataset()
Description copied from interface:RDFLinkClear the dataset - remove all named graphs, clear the default graph.- Specified by:
clearDatasetin interfaceLinkDatasetGraph- Specified by:
clearDatasetin interfaceRDFLink
-
close
public void close()
Description copied from interface:RDFLinkClose 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- Specified by:
closein interfaceRDFLink
-
isClosed
public boolean isClosed()
Description copied from interface:RDFLinkTest whether this connection is closed or not- Specified by:
isClosedin interfaceLinkDatasetGraph- Specified by:
isClosedin interfaceLinkDatasetGraphAccess- Specified by:
isClosedin interfaceRDFLink
-
begin
public void begin()
- Specified by:
beginin interfaceTransactional
-
begin
public void begin(TxnType txnType)
- Specified by:
beginin interfaceTransactional
-
begin
public void begin(ReadWrite mode)
- Specified by:
beginin interfaceTransactional
-
promote
public boolean promote(Transactional.Promote promote)
- Specified by:
promotein interfaceTransactional
-
commit
public void commit()
- Specified by:
commitin interfaceTransactional
-
abort
public void abort()
- Specified by:
abortin interfaceTransactional
-
isInTransaction
public boolean isInTransaction()
- Specified by:
isInTransactionin interfaceTransactional
-
end
public void end()
- Specified by:
endin interfaceTransactional
-
transactionMode
public ReadWrite transactionMode()
- Specified by:
transactionModein interfaceTransactional
-
transactionType
public TxnType transactionType()
- Specified by:
transactionTypein interfaceTransactional
-
-