Commit 0a86e08d authored by Philip Makedonski's avatar Philip Makedonski
Browse files

+ added constraints for constraint-like data content, #225

parent b86069f9
Loading
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -55,15 +55,23 @@ context EntityReference
      or (self.entity.oclIsUndefined() and not self.component.oclIsUndefined())
  

context LiteralValue

  -- Collection-like 'Content' in 'LiteralValue' 
  inv CollectionLikeContentLiteralValue ('If the \'including\' qualifier is used, directly contained \'Content\'s shall not contain a \'Value\'.' + self.toString()):
        (not self.comment->isEmpty() and self.comment->last()._body = 'including') implies
        (self.content->isEmpty() or self.content->forAll(c | c.value.oclIsUndefined()))

context Content
  -- No nested 'Content's if 'Value' is provided 
  inv ContentOrValue ('Either nested \'Content\'s or \'Value\' may be specified within \'Content\', but not both.' + self.toString()):
        self.content->isEmpty() or self.value.oclIsUndefined()
  


  -- Collection-like 'Content'  
  inv CollectionLikeContent ('If the \'including\' qualifier is used, directly contained \'Content\'s shall not contain a \'Value\'.' + self.toString()):
        (not self.comment->isEmpty() and self.comment->last()._body = 'including') implies
        (self.content->isEmpty() or self.content->forAll(c | c.value.oclIsUndefined()))
    --TODO: can/shall this be moved to grammar? -> probably too much of a hassle

context LiteralValueReference
  -- Referenced 'LiteralValue' visibility