It's all about the answers!

Ask a question

Lyo OSLC does not retrieve all DOORS attribute


Ahmed Waheed (1124) | asked Jul 13 '18, 8:37 a.m.

I need to retrieve requirements data from DOORS by URL, I am using the following code for that



      ClientResponse response = client.getResource(url, OslcMediaType.APPLICATION_RDF_XML);
      System.setProperty(AbstractOslcRdfXmlProvider.OSLC4J_STRICT_DATATYPES, "false");
      Requirement requirement = new Requirement();
      requirement = response.getEntity(Requirement.class);

The response (even the raw rdf XML) contains only some of the requirement attribute (the ones that exist by default when creating a new DOORS module, like id and text) but the rest of attributes are not returned.

I thought of making query, I am not sure it will work, but the provided example by lyo query the whole project area, I do not know how to query a specific requirements object

4 answers



permanent link
Jean-Luc Johnson (8125) | answered Jul 13 '18, 9:24 a.m.
edited Jul 16 '18, 5:51 a.m.
Hello,
Requirement inherits from AbstractResource.
All the unknown properties are stored in extendedProperties. Try the method getExtendedProperties() on the class Requirement. Find out more at https://github.com/eclipse/lyo.core/blob/master/org.eclipse.lyo.oslc4j.core/src/main/java/org/eclipse/lyo/oslc4j/core/model/AbstractResource.java .

I hope it helps.

Comments
Ahmed Waheed commented Jul 13 '18, 11:42 a.m.

 extendedProperties even does not contain all of the attributes, specifically three attributes are not found (State, Type and Remarks)


permanent link
Jean-Luc Johnson (8125) | answered Jul 13 '18, 12:20 p.m.
edited Jul 13 '18, 12:20 p.m.

You can perform the same calls with a REST client to get to know the exact document sent by DOORS. Maybe, DOORS  does not expose them all.


Comments
Ahmed Waheed commented Jul 16 '18, 5:45 a.m.

Can you please tell how to achieve that call wih a REST client? I guess you mean something like chrome postman ?
Because I tried making a GET request with the same requirement URL via postman but I get the HTML result that I would get from the browser


Jean-Luc Johnson commented Jul 16 '18, 5:50 a.m.
hello Ahmed,
You should specify a media type to pull the RDF representation of a requirement from DOORS.
My colleague Ian made an excellent video on Youtube with Chrome; Find out more at https://www.youtube.com/watch?v=YzrVo6YM0iQ .


Ahmed Waheed commented Jul 16 '18, 8:07 a.m. | edited Jul 16 '18, 8:07 a.m.
hello Jean-Luc,
I tried same approach but I get in response that media type is not accepted, I even tried other types but I get the same response as follow

<?xml version="1.0"?>
  <oslc:Error>
    <oslc:message>The media type [[application/rdf+xml]] is not acceptable. Possibly expecting [, */*, application/doors-internal-link+html, application/json, application/x-jazz-compact-rendering, application/x-oslc-compact+xml, application/x-oslc-rm-requirement-1.0+xml, application/x-oslc-rm-requirement-collection-1.0+xml, application/x-turtle, application/xhtml+xml, application/xml, text/html, text/plain, text/turtle].</oslc:message>
    <oslc:statusCode>406</oslc:statusCode>
  </oslc:Error>
</rdf:RDF>

although the response is in the rdf format !!

Ahmed Waheed commented Jul 16 '18, 8:08 a.m. | edited Jul 16 '18, 8:18 a.m.
Aside from that, I have inspected the returned rdf xml response via OSLC4J code as follow

      ClientResponse response = client.getResource(url, OslcMediaType.APPLICATION_RDF_XML);
      System.setProperty(AbstractOslcRdfXmlProvider.OSLC4J_STRICT_DATATYPES, "false");   
      InputStream is = response.getEntity(InputStream.class);
      Model model = ModelFactory.createDefaultModel();
      model.read(is, "");
      model.write(System.out, "RDF/XML-ABBREV");

And the xml was not including the required properties, I expect that this xml should be the same if make the call from REST client, please correct me if I am wrong

Jean-Luc Johnson commented Jul 16 '18, 8:26 a.m. | edited Jul 16 '18, 8:36 a.m.
You should follow Jim Amsden's recommendation when it comes to the implementation in Java.
My perspective is a bit different. It is a step by step approach. I am saying that you should be able to perform the REST call with a REST client with FF or Chrome. And if it works, you will be able to adapt the result in your Java code.

Have you tried the mediatype text/turtle?

By the way, which version of DOORS are you using?


Ahmed Waheed commented Jul 16 '18, 9:29 a.m.

 I am not sure how to implement Jim's recommended approach, can you explain to me how? I see he recommends to extend the requirement class, but how to make DOORS fill the newly added attributes with the required properties?


My Client version is 9.6.1.9 , I am not sure if it is the same version for the server


Ahmed Waheed commented Jul 16 '18, 9:31 a.m.

 I got the same error for mediatype text/turtle

oslc_rm:message  "The media type [[text/turtle]] is not acceptable
    

showing 5 of 7 show 2 more comments

permanent link
Jim Amsden (29347) | answered Jul 14 '18, 6:57 a.m.

 This issue is that the Requirement class in the OSLC4J java client class reflects the implementation of the OSLC standard at the time it was developed. This is not the same as a DNG requirement which has application specific extensions. 


the best thing to do would be to create subclass of Requirement that included the DNG properties. Optionally the DNG properties may be included in the Requirement's extended properties. Try that.


Comments
Ahmed Waheed commented Jul 16 '18, 5:55 a.m.

How extending the requirement class  will make the API returns the DNG properties and set them in the extended class? (please specify by code example)


P.S: I am not aware of the difference between requirement and DNG requirement


permanent link
Jim Amsden (29347) | answered Jul 16 '18, 12:01 p.m.

 See this example: RRCFormSample.java


Comments
Ahmed Waheed commented Jul 17 '18, 4:02 a.m. | edited Jul 17 '18, 4:08 a.m.

thank you for referring to the example , this is exactly how I am fetching requirements already (from line 375) and it is not returning all the required attributes.

I was wondering how to achieve your proposal that "the DNG properties may be included in the Requirement's extended properties"

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.