What must OSLC query parameters for DOORS artifact?
Hi
I'm working my way through this article: http://www.ibm.com/developerworks/rational/library/oslc-services-rational-doors/ I'm getting stuck with the OSLC query. See my code: // Find projectServiceURL: https://jazzserver:9443/rm/oslc_rm/_aPM48BvhEeWSspTLOXWHOg/services.xml String projectServiceURL = findServiceProviderURL(dngClient, projectName); // queryCapability.base: https://jazzserver:9443/rm/views?oslc.query=true&projectURL=https%3A%2F%2Ftasjazz01.tasima.co.za%3A9443%2Frm%2Fprocess%2Fproject-areas%2F_aPM48BvhEeWSspTLOXWHOg String queryCapability = dngClient.lookupQueryCapability(projectServiceURL, OSLCConstants.OSLC_RM_V2, OSLCConstants.RM_REQUIREMENT_TYPE); OslcQueryParameters queryParams = new OslcQueryParameters(); queryParams.setPrefix("rrm=<http://www.ibm.com/xmlns/rrm/1.0/>"); queryParams.setSelect("*"); queryParams.setWhere("rrm:title=\"" + title + "\""); OslcQuery query = new OslcQuery(dngClient, queryCapability, 10, queryParams); This query returns nothing. I really struggle / need direction on the query params. Below is an extract from a DOORS artifact. What must the query parameters be to for example select artifacts where <attribute:customAttribute has the following values: attribute:name="Requirement Identifier" attribute:value="1TXN77" <?xml version="1.0" encoding="UTF-8"?> <ds:dataSource xmlns:ds="http://jazz.net/xmlns/alm/rm/datasource/v0.1" xmlns:rrm="http://www.ibm.com/xmlns/rrm/1.0/" xmlns:attribute="http://jazz.net/xmlns/alm/rm/attribute/v0.1" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:history="http://jazz.net/xmlns/alm/rm/history/v0.1" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:text="http://jazz.net/xmlns/alm/rm/text/v0.1" appId="RRC" rrm:totalCount="1" vMajor="50" vMinor="20"> <ds:artifact attribute:itemId="_M6fxmBv1EeWSspTLOXWHOg"> <rrm:title attribute:itemId="_abXFoRvhEeWSspTLOXWHOg">C6 - Pay NOF</rrm:title> <rrm:description attribute:itemId="_aa5yoRvhEeWSspTLOXWHOg"/> <rrm:identifier attribute:itemId="_abBHYRvhEeWSspTLOXWHOg">64451</rrm:identifier> <rrm:about>https://jazzserver:9443/rm/resources/_M6fxmBv1EeWSspTLOXWHOg</rrm:about> <rrm:format attribute:itemId="_aaeU0RvhEeWSspTLOXWHOg">Text</rrm:format> <rrm:collaboration> <rrm:creator attribute:itemId="_aazE8RvhEeWSspTLOXWHOg"> <rrm:about>https://jazzserver:9443/jts/users/henkiem</rrm:about> <rrm:alternative>https://jazzserver:9443/jts/resource/itemName/com.ibm.team.repository.Contributor/henkiem</rrm:alternative> <rrm:title>henkiem</rrm:title> </rrm:creator> <rrm:created attribute:itemId="_aasXQRvhEeWSspTLOXWHOg">2015-06-26T11:19:25.232+0000</rrm:created> <rrm:modified attribute:itemId="_abIcIRvhEeWSspTLOXWHOg">2015-06-26T11:19:25.935+0000</rrm:modified> <rrm:attributes> <attribute:objectType attribute:itemId="_bM9hsRvhEeWSspTLOXWHOg" attribute:name="Transaction" attribute:projectAreaItemId="_aPM48BvhEeWSspTLOXWHOg" attribute:projectAreaName="eNaTIS"> <attribute:customAttribute attribute:datatype="http://www.w3.org/2001/XMLSchema#int" attribute:isEnumeration="true" attribute:isMultiValued="false" attribute:itemId="_bFMs0RvhEeWSspTLOXWHOg" attribute:literalId="_bEzEMRvhEeWSspTLOXWHOg#caddae21-69f5-40cb-8601-193870000f96" attribute:literalName="Completed" attribute:name="Status" attribute:value="13"/> <attribute:customAttribute attribute:datatype="http://www.w3.org/2001/XMLSchema#int" attribute:isEnumeration="true" attribute:isMultiValued="false" attribute:itemId="_bF4pVBvhEeWSspTLOXWHOg" attribute:literalId="_bFfnwRvhEeWSspTLOXWHOg#d981374a-4bd1-4549-a338-affbd67af4c7" attribute:literalName="N - No" attribute:name="Design Review Completed?" attribute:value="1"/> <attribute:customAttribute attribute:datatype="http://www.w3.org/2001/XMLSchema#int" attribute:isMultiValued="false" attribute:itemId="_atpIdhvhEeWSspTLOXWHOg" attribute:name="RootTag#" attribute:value="77" attribute:valueTS=""/> <attribute:customAttribute attribute:datatype="http://www.w3.org/2001/XMLSchema#string" attribute:isMultiValued="false" attribute:itemId="_atO4wRvhEeWSspTLOXWHOg" attribute:name="Requirement Identifier" attribute:value="1TXN77" attribute:valueTS=""/> <attribute:customAttribute attribute:datatype="http://www.w3.org/2001/XMLSchema#string" attribute:isMultiValued="false" attribute:itemId="_bJNqIRvhEeWSspTLOXWHOg" attribute:name="eNaTIS Menu Code" attribute:value="C6" attribute:valueTS=""/> <attribute:customAttribute attribute:datatype="http://www.w3.org/2001/XMLSchema#int" attribute:isEnumeration="true" attribute:isMultiValued="false" attribute:itemId="_bDcZURvhEeWSspTLOXWHOg" attribute:literalId="_bC-fQRvhEeWSspTLOXWHOg#c78aa754-78d1-4616-899d-48c62e19098c" attribute:literalName="Johan Kriel" attribute:name="System Analyst" attribute:value="2"/> <attribute:customAttribute attribute:datatype="http://www.w3.org/2001/XMLSchema#string" attribute:isMultiValued="false" attribute:itemId="_bCCrIRvhEeWSspTLOXWHOg" attribute:name="Page Sequence" attribute:value="P00205, P00215" attribute:valueTS=""/> <attribute:customAttribute attribute:datatype="http://www.w3.org/2001/XMLSchema#string" attribute:isMultiValued="false" attribute:itemId="_bJ4_kRvhEeWSspTLOXWHOg" attribute:name="Menu Level 1" attribute:value="C: Cashier" attribute:valueTS=""/> <attribute:customAttribute attribute:datatype="http://www.w3.org/2001/XMLSchema#int" attribute:isMultiValued="false" attribute:itemId="_bI3E0RvhEeWSspTLOXWHOg" attribute:name="Old NaTIS Spec - # of lines" attribute:value="321" attribute:valueTS=""/> <attribute:customAttribute attribute:datatype="http://www.w3.org/2001/XMLSchema#string" attribute:isMultiValued="false" attribute:itemId="_bJjBURvhEeWSspTLOXWHOg" attribute:name="NaTIS Menu Code" attribute:value="C6" attribute:valueTS=""/> <attribute:customAttribute attribute:datatype="http://www.w3.org/2001/XMLSchema#int" attribute:isEnumeration="true" attribute:isMultiValued="false" attribute:itemId="_bEdF8RvhEeWSspTLOXWHOg" attribute:literalId="_bEDdURvhEeWSspTLOXWHOg#da108eff-f3a7-4fba-a06e-2562419f5a97" attribute:literalName="Txn" attribute:name="Type" attribute:value="0"/> <attribute:customAttribute attribute:datatype="http://www.w3.org/2001/XMLSchema#int" attribute:isMultiValued="false" attribute:itemId="_abBHYRvhEeWSspTLOXWHOg" attribute:name="Identifier" attribute:value="64451" attribute:valueTS=""/> <attribute:customAttribute attribute:datatype="http://www.w3.org/2001/XMLSchema#int" attribute:isEnumeration="true" attribute:isMultiValued="false" attribute:itemId="_bHCf4RvhEeWSspTLOXWHOg" attribute:literalId="_bGnCEBvhEeWSspTLOXWHOg#75cd21e5-796c-45ed-be44-0e21afe058df" attribute:literalName="Release 7" attribute:name="Planned Release" attribute:value="9"/> </attribute:objectType> </rrm:attributes> <rrm:comments> <rrm:href>https://jazzserver:9443/rm/publish/comments?resourceURI=_M6fxmBv1EeWSspTLOXWHOg</rrm:href> </rrm:comments> <rrm:revisions> <rrm:href>https://jazzserver:9443/rm/publish/revisions?resourceURI=_M6fxmBv1EeWSspTLOXWHOg</rrm:href> <rrm:about>https://jazzserver:9443/rm/resources/_M6fxmBv1EeWSspTLOXWHOg?revision=_NBRH8Bv1EeWSspTLOXWHOg</rrm:about> </rrm:revisions> </rrm:collaboration> <ds:location> <ds:project> <rrm:title>eNaTIS</rrm:title> <rrm:description>Requisite Pro project for the eNaTIS Main Branch.</rrm:description> <rrm:about>https://jazzserver:9443/rm/resource/itemOid/com.ibm.team.process.ProjectArea/_aPM48BvhEeWSspTLOXWHOg</rrm:about> <rrm:alternative>https://jazzserver:9443/rm/process/project-areas/_aPM48BvhEeWSspTLOXWHOg</rrm:alternative> </ds:project> <ds:parentFolder> <rrm:title>Transactions</rrm:title> <rrm:about>https://jazzserver:9443/rm/folders/_phRU0RvhEeWSspTLOXWHOg</rrm:about> </ds:parentFolder> </ds:location> |
Accepted answer
Be very careful with what you are using. Judging by the URL, I think you are using the reportable REST API, not the OSLC API. They are different. For reportable REST API, refer to the below wiki.
https://jazz.net/wiki/bin/view/Main/RRCReportableRestAPI For OSLC API, refer to this article. https://jazz.net/library/article/1197 Henkie Maritz selected this answer as the correct answer
Comments If I look at the log files of this attempt,
Henkie Maritz
commented Jan 07 '16, 4:54 a.m.
Thanks.
Henkie Maritz
commented Jan 07 '16, 6:50 a.m.
Follow-up comment to this one, so this OSLC query works:
Donald Nong
commented Jan 08 '16, 4:43 a.m.
If you check the Reportable REST API wiki page, you should notice the lack of mentioning about OSLC query capability - it is not OSLC API. To have a correct OSLC query format does not guarantee anything. The capability needs to be implemented in the product core before you can use it. If it has not been implemented at all, you will not get anything out of it. That is the reason I suggested you check out the wiki page in the first place.
|
One other answer
Firstly, the article you refer to is for Rational DOORS; and you seem to be using Rational DOORS Next Generation. These are two different applications. For Rational DOORS Next Generation, this is a better article:
https://jazz.net/library/article/1197 Next, the resource representation you refer to in your question does not seem to be a rdf representation. I'd suggest you take a look at the response when you use application/rdf+xml as Accept header (and OSLC-Core-Version header set to 2.0). That should give you better idea about the parameters to use. For example, if we're querying for something in title, then I'd use dcterms:title. I'm not entirely clear about what you're trying to query. Are you trying to look for multiple words within same attribute? I've not tried it, but 'and' is supported in oslc.where. So that may help. For a precise description of how to form the query, you may refer to the core query specification here: http://open-services.net/bin/view/Main/OSLCCoreSpecQuery#oslc_where Comments
Henkie Maritz
commented Jan 06 '16, 1:32 a.m.
Thanks Sudarshan
Henkie Maritz
commented Jan 06 '16, 1:34 a.m.
You asked about what I want to retrieve. I need to get a artifact resource where the custom attribute equals a specific value. These custom attributes are specific to our artifact types in DNG.
1
Sudarshan Rao
commented Jan 06 '16, 3:21 a.m.
Try using RESTClient add-on for Mozilla, use the headers I mentioned earlier and do a GET on your artifact. That may help in understanding what namespace your attribute belongs to, and constructing an appropriate query.
Henkie Maritz
commented Jan 06 '16, 3:59 a.m.
I have done that and is getting stuck here.
Henkie Maritz
commented Jan 06 '16, 4:09 a.m.
The rm.log gives the following exception:
Sudarshan Rao
commented Jan 06 '16, 5:56 a.m.
Try appending the following to the queryBase URL and check if you get the required result:
showing 5 of 6
show 1 more comments
|
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.
Comments
I am trying to figure this out, what oslc.prefix are allowed?
Excerpt from specs:
"In addition to the preceeding query parameters, we also define
oslc.prefix
which is used to define the prefixes for prefixed names that appear in the other query parameters."So, for example, if you intend to query on dcterms:title, then the prefix should contain -
oslc.prefix=dcterms=<http://purl.org/dc/terms/>
Thus, what you specify for prefix will depend on what attributes you choose to query and what namespace it belongs to. To get that info, you need to look at either instanceShape or an artifact representation.