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

Clarification of the definition and use of the meta data annotations #777

Open
dschwartznyc opened this issue Jun 19, 2024 · 4 comments
Open
Labels
question Further information is requested

Comments

@dschwartznyc
Copy link

In prep for adding metadata support to the Python implementation, we (@priyanka-amarnani @plamen-neykov @davidcarrascosa00) are looking for clarification on the definition and use of meta data annotations.

A few questions at the start:

  1. Keys

What is responsible for key generation?
Can a key be "user" supplied?
Does the standard enforce uniqueness for keys? If so and if there is a clash, what is supposed to happen?

  1. global vs external

What is the difference between them?
if an item refers to both, what happens if the globalReference points to a different thing than the externalReference? Is there a priority in the references? Does the first reference prevail?

  1. If there are only globalReferences, can the collection of key / values be "destroyed" when the object goes out of scope?
  2. If there are externalReferences, does the collection of key / values need to remain after the object goes out of scope? If so, for how long?
@SimonCockx SimonCockx added the question Further information is requested label Jun 20, 2024
@dschwartznyc
Copy link
Author

Additionally, is the global key expected to be invariant between versions of the same "object?" IE Are all keys expected to be the same after update or, as long as reference consistency is maintained, can they change?

@minesh-s-patel
Copy link
Contributor

@dschwartznyc
Sorry for the delay on replying to this issue. We will take a look tomorrow morning.

@dschwartznyc
Copy link
Author

@minesh-s-patel - checking in on this.

@minesh-s-patel
Copy link
Contributor

minesh-s-patel commented Jul 26, 2024

There are 3 mechanisms for referencing in RUNE. Some of these concepts need to be reviewed and revised as they evolved along side the development of the CDM.

Global Keys/Global References - Global keys are a pluggable infrastructure where a user of a RUNE model can "inject" calculated a uniquely identifying string to identify an instance of a RUNE type or a Basic Type, and references elsewhere.

  • Types annotated with [metadata key]
  • Attributes annotated with [metadata id]
  • Attributes annotated with [metadata reference]

Note that global keys may not be invariant over instances of a particular RUNE object.

External Keys/External References - These are keys that a user "sets" as meta data to any identifiable type.

  • Types annotated with [metadata key]
  • Attributes annotated with [metadata id]
  • Attributes annotated with [metadata reference]

More info needed for Address/Location:

  • Types annotated with [metadata key]
  • Attributes annotated with [metadata address "pointsTo"=PriceQuantity->price]
  • Attributes annotated with [metadata location]

The results of the default "Hash based" Global Keys algorithm shipped with the JAVA libraries are not designed to be shared across different implementations of systems built on top of a RUNE Model (even though this is desirable).

A good place to look for how the Global Keys are injected into the model: https://github.com/finos/common-domain-model/tree/master/examples/src/main/java/com/regnosys/cdm/example/globalkey

The hashing utility libraries can be seen here: https://github.com/finos/common-domain-model/blob/master/examples/src/test/java/com/regnosys/cdm/example/TestObjectsFactory.java

The hashing algorithm for CDM is using the Java hashcode fuctionality - https://github.com/finos/rune-common/blob/0f18618e947a69cf69b28dc68329c6926a20b5ac/src/main/java/com/regnosys/rosetta/common/hashing/IntegerHashGenerator.java

This is the processor that sets all global keys making use of the hashing algo - https://github.com/finos/rune-common/blob/0f18618e947a69cf69b28dc68329c6926a20b5ac/src/main/java/com/regnosys/rosetta/common/hashing/GlobalKeyProcessStep.java

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

No branches or pull requests

3 participants