It's all about the answers!

Ask a question

OSLC where query returns empty rows


TOMI MOOLAN SOURU (1315) | asked May 11 '23, 5:16 p.m.

 WE are trying to fetch data using OSLC queries. Unfortunately it returns empty rows


The API call without an OSLC select/where query returns all the rows as given below

requestURL="https://<server>:9443/qm/oslc_config/resources/com.ibm.team.vvc.Configuration"

It returns a lot of rows like this
  <rdf:Description rdf:about="https://<server>:9443/qm/oslc_config/resources/com.ibm.team.vvc.Configuration/_vBi8kvbqEeu2BNm-5GKwDg">
    <dcterms:identifier>_vBi8kvbqEeu2BNm-5GKwDg</dcterms:identifier>
    <oslc_config:selections rdf:resource="https://<server>:9443/qm/oslc_config/resources/com.ibm.team.vvc.Configuration/_vBi8kvbqEeu2BNm-5GKwDg/selections"/>
    <process:projectArea rdf:resource="https://<server>:9443/qm/process/project-areas/_dN2TEMKTEem1W-cJDHSXXQ"/>
  </rdf:Description>
</rdf:RDF>

The following  oslc where query returns empty rows even though record exist in the database. 
  requestURL="https://<server>:9443/qm/oslc_config/resources/com.ibm.team.vvc.Configuration"
  String strForOslcWhere = URLEncoder.encode("?oslc.where=rdf:Description{dcterms:identifier=<_dyDvZ73dEemoq9Xh_nvV0Q>}&oslc.select=*.","UTF-8");
  URI catalogUrl1 = UriBuilder.fromUri(requestURL+strForOslcWhere).build();

Is there anything wrong with our queries? 



Comments
Ian Barnard commented May 12 '23, 6:04 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 By "empty rows" you mean "no results"?


TOMI MOOLAN SOURU commented May 12 '23, 4:51 p.m. | edited May 12 '23, 5:31 p.m.

 We tried with oslc.where=dcterms%3Aidentifier%3D%22_vBi8kvbqEeu2BNm-5GKwDg%22 and it is working fine. Thanks for the quick responses. But still one more question spin around my head


Assume that an API response as given below
    <dcterms:identifier>_vBi8kvbqEeu2BNm-5GKwDg</dcterms:identifier>
    <process:projectArea rdf:resource="https://<server>:9443/qm/process/project-areas/_dN2TEMKTEem1W-cJDHSXXQ"/>
  </rdf:Description>

How can we use a "where query" to filter based on process:projectArea?

Would the following query is acceptable?
rdf:Description{process:projectArear=<https://<server>:9443/qm/process/project-areas/_dN2TEMKTEem1W-cJDHSXXQ>}


David Honey commented May 12 '23, 5:41 p.m. | edited May 12 '23, 5:48 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Again, you are not interpreting the RDF/XML representation correctly. In Turtle, this would be:

<https://<server>:9443/qm/oslc_config/resources/com.ibm.team.vvc.Configuration/_vBi8kvbqEeu2BNm-5GKwDg">
    dcterms:identifier "_vBi8kvbqEeu2BNm-5GKwDg" ;
    oslc_config:selections <https://<server>:9443/qm/oslc_config/resources/com.ibm.team.vvc.Configuration/_vBi8kvbqEeu2BNm-5GKwDg/selections> ;
    process:projectArea <https://<server>:9443/qm/process/project-areas/_dN2TEMKTEem1W-cJDHSXXQ> .

Turtle is a more human-friendly RDF serialization format that many find is easier to understand. So, if the query capability you are using supports querying on process:projectArea the unencoded query expression would be process:projectArea=<https://<server>:9443/qm/process/project-areas/_dN2TEMKTEem1W-cJDHSXXQ>; . However, that will only work if the query capability supports query on that property. You will probably have to just try it.

Accepted answer


permanent link
David Honey (1.8k17) | answered May 11 '23, 5:50 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited May 12 '23, 5:11 a.m.
Your oslc.where expression looks wrong.
rdf:Description{dcterms:identifier=<_dyDvZ73dEemoq9Xh_nvV0Q>}
That is querying for a resource that has an RDF statement with predicate rdf:Description that references a resource against which there is a dcterms:identifier with the specified subject. This is what is termed a nested property in OSLC terms. It's highly unlikely that predicate would be used. That is not a typical RDF representation. I think you are confusing the RDF/XML representation.

The result of an OSLC query is an LDPC (Linked Data Platform Container). See https://docs.oasis-open-projects.org/oslc-op/query/v3.0/os/oslc-query.html for details. That container will reference member URIs of the resources found by the query. The response may also contain one or more statements of properties against each member referenced in the container.

It looks like one of those resources has a dcterms:identifier of _vBi8kvbqEeu2BNm-5GKwDg . Note that this is a plain literal, not a resource, so should be specified as a quoted string in the query expression. So if you want to query for resources with that identifier, the unencoded query expression would be:
dcterms:identifier="_vBi8kvbqEeu2BNm-5GKwDg"
So the request would include the encoded parameter value as:
oslc.where=dcterms%3Aidentifier%3D%22_vBi8kvbqEeu2BNm-5GKwDg%22 .
TOMI MOOLAN SOURU selected this answer as the correct answer

Your answer


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