Why am I getting Exception while executing OSLC properties query on DNG?
When I try to execute oslc.properties query with a dcterm and a custom value, I am getting the below error
com.ibm.oslc.query.parser.select.ParseException: Invalid prefix definition: j.0
The query would be like - https://localhost:9090/testserver/resources?oslc.properties=j.0:sample,dcterms:title&oslc.prefix=j.0=<http://localhost:9090/testserver/>,dcterms=<http://purl.org/dc/terms/>
Please let me know how this can be fixed ASAP.
|
2 answers
David Honey (1.8k●1●7)
| answered Dec 04 '20, 5:50 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Are you URL encoding the values for the oslc.properties and oslc.prefix parameters?
Comments
G C
commented Dec 07 '20, 12:02 a.m.
I tried encoding as well, but if I encode, I am not getting the filtered results.
I am using oslc.properties just because I need only those values in the response specified in the query
|
David Honey (1.8k●1●7)
| answered Dec 07 '20, 5:32 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER You might try oslc.select instead of oslc.properties. As explained in OSLC Query 3.0 oslc.properties selects properties of the query result container itself, whereas oslc.select selects properties of each member of that container found by the query. For OSLC queries, you almost always want to use oslc.select. While most server implementations that implement OSLC query support oslc.select, many might not support oslc.properties.
Comments
G C
commented Dec 07 '20, 6:01 a.m.
I tried using OSLC select but it is not filtering selected values from the response, my query is like
The query would be like - https://localhost:9090/testserver/resources?oslc.select=dcterms:title,j.0:sample
I would expect that to fail because:
|
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
I've never seen an OSLC Query for DNG based on something like your URL https://localhost:9090/testserver/resources - was this retrieved from a query capability? Or where else did you get it from? Also what is j.0:sample as a URI - this has to be the URI of an attribute type definition. I'm not sure j.0 is valid as a prefix, try j0 or just j? And what headers are you sending with the GET? It's usually easiest to get your query working the first time by using a REST client like Postman - once it works then apply the same headers/parameters in your code.
https://localhost:9090/testserver/resources - This is my server URL from where I am getting response using OSLC query.
AFAICT https://localhost:9090/testserver/resources isn't a published OSLC query URL, i.e. it's not in a QueryCapability, so you're unlikely to get any sense out of it using OSLC Query parameters.
This is the most likely cause of the exception you're getting. To avoid the exception, use a published QueryCapability urls.