It's all about the answers!

Ask a question

Why am I getting Exception while executing OSLC properties query on DNG?


G C (452) | asked Dec 04 '20, 1:28 a.m.

 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
 
 
Please let me know how this can be fixed ASAP.


Comments
Ian Barnard commented Dec 04 '20, 7:01 a.m. | edited Dec 04 '20, 7:08 a.m.
JAZZ DEVELOPER

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

In have my sample response as shown below

<dcterms:title rdf:parseType="Literal">Some Title</dcterms:title>


Ian Barnard commented Dec 07 '20, 7:32 a.m.
JAZZ DEVELOPER

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.



For more details about using OSLC with DOORS Next see https://jazz.net/library/article/1197


Ian Barnard commented Dec 07 '20, 8:42 a.m. | edited Dec 07 '20, 8:59 a.m.
JAZZ DEVELOPER

This is the most likely cause of the exception you're getting. To avoid the exception, use a published QueryCapability urls. 

2 answers



permanent link
David Honey (4056) | answered Dec 04 '20, 5:50 a.m.
JAZZ DEVELOPER

Are you URL encoding the values for the oslc.properties and oslc.prefix parameters?
URL encoding is required for these because they typically contain characters such as ":", "<", ">" etc.


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


permanent link
David Honey (4056) | answered Dec 07 '20, 5:32 a.m.
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 


David Honey commented Dec 07 '20, 6:59 a.m.
JAZZ DEVELOPER
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

Your answer


Register or to post your answer.