This wiki is locked. Future workgroup activity and specification development must take place at our new wiki. For more information, see this blog post about the new governance model and this post about changes to the website.

Change Management Query Syntax

1.0 SPECIFICATION

Table of Contents

Introduction

Change management scenarios have outlined a need for a simple query mechanism. This is provided by supplying the query terms that can be URL-encoded and performed by using a HTTP GET.

The query syntax described here is based loosely on the Library of Congress Contextual Query Language (CQL) but where CQL is for describing structured text searches the language here is intended for more precise queries. So, whereas CQL allows search terms that are not evaluated in the context of a property the language here always scopes a term to a particular property ( property op value). Also, while CQL does support a sort modifier we also introduce a limit modifier to return only a subset of possible results.

Notation and Conventions

The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC2119. Domain name examples use RFC2606.

Query Syntax

The following sections describe the basic query syntax.

Comparison Operators

  • = test for equality of a term,
  • != test for inequality of a term,
  • < test less-than,
  • > test greater-than,
  • <= test less-than or equal,
  • >= test greater-than or equal,
  • in test for equality of any of the terms.

Boolean Operators

  • and; conjunction

Query Modifiers

  • /sort; set the sort order for returned items

Full text Search

BNF

query      ::= (term (boolean_op term)*)+ modifiers
term       ::= (identifier operator)? value+ | (identifier "in")? in_val | fulltext
operator   ::= "=" | "!=" | "<" | ">" | "<=" | ">="
boolean_op ::= "and"
modifiers  ::= sort?
sort       ::= "/sort" "=" identifier
fulltext   ::= "oslc_cm:searchTerms" "=" '"' value+ '"'
identifier ::= word (":" word)?
in_val     ::= "[" value ("," value)* "]"
value      ::= (integer | string)
word       ::= /any sequence of letters and numbers, starting with a letter/
string     ::= '"' + /any sequence of characters/ + '"'
integer    ::= /any sequence of integers/

Notes

  1. a word consists of any character with the Unicode class Alpha (alpha-numeric) as well as the characters ".", "-" and "_".
  2. a string may include the quote character if preceded by the escape character "\", as in "my \"quoted\" example".

Returning Properties

A query should not only declare a set of query terms but can also specify a list of properties that should be returned (if present) for any resource that matches the specified terms. This is not a component of the query syntax itself but split into a separate URI query parameter, with semantics of oslc_cm.properties . The query parameter takes a comma separated list of identifiers, which are of course, to be URL encoded.

For example, to return the creator and created time for any matching resource the following can be added to the URL:

&oslc_cm.properties=dc:creator,dc:created
&oslc_cm.properties=dc%3Acreator%2Cdc%3Acreated

Using Namespaces

In the query part and the properties part of the URL we use qualified names to refer to identifiers, the prefix is intended to reflect a particular namespace where some of these prefixes are pre-defined by an application and some may be user-defined. For example an application may publish the fact that it recognizes the prefix dc: and maps it to the Dublin Core Metadata Terms namespace (http://purl.org/dc/terms/). These pre-defined namespaces should be published by the application as a part of it's specification. Clients and service providers MUST support the predefined set of namespace prefixed defined in the [[CmRestApiV1][OSLC CM REST API specification].

Full Text Search

A full text search is performed when the reserved keyword oslc_cm:searchTerms is used in conjunction with the oslc_cm.query parameter. When oslc_cm:searchTerms is used in the request, each entry (hit) in the response MUST contain a oslc_cm:score property. The oslc_cm:score property MUST be a non-negative number and SHOULD be in the range from 0-100. Results MUST be ordered with the entry with the largest oslc_cm:score occuring first.

Examples

Selecting properties and inlining

Query for resources whose state property is equal to "open" and only return the properties of title and full owner details.

?oslc_cm.query=state="open"&oslc_cm.properties="dc:title,dc:owner{*}" 

Encoding Example

Not encoded:

?oslc_cm.query=dc:title="use case 1" and dc:modified>="12-02-2008T18:42:30"
Encoded:
?oslc_cm.query=dc%3Atitle%3D%22use%20case%201%22%20and%20dc%3Amodified%3E%3D%2212-02-2008T18
     %3A42%3A30%22%20

References

Topic revision: r22 - 28 May 2009 - 18:35:37 - TWikiAdminUser
Main.CmQuerySyntaxV1 moved from Main.CmQuerySyntax on 28 May 2009 - 14:13 by ScottBosworth - put it back
 
This site is powered by the TWiki collaboration platform Copyright � by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Contributions are governed by our Terms of Use
Ideas, requests, problems regarding this site? Send feedback