org.eclipse.rdf4j.http.client

## Class RDF4JProtocolSession

- java.lang.Object
- - org.eclipse.rdf4j.http.client.SPARQLProtocolSession
  - - org.eclipse.rdf4j.http.client.RDF4JProtocolSession

- All Implemented Interfaces:
    AutoCloseable, HttpClientDependent
  Direct Known Subclasses:
    SesameSession

      public class RDF4JProtocolSession
      extends SPARQLProtocolSession

  A `SPARQLProtocolSession` subclass which extends the standard SPARQL 1.1 Protocol with additional functionality, as documented in the RDF4J REST API.
  Author:
    Andreas Schwarte, Jeen Broekstra
  See Also:
    RDF4J REST API

- - ### Field Summary

    - ### Fields inherited from class org.eclipse.rdf4j.http.client.SPARQLProtocolSession

      `DEFAULT_MAXIMUM_URL_LENGTH, MAXIMUM_URL_LENGTH, MAXIMUM_URL_LENGTH_PARAM, UTF8`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RDF4JProtocolSession(org.apache.http.client.HttpClient client, ExecutorService executor)`
    `RDF4JProtocolSession(org.apache.http.client.HttpClient client, ScheduledExecutorService executor)` Deprecated. since 3.6.2 - use `RDF4JProtocolSession(HttpClient, ExecutorService)` instead

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addData(InputStream contents, String baseURI, RDFFormat dataFormat, Resource... contexts)`
    `void` | `beginTransaction(IsolationLevel isolationLevel)`
    `void` | `beginTransaction(TransactionSetting... transactionSettings)`
    `protected void` | `checkRepositoryURL()`
    `protected void` | `checkServerURL()`
    `void` | `clearNamespaces()`
    `void` | `close()`
    `void` | `commitTransaction()`
    `void` | `createRepository(RepositoryConfig config)` Create a new repository.
    `void` | `deleteRepository(String repositoryID)`
    `TupleQueryResult` | `getContextIDs()`
    `void` | `getContextIDs(TupleQueryResultHandler handler)`
    `String` | `getNamespace(String prefix)`
    `TupleQueryResult` | `getNamespaces()`
    `void` | `getNamespaces(TupleQueryResultHandler handler)`
    `protected org.apache.http.client.methods.HttpUriRequest` | `getQueryMethod(QueryLanguage ql, String query, String baseURI, Dataset dataset, boolean includeInferred, int maxQueryTime, Binding... bindings)`
    `protected List<org.apache.http.NameValuePair>` | `getQueryMethodParameters(QueryLanguage ql, String query, String baseURI, Dataset dataset, boolean includeInferred, int maxQueryTime, Binding... bindings)`
    `void` | `getRepositoryConfig(StatementCollector statementCollector)` Retrieve configuration of the current repository and send it to the supplied `StatementCollector`
    `TupleQueryResult` | `getRepositoryList()`
    `void` | `getRepositoryList(TupleQueryResultHandler handler)`
    `String` | `getRepositoryURL()`
    `String` | `getServerProtocol()`
    `String` | `getServerURL()`
    `void` | `getStatements(Resource subj, IRI pred, Value obj, boolean includeInferred, RDFHandler handler, Resource... contexts)`
    `protected org.apache.http.client.methods.HttpUriRequest` | `getUpdateMethod(QueryLanguage ql, String update, String baseURI, Dataset dataset, boolean includeInferred, int maxExecutionTime, Binding... bindings)`
    `protected List<org.apache.http.NameValuePair>` | `getUpdateMethodParameters(QueryLanguage ql, String update, String baseURI, Dataset dataset, boolean includeInferred, int maxQueryTime, Binding... bindings)`
    `String` | `getUpdateURL()`
    `void` | `prepareTransaction()`
    `void` | `removeData(InputStream contents, String baseURI, RDFFormat dataFormat, Resource... contexts)`
    `void` | `removeNamespacePrefix(String prefix)`
    `void` | `rollbackTransaction()`
    `void` | `sendTransaction(Iterable<? extends TransactionOperation> txn)` Deprecated. since 2.8.0
    `void` | `setNamespacePrefix(String prefix, String name)`
    `void` | `setRepository(String repositoryURL)`
    `void` | `setServerURL(String serverURL)`
    `void` | `setUsernameAndPassword(String username, String password)` Set the username and password for authentication with the remote server.
    `long` | `size(Resource... contexts)`
    `void` | `updateRepository(RepositoryConfig config)` Update the config of an existing repository.
    `protected void` | `upload(org.apache.http.HttpEntity reqEntity, String baseURI, boolean overwrite, boolean preserveNodeIds, Protocol.Action action, Resource... contexts)`
    `protected void` | `upload(InputStream contents, String baseURI, RDFFormat dataFormat, boolean overwrite, boolean preserveNodeIds, Protocol.Action action, Resource... contexts)`
    `void` | `upload(InputStream contents, String baseURI, RDFFormat dataFormat, boolean overwrite, boolean preserveNodeIds, Resource... contexts)`
    `protected void` | `upload(Reader contents, String baseURI, RDFFormat dataFormat, boolean overwrite, boolean preserveNodeIds, Protocol.Action action, Resource... contexts)`
    `void` | `upload(Reader contents, String baseURI, RDFFormat dataFormat, boolean overwrite, boolean preserveNodeIds, Resource... contexts)`

    - ### Methods inherited from class org.eclipse.rdf4j.http.client.SPARQLProtocolSession

      `execute, executeNoContent, executeOK, getAdditionalHttpHeaders, getBackgroundTupleQueryResult, getBoolean, getConnectionTimeout, getErrorInfo, getHttpClient, getHttpContext, getParserConfig, getPreferredBooleanQueryResultFormat, getPreferredRDFFormat, getPreferredTupleQueryResultFormat, getQueryURL, getRDF, getRDFBackground, getResponseMIMEType, getTupleQueryResult, getUpdateMethod, getUpdateMethodParameters, getValueFactory, isPassThroughEnabled, sendBooleanQuery, sendBooleanQuery, sendGraphQuery, sendGraphQuery, sendGraphQuery, sendGraphQuery, sendTupleQuery, sendTupleQuery, sendTupleQuery, sendUpdate, sendUpdate, setAdditionalHttpHeaders, setConnectionTimeout, setHttpClient, setParserConfig, setPassThroughEnabled, setPreferredBooleanQueryResultFormat, setPreferredRDFFormat, setPreferredTupleQueryResultFormat, setQueryURL, setUpdateURL, setUsernameAndPasswordForUrl, setValueFactory, shouldUsePost`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### RDF4JProtocolSession

          @Deprecated
          public RDF4JProtocolSession(org.apache.http.client.HttpClient client,
                                                  ScheduledExecutorService executor)

      Deprecated. since 3.6.2 - use `RDF4JProtocolSession(HttpClient, ExecutorService)` instead

    - #### RDF4JProtocolSession

          public RDF4JProtocolSession(org.apache.http.client.HttpClient client,
                                      ExecutorService executor)

  - ### Method Detail

    - #### setServerURL

          public void setServerURL(String serverURL)

    - #### getServerURL

          public String getServerURL()

    - #### getRepositoryURL

          public String getRepositoryURL()

    - #### setRepository

          public void setRepository(String repositoryURL)

    - #### checkRepositoryURL

          protected void checkRepositoryURL()

    - #### checkServerURL

          protected void checkServerURL()

    - #### getUpdateURL

          public String getUpdateURL()

      Overrides:
        `getUpdateURL` in class `SPARQLProtocolSession`

    - #### close

          public void close()

      Specified by:
        `close` in interface `AutoCloseable`
      Overrides:
        `close` in class `SPARQLProtocolSession`

    - #### getRepositoryList

          public TupleQueryResult getRepositoryList()
                                             throws IOException,
                                                    RepositoryException,
                                                    UnauthorizedException,
                                                    QueryInterruptedException

      Throws:
        `IOException`
        `RepositoryException`
        `UnauthorizedException`
        `QueryInterruptedException`

    - #### getRepositoryList

          public void getRepositoryList(TupleQueryResultHandler handler)
                                 throws IOException,
                                        TupleQueryResultHandlerException,
                                        RepositoryException,
                                        UnauthorizedException,
                                        QueryInterruptedException

      Throws:
        `IOException`
        `TupleQueryResultHandlerException`
        `RepositoryException`
        `UnauthorizedException`
        `QueryInterruptedException`

    - #### getServerProtocol

          public String getServerProtocol()
                                   throws IOException,
                                          RepositoryException,
                                          UnauthorizedException

      Throws:
        `IOException`
        `RepositoryException`
        `UnauthorizedException`

    - #### size

          public long size(Resource... contexts)
                    throws IOException,
                           RepositoryException,
                           UnauthorizedException

      Throws:
        `IOException`
        `RepositoryException`
        `UnauthorizedException`

    - #### createRepository

          public void createRepository(RepositoryConfig config)
                                throws IOException,
                                       RepositoryException

      Create a new repository.
      Parameters:
        `config` - the repository configuration
      Throws:
        `IOException`
        `RepositoryException`

    - #### updateRepository

          public void updateRepository(RepositoryConfig config)
                                throws IOException,
                                       RepositoryException

      Update the config of an existing repository.
      Parameters:
        `config` - the repository configuration
      Throws:
        `IOException`
        `RepositoryException`

    - #### deleteRepository

          public void deleteRepository(String repositoryID)
                                throws IOException,
                                       RepositoryException

      Throws:
        `IOException`
        `RepositoryException`

    - #### getRepositoryConfig

          public void getRepositoryConfig(StatementCollector statementCollector)
                                   throws UnauthorizedException,
                                          QueryInterruptedException,
                                          RDFHandlerException,
                                          RepositoryException,
                                          IOException

      Retrieve configuration of the current repository and send it to the supplied `StatementCollector`
      Parameters:
        `statementCollector` - receiver of the repository config information
      Throws:
        `IOException`
        `RepositoryException`
        `RDFHandlerException`
        `QueryInterruptedException`
        `UnauthorizedException`
      Since:
        3.1.0

    - #### getNamespaces

          public TupleQueryResult getNamespaces()
                                         throws IOException,
                                                RepositoryException,
                                                UnauthorizedException,
                                                QueryInterruptedException

      Throws:
        `IOException`
        `RepositoryException`
        `UnauthorizedException`
        `QueryInterruptedException`

    - #### getNamespaces

          public void getNamespaces(TupleQueryResultHandler handler)
                             throws IOException,
                                    TupleQueryResultHandlerException,
                                    RepositoryException,
                                    UnauthorizedException,
                                    QueryInterruptedException

      Throws:
        `IOException`
        `TupleQueryResultHandlerException`
        `RepositoryException`
        `UnauthorizedException`
        `QueryInterruptedException`

    - #### getNamespace

          public String getNamespace(String prefix)
                              throws IOException,
                                     RepositoryException,
                                     UnauthorizedException

      Throws:
        `IOException`
        `RepositoryException`
        `UnauthorizedException`

    - #### setNamespacePrefix

          public void setNamespacePrefix(String prefix,
                                         String name)
                                  throws IOException,
                                         RepositoryException,
                                         UnauthorizedException

      Throws:
        `IOException`
        `RepositoryException`
        `UnauthorizedException`

    - #### removeNamespacePrefix

          public void removeNamespacePrefix(String prefix)
                                     throws IOException,
                                            RepositoryException,
                                            UnauthorizedException

      Throws:
        `IOException`
        `RepositoryException`
        `UnauthorizedException`

    - #### clearNamespaces

          public void clearNamespaces()
                               throws IOException,
                                      RepositoryException,
                                      UnauthorizedException

      Throws:
        `IOException`
        `RepositoryException`
        `UnauthorizedException`

    - #### getContextIDs

          public TupleQueryResult getContextIDs()
                                         throws IOException,
                                                RepositoryException,
                                                UnauthorizedException,
                                                QueryInterruptedException

      Throws:
        `IOException`
        `RepositoryException`
        `UnauthorizedException`
        `QueryInterruptedException`

    - #### getContextIDs

          public void getContextIDs(TupleQueryResultHandler handler)
                             throws IOException,
                                    TupleQueryResultHandlerException,
                                    RepositoryException,
                                    UnauthorizedException,
                                    QueryInterruptedException

      Throws:
        `IOException`
        `TupleQueryResultHandlerException`
        `RepositoryException`
        `UnauthorizedException`
        `QueryInterruptedException`

    - #### getStatements

          public void getStatements(Resource subj,
                                    IRI pred,
                                    Value obj,
                                    boolean includeInferred,
                                    RDFHandler handler,
                                    Resource... contexts)
                             throws IOException,
                                    RDFHandlerException,
                                    RepositoryException,
                                    UnauthorizedException,
                                    QueryInterruptedException

      Throws:
        `IOException`
        `RDFHandlerException`
        `RepositoryException`
        `UnauthorizedException`
        `QueryInterruptedException`

    - #### beginTransaction

          public void beginTransaction(IsolationLevel isolationLevel)
                                throws RDF4JException,
                                       IOException,
                                       UnauthorizedException

      Throws:
        `RDF4JException`
        `IOException`
        `UnauthorizedException`

    - #### beginTransaction

          public void beginTransaction(TransactionSetting... transactionSettings)
                                throws RDF4JException,
                                       IOException,
                                       UnauthorizedException

      Throws:
        `RDF4JException`
        `IOException`
        `UnauthorizedException`

    - #### prepareTransaction

          public void prepareTransaction()
                                  throws RDF4JException,
                                         IOException,
                                         UnauthorizedException

      Throws:
        `RDF4JException`
        `IOException`
        `UnauthorizedException`

    - #### commitTransaction

          public void commitTransaction()
                                 throws RDF4JException,
                                        IOException,
                                        UnauthorizedException

      Throws:
        `RDF4JException`
        `IOException`
        `UnauthorizedException`

    - #### rollbackTransaction

          public void rollbackTransaction()
                                   throws RDF4JException,
                                          IOException,
                                          UnauthorizedException

      Throws:
        `RDF4JException`
        `IOException`
        `UnauthorizedException`

    - #### sendTransaction

          @Deprecated
          public void sendTransaction(Iterable<? extends TransactionOperation> txn)
                                           throws IOException,
                                                  RepositoryException,
                                                  UnauthorizedException

      Deprecated. since 2.8.0
      Sends a transaction list as serialized XML to the server.
      Parameters:
        `txn` -
      Throws:
        `IOException`
        `RepositoryException`
        `UnauthorizedException`

    - #### addData

          public void addData(InputStream contents,
                              String baseURI,
                              RDFFormat dataFormat,
                              Resource... contexts)
                       throws UnauthorizedException,
                              RDFParseException,
                              RepositoryException,
                              IOException

      Throws:
        `UnauthorizedException`
        `RDFParseException`
        `RepositoryException`
        `IOException`

    - #### removeData

          public void removeData(InputStream contents,
                                 String baseURI,
                                 RDFFormat dataFormat,
                                 Resource... contexts)
                          throws UnauthorizedException,
                                 RDFParseException,
                                 RepositoryException,
                                 IOException

      Throws:
        `UnauthorizedException`
        `RDFParseException`
        `RepositoryException`
        `IOException`

    - #### upload

          public void upload(InputStream contents,
                             String baseURI,
                             RDFFormat dataFormat,
                             boolean overwrite,
                             boolean preserveNodeIds,
                             Resource... contexts)
                      throws IOException,
                             RDFParseException,
                             RepositoryException,
                             UnauthorizedException

      Throws:
        `IOException`
        `RDFParseException`
        `RepositoryException`
        `UnauthorizedException`

    - #### upload

          protected void upload(InputStream contents,
                                String baseURI,
                                RDFFormat dataFormat,
                                boolean overwrite,
                                boolean preserveNodeIds,
                                Protocol.Action action,
                                Resource... contexts)
                         throws IOException,
                                RDFParseException,
                                RepositoryException,
                                UnauthorizedException

      Throws:
        `IOException`
        `RDFParseException`
        `RepositoryException`
        `UnauthorizedException`

    - #### upload

          public void upload(Reader contents,
                             String baseURI,
                             RDFFormat dataFormat,
                             boolean overwrite,
                             boolean preserveNodeIds,
                             Resource... contexts)
                      throws UnauthorizedException,
                             RDFParseException,
                             RepositoryException,
                             IOException

      Throws:
        `UnauthorizedException`
        `RDFParseException`
        `RepositoryException`
        `IOException`

    - #### getQueryMethod

          protected org.apache.http.client.methods.HttpUriRequest getQueryMethod(QueryLanguage ql,
                                                                                 String query,
                                                                                 String baseURI,
                                                                                 Dataset dataset,
                                                                                 boolean includeInferred,
                                                                                 int maxQueryTime,
                                                                                 Binding... bindings)

      Overrides:
        `getQueryMethod` in class `SPARQLProtocolSession`

    - #### getUpdateMethod

          protected org.apache.http.client.methods.HttpUriRequest getUpdateMethod(QueryLanguage ql,
                                                                                  String update,
                                                                                  String baseURI,
                                                                                  Dataset dataset,
                                                                                  boolean includeInferred,
                                                                                  int maxExecutionTime,
                                                                                  Binding... bindings)

      Overrides:
        `getUpdateMethod` in class `SPARQLProtocolSession`

    - #### upload

          protected void upload(Reader contents,
                                String baseURI,
                                RDFFormat dataFormat,
                                boolean overwrite,
                                boolean preserveNodeIds,
                                Protocol.Action action,
                                Resource... contexts)
                         throws IOException,
                                RDFParseException,
                                RepositoryException,
                                UnauthorizedException

      Throws:
        `IOException`
        `RDFParseException`
        `RepositoryException`
        `UnauthorizedException`

    - #### upload

          protected void upload(org.apache.http.HttpEntity reqEntity,
                                String baseURI,
                                boolean overwrite,
                                boolean preserveNodeIds,
                                Protocol.Action action,
                                Resource... contexts)
                         throws IOException,
                                RDFParseException,
                                RepositoryException,
                                UnauthorizedException

      Throws:
        `IOException`
        `RDFParseException`
        `RepositoryException`
        `UnauthorizedException`

    - #### setUsernameAndPassword

          public void setUsernameAndPassword(String username,
                                             String password)

      Description copied from class: `SPARQLProtocolSession`
      Set the username and password for authentication with the remote server.
      Overrides:
        `setUsernameAndPassword` in class `SPARQLProtocolSession`
      Parameters:
        `username` - the username
        `password` - the password

    - #### getQueryMethodParameters

          protected List<org.apache.http.NameValuePair> getQueryMethodParameters(QueryLanguage ql,
                                                                                 String query,
                                                                                 String baseURI,
                                                                                 Dataset dataset,
                                                                                 boolean includeInferred,
                                                                                 int maxQueryTime,
                                                                                 Binding... bindings)

      Overrides:
        `getQueryMethodParameters` in class `SPARQLProtocolSession`

    - #### getUpdateMethodParameters

          protected List<org.apache.http.NameValuePair> getUpdateMethodParameters(QueryLanguage ql,
                                                                                  String update,
                                                                                  String baseURI,
                                                                                  Dataset dataset,
                                                                                  boolean includeInferred,
                                                                                  int maxQueryTime,
                                                                                  Binding... bindings)

      Overrides:
        `getUpdateMethodParameters` in class `SPARQLProtocolSession`

Copyright © 2015-2021 Eclipse Foundation. All Rights Reserved.