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
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
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:
- The oslc.select value is not URL encoded and contains ":", and
- The oslc.select value references the prefix "j.0" which is unlikely to have been defined by default and the URI does not define it using oslc.prefix. As a general principle, it's better to use a meaningful prefix name, and if it's not defined by default, specify oslc.prefix to define it. The known prefixes will be listed on the OSLC service provider using oslc:prefixDefinition. See section 5.2 of https://docs.oasis-open-projects.org/oslc-op/core/v3.0/ps01/discovery.html
Comments
Ian Barnard
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Dec 04 '20, 7:08 a.m.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.
G C
Dec 07 '20, 12:37 a.m.https://localhost:9090/testserver/resources - This is my server URL from where I am getting response using OSLC query.
Ian Barnard
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Dec 07 '20, 7:32 a.m.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.
Ian Barnard
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Dec 07 '20, 8:59 a.m.This is the most likely cause of the exception you're getting. To avoid the exception, use a published QueryCapability urls.