OSLC where query returns empty rows
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?
|
Accepted answer
David Honey (1.8k●1●7)
| 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:
So the request would include the encoded parameter value as:
TOMI MOOLAN SOURU selected this answer as the correct answer
|
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.
Comments
By "empty rows" you mean "no results"?
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
Again, you are not interpreting the RDF/XML representation correctly. In Turtle, this would be:
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 beprocess: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.