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 query with a dcterm and a custom value, I am getting the below error Invalid prefix definition: j.0
Please let me know how this can be fixed ASAP.

Ian Barnard commented Dec 04 '20, 7:01 a.m. | edited 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 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.

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

Ian Barnard commented Dec 07 '20, 8:42 a.m. | edited 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. 

2 answers

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

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

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

You might try instead of As explained in OSLC Query 3.0 selects properties of the query result container itself, whereas selects properties of each member of that container found by the query. For OSLC queries, you almost always want to use While most server implementations that implement OSLC query support, many might not support

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.
I would expect that to fail because:
  • The value is not URL encoded and contains ":", and
  • The 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

Your answer

Register or to post your answer.