How to query for artifacts with specific attributes that exists
thimmaiah aa (26●3)
| asked Sep 21 '22, 8:32 a.m.
edited Sep 21 '22, 9:40 a.m. by David Honey (1.8k●1●7)
hello,
Is it possible to write an OSLC query for the artifacts that has attributes with any value? I'm aware of the query to pull artifacts for attributes with specific values (example Approved of Status attribute)
" &oslc.prefix=rm_property=<https://grarrc.ibm.com:9443/rm/types/>&oslc.select=*&oslc.where=rm_property:_PfIW0OrtEeGaNr-hWVrMiw=<https://grarrc.ibm.com:9443/rm/types/_PamcJOrtEeGaNr-hWVrMiw%233e9db9f1-3d5c-4716-aae0-f48d49260a8b>"
But Is there a possibility to query for artifacts with status attribute exists?
|
Accepted answer
David Honey (1.8k●1●7)
| answered Sep 21 '22, 8:49 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
No, that's currently not supported by OSLC query expressions.
This is an open issue - see https://github.com/oslc-op/oslc-specs/issues/454
David Honey selected this answer as the correct answer
Comments
thimmaiah aa
commented Sep 22 '22, 1:32 a.m.
Thank you for the response David.
So does it mean we can query only for the Enum attributes? What if we want to query for string attributes which can have any values? Any suggestion for that please?
David Honey
commented Sep 22 '22, 4:45 a.m.
| edited Sep 22 '22, 6:04 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
It means that an OSLC query cannot express a condition based on the existence or non-existence of a property, regardless of whether that property is a string, integer, enum, URI etc. See https://docs.oasis-open-projects.org/oslc-op/query/v3.0/os/oslc-query.html#oslc.where for details of the
oslc.where query expression syntax.
The OSLC query expression syntax goes back more than 10 years and was designed to be a lightweight mechanism that would not be too onerous to implement regardless of how an OSLC server persisted data. It was designed to be a persistence-agnostic query syntax. For example, it doesn't support
OR
conditions, paranethetical clauses, the ability to test for property existence or non-existence, or use constructs like regular expressions for string conditions that might be expected in more extensive query languages like SQL, SPARQL, Cypher, Gremlin etc.
It means that an OSLC query cannot express a condition based on the existence or non-existence of a property, regardless of whether that property is a string, integer, enum, URI etc. If you have a requirement to query for the existence of some property (any value), then that use case is currently not supported by the OSLC Query specification. See https://docs.oasis-open-projects.org/oslc-op/query/v3.0/os/oslc-query.html#oslc.where for details of the The OSLC query expression syntax goes back more than 10 years and was designed to be a lightweight mechanism that would not be too onerous to implement regardless of how an OSLC server persisted data. It was designed to be a persistence-agnostic query syntax. For example, it doesn't support
thimmaiah aa
commented Sep 22 '22, 6:22 a.m.
Thank you very much again for the response. It really helped a lot. You can achieve this by including the attribute in the oslc.select list and then post-processing the query results. My OSS ELM-Python-Client has an example oslcquery commandline app which does exactly this filtering to, for example, filter out (or in) just core artifacts - core artifacts have a folder URI in rm_nav:parent where module artifacts don't have rm_nav:parent.
FYI I also added extended query syntax for parenthesised and and/or expressions, these require an OSLC Query for each parenthesised expression then the app does the setwise and/or. TBCH I haven't yet found a use for this extended syntax apart from demonstrations :-) For more info see here
I encourage all consumers of OSLC query to participate in the OSLC Open Projects work group, and submit issues for use cases they want to support that are not currently supported. This will help drive the evolution of OSLC specifications, such as OSLC query, to address use cases that are currently not supported.
showing 5 of 6
show 1 more comments
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.