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.

Quality Management Query Syntax

1.0 SPECIFICATION

Table of Contents

Introduction

Quality 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 on Change Management Query Syntax V1 specification which is itself 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)

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

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
identifier ::= word (":" word)?
fulltext   ::= "oslc_qm:searchTerms" "=" value
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_qm.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_qm.properties=dc:creator,dc:modified
&oslc_qm.properties=dc%3Acreator%2Cdc%3Amodified

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 OSLC QM REST API specification.

Full Text Search

A full text search is performed when the reserved keyword oslc_qm:searchTerms is used in conjunction with the oslc_qm.query parameter. When oslc_qm:searchTerms is used in the request, each entry (hit) in the response MUST contain a oslc_qm:score property. The oslc_qm: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_qm: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_qm.query=state="open"&oslc_qm.properties="dc:title,dc:owner" 

Encoding Example

Not encoded:

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

References

Topic revision: r11 - 26 Jan 2010 - 15:58:54 - TWikiAdminUser
Main.QmQuerySyntaxV1 moved from Main.QmQuerySyntax on 03 Nov 2009 - 17:14 by PaulMcMahan - 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