It's all about the answers!

Ask a question

How to get the value of Owned by attribute using HTTP Client Query method(Custom Java implementation)?

Y Deepak (712) | asked Feb 08 '23, 6:16 a.m.


We are trying to get a custom workitem type named Release Schedule and it's attributes details using HTTP Client Query method and the headers are "Content-Type", "application/Json", "OSLC-Core-Version", "2.0", "Accept", "application/Json".

The application version is with iFix027.

We are writing a HTTP Client Query to fetch  field Ownedby by using dcterms:contributor.

String workitemUrl = cnfprop.getWebContextUrl() + "/oslc/contexts/_JSWgwaSqEeqGIaAO2lNttQ/workitems?"

But while fetching we are getting this parser exception, but for other attribute like filedagainst we are getting output  but for owned by  we are unable to get the output.

We are getting this Parser Exception

org.apache.wink.json4j.JSONException: Expecting '{' on line 1, column 6 instead, obtained token: 'Token: String - 'Error''
at org.apache.wink.json4j.internal.Parser.parseObject(
at org.apache.wink.json4j.internal.Parser.parse(
at org.apache.wink.json4j.internal.Parser.parse(
at org.apache.wink.json4j.JSONObject.<init>(
at com.test.Query.getfiledAgainst(
at com.test.Query.main(

Could you Please help on this how to get ownedby attribute value.


Accepted answer

permanent link
David Honey (1.8k17) | answered Feb 09 '23, 4:34 a.m.
edited Feb 09 '23, 4:38 a.m.
It looks like rtc_cm:ownedBy is not defined as property.
Have you checked the resource shape for resources of that type in that project area to see what properties are defined?
Or looked at the RDF of an example work item from that project area to see how owner is represented?

If I look at work items on I do not see a rtc_cm:ownedBy propery. Instead, the owner is represented by dcterms:contributor as per the OSLC Change Management specification - see

If I look at the resource shape, I see it contains:
      a       oslc:Property ;
      oslc:allowedValues <> ;
      oslc:defaultValue <> ;
      oslc:name "contributor"^^<> ;
      oslc:occurs oslc:Zero-or-one ;
              dcterms:contributor ;
      oslc:range <> ;
      oslc:readOnly "false"^^<> ;
      oslc:representation oslc:Either ;
      oslc:valueType oslc:Resource ;
      dcterms:title "Owned By"^^rdf:XMLLiteral .

Which tells me that dcterms:contributor is the property for owner.
Ralph Schoon selected this answer as the correct answer

2 other answers

permanent link
David Honey (1.8k17) | answered Feb 08 '23, 7:04 a.m.
edited Feb 08 '23, 7:12 a.m.

If you are using OSLC related REST services, such as OSLC query, you should use a supported RDF media type. OSLC and Linked Lifecycle data is about RDF. Data is interchanged using RDF serialization formats such a RDF/XML or Turtle. Commonly supported RDF media types include application/rdf+xml , application/turtle , test/turtle .See section 4.1.3 of

Note that application/json is not an RDF media type. While some ELM application REST services might support it, the JSON representation is not defined by OSLC. Clients doing so are likely to become dependent on proprietary and undocumented JSON representations. You can represent RDF as json using JSON-LD for which the media type is application/ld+json . However, few, if any, ELM REST services currently support that media type.

One thing I notice is that your code example is manually constructing the requiest URI. This is bad practice. Instead, you should be using OSLC discovery to find the query base URI of the OSLC query capability you want to use. See that way, if an OSLC server changes the endpoint URIs in a later release, then clients should not be impacted. If you hard code assumptions about the paths, your OSLC client code will be more fragile and likely to break if such changes happen.

Lastly, went end of service on 2022-10-31 and will no longer be remediated against security vulnerabilities. I highly recommend you upgrade to 7.0.2.

Ralph Schoon commented Feb 08 '23, 8:17 a.m.

I would like to point out that we have gotten another question from this user, about the same or similar topics (OSLC, JSON, JAVA API) and answered pretty much already. The parser error is the same as before. You have also pointed out the issues already in your answer David.  

Y Deepak commented Feb 09 '23, 12:25 a.m.

 Hi Ralph,

The Parser issue is already resolved. For other attributes like Planned for, filed against, we are getting the expected output but for only Owned by attribute it is giving this issue. But other attributes are working fine.
In the HTTP Client Query if I used dcterms:contributor  as id in the query it is showing the above parser issue. But other attributes are working fine.

But if I am try to use rtc_cm:ownedBy as id it is showing an error like
The Key [rtc_cm:ownedby] was not  in the Map. 

Cloud you please help on this one.


Ralph Schoon commented Feb 09 '23, 2:27 a.m.

How? You seem to ignore the answers.

As David has already stated in his answer and in JSON is not a supported media type.

permanent link
Ralph Schoon (63.2k33646) | answered Feb 08 '23, 6:43 a.m.

 We had a similar question recently. The answer was to use application/rdf-xml as content type and accept and not JSON.

Your answer

Register or to post 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.