It's all about the answers!

Ask a question

What must OSLC query parameters for DOORS artifact?


Henkie Maritz (37512) | asked Jan 06 '16, 12:14 a.m.
edited Jan 06 '16, 12:16 a.m.
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>


Comments
Henkie Maritz commented Jan 06 '16, 2:30 a.m.

I am trying to figure this out, what oslc.prefix are allowed?


Sudarshan Rao commented Jan 06 '16, 3:12 a.m.

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.

Accepted answer


permanent link
Donald Nong (14.5k414) | answered Jan 07 '16, 4:17 a.m.
edited Jan 07 '16, 4:18 a.m.
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
Henkie Maritz commented Jan 06 '16, 4:17 a.m. | edited Jan 19 '16, 10:34 p.m.

If I look at the log files of this attempt,
WHERE {
    {
    ?R1 jfs:resourceContext <https://tasjazz01.tasima.co.za:9443/rm/process/project-areas/_aPM48BvhEeWSspTLOXWHOg> .
    ?R1 http://www.ibm.com/xmlns/rrm/1.0/title "C6 - Pay NOF".
  }
It seems that the prefix does not get passed in correctly?
It should have been:
?R1 rrm:title <http://www.ibm.com/xmlns/rrm/1.0/> "C6 - Pay NOF".




Henkie Maritz commented Jan 07 '16, 6:50 a.m.

Follow-up comment to this one, so this OSLC query works:
https://jazzserver:9443/rm/views?oslc.query=true&projectURL=https%3A%2F%2Ftasjazz01.tasima.co.za%3A9443%2Frm%2Fprocess%2Fproject-areas%2F_aPM48BvhEeWSspTLOXWHOg
  &oslc.prefix=dcterms=<http://purl.org/dc/terms/>&oslc.select=&oslc.where=dcterms:identifier=64451

But this one don't:
https://jazzserver:9443/rm/views?oslc.query=true&projectURL=https%3A%2F%2Ftasjazz01.tasima.co.za%3A9443%2Frm%2Fprocess%2Fproject-areas%2F_aPM48BvhEeWSspTLOXWHOg
  &oslc.prefix=dcterms=<http://purl.org/dc/terms/>&oslc.select=
&oslc.where=dcterms:title="C6 - Pay NOF"

The only difference is that instead of:
  dcterms:identifier=64451
We now search for:
  dcterms:title="C6 - Pay NOF"

I'm still not sure about the query parameters since the result does have both dcterms:title and dcterms:identifier


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



permanent link
Sudarshan Rao (1963) | answered Jan 06 '16, 1:10 a.m.
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
The resource representation was retrieved from the following URL on HTTP Get:
https://jazzserver:9443/rm/publish/text?resourceURI=_M6fxmBv1EeWSspTLOXWHOg
Even if I add the headers suggested, the output remain the same.

I think what is confusing to me is:
1. The resource representation is what I know how our artifacts looks in DNG.
2. This does NOT correlate with examples. Not really knowing what prefix I should use.

Lastly, when trying to access the OSLC specs, I keep on getting a page that looks like this:
Transfer-Encoding: chunked Content-Encoding: gzip Vary: Accept-Encoding Date: Wed, 06 Jan 2016 06:31:16 GMT Accept-Ranges: bytes Server: LiteSpeed X-UA-Compatible: IE=edge Connection: close 2000 ‹Ô}ërG²æoó)ÚPؤÆ@Mñæ¡(Ò’%jÊÇ™Fh‚°4ÜÝÅñúy7bÿíì÷eVUW_À‹GÞõNÄXDw]²²ò^YÙ»_¾8=<ÿéíQp•MÆÁÛwÏO^f»ý~ý°Ý~qþ"øûËó×'A§µœ'á4e£xŽÛí£7 q•e³ívûúúºu½ÞŠ“aûü¬ý‰cuØÙüÙ̼ž­A6hìïÊ|Ÿ&ãiºW3JçÙ³gÚ¹ Ñö8œ÷Ñôâ]·ø?ö—v¯¢p€²Q6ŽöƒÓîÉáaœDÝYÔÿÛ


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.
Really not sure what prefix should be used to get to that.


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.
1. So, I used RESTClient to retrieve the artifact. See Artifact XML below.
2. Based on the artifact, I modified my query as follows - inline with your advice:
https://tasjazz01.tasima.co.za:9443/rm/views?oslc.prefix=rrm=<http://www.ibm.com/xmlns/rrm/1.0/>&oslc.select=*&oslc.where=rrm:title="C6 - Pay NOF"
3. I executed this query from the REST client and received a parse error. I included the log file from rm.log and can see that for some reason it is replacing the prefix wrongly:
 <rdf:Description>
    <err:detailedMessage rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
    >SPARQL error when parsing:
SELECT DISTINCT ?R1 ?R1_resourceContext ?R1_v1 ?R1_v2 ?R1_v3 ?R1_v4 ?R1_v5 ?R1_v6
WHERE {
    {
    ?R1 http://www.ibm.com/xmlns/rrm/1.0/title "C6 - Pay NOF".
  }


Henkie Maritz commented Jan 06 '16, 4:09 a.m.

The rm.log gives the following exception:
com.hp.hpl.jena.query.QueryParseException: Line 24, column 9: Unresolved prefixed name: http:
        at com.ibm.rdm.fronting.server.rrs.views.execution.sparql.SparqlExpr.<init>(SparqlExpr.java:27)
        at com.ibm.rdm.fronting.server.rrs.views.execution.grid.filter.FilteredSparqlExecutor.execute(FilteredSparqlExecutor.java:36)
        at com.ibm.rdm.fronting.server.rrs.views.execution.grid.GridViewExecutor.executeSparqlWithSupportForAutopagedFilter(GridViewExecutor.java:156)
        at com.ibm.rdm.fronting.server.rrs.views.execution.grid.GridViewExecutor.executeWithCountAndFormatResults(GridViewExecutor.java:132)
        at com.ibm.rdm.fronting.server.rrs.views.execution.grid.ArtifactGridViewExecutor.executeGridViewRequest(ArtifactGridViewExecutor.java:52)
com.ibm.rdm.fronting.server.rrs.views.execution.grid.GridViewExecutor.execute(GridViewExecutor.java:90)


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:
oslc.prefix=dcterms=<http://purl.org/dc/terms/>&oslc.select=*&oslc.where=dcterms:title="C6 - Pay NOF"

showing 5 of 6 show 1 more comments

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.