Class Protocol


  • public abstract class Protocol
    extends java.lang.Object
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Protocol.Action
      Defines the action a particular transaction update is executing.
      static class  Protocol.TIMEOUT
      Deprecated.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ACCEPT_PARAM_NAME
      Parameter name for the Accept parameter (may also be used as the name of the Accept HTTP header).
      static java.lang.String ACTION_PARAM_NAME
      Parameter name for the action parameter used in transactions.
      static java.lang.String BASEURI_PARAM_NAME
      Parameter name for the base-URI parameter.
      static java.lang.String BINDING_PREFIX
      Parameter prefix for query-external variable bindings.
      static java.lang.String CACHE_TIMEOUT_PROPERTY
      Configurable system property rdf4j.server.txn.registry.timeout for specifying the transaction cache timeout (in seconds).
      static java.lang.String CONFIG
      Relative location of the config resource.
      static java.lang.String CONTEXT_PARAM_NAME
      Parameter name for the context parameter.
      static java.lang.String CONTEXTS
      Relative location of the context list resource of a repository.
      static java.lang.String DEFAULT_GRAPH_PARAM_NAME
      Parameter name for the default graph URI parameter.
      static int DEFAULT_TIMEOUT
      Default timeout setting for transaction cache entries (in seconds).
      static java.lang.String DISTINCT_PARAM_NAME
      Parameter name for the distinct parameter.
      static java.lang.String FORM_MIME_TYPE
      MIME type for www forms: application/x-www-form-urlencoded.
      static java.lang.String GRAPH_PARAM_NAME
      Parameter name for the graph parameter.
      static java.lang.String INCLUDE_INFERRED_PARAM_NAME
      Parameter name for the 'includeInferred' parameter.
      static java.lang.String INSERT_GRAPH_PARAM_NAME
      Parameter name for the default insert graph URI parameter.
      static java.lang.String ISOLATION_LEVEL_PARAM_NAME
      Deprecated.
      Use transaction-setting__isolation-level instead.
      static java.lang.String LIMIT_PARAM_NAME  
      static java.lang.String NAMED_GRAPH_PARAM_NAME
      Parameter name for the named graph URI parameter.
      static java.lang.String NAMESPACES
      Relative location of the namespaces list resource of a repository.
      static java.lang.String NULL_PARAM_VALUE
      Parameter value for the NULL context.
      static java.lang.String OBJECT_PARAM_NAME
      Parameter name for the 'object' parameter of statement query.
      static java.lang.String OFFSET_PARAM_NAME  
      static java.lang.String PREDICATE_PARAM_NAME
      Parameter name for the 'predicate' parameter of a statement query.
      static java.lang.String PRESERVE_BNODE_ID_PARAM_NAME
      Parameter for server instruction to preserve blank node ids when parsing request data.
      static java.lang.String PROTOCOL
      Relative location of the protocol resource.
      static java.lang.String QUERY_LANGUAGE_PARAM_NAME
      Parameter name for the query language parameter.
      static java.lang.String QUERY_PARAM_NAME
      Parameter name for the query parameter.
      static java.lang.String REMOVE_GRAPH_PARAM_NAME
      Parameter name for the default remove graph URI parameter.
      static java.lang.String REPOSITORIES
      Relative location of the repository list resource.
      static java.lang.String SIZE
      Relative location of the 'size' resource of a repository.
      static java.lang.String SPARQL_QUERY_MIME_TYPE
      MIME type for SPARQL update: application/sparql-query.
      static java.lang.String SPARQL_UPDATE_MIME_TYPE
      MIME type for SPARQL update: application/sparql-update.
      static java.lang.String STATEMENTS
      Relative location of the statement list resource of a repository.
      static java.lang.String SUBJECT_PARAM_NAME
      Parameter name for the 'subject' parameter of a statement query.
      static java.lang.String TIMEOUT_PARAM_NAME  
      static java.lang.String TRANSACTION_SETTINGS_PREFIX
      Prefix for transaction settings in the query param
      static java.lang.String TRANSACTIONS
      Relative location of the transaction resources of a repository.
      static java.lang.String TXN_MIME_TYPE
      MIME type for transactions: application/x-rdftransaction.
      static java.lang.String UPDATE_PARAM_NAME
      Parameter name for the update parameter.
      static java.lang.String USING_GRAPH_PARAM_NAME
      Parameter name for the default graph URI parameter for update.
      static java.lang.String USING_NAMED_GRAPH_PARAM_NAME
      Parameter name for the named graph URI parameter for update.
      static java.lang.String VERSION
      Protocol version.
    • Constructor Summary

      Constructors 
      Constructor Description
      Protocol()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Resource decodeContext​(java.lang.String encodedValue, ValueFactory valueFactory)
      Decode a previously encoded context Resource.
      static Resource[] decodeContexts​(java.lang.String[] encodedValues, ValueFactory valueFactory)
      Decode previously encoded contexts.
      static Resource decodeResource​(java.lang.String encodedValue, ValueFactory valueFactory)
      Decode a previously encoded Resource.
      static IRI decodeURI​(java.lang.String encodedValue, ValueFactory valueFactory)
      Decode a previously encoded URI.
      static Value decodeValue​(java.lang.String encodedValue, ValueFactory valueFactory)
      Decode a previously encoded value.
      static java.lang.String encodeContext​(Resource context)
      Encodes a context resource for use in a URL.
      static java.lang.String[] encodeContexts​(Resource... contexts)
      Encode context resources for use in a URL.
      static java.lang.String encodeValue​(Value value)
      Encodes a value in a canonical serialized string format, for use in a URL query parameter.
      static java.lang.String getConfigLocation​(java.lang.String serverLocation)
      Get the location of the server configuration resource on the specified server.
      static java.lang.String getContextsLocation​(java.lang.String repositoryLocation)
      Get the location of the contexts lists resource for a specific repository.
      static java.lang.String getNamespacePrefixLocation​(java.lang.String repositoryLocation, java.lang.String prefix)
      Get the location of the namespace with the specified prefix for a specific repository on the specified server.
      static java.lang.String getNamespacesLocation​(java.lang.String repositoryLocation)
      Get the location of the namespaces lists resource for a specific repository on the specified server.
      static java.lang.String getProtocolLocation​(java.lang.String serverLocation)
      Get the location of the protocol resource on the specified server.
      static java.lang.String getRepositoriesLocation​(java.lang.String serverLocation)
      Get the location of the repository list resource on the specified server.
      static java.lang.String getRepositoryConfigLocation​(java.lang.String repositoryLocation)
      Get the location of the config of a specific repository resource.
      static java.lang.String getRepositoryID​(java.lang.String repositoryLocation)
      Extracts the repository ID from the repository location.
      static java.lang.String getRepositoryLocation​(java.lang.String serverLocation, java.lang.String repositoryID)
      Get the location of a specific repository resource on the specified server.
      private static java.lang.String getServerDir​(java.lang.String serverLocation)  
      static java.lang.String getServerLocation​(java.lang.String repositoryLocation)
      Extracts the server location from the repository location.
      static java.lang.String getSizeLocation​(java.lang.String repositoryLocation)
      Get the location of the 'size' resource for a specific repository on the specified server.
      static java.lang.String getStatementsLocation​(java.lang.String repositoryLocation)
      Get the location of the statements resource for a specific repository.
      static java.lang.String getTransactionsLocation​(java.lang.String repositoryLocation)
      Get the location of the transaction resources for a specific repository.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • CACHE_TIMEOUT_PROPERTY

        public static final java.lang.String CACHE_TIMEOUT_PROPERTY
        Configurable system property rdf4j.server.txn.registry.timeout for specifying the transaction cache timeout (in seconds).
        See Also:
        Constant Field Values
      • DEFAULT_TIMEOUT

        public static final int DEFAULT_TIMEOUT
        Default timeout setting for transaction cache entries (in seconds).
        See Also:
        Constant Field Values
      • VERSION

        public static final java.lang.String VERSION
        Protocol version.
        • 12: since RDF4J 3.5.0
        • 11: since RDF4J 3.3.0
        • 10: since RDF4J 3.1.0
        • 9: since RDF4J 3.0.0
        See Also:
        Constant Field Values
      • SUBJECT_PARAM_NAME

        public static final java.lang.String SUBJECT_PARAM_NAME
        Parameter name for the 'subject' parameter of a statement query.
        See Also:
        Constant Field Values
      • PREDICATE_PARAM_NAME

        public static final java.lang.String PREDICATE_PARAM_NAME
        Parameter name for the 'predicate' parameter of a statement query.
        See Also:
        Constant Field Values
      • OBJECT_PARAM_NAME

        public static final java.lang.String OBJECT_PARAM_NAME
        Parameter name for the 'object' parameter of statement query.
        See Also:
        Constant Field Values
      • INCLUDE_INFERRED_PARAM_NAME

        public static final java.lang.String INCLUDE_INFERRED_PARAM_NAME
        Parameter name for the 'includeInferred' parameter.
        See Also:
        Constant Field Values
      • CONTEXT_PARAM_NAME

        public static final java.lang.String CONTEXT_PARAM_NAME
        Parameter name for the context parameter.
        See Also:
        Constant Field Values
      • NULL_PARAM_VALUE

        public static final java.lang.String NULL_PARAM_VALUE
        Parameter value for the NULL context.
        See Also:
        Constant Field Values
      • GRAPH_PARAM_NAME

        public static final java.lang.String GRAPH_PARAM_NAME
        Parameter name for the graph parameter.
        See Also:
        Constant Field Values
      • UPDATE_PARAM_NAME

        public static final java.lang.String UPDATE_PARAM_NAME
        Parameter name for the update parameter.
        See Also:
        Constant Field Values
      • BASEURI_PARAM_NAME

        public static final java.lang.String BASEURI_PARAM_NAME
        Parameter name for the base-URI parameter.
        See Also:
        Constant Field Values
      • QUERY_PARAM_NAME

        public static final java.lang.String QUERY_PARAM_NAME
        Parameter name for the query parameter.
        See Also:
        Constant Field Values
      • LIMIT_PARAM_NAME

        public static final java.lang.String LIMIT_PARAM_NAME
        See Also:
        Constant Field Values
      • OFFSET_PARAM_NAME

        public static final java.lang.String OFFSET_PARAM_NAME
        See Also:
        Constant Field Values
      • QUERY_LANGUAGE_PARAM_NAME

        public static final java.lang.String QUERY_LANGUAGE_PARAM_NAME
        Parameter name for the query language parameter.
        See Also:
        Constant Field Values
      • TIMEOUT_PARAM_NAME

        public static final java.lang.String TIMEOUT_PARAM_NAME
        See Also:
        Constant Field Values
      • REMOVE_GRAPH_PARAM_NAME

        public static final java.lang.String REMOVE_GRAPH_PARAM_NAME
        Parameter name for the default remove graph URI parameter.
        See Also:
        Constant Field Values
      • INSERT_GRAPH_PARAM_NAME

        public static final java.lang.String INSERT_GRAPH_PARAM_NAME
        Parameter name for the default insert graph URI parameter.
        See Also:
        Constant Field Values
      • USING_GRAPH_PARAM_NAME

        public static final java.lang.String USING_GRAPH_PARAM_NAME
        Parameter name for the default graph URI parameter for update.
        See Also:
        Constant Field Values
      • USING_NAMED_GRAPH_PARAM_NAME

        public static final java.lang.String USING_NAMED_GRAPH_PARAM_NAME
        Parameter name for the named graph URI parameter for update.
        See Also:
        Constant Field Values
      • DEFAULT_GRAPH_PARAM_NAME

        public static final java.lang.String DEFAULT_GRAPH_PARAM_NAME
        Parameter name for the default graph URI parameter.
        See Also:
        Constant Field Values
      • NAMED_GRAPH_PARAM_NAME

        public static final java.lang.String NAMED_GRAPH_PARAM_NAME
        Parameter name for the named graph URI parameter.
        See Also:
        Constant Field Values
      • ACCEPT_PARAM_NAME

        public static final java.lang.String ACCEPT_PARAM_NAME
        Parameter name for the Accept parameter (may also be used as the name of the Accept HTTP header).
        See Also:
        Constant Field Values
      • ISOLATION_LEVEL_PARAM_NAME

        @Deprecated(since="3.3.0")
        public static final java.lang.String ISOLATION_LEVEL_PARAM_NAME
        Deprecated.
        Use transaction-setting__isolation-level instead.
        Parameter name for the isolation level used in transactions.
        See Also:
        TRANSACTION_SETTINGS_PREFIX, Constant Field Values
      • TRANSACTION_SETTINGS_PREFIX

        public static final java.lang.String TRANSACTION_SETTINGS_PREFIX
        Prefix for transaction settings in the query param
        Since:
        3.3.0
        See Also:
        Constant Field Values
      • ACTION_PARAM_NAME

        public static final java.lang.String ACTION_PARAM_NAME
        Parameter name for the action parameter used in transactions.
        See Also:
        Constant Field Values
      • DISTINCT_PARAM_NAME

        public static final java.lang.String DISTINCT_PARAM_NAME
        Parameter name for the distinct parameter.
        See Also:
        Constant Field Values
      • PROTOCOL

        public static final java.lang.String PROTOCOL
        Relative location of the protocol resource.
        See Also:
        Constant Field Values
      • CONFIG

        public static final java.lang.String CONFIG
        Relative location of the config resource.
        See Also:
        Constant Field Values
      • REPOSITORIES

        public static final java.lang.String REPOSITORIES
        Relative location of the repository list resource.
        See Also:
        Constant Field Values
      • STATEMENTS

        public static final java.lang.String STATEMENTS
        Relative location of the statement list resource of a repository.
        See Also:
        Constant Field Values
      • TRANSACTIONS

        public static final java.lang.String TRANSACTIONS
        Relative location of the transaction resources of a repository.
        See Also:
        Constant Field Values
      • CONTEXTS

        public static final java.lang.String CONTEXTS
        Relative location of the context list resource of a repository.
        See Also:
        Constant Field Values
      • NAMESPACES

        public static final java.lang.String NAMESPACES
        Relative location of the namespaces list resource of a repository.
        See Also:
        Constant Field Values
      • BINDING_PREFIX

        public static final java.lang.String BINDING_PREFIX
        Parameter prefix for query-external variable bindings.
        See Also:
        Constant Field Values
      • SIZE

        public static final java.lang.String SIZE
        Relative location of the 'size' resource of a repository.
        See Also:
        Constant Field Values
      • TXN_MIME_TYPE

        public static final java.lang.String TXN_MIME_TYPE
        MIME type for transactions: application/x-rdftransaction.
        See Also:
        Constant Field Values
      • FORM_MIME_TYPE

        public static final java.lang.String FORM_MIME_TYPE
        MIME type for www forms: application/x-www-form-urlencoded.
        See Also:
        Constant Field Values
      • SPARQL_QUERY_MIME_TYPE

        public static final java.lang.String SPARQL_QUERY_MIME_TYPE
        MIME type for SPARQL update: application/sparql-query.
        See Also:
        Constant Field Values
      • SPARQL_UPDATE_MIME_TYPE

        public static final java.lang.String SPARQL_UPDATE_MIME_TYPE
        MIME type for SPARQL update: application/sparql-update.
        See Also:
        Constant Field Values
      • PRESERVE_BNODE_ID_PARAM_NAME

        public static final java.lang.String PRESERVE_BNODE_ID_PARAM_NAME
        Parameter for server instruction to preserve blank node ids when parsing request data.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Protocol

        public Protocol()
    • Method Detail

      • getServerDir

        private static java.lang.String getServerDir​(java.lang.String serverLocation)
      • getProtocolLocation

        public static final java.lang.String getProtocolLocation​(java.lang.String serverLocation)
        Get the location of the protocol resource on the specified server.
        Parameters:
        serverLocation - the base location of a server implementing this REST protocol.
        Returns:
        the location of the protocol resource on the specified server
      • getConfigLocation

        public static final java.lang.String getConfigLocation​(java.lang.String serverLocation)
        Get the location of the server configuration resource on the specified server.
        Parameters:
        serverLocation - the base location of a server implementing this REST protocol.
        Returns:
        the location of the server configuration resource on the specified server
      • getRepositoriesLocation

        public static final java.lang.String getRepositoriesLocation​(java.lang.String serverLocation)
        Get the location of the repository list resource on the specified server.
        Parameters:
        serverLocation - the base location of a server implementing this REST protocol.
        Returns:
        the location of the repository list resource on the specified server
      • getRepositoryLocation

        public static final java.lang.String getRepositoryLocation​(java.lang.String serverLocation,
                                                                   java.lang.String repositoryID)
        Get the location of a specific repository resource on the specified server.
        Parameters:
        serverLocation - the base location of a server implementing this REST protocol.
        repositoryID - the ID of the repository
        Returns:
        the location of a specific repository resource on the specified server
      • getRepositoryConfigLocation

        public static final java.lang.String getRepositoryConfigLocation​(java.lang.String repositoryLocation)
        Get the location of the config of a specific repository resource.
        Parameters:
        repositoryLocation - the location of a repository implementing this REST protocol.
        Returns:
        the location of the configuration resource for the specified repository
      • getStatementsLocation

        public static final java.lang.String getStatementsLocation​(java.lang.String repositoryLocation)
        Get the location of the statements resource for a specific repository.
        Parameters:
        repositoryLocation - the location of a repository implementing this REST protocol.
        Returns:
        the location of the statements resource for the specified repository
      • getTransactionsLocation

        public static final java.lang.String getTransactionsLocation​(java.lang.String repositoryLocation)
        Get the location of the transaction resources for a specific repository.
        Parameters:
        repositoryLocation - the location of a repository implementing this REST protocol.
        Returns:
        the location of the transaction resources for the specified repository
      • getServerLocation

        public static final java.lang.String getServerLocation​(java.lang.String repositoryLocation)
        Extracts the server location from the repository location.
        Parameters:
        repositoryLocation - the location of a repository implementing this REST protocol.
        Returns:
        the location of the server resource for the specified repository.
      • getRepositoryID

        public static final java.lang.String getRepositoryID​(java.lang.String repositoryLocation)
        Extracts the repository ID from the repository location.
        Parameters:
        repositoryLocation - the location of a repository implementing this REST protocol.
        Returns:
        the ID of the repository.
      • getContextsLocation

        public static final java.lang.String getContextsLocation​(java.lang.String repositoryLocation)
        Get the location of the contexts lists resource for a specific repository.
        Parameters:
        repositoryLocation - the location of a repository implementing this REST protocol.
        Returns:
        the location of the contexts lists resource for the specified repository
      • getNamespacesLocation

        public static final java.lang.String getNamespacesLocation​(java.lang.String repositoryLocation)
        Get the location of the namespaces lists resource for a specific repository on the specified server.
        Parameters:
        repositoryLocation - the base location of a server implementing this REST protocol.
        Returns:
        the location of the namespaces lists resource for a specific repository on the specified server
      • getNamespacePrefixLocation

        public static final java.lang.String getNamespacePrefixLocation​(java.lang.String repositoryLocation,
                                                                        java.lang.String prefix)
        Get the location of the namespace with the specified prefix for a specific repository on the specified server.
        Parameters:
        repositoryLocation - the location of a repository implementing this REST protocol.
        prefix - the namespace prefix
        Returns:
        the location of the the namespace with the specified prefix for a specific repository on the specified server
      • getSizeLocation

        public static final java.lang.String getSizeLocation​(java.lang.String repositoryLocation)
        Get the location of the 'size' resource for a specific repository on the specified server.
        Parameters:
        repositoryLocation - the location of a repository implementing this REST protocol.
        Returns:
        the location of the 'size' resource for a specific repository on the specified server
      • encodeValue

        public static java.lang.String encodeValue​(Value value)
        Encodes a value in a canonical serialized string format, for use in a URL query parameter.
        Parameters:
        value - The value to encode, possibly null.
        Returns:
        The protocol-serialized representation of the supplied value, or NULL_PARAM_VALUE if the supplied value was null.
      • decodeValue

        public static Value decodeValue​(java.lang.String encodedValue,
                                        ValueFactory valueFactory)
        Decode a previously encoded value.
        Parameters:
        encodedValue - the encoded value
        valueFactory - the factory to use for constructing the Value
        Returns:
        the decoded Value
        See Also:
        encodeValue(Value)
      • decodeResource

        public static Resource decodeResource​(java.lang.String encodedValue,
                                              ValueFactory valueFactory)
        Decode a previously encoded Resource.
        Parameters:
        encodedValue - the encoded value
        valueFactory - the factory to use for constructing the Resource
        Returns:
        the decoded Resource
        See Also:
        encodeValue(Value)
      • decodeURI

        public static IRI decodeURI​(java.lang.String encodedValue,
                                    ValueFactory valueFactory)
        Decode a previously encoded URI.
        Parameters:
        encodedValue - the encoded value
        valueFactory - the factory to use for constructing the URI
        Returns:
        the decoded URI
        See Also:
        encodeValue(Value)
      • encodeContext

        public static java.lang.String encodeContext​(Resource context)
        Encodes a context resource for use in a URL.
        Parameters:
        context - The context to encode, possibly null.
        Returns:
        The protocol-serialized representation of the supplied context, or NULL_PARAM_VALUE if the supplied value was null.
      • decodeContext

        public static Resource decodeContext​(java.lang.String encodedValue,
                                             ValueFactory valueFactory)
        Decode a previously encoded context Resource.
        Parameters:
        encodedValue - the encoded value
        valueFactory - the factory to use for constructing the Resource
        Returns:
        the decoded Resource, or null if the encoded values was null or equal to NULL_PARAM_VALUE
      • encodeContexts

        public static java.lang.String[] encodeContexts​(Resource... contexts)
        Encode context resources for use in a URL.
        Parameters:
        contexts - the contexts to encode, must not be null.
        Returns:
        the encoded contexts
        Throws:
        java.lang.IllegalArgumentException - If the contexts is null.
      • decodeContexts

        public static Resource[] decodeContexts​(java.lang.String[] encodedValues,
                                                ValueFactory valueFactory)
        Decode previously encoded contexts.
        Parameters:
        encodedValues - the encoded values
        valueFactory - the factory to use for constructing the Resources
        Returns:
        the decoded Resources, or an empty array if the supplied encodedValues was null.