It's all about the answers!

Ask a question

How to read the details of all the Atribute Types in any Project Area ?


Vaibhav S (106350) | asked Jan 22 '18, 6:23 a.m.

Hi all,

Is it possible to read the details of all the Attribute Types in any Project Area ?

My Requirement is to match the Attribute Type URI with the Instance Shape returned by the Requirement Object.

Please let me know.

Thanks
Vaibhav

2 answers



permanent link
Donald Nong (14.5k414) | answered Jan 22 '18, 6:23 p.m.

Not quite sure why you need all the attribute types in "any" project area. Getting the type definition should be very straightforward.

When you GET the details of a requirement, you will get <oslc:instanceShape>, which I believe you have already known that. Follow the instance shape URI, you should then have some <rm:hasSystemAttribute> and <rm:hasAttribute> attributes. And finally follow the URI in these attributes, you can get the details of each individual attribute, with <dcterms:title> being the attribute name.

Do I misunderstand what you are trying to do?


Comments
Vaibhav S commented Jan 23 '18, 12:21 a.m. | edited Jan 23 '18, 12:21 a.m.

Hi Donald Nong,

Thanks for the response.

I will elaborate a bit. I am developing a utility which takes "ArtifactType" name as input and returns Ids of all the Artifacts of that Artifact Type as output.

For the same I need to match the Attribute Type/ Instance Shape of any requirement object with all the available Attribute Types in the given Project Area.

So far I am able to read the Instance shape for any Requirement object but not able to retrieve Attribute Type Name from that URI.

On passing the instanceShape URI i dont get any "rm" related tags (<rm:hasSystemAttribute>,<rm:hasAttribute> as mentioned by you).

<dcterms:title> is do visible but it has many instances of it available.

Please let me know what did I miss.

Thanks
Vaibhav


permanent link
Vaibhav S (106350) | answered Jan 23 '18, 11:43 p.m.

Hi,

I found the code that will do the job:

ClientResponse clientResponseAttribute = client.getResource(requirement.getInstanceShape().toString(), OSLCConstants.CT_RDF);
                 
 ResourceShape resourceShape = clientResponseAttribute.getEntity(ResourceShape.class);
                
 artifactType = resourceShape.getTitle();


Thanks
Vaibhav

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.