OSLC Simple Query as stated by its name, is useful for simple queries. Often specific domains have needs for queries that are more complex and difficult to express with simple query. Short of exposing a full SPARQL endpoint, this document describes a solution that enables service implementations to offer pre-defined parameterized queries that clients can use when OSLC Simple query is not sufficient.
In this proposal we include a new resource in the service provider document; PredefinedQuery. This resource defines how a client can execute a potentially complicated, but common, query on resources across the entire service provider by only supplying values for defined parameters.
A pre-defined query is exposed in the service provider document. The service provider document includes references to PredefinedQuery resources, each of which represent a separate pre-defined query. A client executes this query by POSTing a resource to the query URL. Pre-define query responses are identical to Simple Query responses.
Acceptable query parameters include oslc.prefix, oslc.select, and oslc.orderBy.
Note: this document uses the OSLC AM namespace. We hope that this resource and pattern will be adopted by core, at which time the appropriate namespace would be OSLC Core.
A pre-defined query is a service provider defined query that is exposed through service documents, that a client can GET or POST a request to. The service provider defines the allowable parameters and expected behavior.
- Name:
PredefinedQuery
- Type URI
http://open-services.net/ns/am#PredefinedQuery
Prefixed Name |
Occurs |
Read-only |
Value-type |
Representation |
Range |
Description |
dcterms:title |
exactly-one |
true |
String |
n/a |
n/a |
The name of the query. |
oslc:label |
zero-or-one |
true |
String |
n/a |
n/a |
A label to use in a menu item or drop down UI for this query. |
dcterms:description |
zero-or-one |
true |
XMLLiteral |
n/a |
n/a |
A description of the query. This description should explain what matches to expect for given values of the parameter resource submitted. |
oslc:resourceShape |
zero-or-many |
true |
Resource |
Either |
oslc:ResourceShape |
A description of the query. This description should explain what matches to expect for given values of the parameter resource submitted. |
oslc_am:queryUrl |
exactly-one |
true |
Resource |
Reference |
n/a |
The query endpoint URL. Resources of the type specified by the resource shape are POSTed to this URL to execute the query. If the query does not specify a resource shape then the query does not require any parameters and a POST with an empty body, or a GET will execute the re-defined query. |
oslc:usage |
zero-or-one |
true |
Resource |
Reference |
n/a |
An identifier URI for the domain specified usage of this query. URIs maye be defined in this or other specifications facilitating automatic usage of the query by a knowledgable client. |
Examples
An example of a simple pre-defined query that does not require any parameters.
An example of a predefined query that requires a parameter resource, and specifies an oslc.select query parameter.