Strumenta / tylasu

Apache License 2.0
20 stars 4 forks source link

Issue with LionWeb interoperability #66

Closed ftomassetti closed 4 months ago

ftomassetti commented 4 months ago

At this time we consider only features providing AST nodes to be containments. However AST nodes are a subset of all possible LionWeb Nodes, and if we have a feature returning something that is a LionWeb Node but not also an AST node that is treated as an attribute and not a containment. So far it was not an issue because we only used AST nodes. However now we are using simple LionWeb Nodes in CIS and encountered this issue.

We (Martin and myself) think that the issue is here:

https://github.com/Strumenta/tylasu/blob/db40528ac077b1e25ea06d86d09db5bc22ee3b2e/src/interop/lionweb.ts#L88

We should check for something to be just a Node. Changing the code into:

function isLionWebNode(classifier: Classifier) {
    return classifier instanceof Concept;
}

Our issue was solved

alessiostalla commented 4 months ago

Isn't the same true in Kolasu though? You can't have a child that is not a Kolasu Node.

Or do you mean that all containments (except for special ones such as the Position) should be turned into AST nodes even if in origin they weren't? The Lionweb import feature has been designed with ASTs exported from Kolasu in mind. If we want to generalize and represent all Lionweb nodes as Tylasu nodes, I think we can do so.

ftomassetti commented 4 months ago

The Lionweb import feature has been designed with ASTs exported from Kolasu in mind.

So maybe the problem here is that we are using it to export classes that do not represent ASTs to LionWeb

alessiostalla commented 4 months ago

Yes that's the problem but we could enhance Tylasu with the ability to import arbitrary Lionweb models, modeling all nodes as AST nodes. One issue that I see with that if that if we consider all Lionweb nodes to be AST nodes, then we lose information: if we later export the same metamodel to Lionweb, we would either have all nodes inherit from ASTNode, or none of them, and that may not turn out to be the same metamodel as we imported. But, probably we're doing the same with ECore, we don't offer the guarantee that the metamodel stays the same when imported and re-exported.

ftomassetti commented 4 months ago

Good point. I am not sure how this should be solved