It's all about the answers!

Ask a question

RTC OSLC query not working


Oana Capatana (23111) | asked Dec 04 '18, 9:18 a.m.

 Hello,


I have RTC 6.0.6 installed.
I am trying to filter the workitems from a project area by type but I keep ending up with a list of all workitems from the project.
I have tried encoding and not encoding the oslc_cm.query parameter as follows but all attempts were unsuccessful.
https://<server:port>/ccm/oslc/contexts/_tQ4kMOZdEeiSKJbK_kaFqA/workitems?oslc.select=dcterms:type,dcterms:title,dcterms:identifier&oslc_cm.query=dcterms%3Atype%3Dtask
https://<server:port>/ccm/oslc/contexts/_tQ4kMOZdEeiSKJbK_kaFqA/workitems?oslc.select=dcterms:type,dcterms:title,dcterms:identifier&oslc_cm.query=dcterms%3Atype%3DTask
https://<server:port>/ccm/oslc/contexts/_tQ4kMOZdEeiSKJbK_kaFqA/workitems?oslc.select=dcterms:type,dcterms:title,dcterms:identifier&oslc_cm.query=dcterms:type=task
https://<server:port>/ccm/oslc/contexts/_tQ4kMOZdEeiSKJbK_kaFqA/workitems?oslc.select=dcterms:type,dcterms:title,dcterms:identifier&oslc_cm.query=dcterms:type=Task

The selection part works. Query I couldnt get any of the examples here https://jazz.net/wiki/bin/view/Main/ResourceOrientedWorkItemAPIv2 to work.

Any suggestions?

Thanks,
Oana

Accepted answer


permanent link
Jim Amsden (25837) | answered Dec 10 '18, 9:57 a.m.

dcterms:type with a string value is not considered a reliable mechanism for typing. I believe this usage is left over from OSLC 1.0. 

For OSLC Core 2.0, dcterms:type is deprecated and attempting to access it in a oslc.where query parameter fails indicating the property is an unknown attribute id. However, a GET on the work item does show that property.

RTC uses its own typing mechanism that is extensible and has proper namespaces. 

Use rtc_cm:type="com.ibm.team.workitem.workItemType.defect" in the oslc.where clause to find RTC defects.

OSLC Core 3.0 and OSLC Change Management 3.0 use rdf:type with standard OSLC namespaces to define specific subclasses of oslc_cm:ChangeRequest.

See this jazz forum entry for further details.




Oana Capatana selected this answer as the correct answer

Comments
Oana Capatana commented Dec 11 '18, 12:18 a.m.

Thank you for clarifying 

4 other answers



permanent link
Jim Amsden (25837) | answered Dec 04 '18, 1:31 p.m.

 Try setting header OSLC-Core-Version=2.0 and use OSLC 2.0 query: https://archive.open-services.net/bin/view/Main/OSLCCoreSpecQuery.html 


Comments
Oana Capatana commented Dec 05 '18, 12:39 a.m.

Thanks for your answer Jim!

If I use oslc.where from oslc 2.0 specification I can filter by common attributes like identifier or title but it still doesn;t work to filter by type.
I tried this (with OSLC-Core-Version header set to 2.0):
and i get this response:
{
  "oslc:statusCode": 400,
  "prefixes": {
    "oslc": "http:\/\/open-services.net\/ns\/core#"
  },
  "oslc:message": "Unexpected symbol: null"
}


Oana Capatana commented Dec 05 '18, 12:46 a.m.

 if I set "defect" instead of defect in the above url, I still get a 400 status and the error message is Unknown attribute id: [http:\/\/purl.org\/dc\/terms\/type], which is strange because it allows me to select it with oslc.select. 


permanent link
Jim Amsden (25837) | answered Dec 05 '18, 7:35 a.m.

You need to escape the # in the prefix definition URI with %23.


Comments
Oana Capatana commented Dec 05 '18, 7:46 a.m.

permanent link
Jim Amsden (25837) | answered Dec 05 '18, 9:23 a.m.

 https://<server>:<port>/ccm/oslc/contexts/_tQ4kMOZdEeiSKJbK_kaFqA/workitems?oslc.select=dcterms:type,dcterms:title,dcterms:identifier&oslc.where=dcterms:type="Defect"


should work. Here's the dcterms:type property of a defect work item I created:

        <dcterms:type rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Defect</dcterms:type>

But I see it doesn't. I'll look into it.


permanent link
Oana Capatana (23111) | answered Dec 10 '18, 3:34 a.m.

 I found the answer to this issue.

The oslc.where value should be rtc_cm:type="task" instead of dcterms:type="task"

This I think is non-intuitive since in the response the attribute show up as:
dcterms:type="Task"

Your answer


Register or to post your answer.