Jazz Register Log in
Jazz Forum Welcome to the Jazz Community Forum

Welcome to the Jazz Community Forum

Connect and collaborate with IBM Engineering experts and users

How to query for artifacts with specific attributes that exists

 

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)


But Is there a possibility to query for artifacts with status attribute exists? 

0 votes


Accepted answer

Permanent link
No, that's currently not supported by OSLC query expressions.
David Honey selected this answer as the correct answer

1 vote

Comments

 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?

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 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.

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

Register or log in to post 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,971
× 516

Question asked: Sep 21 '22, 8:32 a.m.

Question was seen: 1,114 times

Last updated: Sep 22 '22, 6:50 a.m.

Confirmation Cancel Confirm