How to use RM API/OSLC where clause using not equal / null conditions
&oslc.where=rm_property:_f1FOIfawEeWWmYXMBVuVVw=<https://itec-rrc.fmr.com/rm/types/_53IXkfasEeWWmYXMBVuVVw%2399d86095-0a43-4efd-87ce-87bb63703d02>
&oslc.where=rm_property:_T-0KwfawEeWWmYXMBVuVVw=<https://itec-rrc.fmr.com/rm/types/_i5ORYfasEeWWmYXMBVuVVw%23f481adbb-8b77-41cf-8f00-acced77cab23>
&oslc.where=rm_property:_hwzT8fawEeWWmYXMBVuVVw=<https://itec-rrc.fmr.com/rm/types/_TDTsIfatEeWWmYXMBVuVVw%2358e1fb0e-17ea-4e88-8c57-e7d0108c3d45>
&oslc.where=rm_property:_j4WPQfawEeWWmYXMBVuVVw=<https://itec-rrc.fmr.com/rm/types/_dLHpoPatEeWWmYXMBVuVVw%23acc27ca3-edeb-43cc-8949-a1eadb5f76b2>
We have an attribute that may or may not have a value assigned. From the following reference:
https://www.ibm.com/support/knowledgecenter/SSZRHJ/com.ibm.mif.doc/gp_intfrmwk/oslc/r_oslc_query_params.html
The parent!="*" query is semantically equivalent to the parent="NULL" query.
we are trying to query for artifacts where the last attribute does not have a value assigned; i.e. is null. This is needed since we need to exclude the artifacts where a value is assigned. We are unsuccessful with the following. Is there anything wrong with the use of !=%22*%22
&oslc.where=rm_property:_j4WPQfawEeWWmYXMBVuVVw!=%22*%22
We initially tried and were unsuccessful with "" or " " such as
&oslc.where=rm_property:_j4WPQfawEeWWmYXMBVuVVw=%22%22
Any other ideas would be appreciated.
3 answers
I had the same issue while is using the ClearQuest OSLC 2.0 API.
BTW, these are the specifications that RDNG would adhere to.
http://open-services.net/bin/view/Main/RmSpecificationV2#Query_Capabilities
http://open-services.net/bin/view/Main/OslcCoreSpecification#Query_Capabilities
http://open-services.net/bin/view/Main/OSLCCoreSpecQuery
P.S. In the tutorial, not even the "!=" operator is mentioned.
https://jazz.net/library/article/1197
From Andri Berezovskyi:
OSLC Query allows wildcards only on the left hand side of the operator, to filter properties. See the BNF over here https://tools.oasis-open.org/version-control/svn/oslc-core/trunk/specs/oslc-query.html#oslc.where, take a look at the following fragment:term ::= identifier_wc comparison_op value | identifier_wc space in_op space? in_valscoped_term ::= identifier_wc "{" compound_term "}"
identifier_wc ::= identifier | wildcard
The problem you have is surfacing because RDF does not allow modelling a NULL value – it is "modelled" by a nonexistence of the triple, but the OSCL Query does not allow you to test for the presence of a property alone.BUT, all OSLC Query implementations MUST respect https://www.w3.org/TR/sparql11-query/#OperatorMapping semantics. So what you can do is the following:
oslc.where=rm_property:_j4WPQfawEeWWmYXMBVuVVw>="test" or rm_property:_j4WPQfawEeWWmYXMBVuVVw<="test"
You can try out an example in SPARQL here: http://fuseki.aide.md.kth.se/dataset.html?tab=query&ds=/aide-pror#query=SELECT+%3Fsubject+%3Fpredicate+%3Fobject%0AWHERE+%7B+GRAPH+%3Fg+%7B%0A++%3Fsubject+%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Fterms%2Fidentifier%3E+%3Fobject+.%0A++++FILTER(%3Fobject+%3E%3D+%22test%22+%7C%7C+%3Fobject+%3C%3D+%22test%22).%0A++%7D%7D%0ALIMIT+25
If IBM's OSLC Query implementation is compliant, it MUST retain the same semantics of the binary comparison operator.
Comments
Daniel Senko
Sep 22 '16, 3:15 p.m.Daniel Senko
Sep 22 '16, 3:18 p.m.Daniel Senko
Sep 22 '16, 3:18 p.m.Daniel Senko
Sep 22 '16, 3:19 p.m.