Questions tagged [ocl]

The Object Constraint Language (OCL) is a declarative language describing rules applying to Unified Modeling Language (UML) models developed at IBM and is now part of the UML standard.

The Object Constraint Language (OCL) is a declarative language describing rules applying to Unified Modeling Language (UML) models developed at IBM and is now part of the UML standard.

The Object Constraint Language is a precise text language that provides constraint and object query expressions on any Meta-Object Facility (MOF) model or meta-model that cannot otherwise be expressed by diagrammatic notation.

See more on wikipedia.

5 questions
10
votes
1 answer

Object Constraint Language (OCL) for Stack in java.util package

I have an exam coming up and I'm looking at past papers to get some ideas of what to expect. I'm a bit stuck on the following one and would really appreciate if someone could give some example answers. Write preconditions and postconditions in OCL…
Aimee Jones
  • 201
  • 2
  • 8
2
votes
0 answers

OCL - how to explicitly model if a property can or can not be null?

I'm thinking about defensive programming here, through model driven design. I would insert null guards where a property must not be null, but would use a Maybe struct in the cases where it's admissible. However, I'm not sure how to explicitly model…
João Otero
  • 185
  • 1
  • 6
1
vote
1 answer

OCL in a domain model to capture rules for building houses and hotels in Monopoly

It's maybe an old horse to beat (not dead yet?), but I'm wondering if OCL allows modeling the problem of the business rules for building houses and hotels in the game of Monopoly within a domain model (conceptual class diagram, separate from an…
Fuhrmanator
  • 1,435
  • 9
  • 19
1
vote
0 answers

How to use derive: in OCL when the type is not primitive

Let's consider the following class diagram I would like to express the following rule in OCL if cond = true then bderived = b else bderived.x = b.x + 10 bderived.y = b.y + 10 endif My best guess to express the above using OCL is the…
Robbo
  • 167
  • 3
1
vote
0 answers

How to specify OCL time constraints?

The article An OCL Extension for Real-Time Constraints describes and interesting extension to OCL for the specification of time constraints. New types OclConfiguration and OclPath are defined along with a new post() operation which is able to…
Robbo
  • 167
  • 3