Class GSP


  • public class GSP
    extends java.lang.Object
    Client for the SPARQL 1.1 Graph Store Protocol.

    This is extended to include operations GET, POST and PUT on datasets.

    Examples:

       // Get the default graph.
       Graph graph = GSP.service("http://example/dataset").defaultGraph().GET();
     
       // Get a named graph.
       Graph graph = GSP.service("http://example/dataset").namedGraph("http://my/graph").GET();
     
       // POST (add) to a named graph.
       Graph myData = ...;
       GSP.service("http://example/dataset").namedGraph("http://my/graph").POST(myData);
     
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      GSP accept​(Lang lang)
      Set the accept header on GET requests.
      GSP acceptHeader​(java.lang.String acceptHeader)
      Set the accept header on GET requests.
      void clearDataset()
      Clear - delete named graphs, empty the default graph - SPARQL "CLEAR ALL"
      GSP contentType​(RDFFormat rdfFormat)
      Set the Content-type for a POST, PUT request of a file or serialization of a graph opf dataset is necessary.
      GSP contentTypeHeader​(java.lang.String contentType)
      Set the Content-type for a POST, PUT request of a file or serialization of a graph opf dataset is necessary.
      GSP dataset()
      Send request for the dataset.
      GSP defaultGraph()
      Send request for the default graph (that is, ?default)
      void DELETE()
      Delete a graph.
      GSP endpoint​(java.lang.String serviceURL)
      Set the URL of the query endpoint.
      Graph GET()
      Get a graph
      DatasetGraph getDataset()
      GET dataset.
      GSP graphName​(java.lang.String graphName)
      Send request for a named graph (that is, ?graph=)
      GSP graphName​(Node graphName)
      Send request for a named graph (that is, ?graph=)
      GSP httpClient​(java.net.http.HttpClient httpClient)  
      GSP httpHeader​(java.lang.String headerName, java.lang.String headerValue)
      Set an HTTP header that is added to the request.
      void POST​(java.lang.String file)
      POST the contents of a file using the filename extension to determine the Content-Type to use if it is not already set.
      void POST​(Graph graph)
      POST a graph.
      void postDataset​(java.lang.String file)
      POST the contents of a file using the filename extension to determine the Content-Type to use if not already set.
      void postDataset​(DatasetGraph dataset)
      POST a dataset
      void PUT​(java.lang.String file)
      PUT the contents of a file using the filename extension to determine the Content-Type to use if it is not already set.
      void PUT​(Graph graph)
      PUT a graph.
      void putDataset​(java.lang.String file)
      PUT the contents of a file using the filename extension to determine the Content-Type to use if not already set.
      void putDataset​(DatasetGraph dataset)
      PUT a dataset
      static GSP request()
      Create a request to the remote service (without GSP naming).
      static GSP service​(java.lang.String service)
      Create a request to the remote service (without GSP naming).
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • service

        public static GSP service​(java.lang.String service)
        Create a request to the remote service (without GSP naming). Call defaultGraph() or graphName(String) to select the target graph.
        Parameters:
        service -
      • endpoint

        public GSP endpoint​(java.lang.String serviceURL)
        Set the URL of the query endpoint. This replaces any value set in the service(String) call.
      • httpClient

        public GSP httpClient​(java.net.http.HttpClient httpClient)
      • graphName

        public GSP graphName​(java.lang.String graphName)
        Send request for a named graph (that is, ?graph=)
      • graphName

        public GSP graphName​(Node graphName)
        Send request for a named graph (that is, ?graph=)
      • defaultGraph

        public GSP defaultGraph()
        Send request for the default graph (that is, ?default)
      • dataset

        public GSP dataset()
        Send request for the dataset. This is "no GSP naming".
      • acceptHeader

        public GSP acceptHeader​(java.lang.String acceptHeader)
        Set the accept header on GET requests. Optional; if not set, a system default is used.
      • accept

        public GSP accept​(Lang lang)
        Set the accept header on GET requests. Optional; if not set, a system default is used.
      • contentTypeHeader

        public GSP contentTypeHeader​(java.lang.String contentType)
        Set the Content-type for a POST, PUT request of a file or serialization of a graph opf dataset is necessary. Optional; if not set, the file extension is used or the system default RDF syntax encoding.
      • contentType

        public GSP contentType​(RDFFormat rdfFormat)
        Set the Content-type for a POST, PUT request of a file or serialization of a graph opf dataset is necessary. Optional; if not set, the file extension is used or the system default RDF syntax encoding.
      • GET

        public Graph GET()
        Get a graph
      • POST

        public void POST​(java.lang.String file)
        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​(Graph graph)
        POST a graph.
      • PUT

        public void PUT​(java.lang.String file)
        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​(Graph graph)
        PUT a graph.
      • DELETE

        public void DELETE()
        Delete a graph.
      • getDataset

        public DatasetGraph 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

        public void postDataset​(java.lang.String file)
        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

        public void postDataset​(DatasetGraph dataset)
        POST a dataset
      • putDataset

        public void putDataset​(java.lang.String file)
        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

        public void putDataset​(DatasetGraph dataset)
        PUT a dataset
      • clearDataset

        public void clearDataset()
        Clear - delete named graphs, empty the default graph - SPARQL "CLEAR ALL"