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 |
---|---|
|
Required. URL of the Pod to query. URL-encode the value. If the Note
|
|
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. |
|
The predicate to match, as defined in the QPF quad pattern selector. URL-encode the value. |
|
The object to match, as defined in the QPF quad pattern selector. URL-encode the value. |
|
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:
Hypermedia Control that includes the search pattern template.
Metadata that includes the estimated count of matching data and links for pagination.
Matching Data Results that includes up to
INRUPT_FRAGMENTS_PAGE_SIZE
number of matching records.
For example:
<https://fragments.example.com/qpf?storage=https%3A%2F%2Fstorage.example.com%2Ff0a179f8-zzzz-9999-aa17-7912971b69d6%2F>
<http://rdfs.org/ns/void#subset>
<https://fragments.example.com/qpf?storage=https%3A%2F%2Fstorage.example.com%2Ff0a179f8-zzzz-9999-aa17-7912971b69d6%2F&object=https%3A%2F%2Fwww.w3.org%2Fns%2Factivitystreams%23Article> ;
<http://www.w3.org/ns/hydra/core#search>
[ <http://www.w3.org/ns/hydra/core#mapping>
[ <http://www.w3.org/ns/hydra/core#property>
<http://www.w3.org/ns/sparql-service-description#graph> ;
<http://www.w3.org/ns/hydra/core#variable>
"graph"
] ;
<http://www.w3.org/ns/hydra/core#mapping>
[ <http://www.w3.org/ns/hydra/core#property>
<http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> ;
<http://www.w3.org/ns/hydra/core#variable>
"subject"
] ;
<http://www.w3.org/ns/hydra/core#mapping>
[ <http://www.w3.org/ns/hydra/core#property>
<http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> ;
<http://www.w3.org/ns/hydra/core#variable>
"predicate"
] ;
<http://www.w3.org/ns/hydra/core#mapping>
[ <http://www.w3.org/ns/hydra/core#property>
<http://www.w3.org/1999/02/22-rdf-syntax-ns#object> ;
<http://www.w3.org/ns/hydra/core#variable>
"object"
] ;
<http://www.w3.org/ns/hydra/core#template>
"https://fragments.example.com/qpf?storage=https%3A%2F%2Fstorage.example.com%2Ff0a179f8-zzzz-9999-aa17-7912971b69d6%2F{&graph,subject,predicate,object}"
] .
<https://fragments.example.com/qpf?storage=https%3A%2F%2Fstorage.example.com%2Ff0a179f8-zzzz-9999-aa17-7912971b69d6%2F&object=https%3A%2F%2Fwww.w3.org%2Fns%2Factivitystreams%23Article>
<http://rdfs.org/ns/void#subset>
<https://fragments.example.com/qpf?storage=https%3A%2F%2Fstorage.example.com%2Ff0a179f8-zzzz-9999-aa17-7912971b69d6%2F&object=https%3A%2F%2Fwww.w3.org%2Fns%2Factivitystreams%23Article> ;
<http://rdfs.org/ns/void#triples>
"10"^^<http://www.w3.org/2001/XMLSchema#long> ;
<http://www.w3.org/ns/hydra/core#next>
<https://fragments.example.com/qpf?storage=https%3A%2F%2Fstorage.example.com%2Ff0a179f8-zzzz-9999-aa17-7912971b69d6%2F&object=https%3A%2F%2Fwww.w3.org%2Fns%2Factivitystreams%23Article&after=1051973> ;
<http://www.w3.org/ns/hydra/core#previous>
<https://fragments.example.com/qpf?storage=https%3A%2F%2Fstorage.example.com%2Ff0a179f8-zzzz-9999-aa17-7912971b69d6%2F&object=https%3A%2F%2Fwww.w3.org%2Fns%2Factivitystreams%23Article&before=1051955> ;
<http://xmlns.com/foaf/0.1/isPrimaryTopicOf>
[] .
<https://storage.example.com/f0a179f8-zzzz-9999-aa17-7912971b69d6/readingLists/publicList#title3>
a <https://www.w3.org/ns/activitystreams#Article> .
<https://storage.example.com/f0a179f8-zzzz-9999-aa17-7912971b69d6/readingLists/publicList#title1>
a <https://www.w3.org/ns/activitystreams#Article> .
<https://storage.example.com/f0a179f8-zzzz-9999-aa17-7912971b69d6/readingLists/publicList#title4>
a <https://www.w3.org/ns/activitystreams#Article> .
<https://storage.example.com/f0a179f8-zzzz-9999-aa17-7912971b69d6/readingLists/publicList#title2>
a <https://www.w3.org/ns/activitystreams#Article> .
<https://storage.example.com/f0a179f8-zzzz-9999-aa17-7912971b69d6/readingLists/publicList#title0>
a <https://www.w3.org/ns/activitystreams#Article> .
<https://storage.example.com/f0a179f8-zzzz-9999-aa17-7912971b69d6/readingLists/indexerOnlyList#title2>
a <https://www.w3.org/ns/activitystreams#Article> .
<https://storage.example.com/f0a179f8-zzzz-9999-aa17-7912971b69d6/readingLists/indexerOnlyList#title0>
a <https://www.w3.org/ns/activitystreams#Article> .
<https://storage.example.com/f0a179f8-zzzz-9999-aa17-7912971b69d6/readingLists/indexerOnlyList#title3>
a <https://www.w3.org/ns/activitystreams#Article> .
<https://storage.example.com/f0a179f8-zzzz-9999-aa17-7912971b69d6/readingLists/indexerOnlyList#title1>
a <https://www.w3.org/ns/activitystreams#Article> .
<https://storage.example.com/f0a179f8-zzzz-9999-aa17-7912971b69d6/readingLists/indexerOnlyList#title4>
a <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%2Ff0a179f8-zzzz-9999-aa17-7912971b69d6%2F>
<http://rdfs.org/ns/void#subset>
<https://fragments.example.com/qpf?storage=https%3A%2F%2Fstorage.example.com%2Ff0a179f8-zzzz-9999-aa17-7912971b69d6%2F&object=https%3A%2F%2Fwww.w3.org%2Fns%2Factivitystreams%23Article> ;
<http://www.w3.org/ns/hydra/core#search>
[ <http://www.w3.org/ns/hydra/core#mapping>
[ <http://www.w3.org/ns/hydra/core#property>
<http://www.w3.org/ns/sparql-service-description#graph> ;
<http://www.w3.org/ns/hydra/core#variable>
"graph"
] ;
<http://www.w3.org/ns/hydra/core#mapping>
[ <http://www.w3.org/ns/hydra/core#property>
<http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> ;
<http://www.w3.org/ns/hydra/core#variable>
"subject"
] ;
<http://www.w3.org/ns/hydra/core#mapping>
[ <http://www.w3.org/ns/hydra/core#property>
<http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> ;
<http://www.w3.org/ns/hydra/core#variable>
"predicate"
] ;
<http://www.w3.org/ns/hydra/core#mapping>
[ <http://www.w3.org/ns/hydra/core#property>
<http://www.w3.org/1999/02/22-rdf-syntax-ns#object> ;
<http://www.w3.org/ns/hydra/core#variable>
"object"
] ;
<http://www.w3.org/ns/hydra/core#template>
"https://fragments.example.com/qpf?storage=https%3A%2F%2Fstorage.example.com%2Ff0a179f8-zzzz-9999-aa17-7912971b69d6%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:
An estimate of the number of matches.
For example:
<https://fragments.example.com/qpf?storage=https%3A%2F%2Fstorage.example.com%2Ff0a179f8-zzzz-9999-aa17-7912971b69d6%2F&object=https%3A%2F%2Fwww.w3.org%2Fns%2Factivitystreams%23Article>
<http://rdfs.org/ns/void#subset>
<https://fragments.example.com/qpf?storage=https%3A%2F%2Fstorage.example.com%2Ff0a179f8-zzzz-9999-aa17-7912971b69d6%2F&object=https%3A%2F%2Fwww.w3.org%2Fns%2Factivitystreams%23Article> ;
<http://rdfs.org/ns/void#triples>
"10"^^<http://www.w3.org/2001/XMLSchema#long> ;
<http://www.w3.org/ns/hydra/core#next>
<https://fragments.example.com/qpf?storage=https%3A%2F%2Fstorage.example.com%2Ff0a179f8-zzzz-9999-aa17-7912971b69d6%2F&object=https%3A%2F%2Fwww.w3.org%2Fns%2Factivitystreams%23Article&after=1051973> ;
<http://www.w3.org/ns/hydra/core#previous>
<https://fragments.example.com/qpf?storage=https%3A%2F%2Fstorage.example.com%2Ff0a179f8-zzzz-9999-aa17-7912971b69d6%2F&object=https%3A%2F%2Fwww.w3.org%2Fns%2Factivitystreams%23Article&before=1051955> ;
<http://xmlns.com/foaf/0.1/isPrimaryTopicOf>
[] .
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/f0a179f8-zzzz-9999-aa17-7912971b69d6/readingLists/publicList#title3>
a <https://www.w3.org/ns/activitystreams#Article> .
<https://storage.example.com/f0a179f8-zzzz-9999-aa17-7912971b69d6/readingLists/publicList#title1>
a <https://www.w3.org/ns/activitystreams#Article> .
<https://storage.example.com/f0a179f8-zzzz-9999-aa17-7912971b69d6/readingLists/publicList#title4>
a <https://www.w3.org/ns/activitystreams#Article> .
<https://storage.example.com/f0a179f8-zzzz-9999-aa17-7912971b69d6/readingLists/publicList#title2>
a <https://www.w3.org/ns/activitystreams#Article> .
<https://storage.example.com/f0a179f8-zzzz-9999-aa17-7912971b69d6/readingLists/publicList#title0>
a <https://www.w3.org/ns/activitystreams#Article> .
<https://storage.example.com/f0a179f8-zzzz-9999-aa17-7912971b69d6/readingLists/indexerOnlyList#title2>
a <https://www.w3.org/ns/activitystreams#Article> .
<https://storage.example.com/f0a179f8-zzzz-9999-aa17-7912971b69d6/readingLists/indexerOnlyList#title0>
a <https://www.w3.org/ns/activitystreams#Article> .
<https://storage.example.com/f0a179f8-zzzz-9999-aa17-7912971b69d6/readingLists/indexerOnlyList#title3>
a <https://www.w3.org/ns/activitystreams#Article> .
<https://storage.example.com/f0a179f8-zzzz-9999-aa17-7912971b69d6/readingLists/indexerOnlyList#title1>
a <https://www.w3.org/ns/activitystreams#Article> .
<https://storage.example.com/f0a179f8-zzzz-9999-aa17-7912971b69d6/readingLists/indexerOnlyList#title4>
a <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:
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.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
.
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.
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_AUTHZ_AS_URI#
The URI of the UMA Authorization Server.
The value must match the
INRUPT_UMA_ISSUER
configuration for UMA Service.
- INRUPT_FRAGMENTS_PAGE_SIZE#
Default:
10
The number of matching results per page.
- QUARKUS_LOG_LEVEL#
Default:
INFO
Logging level.
- INRUPT_JWT_ISSUER_ALLOW_LIST#
A comma-separated list of trusted Solid-OIDC issuers (i.e., identity providers).
If unset, the service accepts all Solid-OIDC issuers with the exception of those in the
INRUPT_JWT_ISSUER_DENY_LIST
.If set, the service accepts only those Solid-OIDC issuers in the list with the following exception:
If an issuer is in both
INRUPT_JWT_ISSUER_ALLOW_LIST
andINRUPT_JWT_ISSUER_DENY_LIST
, theINRUPT_JWT_ISSUER_DENY_LIST
supersedes theINRUPT_JWT_ISSUER_ALLOW_LIST
and the issuer is not accepted by ESS.
See also
INRUPT_JWT_ISSUER_DENY_LIST
.
- INRUPT_JWT_ISSUER_DENY_LIST#
A comma-separated list of disallowed Solid-OIDC issuers.
If unset, the service accepts all Solid-OIDC issuers unless
INRUPT_JWT_ISSUER_ALLOW_LIST
is set, in which case, the service only accepts those in theINRUPT_JWT_ISSUER_ALLOW_LIST
.If set, the service disallows the Solid-OIDC issuers in the list. If
INRUPT_JWT_ISSUER_ALLOW_LIST
is also set, issuers not in theINRUPT_JWT_ISSUER_ALLOW_LIST
are also disallowed.
- INRUPT_JWT_ALLOWED_SIGNATURE_ALGORITHMS#
Default:
ES256
,RS256
A comma-separated list that specifies the allowed encryption algorithms used to sign ID tokens.
Kafka Configuration#
Tip
See also ESS’ Kafka Configuration.
- 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
andauditv1out
message channels). The UMA service uses theauditv1out
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.
- INRUPT_KAFKA_AUDITV1EVENTSENCRYPTED_CIPHER_PASSWORD#
The strong cipher key to use when running auditing with encrypted messages.
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.