Thursday 30 July 2015

OSLC and DOORS 9 Hierarchy

OSLC is still evolving standard. Currently there is a version 2, which even though it has major improvements over version 1, it still lacks some definitions which could help when it comes to data representation. 

When you have a look at the OSLC Resource RequirementCollection you might notice the only relation to a OSLC Requirement is oslc_rm:uses. Described as:
"A collection uses a resource - the resource is in the requirement collection"

Thus OSLC RequirementCollection could be illustrated as an array or a table of non-related requirements.


That's not really useful when you look at the size and structure of a single DOORS 9 module used in production environment. You know a module it is not a flat list with thousands of requirements, it is more like a tree with lots of branches where each Heading or Subheading is a local root.
DOORS 9 structure is more complex.

Loosing a structure when converting DOORS 9 module to OSLC Requirements Collection might not be a problem when you want simply display its unordered contents or simply find a Requirement. However the power of DOORS comes from relations, traceability and reporting which are often key factors in many standards.

How to make a tree tree

Sadly OSLC cannot help us with requirements parenting or sorting so we need to get help elsewhere. 

If you had a look a my introductory post on OSLC DXL Services you know what to do!
Indeed all you need is a DXL Service which would return the structure for you. Yeah I know there were those perms and scripts you had to write...
Well since that post on DXL services there was DOORS 9.6.1.3 release and guess what! OSLC DXL Services got their UI. Finally! I mean DXL services perms were there for quite a long time, yet there was not much use of them.

In Database Explorer File -> OSLC you can see new item "DXL Services"
new menu flow in DOORS 9

Similarly to other configuration tools in DOORS this menu is not available for everyone.

This opens DXL Services UI which is relatively simple, yet does its job.
DXL Services UI

Hierarchy DXL script

In the picture above helloWord is the script from preview post, but what is "hierarchy"? I know I didn't put description but the function name gives some hints ;)

Code listing for hierarchy.dxl can be found here. It wasn't tested thoroughly, it might be, and should be optimized - specially for URL re-usage but that's not a part of this post.

Once you add this script to your DXL services it is ready to use.

Short summary how to get use of a DXL service:
Send a HTTP PUT request to your server with specified service name

https://yourserver:8443/dwa/rm/dxl/hierarchy

setting header to:
accept: application/rdf+xml

and content initialized with DXL services arguments (remember to encode your arguments for XML):
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:doors="http://jazz.net/doors/xmlns/prod/jazz/doors/2.0/">
  <doors:Arguments>
  <doors:arguments>https%3A%2F%2Fyourserver%3A8443%2Fdwa%2Frm%2Furn%3Arational%3A%3A1-DBID-M-MODULE_ID</doors:arguments>
  </doors:Arguments>
</rdf:RDF>


DWA should return with the structured document similar to below:
<?xml version="1.0"?>
<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:doors="http://jazz.net/doors/xmlns/prod/jazz/doors/2.0/">
  <doors:DxlServiceResult rdf:about="https://yourserver:8443/dwa/rm/dxl/hierarchy">
    <doors:result rdf:parseType="Literal"><OSLCDXLService name="oslc_getHierarchy" version="1.0">
    <Module uri="https://yourserver:8443/dwa/rm/urn:rational::1-DBID-M-MODULE_ID" fullName="/Folder" viewName="" />
    <Object uri="https://yourserver:8443/dwa/rm/urn:rational::1-DBID-O-1-MODULE_ID">
        <Object uri="https://yourserver:8443/dwa/rm/urn:rational::1-DBID-O-2-MODULE_ID">
            <Object uri="https://yourserver:8443/dwa/rm/urn:rational::1-DBID-O-8-MODULE_ID">
                <Object uri="https://yourserver:8443/dwa/rm/urn:rational::1-DBID-O-14-MODULE_ID">
                    <Object uri="https://yourserver:8443/dwa/rm/urn:rational::1-DBID-O-20-MODULE_ID">
                        <Object uri="https://yourserver:8443/dwa/rm/urn:rational::1-DBID-O-24-MODULE_ID">
                            <Object uri="https://yourserver:8443/dwa/rm/urn:rational::1-DBID-O-25-MODULE_ID"/>
                            <Object uri="https://yourserver:8443/dwa/rm/urn:rational::1-DBID-O-26-MODULE_ID"/>
                            <Object uri="https://yourserver:8443/dwa/rm/urn:rational::1-DBID-O-27-MODULE_ID"/>
                        </Object>
                    </Object>
                    <Object uri="https://yourserver:8443/dwa/rm/urn:rational::1-DBID-O-15-MODULE_ID"/>
                    <Object uri="https://yourserver:8443/dwa/rm/urn:rational::1-DBID-O-19-MODULE_ID"/>
                </Object>
                <Object uri="https://yourserver:8443/dwa/rm/urn:rational::1-DBID-O-9-MODULE_ID"/>
                <Object uri="https://yourserver:8443/dwa/rm/urn:rational::1-DBID-O-13-MODULE_ID"/>
            </Object>
        </Object>
        <Object uri="https://yourserver:8443/dwa/rm/urn:rational::1-DBID-O-3-MODULE_ID"/>
        <Object uri="https://yourserver:8443/dwa/rm/urn:rational::1-DBID-O-7-MODULE_ID"/>
    </Object>
</OSLCDXLService></doors:result>
  </doors:DxlServiceResult>
</rdf:RDF>

Now depending on your needs you can parse it and create DOORS 9 like view of a Module in your application.