Skip to content

Requirements on metamodel keys #91

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

Closed
enikao opened this issue Mar 6, 2023 · 7 comments
Closed

Requirements on metamodel keys #91

enikao opened this issue Mar 6, 2023 · 7 comments

Comments

@enikao
Copy link
Contributor

enikao commented Mar 6, 2023

Both NamespacedElement.key and Metamodel.key MUST adhere to LIonWeb id format (#31).

NamespacedElement.key MUST be unique within its metamodel.

Metamodel.key SHOULD be globally unique, and MUST be unique within an id-space (#31).
For approximate global uniqueness, we SHOULD adopt Java's package naming scheme, based on domain names.
As we don't allow dots (.) in ids, we SHOULD use dashes (-) instead.
Dashes are preferable to underscores (_) because of better Java compatibility: In Java package names, underscores are allowed, but dashes are not. The same applies to most other programming languages, as they need to separate names from subtract expressions. Thus, we can easily establish similar names for metamodels and packages by substituting dashes with dots.

Example: Given domain subdomain.example.com, metamodel keys might be com-example-subdomain-myDepartment-group123-entity_model (with package name com.example.subdomain.mydepartment.group123.entity_model) and com-example-subdomain-great_ultimate_universal_unified_dataModel (with package name com.example.subdomain.great_ultimate_universal_unified_datamodel).

@enikao
Copy link
Contributor Author

enikao commented Mar 24, 2023

Does the dashes-policy as described above makes sense?
If yes, shall we change our M3 ids? E.g. LIonCore_M3_Language_dependsOn --> LIonCore-M3-Language-dependsOn?

cc @ftomassetti @dslmeinte

@dslmeinte
Copy link
Contributor

For the actual keys in the M3, I was thinking more along the lines of dependsOn, etc. - at We don't really need to qualify the keys, because the M3 is pretty small.

But I don't get why dashes instead of underscores. A key with underscores is likely immediately Java-friendly, right?

@enikao
Copy link
Contributor Author

enikao commented Mar 25, 2023

My line of thought for Java-based names:

  1. Java has a working approach to (mostly) globally unique names: DNS-based package names
  2. Java separates subpackages (and other names) by dot
  3. Java does allow underscores in names, but does not allow dashes in names ^1
  4. LIonWeb does allow underscores in ids, but does not allow dots
  5. We can establish an unambiguous, bidirectional, one-to-one mapping between Java names and LIonWeb ids by swapping Java dots with LIonWeb dashes

If we swapped Java dots with LIonWeb underscores, the mapping becomes ambiguous: Java package name com.example.sub_package --> LIonWeb id com_example_sub_package --> mapping back to Java package name com.example.sub.package

^1: Dashes in (package) names would be ambiguous with subtract operation if using full qualified names: com.example.MyClass.CONST1-com.example.OtherClass.CONST2

@dslmeinte
Copy link
Contributor

OK, so dashes are in addition to underscores, with the explicit purpose to have an effective equivalence Java FQ-names ⇆ keys? That sounds good.

@enikao
Copy link
Contributor Author

enikao commented Mar 26, 2023

So the M3 ids would be like

M3 element Concept Key
LIonCore Language LIonCore-M3
Language Concept Language
Language.dependsOn Reference Language-dependsOn
Concept Concept Concept
Concept.abstract Property Concept-abstract
Link.type Reference Link-type
Property.type Reference Property-type

I'd prefer Language-dependsOn over dependsOn. The latter would still be unique within LIonCore, but for type we'd include the owning concept -- and then I would keep it consistent for all elements.

@enikao
Copy link
Contributor Author

enikao commented Jun 9, 2023

Agreed in meeting on 2023-06-09

@enikao
Copy link
Contributor Author

enikao commented Jul 7, 2023

For reference: The agreed ids and keys are listed in metamodel docs

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

No branches or pull requests

2 participants