Containment restrictions are not enforced
Given these two MGLs:
-
GraphA.mgl
- Defines GraphA1
- Defines NodeA1
- Defines NodeA2 (extends NodeA1)
- GraphA can contain NodeA1 (and its sub-types) with the exception of NodeA2
-
GraphB.mgl
- Defines GraphB1 (extends GraphA1)
- Defines NodeB1 (extends NodeA1)
- GraphB has the same containment rules as GraphA
Expected behaviour:
- Can create NodeA1, NodeB1 in GraphA1
- Cannot create NodeA2 in GraphA1
- Can create NodeA1, NodeB1 in GraphB1
- Cannot create NodeA2 in GraphB1
Actual behaviour:
- Can create NodeA1, NodeA2, NodeB1 in GraphA1
- Can create NodeA1, NodeB1 in GraphB1
- Cannot create NodeA2 in GraphB1
Containment restrictions are not enforced in the top-level graph model "GraphA1". But they are enforced in a sub graph model "GraphB1".
GraphA.mgl
id demo.tool.a
stylePath "model/DemoTool.style"
graphModel GraphA1 {
diagramExtension "a1"
containableElements(NodeA1[1, *], NodeA2[0, 0])
}
node NodeA1 {
style rect("A1")
}
node NodeA2 extends NodeA1 {
style rect("A2")
}
GraphB.mgl
import "model/GraphA.mgl" as a
id demo.tool.b
stylePath "model/DemoTool.style"
graphModel GraphB1 extends a::GraphA1 {
diagramExtension "b1"
}
node NodeB1 extends a::NodeA1 {
style rect("B1")
}
Example project: demo.tool.zip
Edited by Fabian