0% found this document useful (0 votes)
20K views1 page

OCL 2 Reference Card

The Object Constraint Language (OCL) is a declarative language describing rules applying to Unified Modeling Language (UML) models and is part of the UML standard. OCL is a precise text language that provides constraint and object query expressions on any MOF model or meta-model that cannot otherwise be expressed by diagrammatic notation. OCL is a key component of the OMG standard for transforming models, the Queries / Views / Transformations (QVT) specification. This OCL 2 reference card has been extensively checked and is compatible with the USE (UML-based Specification Environment) tool [DOI=10.1016/j.scico.2007.01.013] PLEASE CITE THIS REFERENCE CARD IF YOU FIND IT USEFUL! APA style: Brito e Abreu, F. (2018). OCL 2.0 Reference Card. Departamento de Ciências e Tecnologias da Informação, Instituto Universitário de Lisboa, Av. das Forças Armadas, 1649-026 Lisboa, Portugal: ISCTE-IUL. IEEE style: [1]F. Brito e Abreu, OCL 2.0 Reference Card. Departamento de Ciências e Tecnologias da Informação, Instituto Universitário de Lisboa, Av. das Forças Armadas, 1649-026 Lisboa, Portugal: ISCTE-IUL, 2018. BibTeX entry: @MANUAL {BritoeAbreu_OCL_Reference_Card, title = "OCL 2.0 Reference Card", author = "Fernando Brito e Abreu", organization = "ISCTE-IUL", address = "Departamento de Ciências e Tecnologias da Informação, Instituto Universitário de Lisboa, Av. das Forças Armadas, 1649-026 Lisboa, Portugal", month = "dec", year = "2018" }

Uploaded by

Fernando
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20K views1 page

OCL 2 Reference Card

The Object Constraint Language (OCL) is a declarative language describing rules applying to Unified Modeling Language (UML) models and is part of the UML standard. OCL is a precise text language that provides constraint and object query expressions on any MOF model or meta-model that cannot otherwise be expressed by diagrammatic notation. OCL is a key component of the OMG standard for transforming models, the Queries / Views / Transformations (QVT) specification. This OCL 2 reference card has been extensively checked and is compatible with the USE (UML-based Specification Environment) tool [DOI=10.1016/j.scico.2007.01.013] PLEASE CITE THIS REFERENCE CARD IF YOU FIND IT USEFUL! APA style: Brito e Abreu, F. (2018). OCL 2.0 Reference Card. Departamento de Ciências e Tecnologias da Informação, Instituto Universitário de Lisboa, Av. das Forças Armadas, 1649-026 Lisboa, Portugal: ISCTE-IUL. IEEE style: [1]F. Brito e Abreu, OCL 2.0 Reference Card. Departamento de Ciências e Tecnologias da Informação, Instituto Universitário de Lisboa, Av. das Forças Armadas, 1649-026 Lisboa, Portugal: ISCTE-IUL, 2018. BibTeX entry: @MANUAL {BritoeAbreu_OCL_Reference_Card, title = "OCL 2.0 Reference Card", author = "Fernando Brito e Abreu", organization = "ISCTE-IUL", address = "Departamento de Ciências e Tecnologias da Informação, Instituto Universitário de Lisboa, Av. das Forças Armadas, 1649-026 Lisboa, Portugal", month = "dec", year = "2018" }

Uploaded by

Fernando
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

OCL 2.

0 Reference Card Author: Fernando Brito e Abreu Affiliation: ISTAR-IUL / ISCTE-IUL


([email protected])

en t
qu Se
Cite this

ce
Se red
Reference Card

de
t
g
Collection type operations Description

Se
Ba
Or
collection->size(): Integer V V V V Number of elements in the self collection
collection->isEmpty(): Boolean V V V V True if the self collection is empty
collection->notEmpty(): Boolean V V V V True if the self collection is not empty
collection1 = collection2 : Boolean V V V V True if the first collection is equal to the second collection
collection1 <> collection2 : Boolean V V V V True if the first collection is different to the second collection
collection->isUnique(expr: T): Boolean V V V V True if the argument expression is unique within the self collection
collection->select(expr: Boolean): Collection(T) V V V V Elements of the self collection that match the argument condition
collection->reject(expr: Boolean): Collection(T) V V V V Elements of the self collection that do not match the argument condition
collection->sortedBy(OclBasicType): Sequence(T) V V V V Elements of the self collection sorted by the argument expression
collection->collect(expr: T): Collection(T) V V V V Flattened collection of expression values obtained from the self collection members
collection->collectNested(expr: T): Collection(T) V V V V Nested collection of expression values obtained from the self collection members
collection->iterate(x:I [; acc:J=init]|expr: T|Collection(T)): T|Collection(T) V V V V Iterator that allows defining its logic
collection->forAll(expr: Boolean): Boolean V V V V True if the argument expression holds for all members of the self collection
collection->exists(expr: Boolean): Boolean V V V V True if the argument holds for at least one member of the self collection
collection->one(expr: Boolean): Boolean V V V V True if the argument holds for only one member of the self collection
collection->includes(element: T): Boolean V V V V True if the argument is part of the self collection
collection->excludes(element: T): Boolean V V V V True if the argument is not part of the self collection
collection->includesAll(collection: Collection(T)): Boolean V V V V True if all members of the argument collection belong to the self collection
collection->excludesAll(collection: Collection(T)): Boolean V V V V True if none of the members of the argument collection belong to the self collection
collection->including(element: T): Collection(T) V V V V The self collection with the argument added to it
collection->excluding(element: T): Collection(T) V V V V The self collection with the argument removed from it
collection->union(collection: Collection(T)): Collection(T) V V V V The union of the self collection with the argument collection
collection->intersection(collection: Set(T) | Bag(T)): Set(T) | Bag(T) V V The intersection of the self collection with the argument collection
collection1 - collection2: Set(T) V The first set excluding all elements of the second set
collection->symmetricDifference(collection: Set(T)): Set(T) V Union of the self collection with the argument collection, minus their intersection
collection->prepend(element: T): OrderedSet(T) | Sequence(T) V V The self (ordered) collection prepended with the argument
collection->insertAt(pos:Integer,element:T):OrderedSet(T)|Sequence(T) V V The self (ordered) collection with the argument inserted at the position
collection->reverse(): OrderedSet(T) | Sequence(T) V V The self (ordered) collection in reverse order
collection->append(element: T): OrderedSet(T) | Sequence(T) V V The self (ordered) collection appended with the argument
collection->flatten(): Collection(T) V V V V The self collection flattened; only produces effect if the self collection is nested
collection->sum(): Integer | Real V V V V The addition of all elements of an Integer or Real collection
collection->max(): Integer | Real V V V V The largest element of an Integer or Real collection
collection->min(): Integer | Real V V V V The smallest element of an Integer or Real collection
collection->first(): T V V First element of the self (ordered) collection
collection->at(position: Integer): T V V Element of the self (ordered) collection at the given position
collection->last(): T V V Last element of the self (ordered) collection
collection->any(expr: Boolean): T V V V V Any element of the self collection for which the argument expression is true
collection->indexOf(element: T): Integer V V Position within the self collection of the argument; undefined if not found
collection->count(element: T): Integer V V V V The number of times the argument occurs in the self collection
collection->subOrderedSet(lower: Integer, upper: Integer): OrderedSet(T) V Subset of the self ordered set, between the two argument positions
collection->subSequence(lower: Integer, upper: Integer): Sequence(T) V Subsequence of the self sequence, between the two argument positions
collection->asSet(): Set(T) V V V V Cast operator to type T (eliminates duplicates, does not preserve existing order)
collection->asBag(): Bag(T) V V V V Cast operator to type T (does not preserve existing order)
collection->asOrderedSet(): OrderedSet(T) V V V V Cast operator to type T (eliminates duplicates, preserves existing order)
collection->asSequence(): Sequence(T) V V V V Cast operator to type T (preserves existing order)

Object type operations Description


T.allInstances(): Set(T) Static operation that returns the set of all instances of class T
object.isUndefined() : Boolean True if the attribute or link was not initialized or a value (e.g. 5/0) is undetermined
object.isDefined() : Boolean True if the attribute or link was initialized or a value can be determined
oclUndefined(T) Returns the undefined value of type T (e.g.: ? oclUndefined(Real) => Undefined : Real)
object.oclIsTypeOf (T) : Boolean True if self is an instance of type t
object.oclIsKindOf (T) : Boolean True if self is an instance of type t or of one of t type descendants
object.oclAsType (T) : T Cast operator (t should be a subtype of the self type)
Re ean

St er
g
g
rin
ol
al
te

Basic type operators and operations Description


Bo

In

toString() V V V V Serialization operation


= , <> V V V V Equality and inequality operators
> , < , >=, <= V V Relational operators
+,-,*,/ V V Arithmetic operators
not Boolean V Unary logic operator (negation)
Boolean and Boolean, Boolean or Boolean, Boolean xor Boolean V Binary logic operators (conjunction, disjunction, exclusive disjunction)
Boolean implies Boolean V Logic implication
if <booleanExpression> then <resultIfTrue> else <resultIfFalse> endif V Conditional operator like Java's <booleanExpression> ? <resultIfTrue> : <resultIfFalse>
Real|Integer.max(other: Real|Integer): Real|Integer V V Biggest of two numbers
Real|Integer.min(other: Real|Integer): Real|Integer V V Lowest of two numbers
Real.round(): Integer V Normal round operation
Real.floor(): Integer V Truncation operation
Real.ceil(): Integer V Ceiling operation (round upwards)
Integer div Integer V Integer division operator
Integer.mod(divisor: Integer): Integer V Remainder of integer division operation
String.size(): Integer V Number of characters in the string
String.toLower(): String V Lower case conversion operation
String.toUpper(): String V Upper case conversion operation
String.concat(other: String): String V Concatenation operation
String.substring(from: Integer, to: Integer): String V Substring operation

This reference card is licensed as


Creative Commons Attribution-Noncommercial-No Derivatives

You might also like