Architecture Management Simple Query
Introduction
The OSLC AM service specification leverages the OSLC Core specification and
syntax for simple query. The query URI is specified in the services document. Clients use this URI to GET (or POST) simple queries, and receive an ATOM formatted response with OSLC AM Resource (RDF/XML) in each entry's
<content>
.
The OSLC AM specification does not require the use of OSLC Core Resource Shapes. This specification only requires service providers to support the Member List Pattern defined in the
query syntax.
To perform a query an OSLC client first creates a URI by starting with a Query Capability's base URI as a base and adding a URI Query String to express the query criteria. The OSLC client then uses HTTP GET to request a Query Resource representation of the query results. The Query Resource representation will contain property values about the query and a collection of resources that match the query criteria.
Predefined Prefixes
For simplicity, this specification pre-defines some prefixes that can are used in the query string:
When a property name does not use one of these prefixes, then the oslc.prefix parameter can be used to explicitly specify it (or override one of these existing definitions). This parameter is useful when referencing custom properties (those defined outside of this specification).
HTTP GET Queries
To perform an HTTP GET query, an OSLC client starts with the base URI as defined by the
oslc:queryBase
property of a Query Capability, and appends to it query parameters in a syntax supported by the service. The resulting URI is the query URI. The OSLC client sends an HTTP GET request to the query URI, optionally specifying the preferred content media type for the query response in the HTTP Accept header. OSLC services
MUST support query responses in RDF/XML format (media type
application/rdf+xml
) and
MAY support other formats. OSLC services
SHOULD support the Query Syntax defined in this specification, but
MAY support other syntaxes.
HTTP POST Queries
Alternatively, the client
MAY encode the query parameters in the HTTP request body as media type
application/x-www-form-urlencoded
, and send an HTTP POST request to the base URI. An OSLC service
MAY support other query languages using other media types in the request body, e.g. SPARQL (media type
application/sparql-query
).
Examples
The following are examples of queries for OSLC AM resources using the OSLC common simple query syntax. Each of these examples is NOT URL encoded for clarity.
Modifed past a given date
The client wants all the resources that have been modified since April 1, 2010.
.../query?oslc.where=dcterms:created>"2008-04-01T12:00:00"^^xsd:dateTime
With a name and type
The client wants all the resources with the name ICustomer that are a UML interface.
.../query?oslc.where=dcterms:title>"ICustomer" and rdf:type="http://www.eclipse.org/uml2/3.0.0/UML/Interface"
With a custom property
The client wants all the resources with that have the custom property "status" equal to "red". The namespace of this property must be specified with the oslc.prefix parameter.
.../query?oslc.prefix=acme="http://acme.com/ns/" and acme:status="red"
Query for all resources that have a link (property) of any type to a given resource URI
The client wants all the resources with that have the custom property "status" equal to "red". The namespace of this property must be specified with the oslc.prefix parameter.
.../query?oslc.where=*=<http://acme.req.com/requirements/req123>