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
.
TWiki
>
Main Web
>
CmHome
>
CmSpecificationV1
>
CmQuerySyntaxV1
(28 May 2009,
TWikiAdminUser
)
(raw view)
---+ Change Management Query Syntax _1.0 SPECIFICATION_ %RED% %ENDCOLOR% *Table of Contents* %TOC% ---++ 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 [[http://www.loc.gov/standards/sru/specs/cql.html][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 [[http://www.ietf.org/rfc/rfc2119.txt][RFC2119]]. Domain name examples use [[http://tools.ietf.org/html/rfc2606][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* * *oslc_cm:searchTerms*; a list of terms to apply to a [[http://en.wikipedia.org/wiki/Full_text_search][full text search]] processor *BNF* <verbatim>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/</verbatim> *Notes* 1 a word consists of any character with the Unicode class Alpha (alpha-numeric) as well as the characters ".", "-" and "_". 1 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 [[CmRestApiV1#Selective_properties][ =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: <verbatim>&oslc_cm.properties=dc:creator,dc:created &oslc_cm.properties=dc%3Acreator%2Cdc%3Acreated </verbatim> ---++++ 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. <verbatim>?oslc_cm.query=state="open"&oslc_cm.properties="dc:title,dc:owner{*}" </verbatim> ---++++ Encoding Example Not encoded: <verbatim>?oslc_cm.query=dc:title="use case 1" and dc:modified>="12-02-2008T18:42:30"</verbatim>Encoded: <br /><verbatim>?oslc_cm.query=dc%3Atitle%3D%22use%20case%201%22%20and%20dc%3Amodified%3E%3D%2212-02-2008T18 %3A42%3A30%22%20</verbatim> ---++ References * [[http://www.loc.gov/standards/sru/specs/cql.html][Library of Congress Contextual Query Language (CQL)]] * [[http://www.w3.org/TR/rdf-sparql-query/][SPARQL Query Language for RDF]]
E
dit
|
A
ttach
|
P
rint version
|
H
istory
: r22
<
r21
<
r20
<
r19
<
r18
|
B
acklinks
|
V
iew topic
|
Ra
w
edit
|
M
ore topic actions
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
Main
Main Web
Create New Topic
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
Webs
Main
Sandbox
TWiki
Български
Cesky
Dansk
Deutsch
English
Español
Français
Italiano
日本語
Nederlands
Polski
Português
Русский
Svenska
简体中文
簡體中文
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