Solved

Identiy the entity for a GID

  • 4 March 2024
  • 7 replies
  • 30 views

Userlevel 4
Badge +4

Hi Community,

When defining a metadatareader you can add the parent ID in the output by specifying the Parent ID Column Name in the Columns tab. It is not always clear though to which entity this parent ID belongs (and browsing the model graph is often cumbersome).

Is there a way to identify the entity for a given GID value?

Thanks and kind regards,

Albert

icon

Best answer by anna.spakova 6 March 2024, 14:30

View original

7 replies

Userlevel 5
Badge +8

Hello @Albert de Ruiter ,

 

thank you for this question. Currently, no mechanism would give you the entity type for a specified GID. However, what could maybe help a little, is that when you use the ONE Metadata Writer, on the General tab there is the Parent Type, which lists all the possible parents. In some cases the parent type is only one, in other it can be more types like in this example:

Usually, it lists all the subtypes of possible parent entities, so when you eliminate those, you will get only a handful of options (e.g. databaseLocation is a subtype of location so the parent is simply location and you should be able to insert the GID in the URL: https://<your-environment>/catalog/data/location/<parentId>)

It’s not much, but it can be used as another way how to get to the information together with the mmd graph.

Anyway, I will pass this on as feedback for our engineering. I had a similar request in the past.

Kind regards,

Anna

Userlevel 4
Badge +4

Hi Anna,

Although a direct ‘hit’ is not possible then, this looks like a very useful workaround.

Thanks :-)

Kind regards,

Albert

Userlevel 5
Badge +8

Hello @Albert de Ruiter ,

 

I’ve been talking to engineering, and there is a way how to find out the ancestor type for an entity after all using the graphql query. The _ancestors property holds all the ancestors and the type is what you are looking for.

query GetCatalogItems {
catalogItems(versionSelector: {draftVersion: true}) {
edges {
node {
gid
draftVersion{
name,
connection {
type
},
_ancestors(depth:1){
gid
storedVersion{
_displayName
}
type
nodePath
}
}
}
}
}
}

This will produce all CIs with their immediate parent:

If you remove the (depth:1) parameter, you can get all the ancestors all the way to the top metadata node.

So the graphql knows the information, unfortunately, it is not possible to get it through ONE Metada reader as of right now.

I hope this helps.

Kind regards,

Anna

Userlevel 4
Badge +4

That looks very interesting @anna.spakova! I'll give it a try.

Userlevel 4
Badge +4

Hi @anna.spakova, I have done a little testing and it looks certainly usefull. Still two questions:

  • To narrow down the search I can add a filter like filter: "name = '<CI name value>'". I have also been trying to filter on gid but that doesn't seem to work as it 's not a regular property. Should filtering on gid been done in a different manner, or is that simply not possible?
  • The node name is catalogItem but in the graphQL it is defined as catalogItems, so in plural. Why is that, maybe because it is named like that in the metadata node?

Thanks and kind regards,

Albert

Userlevel 5
Badge +8

Hello @Albert de Ruiter,

 

to filter using GID, you need to use the dollar sign: $id = ‘<id>’. The plural form here does not affect that, it’s just the syntax of the graphQL saying you want all the CIs. This documentation can also give you more insight into the filtering. The filter is using the AQL query language.

 

Let me know if you have any further questions.

Kind regards,

Anna

Userlevel 4
Badge +4

Thanks for your explanations @anna.spakova !

Kind regards,

Albert

Reply