Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to check if an artifact is present in another module or location in general

Hello,
I am quite new to DNG and extending it using the RMExtenstionsAPI. I am currently trying to check if a saved artifact is used in another location in order to give the user an alert that they not only changed the artifact at this location, but also at another one. My goal is to raise awareness for the behaviour of artifacts that are used in multiple locations, especially for newer users.
I found the CONTAINING_MODULE attribute but it only shows one value, which is the current Module (from where I did some changes to my artifact).

Initially I was also trying to send an alert when a user inserts an already existing artifact, but this action does not seem to trigger any of the four events we can watch with the API.

Thanks in advance


1

1 vote



3 answers

Permanent link

Hi,


Please try a simple GET request:
rm = 'rm1' #for me
artifact_url = 'your resource/artifact url'
query_url = f'https://server/{rm}/publish/resources?resourceURI={artifact_url }'
headers =  {  "OSLC-Core-Version": "2.0",
    "Accept": "application/xml",
    "Content-Type": "application/rdf+xml",
    "Configuration-Context":"your_local/global_config" }

requests.get(url=query_url, headers=headers)

For me, I see stuff like 'In Module' in the response xml/rdf.

Br,
Alex

1 vote

Comments
Hi Alex,
thanks for your answer. I just gave this a try but I don't see a general "In Module" information. I found out that artifact_urls differ depending on which module you are in while getting the url. When I get the url from within a module I get the link to that one module, but not to the other one it is used in. When using the artifact_url of the base artifact I see link information which in turn contains information about the corresponding module. But there seems to be no general information on the modules the base artifact is used in. At least not for me.

However, I of course cannot rule out that I not making any mistakes ^^

Best regards,
Jakob


Permanent link

You're right, I can't find a way to get all the links an artifact is linked to by being in another module. There is a list however on the artifact, on bottom right of the web artifact page, called 'Where Used'. You have a list of Linked Modules there but it's somewhat unpractical to have to enter the artifact page and see where it's used.


Let's try a different approach. What type of artifact are we talking about? Requirement/Attachment/Heading/Information/Parameter (I'm also somewhat new to DNG so I'm not sure if some are custom made by my Project Area)

 I am currently trying to check if a saved artifact is used in another location in order to give the user an alert that they not only changed the artifact at this location, but also at another one.

I'm pretty sure that every artifact is unique. Once created/uploaded, even inside an un-delivered change-set, everything has a unique data-base ID. So there's no way for someone to change an already existing artifact by creating a new one. (Experts please correct me if I'm wrong).

My ideas:

Put everything related in a Folder. 
E.g. a) Attachments in Attachment_Artifacts. 
b) Requirements Modules in Specification_Modules. The artifacts from each Requirement Module in Administration_Artifacts/Specification_Modules/{Module Name} artifacts
^ For this I'm unaware how the structure works for other areas, I'm enunciating the fact that you should have the Requirements (in my case) separated from the Requirements Modules.

With this, you should have just a little better overview.

Now, to the real work. Do you have special attributes for those artifacts? Something unique, in the name, description, custom attributes, anything. If you do, we can try the good old 'parse through everything till we find a match'. Found a match -> use that one, didn't find one -> create one.

Also apologies for answering a JavaScript related question with Python.

0 votes

Comments
Exactly this "Where Used" information is what I am trying to query.
Regarding artifacts being unique: You are right in that an artifact has a unique id. This artifact is known as the base artifact. It is automatically created when creating an artifact in a module. The module just uses a reference to this base artifact to provide context through further information like links and comments.
But there is also the possibility to insert an already existing artifact into a module instead of creating a new one. This inserted artifact refers to the same base artifact as all other references of that artifact. Therefore if one of those references is altered, every reference including the base artifact is also changed.

I already use a similar folder structure and also thought about looking through all artifacts to find a match, but doing so on every ARTIFACT_SAVED event would propably cost lots of performance.

I will add my results to this thread if I find a way. But thank you for your time and ideas so far :)

Exactly this "Where Used" information is what I am trying to query.
Regarding artifacts being unique: You are right in that an artifact has a unique id. This artifact is known as the base artifact. It is automatically created when creating an artifact in a module. The module just uses a reference to this base artifact to provide context through further information like links and comments.
But there is also the possibility to insert an already existing artifact into a module instead of creating a new one. This inserted artifact refers to the same base artifact as all other references of that artifact. Therefore if one of those references is altered, every reference including the base artifact is also changed.

I already use a similar folder structure and also thought about looking through all artifacts to find a match, but doing so on every ARTIFACT_SAVED event would propably cost lots of performance.

I will add my results to this thread if I find a way. But thank you for your time and ideas so far :)


Permanent link

You could use OSLC Query to search for the identifier - this would return the core artifact and all uses (bindings) of the artifact in modules, because these all have the same dcterms:identifier.


The core artifact can be distinguished because if has an rm_nav:parent property (the folder it's stored in) and the reuses/bindings don't have this property. Conversely the binding(s) have a rm:module property with the URL of the module :-) This property isn't in the OSLC GET results on the binding URL.

HtH
Ian

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 11,101

Question asked: May 13 '25, 3:35 a.m.

Question was seen: 1,607 times

Last updated: Jun 02 '25, 11:42 a.m.

Confirmation Cancel Confirm