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

Implement unique id for vertices in a transpose flow graph #229

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Entenwilli
Copy link
Member

This PR implements a unique ID for vertices in a transpose flow graph.
The UUID is unique on a vertex basis between all transpose flow graphs (e,g. there exists no vertex in all transpose flow graphs with the same UUID)

This PR closes #223

@Entenwilli Entenwilli added enhancement New feature or request core Related to the core DFD/PCM data flow analysis support Related to supporting projects which are neither core analysis or meta model bundels labels Dec 8, 2024
@Entenwilli Entenwilli added this to the 4.0.0 milestone Dec 8, 2024
@Entenwilli Entenwilli self-assigned this Dec 8, 2024
uuidString.append(previousElement.getUniqueIdentifier());
}
return UUID.nameUUIDFromBytes(uuidString.toString().getBytes(StandardCharsets.UTF_8));
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not enough to uniquely identify the vertex.
Assume a DFD like this:

               B
Z - A <           > D
               C

This would mean 2 partial TFG's ZABD and ZACD (assuming both flows land in the same pin of D).

It is impossible to differentiate between the Z/A vertices in the different partial flow graphs with the information contained in the Class. This is always the case if they share the same sequence of previous vertices.
It's fine if there is a different sequence of previous vertices (use of different pin, loop, etc.).

However if they share the same sequence they are equal in everything (previous vertices sequence/ data/node characteristics), so maybe it's fine if they share an ID?

Otherwise, the only difference is in which Partial TFG they are, so the ID needs to be derived from the partial flow graph.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The UUID of Z/A would be dependent on the previous elements (e.g. either B or C) therefore, we can differentiate between flows to A from B and flows to A from C. Therefore the UUID of the vertices that reference A would be different.

For Z, it would take the previous vertex (so A) and its ID an generate a UUID from that. As the UUID of A is different in the diffrent cases, the UUID of Z would be different as well

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or am I misunderstanding your point?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe my diagram wasn't clear
image
This would for example create 2 User vertices in two different partial tfg's. Their parameters would be equal

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be fixed in 12601fe, as the UUID now depends on the ID of the following element as well (if it is present)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole point of the UUID is to have a unique, not random ID for elements that stays the same during runs of the analysis.
Therefore, I would further revise the approach to include the ID of the outgoing Port as well.

In the Example, to get the UUID of the Function Node, it would first calculate the UUID of the previous vertex and pass its Node ID and the ID of the sending Port to it. Therefore, the UUIDs of the two Vertices that reference User would be different, as the sending port is different.

I know this solution is pretty complicated, but is still better that really not being able to reference a vertex between runs consistently.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've implemented this in 0d14062

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing against creating the type 3 uuids from some meaningful properties from the nodes or something, but if we do not need those properties to be encoded there, I opt for using the random uuid functionality.
Looking into how EcoreUtils does this, they seem to mainly use the timestamp to generate a type 2 uuid. As huge as the type 4 UUIDs that are generated are, I do not see a problem.

This would also make the code simpler as it just needs to be implemented in AbstractVertex.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pinDFDVertexMap only maps the input Pins to the previous vertices. A vertex holds no information about its successor. Therefore in this case Function would grap user to compute its ID. As Users pinDFDVertexMap is empty the user vertices would be indistinguishable.

If you don't want random ID's or to use the partial TFG they are residing in, you need to make the ID depended on the Ids of the incoming flows and then hand it to its predecessor. The incoming flow is the only part in which the vertices differ.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole point is to have UUIDs that do not change between (test) runs.
But let's talk about this on Wednesday

uuidString.append(previousElement.getUniqueIdentifier());
}
return UUID.nameUUIDFromBytes(uuidString.toString().getBytes(StandardCharsets.UTF_8));
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pinDFDVertexMap only maps the input Pins to the previous vertices. A vertex holds no information about its successor. Therefore in this case Function would grap user to compute its ID. As Users pinDFDVertexMap is empty the user vertices would be indistinguishable.

If you don't want random ID's or to use the partial TFG they are residing in, you need to make the ID depended on the Ids of the incoming flows and then hand it to its predecessor. The incoming flow is the only part in which the vertices differ.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Related to the core DFD/PCM data flow analysis enhancement New feature or request support Related to supporting projects which are neither core analysis or meta model bundels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unique IDs for vertices
3 participants