Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RM how to retrieve value/label from enumerated attribute #64

Open
struggling-dev0 opened this issue May 16, 2024 · 4 comments
Open

RM how to retrieve value/label from enumerated attribute #64

struggling-dev0 opened this issue May 16, 2024 · 4 comments

Comments

@struggling-dev0
Copy link

struggling-dev0 commented May 16, 2024

I've been working in a project that has made extensive use of custom artifacts and attributes, and was wondering if there was a way to translate the URI returned for enumerated attributes by oslc_query methods into the corresponding value/label.

In the artifact XML returned by theartifact_x, etag = self.config.component.execute_get_rdf_xml( theartifact_u, return_etag=True, intent="Retrieve the artifact" ) we've been able to retrieve and modify our custom attributes by parsing the output, but for enumerated attributes the only return value is an 'rdf:resource' URI (example provided below).

<j.0:enumAttribute rdf:resource="https://jazz.external.company.com/rm/types/AT_YizZiKjKEe2vXr_tc4cF9Q#_9s-KxivuIym9A1QTfgQjpA"/>

How can I retrieve the value and label associated with this enumerated URI?

@barny
Copy link
Member

barny commented May 20, 2024

You can retrieve the definitions of artifacts through the shapes referenced in the CreationFactory in the configuration-specific services.xml document.

The example oslcquery.py uses these to generate a typesystem report which will show enumerations and their values, when using option --typesystemreport

@barny
Copy link
Member

barny commented May 20, 2024

NOTE there are some limitations on the typesystem support implemented in elmclient - for example there's no resolution of URIs across different components to recognise the types are equivalent - this in particular would affect OSLC Query across more than one component.

@struggling-dev0
Copy link
Author

This is just what I was looking for, thank you!

To follow on, I notice that when performing the oslc query the typesystemreport is generated near-instantly, but the full query is taking substantially longer. For my purposes I only need the typesystemreport to get the enumeration values; is there a way to inhibit the full query and only return the typesystemreport?

@barny
Copy link
Member

barny commented May 20, 2024

oslcquery caches the typesystem for 7 days - the first time you access it will take a long time then it will be a lot quicker for 7 days because the shapes are coming from the cache withput having to contact the server.. Add -W to the oslcquery command to clear the cache and it will be slower as it has to get the results from the server.

It's this line in oslcquery.py that sets the caching level:

# create our "server" theserver = server.JazzTeamServer(args.jazzurl, args.username, args.password, verifysslcerts=args.certs, jtsappstring=f"jts:{approots['jts']}", cachingcontrol=args.cachecontrol, cachefolder=cachefolder )

It's the line in oslcquery.py which loads the types from the project/component being queried:

queryon.load_types()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants