-
Notifications
You must be signed in to change notification settings - Fork 2
Annotations #84
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
Annotations #84
Conversation
Isn't the common ancestor |
It would be the equivalent on Classifier on the model level. I.e., it would have the thing that represent an instance of a Classifier, in the same way that Node is an instance on Concept and AnnotationInstance is an instance of Annotation |
I renamed |
Discussion in LionWeb-io/specification#164 could affect this |
This is a very big PR because a lot of code had to be changed to deal with Classifiers (and not just Concepts) and with Classifier Instances (which are either Nodes or Annotation Instances, while before we dealt only with Node). I do not expect anyone to have the time to read this whole PR, but perhaps @enikao and/or @dslmeinte have the time to take a look at some part and provide some feedback. Otherwise I can merge and then react to issues and inconsistencies with the TS implementation as they emerge :) |
It's indeed a big PR. What I'm sort of missing is a persisted serialization chunk with some actual annotation instances. I only see the key-value-pair |
core/src/main/java/io/lionweb/lioncore/java/serialization/ClassifierResolver.java
Outdated
Show resolved
Hide resolved
@@ -160,4 +164,12 @@ public String toString() { | |||
public void setAnnotations(List<String> annotationIDs) { | |||
this.annotations = annotationIDs; | |||
} | |||
|
|||
public String getAnnotated() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we have this method? This must be the same as getParent()
, according to https://lionweb-org.github.io/organization/serialization/serialization.html#parent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This came as a surprise to me. When I think about the model I imagine a tree (or a forest) which is composed by nodes, each one with their own position within the tree. Each one (besides roots) having a parent. Annotation instances are instances something else: they are not node, they are not part of the tree. They are attached to nodes. Some consumers are interested in the tree (so just the nodes), some others are interested in the tree and the attached annotation instances.
So it seems strange to me that an annotation instance has a parent, as it is not part of the tree. From may point of view it has a pointer to the node that it is attached to, which it is not its parent, as the annotation instance is not a children of the node (it is not part of any containment).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rationale was: Every node must be contained in a Partition
. We can always find the partition by moving up to the root of the containment hierarchy.
If not the annotated node, who else is the parent of an annotation instance? Which partition does it belong to?
If we wanted completely independent annotations (i.e. stored somewhere outside the annotated node), they would be provided by a processor as a derived model. This processor might have its own internal storage, or ask the repository for a "special" partition that contains all the annotations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the partition containing the annotation is the same partition which is containing the annotated node, on that we agree. My problem is with the term "parent" to indicate what it seems to me are two different relationship.
I think that the children of a node do not contain the annotations attached to that node. Is that right?
If it is right, then it is surprising that the annotation can have as a parent the annotated node. It means that parent is not the inverse relationship of children.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's what we decided in LionWeb-io/specification#150
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood, I will comply
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope this was our understanding, not only my understanding -- shall we raise the issue again in the next meeting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that once @dslmeinte implements annotations for TS it could be useful to compare ideas regarding annotations at the model level, because I think we discussed annotations mostly at the metamodel level, and he may also find certain inconsistencies/weird naming. However for getAnnotated
I agree and I will remove it
@@ -11,6 +11,7 @@ public class SerializedClassifierInstance { | |||
private String id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the difference to a SerializedNode
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my understanding we have annotation instances and nodes, which are similar but not the same. So the common ancestor (grouping the similarities) is called Classifier Instance. Also when serializing them they are very similar but not the same. For example, an annotation instance has no concept, it has an annotation instead. It has no parent but an annotated node instead (see previous comment). For this reason also on the serialization level I find useful to distinguish them.
Annotation getAnnotationDefinition(); | ||
|
||
ClassifierInstance getAnnotated(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as getParent()
TODO: let annotations have containments |
Merging to avoid conflicts with other work (lke renaming LIonWeb into LionWeb). Some changes may be done later, to ensure adherence with the "standard" |
With this PR:
What we still need to do: