java.lang.Object
org.apache.jena.query.ModelStore
Client for the
SPARQL 1.1 Graph Store Protocol
working at the Model/Resource API level.
This is extended to include operations GET, POST and PUT on RDF Datasets.
Examples:
// Get the default graph.
Model model = ModelStore.service("http://example/dataset").defaultModel().GET();
// Get a named graph.
Model model = ModelStore.service("http://example/dataset").namedGraph("http://my/graph").GET();
// POST (add) to a named graph.
Model myData = ...;
ModelStore.request("http://example/dataset").namedGraph("http://my/graph").POST(myData);
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionSet the accept header on GET requests.acceptHeader(String acceptHeader) Set the accept header on GET requests.voidClear - delete named graphs, empty the default graph - SPARQL "CLEAR ALL"contentType(RDFFormat rdfFormat) Set the Content-type for a POST, PUT request of a file or serialization of a graph of dataset is necessary.contentTypeHeader(String contentType) Set the Content-type for a POST, PUT request of a file or serialization of a graph of dataset is necessary.Send request for the default graph (that is,?default)Send request for the default graph (that is,?default)voidDELETE()Delete a graph.Set the URL of the query endpoint.org.apache.jena.rdf.model.ModelGET()Get a graphGET dataset.httpClient(HttpClient httpClient) httpHeader(String headerName, String headerValue) Set an HTTP header that is added to the request.namedGraph(String graphName) Send request for a named graph (that is,?graph=)voidPOST the contents of a file using the filename extension to determine the Content-Type to use if it is not already set.voidPOST(org.apache.jena.rdf.model.Model model) POST a model.voidpostDataset(String file) POST the contents of a file using the filename extension to determine the Content-Type to use if not already set.voidpostDataset(Dataset dataset) POST a datasetvoidPUT the contents of a file using the filename extension to determine the Content-Type to use if it is not already set.voidPUT(org.apache.jena.rdf.model.Model model) PUT a graph.voidputDataset(String file) PUT the contents of a file using the filename extension to determine the Content-Type to use if not already set.voidputDataset(Dataset dataset) PUT a datasetstatic ModelStoreCreate a request to the remote service (without Graph Store Protocol naming).
-
Method Details
-
service
Create a request to the remote service (without Graph Store Protocol naming). CalldefaultModel()ornamedGraph(String)to select the target graph.- Parameters:
service-
-
endpoint
Set the URL of the query endpoint. This replaces any value set in theservice(String)call. -
httpClient
-
httpHeader
Set an HTTP header that is added to the request. Seeaccept(org.apache.jena.riot.Lang),acceptHeader(java.lang.String)andcontentType(RDFFormat). for specific handling ofAccept:andContent-Type. -
namedGraph
Send request for a named graph (that is,?graph=) -
defaultModel
Send request for the default graph (that is,?default) -
defaultGraph
Send request for the default graph (that is,?default) -
acceptHeader
Set the accept header on GET requests. Optional; if not set, a system default is used. -
accept
Set the accept header on GET requests. Optional; if not set, a system default is used. -
contentTypeHeader
Set the Content-type for a POST, PUT request of a file or serialization of a graph of dataset is necessary. Optional; if not set, the file extension is used or the system default RDF syntax encoding. -
contentType
Set the Content-type for a POST, PUT request of a file or serialization of a graph of dataset is necessary. Optional; if not set, the file extension is used or the system default RDF syntax encoding. -
GET
public org.apache.jena.rdf.model.Model GET()Get a graph -
POST
POST the contents of a file using the filename extension to determine the Content-Type to use if it is not already set.This operation does not parse the file.
-
POST
public void POST(org.apache.jena.rdf.model.Model model) POST a model. -
PUT
PUT the contents of a file using the filename extension to determine the Content-Type to use if it is not already set.This operation does not parse the file.
If the data may have quads (named graphs), use
putDataset(String). -
PUT
public void PUT(org.apache.jena.rdf.model.Model model) PUT a graph. -
DELETE
public void DELETE()Delete a graph. -
getDataset
GET dataset.If the remote end is a graph, the result is a dataset with that graph data in the default graph of the dataset.
-
postDataset
POST the contents of a file using the filename extension to determine the Content-Type to use if not already set.This operation does not parse the file.
-
postDataset
POST a dataset -
putDataset
PUT the contents of a file using the filename extension to determine the Content-Type to use if not already set.This operation does not parse the file.
-
putDataset
PUT a dataset -
clearDataset
public void clearDataset()Clear - delete named graphs, empty the default graph - SPARQL "CLEAR ALL"
-