OSLC: Is it possible to access all attributes and their types for particular work item type?
Accepted answer
Resource Shape is what I believe you are looking for which is reached following the discovery mechanism starting with rootservices of ccm.
let me explain from the Services URL obtained through the discovery mechanism:
GET on
https://localhost:9443/ccm/oslc/contexts/_87qOEKvrEeKxU5AQolS52w/workitems/services.xml
with following headers
OSLC-Core-Version: 2.0
Accept: application/xml
and from the response locate the creation factory for the work item type you want to understand and you will see the resourceShape URL
<oslc:creationFactory>
<oslc:CreationFactory>
<dcterms:title rdf:parseType="Literal">Location for creation of Defect change requests </dcterms:title>
<oslc:usage rdf:resource="http://open-services.net/ns/core#default"/>
<oslc:usage rdf:resource="http://open-services.net/ns/cm#defect"/>
<oslc:resourceType rdf:resource="http://open-services.net/ns/cm#ChangeRequest"/>
<oslc:resourceType rdf:resource="https://localhost:9443/ccm/oslc/types/_87qOEKvrEeKxU5AQolS52w/defect"/>
<oslc:resourceShape rdf:resource="https://localhost:9443/ccm/oslc/context/_87qOEKvrEeKxU5AQolS52w/shapes/workitems/defect"/>
<oslc:creation rdf:resource="https://localhost:9443/ccm/oslc/contexts/_87qOEKvrEeKxU5AQolS52w/workitems/defect"/>
</oslc:CreationFactory>
</oslc:creationFactory>
perform a GET on the rdf:resource for oslc:resourceShape and you will see all the attributes of the work item type and the attriubtes data type and more (readonly, mandatory... )
here is a sample for Resolution Date of Defect Work Item Type:
<oslc:property>
<oslc:Property rdf:about="https://localhost:9443/ccm/oslc/context/_87qOEKvrEeKxU5AQolS52w/shapes/workitems/defect/property/resolutionDate">
<oslc:valueType rdf:resource="http://www.w3.org/2001/XMLSchema#dateTime"/>
<oslc:readOnly rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">true</oslc:readOnly>
<oslc:propertyDefinition rdf:resource="http://open-services.net/ns/cm#closeDate"/>
<oslc:occurs rdf:resource="http://open-services.net/ns/core#Zero-or-one"/>
<oslc:name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">closeDate</oslc:name>
<dcterms:title rdf:parseType="Literal">Resolution Date</dcterms:title>
</oslc:Property>
</oslc:property>
hope this helps...
let me explain from the Services URL obtained through the discovery mechanism:
GET on
https://localhost:9443/ccm/oslc/contexts/_87qOEKvrEeKxU5AQolS52w/workitems/services.xml
with following headers
OSLC-Core-Version: 2.0
Accept: application/xml
and from the response locate the creation factory for the work item type you want to understand and you will see the resourceShape URL
<oslc:creationFactory>
<oslc:CreationFactory>
<dcterms:title rdf:parseType="Literal">Location for creation of Defect change requests </dcterms:title>
<oslc:usage rdf:resource="http://open-services.net/ns/core#default"/>
<oslc:usage rdf:resource="http://open-services.net/ns/cm#defect"/>
<oslc:resourceType rdf:resource="http://open-services.net/ns/cm#ChangeRequest"/>
<oslc:resourceType rdf:resource="https://localhost:9443/ccm/oslc/types/_87qOEKvrEeKxU5AQolS52w/defect"/>
<oslc:resourceShape rdf:resource="https://localhost:9443/ccm/oslc/context/_87qOEKvrEeKxU5AQolS52w/shapes/workitems/defect"/>
<oslc:creation rdf:resource="https://localhost:9443/ccm/oslc/contexts/_87qOEKvrEeKxU5AQolS52w/workitems/defect"/>
</oslc:CreationFactory>
</oslc:creationFactory>
perform a GET on the rdf:resource for oslc:resourceShape and you will see all the attributes of the work item type and the attriubtes data type and more (readonly, mandatory... )
here is a sample for Resolution Date of Defect Work Item Type:
<oslc:property>
<oslc:Property rdf:about="https://localhost:9443/ccm/oslc/context/_87qOEKvrEeKxU5AQolS52w/shapes/workitems/defect/property/resolutionDate">
<oslc:valueType rdf:resource="http://www.w3.org/2001/XMLSchema#dateTime"/>
<oslc:readOnly rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">true</oslc:readOnly>
<oslc:propertyDefinition rdf:resource="http://open-services.net/ns/cm#closeDate"/>
<oslc:occurs rdf:resource="http://open-services.net/ns/core#Zero-or-one"/>
<oslc:name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">closeDate</oslc:name>
<dcterms:title rdf:parseType="Literal">Resolution Date</dcterms:title>
</oslc:Property>
</oslc:property>
hope this helps...
Comments
For a workshop on how to use the OSLC API, see this article Open Services for Lifecycle Collaboration Workshop
I realized that this answer is fairly old. But hopefully someone will answer my question. A GET on the rdf:resource for oslc:resourceShape does appear to return properties for all of the attributes. But it also seems to return properties for other items such as link types. So how do I determine which properties refer to attributes?
1 vote