Query Service#

Changed in version 2.0.

ESS provides a Query service that allows a Pod Owner (or other agents with Control access to the Pod) to query RDF (Resource Description Framework) data in the Pod. Specifically, the ESS Query service provides a Quad Pattern Fragment (QPF) interface that the Pod Owner (or other agents with Control access to the Pod) can use to query RDF data.

See also:

QPF Query Service#

ESS Query service has the following QPF endpoint:

https://fragments.{ESS DOMAIN}/qpf

Query Parameters#

To query a Pod using QPF, you can specify the following query parameters to the service as part of a GET operation:

?storage={POD}&subject={SUBJECT}&predicate={PREDICATE}&object={OBJECT}&graph={GRAPH}

Tip

The Query service includes the Hypermedia Control as part of every result set. You can issue a GET to the service with only the storage parameter set (i.e., omit the data matching pattern parameters) to return just the Hypermedia Control.

The Hypermedia Control provides the supported query template and mapping of the QPF quad pattern selector parameters for querying data.

The table of parameters is provided below to complement the returned Hypermedia Control information. However, Hypermedia Control acts as the definitive source.

Parameter

Description

storage

Required. URL of the Pod to query.

URL-encode the value.

If the storage parameter is omitted, ESS Query service returns a 400 Bad Request.

Note

  • storage is an ESS-specific parameter.

  • The querying agent must be either the Pod Owner or another agent with Control access to the Pod.

subject

The subject to match, as defined in the QPF quad pattern selector.

Triples with blank node values will be normalized into statements with URIs.

URL-encode the value.

predicate

The predicate to match, as defined in the QPF quad pattern selector.

URL-encode the value.

object

The object to match, as defined in the QPF quad pattern selector.

URL-encode the value.

graph

The graph (the URL of the Resource) to match, as defined in the QPF quad pattern selector.

URL-encode the value.

Query Response#

Important

The query results may lag behind the current state of the Resource. For more details, see Query Service Indexer.

The response includes:

For example:

@prefix foaf:  <http://xmlns.com/foaf/0.1/> .
@prefix hydra: <http://www.w3.org/ns/hydra/core#> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix sd:    <http://www.w3.org/ns/sparql-service-description#> .
@prefix void:  <http://rdfs.org/ns/void#> .

_:b0 {
    <https://fragments.example.com/qpf?storage=https%3A%2F%2Fstorage.example.com%2Fa211ad26-zzzz-9999-8b20-acb3aed0e369%2F>
         void:subset   <https://fragments.example.com/qpf?storage=https%3A%2F%2Fstorage.example.com%2Fa211ad26-zzzz-9999-8b20-acb3aed0e369%2F&object=https%3A%2F%2Fwww.w3.org%2Fns%2Factivitystreams%23Article> ;
         hydra:search  [ hydra:mapping   [ hydra:property  sd:graph ;
                                           hydra:variable  "graph"
                                         ] ;
                         hydra:mapping   [ hydra:property  rdf:subject ;
                                           hydra:variable  "subject"
                                         ] ;
                         hydra:mapping   [ hydra:property  rdf:predicate ;
                                           hydra:variable  "predicate"
                                         ] ;
                         hydra:mapping   [ hydra:property  rdf:object ;
                                           hydra:variable  "object"
                                         ] ;
                         hydra:template  "https://fragments.example.com/qpf?storage=https%3A%2F%2Fstorage.example.com%2Fa211ad26-zzzz-9999-8b20-acb3aed0e369%2F{&graph,subject,predicate,object}"
                       ] .

    _:b0    foaf:primaryTopic  <https://fragments.example.com/qpf?storage=https%3A%2F%2Fstorage.example.com%2Fa211ad26-zzzz-9999-8b20-acb3aed0e369%2F&object=https%3A%2F%2Fwww.w3.org%2Fns%2Factivitystreams%23Article> .

    <https://fragments.example.com/qpf?storage=https%3A%2F%2Fstorage.example.com%2Fa211ad26-zzzz-9999-8b20-acb3aed0e369%2F&object=https%3A%2F%2Fwww.w3.org%2Fns%2Factivitystreams%23Article>
         void:subset            <https://fragments.example.com/qpf?storage=https%3A%2F%2Fstorage.example.com%2Fa211ad26-zzzz-9999-8b20-acb3aed0e369%2F&object=https%3A%2F%2Fwww.w3.org%2Fns%2Factivitystreams%23Article> ;
         void:triples           "10"^^<http://www.w3.org/2001/XMLSchema#long> ;
         hydra:next             <https://fragments.example.com/qpf?storage=https%3A%2F%2Fstorage.example.com%2Fa211ad26-zzzz-9999-8b20-acb3aed0e369%2F&object=https%3A%2F%2Fwww.w3.org%2Fns%2Factivitystreams%23Article&after=285896126> ;
         hydra:previous         <https://fragments.example.com/qpf?storage=https%3A%2F%2Fstorage.example.com%2Fa211ad26-zzzz-9999-8b20-acb3aed0e369%2F&object=https%3A%2F%2Fwww.w3.org%2Fns%2Factivitystreams%23Article&before=285896101> ;
         hydra:view             <https://fragments.example.com/qpf?storage=https%3A%2F%2Fstorage.example.com%2Fa211ad26-zzzz-9999-8b20-acb3aed0e369%2F&object=https%3A%2F%2Fwww.w3.org%2Fns%2Factivitystreams%23Article> ;
         foaf:isPrimaryTopicOf  _:b0 .
}

<https://storage.example.com/a211ad26-zzzz-9999-8b20-acb3aed0e369/readingLists/myList> {
    <https://storage.example.com/a211ad26-zzzz-9999-8b20-acb3aed0e369/readingLists/myList#title2>
            rdf:type  <https://www.w3.org/ns/activitystreams#Article> .

    <https://storage.example.com/a211ad26-zzzz-9999-8b20-acb3aed0e369/readingLists/myList#title0>
            rdf:type  <https://www.w3.org/ns/activitystreams#Article> .

    <https://storage.example.com/a211ad26-zzzz-9999-8b20-acb3aed0e369/readingLists/myList#title3>
            rdf:type  <https://www.w3.org/ns/activitystreams#Article> .

    <https://storage.example.com/a211ad26-zzzz-9999-8b20-acb3aed0e369/readingLists/myList#title1>
            rdf:type  <https://www.w3.org/ns/activitystreams#Article> .

    <https://storage.example.com/a211ad26-zzzz-9999-8b20-acb3aed0e369/readingLists/myList#title4>
            rdf:type  <https://www.w3.org/ns/activitystreams#Article> .
}

<https://storage.example.com/a211ad26-zzzz-9999-8b20-acb3aed0e369/readingLists/publicList> {
    <https://storage.example.com/a211ad26-zzzz-9999-8b20-acb3aed0e369/readingLists/publicList#title3>
            rdf:type  <https://www.w3.org/ns/activitystreams#Article> .

    <https://storage.example.com/a211ad26-zzzz-9999-8b20-acb3aed0e369/readingLists/publicList#title1>
            rdf:type  <https://www.w3.org/ns/activitystreams#Article> .

    <https://storage.example.com/a211ad26-zzzz-9999-8b20-acb3aed0e369/readingLists/publicList#title4>
            rdf:type  <https://www.w3.org/ns/activitystreams#Article> .

    <https://storage.example.com/a211ad26-zzzz-9999-8b20-acb3aed0e369/readingLists/publicList#title2>
            rdf:type  <https://www.w3.org/ns/activitystreams#Article> .

    <https://storage.example.com/a211ad26-zzzz-9999-8b20-acb3aed0e369/readingLists/publicList#title0>
            rdf:type  <https://www.w3.org/ns/activitystreams#Article> .
}

Hypermedia Control#

Per the Quad Pattern Fragment (QPF) specification, successful query response includes the Hypermedia controls. The returned Hypermedia controls includes the search pattern template.

For example:

<https://fragments.example.com/qpf?storage=https%3A%2F%2Fstorage.example.com%2Fa211ad26-zzzz-9999-8b20-acb3aed0e369%2F>
   void:subset   <https://fragments.example.com/qpf?storage=https%3A%2F%2Fstorage.example.com%2Fa211ad26-zzzz-9999-8b20-acb3aed0e369%2F&object=https%3A%2F%2Fwww.w3.org%2Fns%2Factivitystreams%23Article> ;
   hydra:search  [ hydra:mapping   [ hydra:property  sd:graph ;
                                     hydra:variable  "graph"
                                   ] ;
                   hydra:mapping   [ hydra:property  rdf:subject ;
                                     hydra:variable  "subject"
                                   ] ;
                   hydra:mapping   [ hydra:property  rdf:predicate ;
                                     hydra:variable  "predicate"
                                   ] ;
                   hydra:mapping   [ hydra:property  rdf:object ;
                                     hydra:variable  "object"
                                   ] ;
                   hydra:template  "https://fragments.example.com/qpf?storage=https%3A%2F%2Fstorage.example.com%2Fa211ad26-zzzz-9999-8b20-acb3aed0e369%2F{&graph,subject,predicate,object}"
                 ] .

For more information, see Hypermedia controls in the QPF specification.

Metadata#

Per the Quad Pattern Fragment (QPF) specification, a successful query response includes the metadata.

The returned metadata includes:

For example:

_:b0    foaf:primaryTopic  <https://fragments.example.com/qpf?storage=https%3A%2F%2Fstorage.example.com%2Fa211ad26-zzzz-9999-8b20-acb3aed0e369%2F&object=https%3A%2F%2Fwww.w3.org%2Fns%2Factivitystreams%23Article> .

<https://fragments.example.com/qpf?storage=https%3A%2F%2Fstorage.example.com%2Fa211ad26-zzzz-9999-8b20-acb3aed0e369%2F&object=https%3A%2F%2Fwww.w3.org%2Fns%2Factivitystreams%23Article>
     void:subset            <https://fragments.example.com/qpf?storage=https%3A%2F%2Fstorage.example.com%2Fa211ad26-zzzz-9999-8b20-acb3aed0e369%2F&object=https%3A%2F%2Fwww.w3.org%2Fns%2Factivitystreams%23Article> ;
     void:triples           "10"^^<http://www.w3.org/2001/XMLSchema#long> ;
     hydra:next             <https://fragments.example.com/qpf?storage=https%3A%2F%2Fstorage.example.com%2Fa211ad26-zzzz-9999-8b20-acb3aed0e369%2F&object=https%3A%2F%2Fwww.w3.org%2Fns%2Factivitystreams%23Article&after=285896126> ;
     hydra:previous         <https://fragments.example.com/qpf?storage=https%3A%2F%2Fstorage.example.com%2Fa211ad26-zzzz-9999-8b20-acb3aed0e369%2F&object=https%3A%2F%2Fwww.w3.org%2Fns%2Factivitystreams%23Article&before=285896101> ;
     hydra:view             <https://fragments.example.com/qpf?storage=https%3A%2F%2Fstorage.example.com%2Fa211ad26-zzzz-9999-8b20-acb3aed0e369%2F&object=https%3A%2F%2Fwww.w3.org%2Fns%2Factivitystreams%23Article> ;
     foaf:isPrimaryTopicOf  _:b0 .

For more information, see metadata section in the QPF specification.

Matching Data Results#

Note

  • ESS Query service only returns matching data from the data that has been indexed.

  • Because the resource indexing occurs after the indexer consumes a resource change notification event, the query results may lag behind the current state of the Resource.

A successful query response includes the matching data in triples.

For example,

<https://storage.example.com/a211ad26-zzzz-9999-8b20-acb3aed0e369/readingLists/myList> {
    <https://storage.example.com/a211ad26-zzzz-9999-8b20-acb3aed0e369/readingLists/myList#title2>
            rdf:type  <https://www.w3.org/ns/activitystreams#Article> .

    <https://storage.example.com/a211ad26-zzzz-9999-8b20-acb3aed0e369/readingLists/myList#title0>
            rdf:type  <https://www.w3.org/ns/activitystreams#Article> .

    <https://storage.example.com/a211ad26-zzzz-9999-8b20-acb3aed0e369/readingLists/myList#title3>
            rdf:type  <https://www.w3.org/ns/activitystreams#Article> .

    <https://storage.example.com/a211ad26-zzzz-9999-8b20-acb3aed0e369/readingLists/myList#title1>
            rdf:type  <https://www.w3.org/ns/activitystreams#Article> .

    <https://storage.example.com/a211ad26-zzzz-9999-8b20-acb3aed0e369/readingLists/myList#title4>
            rdf:type  <https://www.w3.org/ns/activitystreams#Article> .
}

<https://storage.example.com/a211ad26-zzzz-9999-8b20-acb3aed0e369/readingLists/publicList> {
    <https://storage.example.com/a211ad26-zzzz-9999-8b20-acb3aed0e369/readingLists/publicList#title3>
            rdf:type  <https://www.w3.org/ns/activitystreams#Article> .

    <https://storage.example.com/a211ad26-zzzz-9999-8b20-acb3aed0e369/readingLists/publicList#title1>
            rdf:type  <https://www.w3.org/ns/activitystreams#Article> .

    <https://storage.example.com/a211ad26-zzzz-9999-8b20-acb3aed0e369/readingLists/publicList#title4>
            rdf:type  <https://www.w3.org/ns/activitystreams#Article> .

    <https://storage.example.com/a211ad26-zzzz-9999-8b20-acb3aed0e369/readingLists/publicList#title2>
            rdf:type  <https://www.w3.org/ns/activitystreams#Article> .

    <https://storage.example.com/a211ad26-zzzz-9999-8b20-acb3aed0e369/readingLists/publicList#title0>
            rdf:type  <https://www.w3.org/ns/activitystreams#Article> .
}

The number of query results returned per page is determined by INRUPT_FRAGMENTS_PAGE_SIZE). For pagination information, see Metadata.

Query Service Indexer#

To query your data, the Query service uses an indexer to index your RDF resources; i.e., the the Query service returns results only from the indexed RDF resources.

To index your data, the indexer requires Read access to the resources to be indexed. You can grant Read access specifically to the indexer using its WebID. The indexer has a WebID of the following form:

https://fragments-indexer.{ESS DOMAIN}/id

In addition, like any other agent, the indexer has Read access to those resources with Read access granted to the Public.

Indexing Data#

Once the indexer is given Read access to a Resource, a Resource change notification triggers the indexing of that Resource.

Important

Because the resource indexing occurs after the indexer consumes a resource change notification event, the query results may lag behind the current state of the Resource. The delay amount depends on the lag in the notification queue.

See also INRUPT_FRAGMENTS_INGEST_IGNORE_ERRORS.

Access Control#

UMA and Solid-OIDC Access Tokens#

For query access to the Pod, the ESS’ Query service can use either:

  • UMA token, or

  • Solid-OpenID Connect (OIDC) access token.

With the UMA authorization flow:

  1. When you issue your query without an access token, the Query service returns a 401 along with a ticket and authorization server in the WWW-Authenticate header.

  2. From the authorization server, the client can exchange the UMA ticket for the UMA access token.

    • To exchange the UMA ticket for the access token, the client must include its client_id.

  3. Include the access token in the header of your query request and retry.

See also:

Querying Agent#

Only Agents who have Control Read access to the root of the Pod, such as the Pod Owner, can access data from the QPF endpoint.

You can further specify which applications can query the endpoint by granting specific applications appropriate access.

Indexer#

To index the data in a resource, indexer requires Read access to the resource. The Query service only returns results from the indexed RDF resources.

See also:

Configuration#

As part of the installation process, Inrupt provides base Kustomize overlays and associated files that require deployment-specific configuration inputs.

The following configuration options are available for the service and may be set as part of updating the inputs for your deployment. The Inrupt-provided base Kustomize overlays may be using updated configuration values that differ from the default values.

Query Service Configuration#

INRUPT_FRAGMENTS_PAGE_SIZE#

Default: 10

The number of matching results per page.

QUARKUS_LOG_LEVEL#

Default: INFO

Logging level.

UMA Configuration#

INRUPT_AUTHZ_AS_URI#

The URI of the UMA Authorization Server.

The value must match:

INRUPT_JWT_AUTHORIZATION_SERVER_ISSUER#

The URI of the UMA token issuer.

The value must match INRUPT_AUTHZ_AS_URI.

INRUPT_JWT_AUTHORIZATION_SERVER_JWKS#

The JWKS endpoint of the INRUPT_JWT_AUTHORIZATION_SERVER_ISSUER.

OIDC Configuration#

INRUPT_JWT_ALLOWED_SIGNATURE_ALGORITHMS#

Default: ES256, RS256

A comma-separated list that specifies the allowed encryption algorithms used to sign ID tokens.

INRUPT_JWT_ISSUER_ALLOW_LIST#

A comma-separated list of trusted issuers of Solid-OIDC tokens.

See also INRUPT_JWT_ISSUER_DENY_LIST.

Tip

Ensure that ESS UMA service’ INRUPT_JWT_ISSUER_ALLOW_LIST is consistent with the INRUPT_JWT_ISSUER_ALLOW_LIST value set for this service.

INRUPT_JWT_ISSUER_DENY_LIST#

A comma-separated list of disallowed issuers of Solid-OIDC tokens.

Tip

Ensure that ESS’ UMA service’s INRUPT_JWT_ISSUER_DENY_LIST is consistent with the INRUPT_JWT_ISSUER_DENY_LIST value set for this service.

Kafka Configuration#

INRUPT_KAFKA_AUDITV1EVENTSENCRYPTED_CIPHER_PASSWORD#

The strong cipher key to use when running auditing with encrypted messages.

KAFKA_BOOTSTRAP_SERVERS#

Default: localhost:9092

Comma-delimited list of Kafka broker servers for use by ESS services.

Setting KAFKA_BOOTSTRAP_SERVERS configures ESS to use the same Kafka instance(s) for all its Kafka message channels (e.g., solidresource and auditv1out message channels). The UMA service uses the auditv1out message channel.

Note

Inrupt-provided overlays default to using KAFKA_BOOTSTRAP_SERVERS.

To use a different Kafka instance for the auditv1out channel, use specific message channel configuration.

See also ESS’ Kafka Configuration.

Indexer Configuration#

INRUPT_AUTHZ_AS_URI#

The URI of the UMA Authorization Server.

The value must match the INRUPT_UMA_ISSUER configuration for UMA Service.

INRUPT_FRAGMENTS_INGEST_IGNORE_ERRORS#

Default: false

A boolean that determines whether the indexer should log but continue on error or throw an exception on error:

  • Set to true to log the error and continue when the indexer encounters an error.

  • Set to false to throw an exception on error. (Default)

New in version 2.0.15.

Additional Information#

See also https://quarkus.io/guides/all-config.