eMoflon / emoflon-neo

A Neo4j-based implementation of eMoflon
Eclipse Public License 2.0
6 stars 2 forks source link

Validation of type of link target doesn't seem to be working #301

Closed anthonyanjorin closed 3 years ago

anthonyanjorin commented 3 years ago

In the example below, the target of the links in orchard:Orchard are of nonsensical types and there is no error or warning. Something seems to be wrong with the scope provider or validator (less important but still nice-to-have: the options on code completion are also not filtered in any way).

metamodel Obstgarten {
    Pathway {
      <+>-segments(1..*)->PathSegment
    }

    PathSegment

  abstract RelevantForMove

    Raven : RelevantForMove {
    -on(1..1)->PathSegment  
    }

    FruitTree : RelevantForMove {
      <>-fruits(0..*)->Fruit
    }

    Dice {
      -nextMove(1..1)->RelevantForMove
    }

    Fruit

    FruitBasket {
      <>-fruits(0..*)->Fruit
    }

    Orchard {
    <+>-raven(1..1)->Raven
    <+>-trees(1..*)->FruitTree
    <+>-basket(1..1)->FruitBasket
    <+>-dice(1..1)->Dice
    <+>-pathway(1..1)->Pathway
  }
}

model HabaObstgarten {
  orchard:Orchard {
    -pathway->path
    -raven->raven
    -dice->dice

   // The targets of the following links should be flagged as wrong 
    -trees->a1
    -basket->a1
  }

  raven:Raven {
    -on->segment2
  }

  path:Pathway {
    -segments->segment1
    -segments->segment2
    -segments->segment3
    -segments->segment4
    -segments->segment5
  }

  segment1:PathSegment
  segment2:PathSegment
  segment3:PathSegment
  segment4:PathSegment
  segment5:PathSegment

  a1:Fruit
  a2:Fruit
  a3:Fruit
  a4:Fruit
  appleTree:FruitTree {
    -fruits->a1
    -fruits->a2
    -fruits->a3
  }

  p1:Fruit
  p2:Fruit
  p3:Fruit
  p4:Fruit
  plumTree:FruitTree {
    -fruits->p1
    -fruits->p2
  }

  pe1:Fruit
  pe2:Fruit
  pe3:Fruit
  pe4:Fruit
  peachTree:FruitTree {
    -fruits->pe1
    -fruits->pe2
    -fruits->pe3
  }

  c1:Fruit
  c2:Fruit
  c3:Fruit
  c4:Fruit
  cherryTree:FruitTree {
    -fruits->c1
    -fruits->c2
    -fruits->c3
    -fruits->c4
  }

  basket:FruitBasket {
    -fruits->a4
    -fruits->p3
    -fruits->p4
    -fruits->pe4
  }

  dice:Dice {
    -nextMove->appleTree
  }
}