Saved queries

When an OSLC resource is defined based on an object structure that references an application, all the public saved queries from the application are made available through the service provider. The queries are exposed as OSLC query capabilities in the service provider document for that OSLC resource.

Object structures can be optionally connected to an application. In the application of the resource, you define custom queries and save those queries for later use. You can make the queries public so that the queries are available to all users who are authorized to use that application. To run a saved query, you perform an HTTP GET request on the query base URI that is provided in the query capability for the saved query. A list of OSLC resources that match the saved query are returned.

Each query capability property exposes a URI called oslc:queryBase property that enables a consumer to search the resources that are managed by the service provider. Each query capability supports only one resource type called oslc:resourceType. The OSLC specification allows a query capability to support multiple resource types. The query capability lists all of the public saved queries for the application that is registered with the object structure that implements the OSLC resource. If there are no public saved queries for the registered application or if no application was registered, only one query capability provides the generic query collection URI. There is always at least one query capability for each resource type that is supported by the service provider.

Example: Saved queries in the Work order application

You create a query in the Work Order application to search for work orders that you own. You make the query public so that the query appears in the service provider document as savedQuery=OWNER+IS+ME. The OSLC top-level object structure must also be work order.
<oslc:service>
      <oslc:Service>
        <oslc:queryCapability>
          <oslc:QueryCapability>
            <oslc:resourceType rdf:resource="http://jazz.net/ns/ism/work/smarter_physical_
infrastructure#WorkOrder"/>
            <oslc:queryBase rdf:resource="http://host/maximo/oslc/os/oslcwodetail?
savedQuery=OWNER+IS+ME"/>
            <oslc:label>Query OWNER IS ME</oslc:label>
            <dcterms:title>OSLC query capability for My Work Orders</dcterms:title>
          </oslc:QueryCapability>
        </oslc:queryCapability>
        <oslc:queryCapability>
          <oslc:QueryCapability>
            <oslc:resourceType rdf:resource="http://jazz.net/ns/ism/work/smarter_physical_
infrastructure#WorkOrder"/>
            <oslc:queryBase rdf:resource="http://host/maximo/oslc/os/oslcwodetail"/>
            <oslc:label>Query WorkOrder</oslc:label>
            <dcterms:title>OSLC query capability for WorkOrder</dcterms:title>
          </oslc:QueryCapability>
        </oslc:queryCapability>
        ......