telecom and informatics 1 inf5120 ”modellbasert systemutvikling” ”modelbased system...
TRANSCRIPT
![Page 1: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/1.jpg)
Telecom and Informatics 1
INF5120”Modellbasert Systemutvikling”
”Modelbased System development”
Lecture 6: 20.02.2012Arne-Jørgen Berre
![Page 2: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/2.jpg)
Telecom and Informatics 2
INF5120 - Lecture plan - 2012
Part I: SSI – Service Innovation and Agile Service/Software Engineering Part II: SSMDE – Model Driven Engineering Part III – Model Driven Interoperability and ADM
1: 16/1: Introduction to Model Based System Development (INF5120) 2: 23/1: SIE I: Enterprise Architecture, Role modeling-Collaboration and Value Networks – Verna Allee (VNA) 3: 30/1: SIE II:: Business Process Modeling with BPMN 2.0 and Business Model Innovation - Peter Lindgren (BMI) 4: 6/2: SIE III: AT ONE –User-oriented design – with Use cases and user stories 5: 13/2: SIE IV: Service modeling with SoaML – Service modeling - Design, patterns 6: 20/2: SIE V: Precise Modeing in UML with OCL and Design with DCI - Design, patterns 7: 27/2: MDE I: Software Process Model Frameworks – Essence/SEMAT, SPEM, EPF and ISO 24744 –Shihong
Huang/Brian Elvesæter/Arne J. Berre 8: 5/3: MDE II: Metamodels, Domain specific languages and UML profiles (Franck Fleurey, Brian Elvesæter) 9: 12/3: MDE III: Metamodeling, MDLE and DSL Tools (EMF, GMF, ATL, Kermeta) (Franck Fleurey) 10: 19/3: MDE IV: Model transformations - MOFScript, QVT DSLs with examples (Franck Fleurey) 11: 26/3: MDE V: Internet Service Architectures - and Method Engineering (Arne J. Berre) 2/4, 9/4: EASTER 12: 16/4: MDE VI: User Interface Modeling – IFML etc. - ESITO 13: 23/4: MDI I: Semantic technologies, Ontologies and Semantic annotations , Rules/SBVR 14: 30/4: MDI II: Model Driven Service Interoperability 15: 7/5: MDI III: ADM and Migration to Cloud computing 16: 13/5: Conclusion and Summary for INF5120 - Preparation of Exam
Exam: Monday June 4th, 2011, 1430-1830 (4 hours)
![Page 3: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/3.jpg)
Telecom and Informatics 3
INF5120 – Oblig/Exercise plan - 2012
1: 16/1: None 2: 23/1: Guest lecture: Value Networks – Verna Allee (VNA) 3: 30/1: Guest lecture: Business Model Innovation - Peter Lindgren (BMI) – Establish groups 4: 6/2: AT ONE initial exercise – overall approach for Oblig 1 – “myServiceFellow” 5: 13/2: Group presentation 6: 20/2: Group presentation 7: 27/2: Group presentation
8: 5/3: MDE Tools – introduction – Oblig 2 intro 9: 12/3: MDE Tools II - EMF 10: 21/3: MDE Transformation tools - Delivery of Oblig 1 11: 26/3: Walk through of Oblig 1 2/4, 9/4: EASTER 12: 16/4: MDE User Interface tools – ESITO o.a. 13: 23/4: Oblig 2 questions 14: 30/4: Oblig 2 delivery 15: 7/5: Oblig 2 summary 16: 13/5: Conclusion and Summary for INF5120 - Preparation of Exam
Exam: Monday June 4th, 2011, 1430-1830 (4 hours)
![Page 4: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/4.jpg)
Telecom and Informatics
Outline SoaML – part 2 – composite structures
Modelio – and support for UML 2, SoaML and BPMN
Precise Modeling and use of UML OCL
Roles and DCI
Scala – and support for roles and DCI through Traits
Software Process Engineering Metamodels (next lecture) Oblig 1 – presentations and delivery
![Page 5: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/5.jpg)
Telecom and Informatics
Individual exercise – until February 13th
Download myServiceFellow on a SmartPhone, iPhone or Android (from the respective AppStore).
Identifiy and evaluate touchpoints related to service interaction points you know about in the context of University of Oslo and Institute for Informatics
Think both about touchpoints that can be incrementally improved and radically improved (i.e. new apps/applications etc.)
Document your touchpoint evaluations using the app myServiceFellow
5
![Page 6: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/6.jpg)
Telecom and Informatics
Service Design – ”My University” Actors - Value Networks, Role models – VNA, Verna Allee Service/Customer Journey – BPMN, Role play, Touchpoints - UI sketches – Experiences – UI sketches Opportunities and Needs Identified services – SoaML – collaboration diagrams Specificed services – SoaML - composite diagrams
13/2: Touchpoint identification, customer journey (All) 20/2: Actors and Role models, Value Networks, Role play 27/2: BPMN diagrams, initial SoaML diagrams 19/3-26/3: Final group delivery Oblig 1
6
![Page 7: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/7.jpg)
Telecom and Informatics
Requirements for the Oblig 1 delivery
A group delivery – one document per group - containing your models for your selected area of interest.
Actors – Role models, CRC cards, – Interactive Role play, Value Network analysis
Customer/User/Service journey, BPMN, User stories/use cases
Touchpoints – Service descriptions/specifications, SoaML and UML for information exchange
Opportunities/Needs – match/mismatch ? Experiences – Service experiences, User Interface sketches Voluntary: Any comments on Business Model Innovation
7
Methodology: inf5120.modelbased.net
![Page 8: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/8.jpg)
Telecom and Informatics
Use of tools in Oblig 1
Value Networks – VNA www.valuenetworks.com
Ideas – Sticky/coloured notes in Symphonical – AT ONE workshop results
Service journeys – BPMN in Modelio Service Models – SoaML in Modelio Service Information models – SoaML/UML in Modelio
8
![Page 9: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/9.jpg)
Telecom and Informatics 9
Next Lecture – February 27th, 2012
Software Process Engineering metamodels
SPEM ISO 24744 SEMAT
Oblig 1 – Group presentations, BPMN and SoaML
![Page 10: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/10.jpg)
Telecom and Informatics
10
Service ports and service participants
A Service port: is the offer of a service by one participant to others using well defined terms,
conditions and interfaces defines the connection point through which a Participant offers its capabilities and
provides a service to clients. It is defined using a UML Port on a Participant, and stereotyped as a <<Service>>
A Service port is a mechanism by which a provider Participant makes available services that meet the needs of consumer requests as defined by ServiceInterfaces, Interfaces and ServiceContracts.
![Page 11: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/11.jpg)
Telecom and Informatics
11
ServiceInterfaces and Participants Metamodel
![Page 12: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/12.jpg)
Telecom and Informatics
12
ServiceInterfaces and Participants Profile
![Page 13: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/13.jpg)
Telecom and Informatics
UML Composite Diagrams Composite Diagrams
A composite structure diagram is a diagram that shows the internal structure of a classifier, including its interaction points to other parts of the system. It shows the configuration and relationship of parts, that together, perform the behavior of the containing classifier.
classes can be displayed as composite elements exposing interfaces and containing ports and parts.
13
Start - Explanation of standard UML 2.3
![Page 14: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/14.jpg)
Telecom and Informatics
Part
A part is an element that represents a set of one or more instances which are owned by a containing classifier instance. So for example, if a diagram instance owned a set of graphical elements, then the graphical elements could be represented as parts; if it were useful to do so, to model some kind of relationship between them. Note that a part can be removed from its parent before the parent is deleted, so that the part isn't deleted at the same time.
A part is shown as an unadorned rectangle contained within the body of a class or component element.
14
![Page 15: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/15.jpg)
Telecom and Informatics
Ports
A port is attached to an active class. The port has:
A name. An interface specifying the signals that can be received. An interface specifying the signals that can be sent.
Two types of ports: Connected to internal communication channels (by
default). Connected to the state machine for the class instance (a
behaviour port).
A behaviour port
In interface
Out interface
![Page 16: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/16.jpg)
Telecom and Informatics
Composite Structure
A composite structure diagram shows the relationship among internal components of a class, in terms of communication paths.
The class may have one or more communications ports through which signals can be sent or received.
The ports are connected either to: Internal components
Channels connect the ports of the class to the ports of the internal components.
Channels can be unidirectional (one direction only) or bidirectional (both directions).
The state machine behaviour of the class (a behaviour port).
![Page 17: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/17.jpg)
Telecom and Informatics
Object instance references
instance name
class name
![Page 18: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/18.jpg)
Telecom and Informatics
Composite Structure
![Page 19: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/19.jpg)
Telecom and Informatics 19
Composite class (incomplete) with parts, ports and connectors
ATM
:CardReader
:CashDispenser:Keyboard
User-Reader
User-Keyboard
ATM-bank
User-Cash
:ScreenUser-Screen
part
port
connector
![Page 20: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/20.jpg)
Telecom and Informatics 20
Context Model in UML2.0 - I composite structure as part of a Collaboration
BankContext
:User :ATM :Bank
User-Reader
User-Keyboard
ATM-bank
User-Cash
User-Screen
![Page 21: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/21.jpg)
Telecom and Informatics 21
Context Model in UML2.0 - II
Including multiplicities on parts
BankContext
:User[1..10000]
:ATM[1..100]
:Bank
User-Reader
User-Keyboard
ATM-bank
User-Cash
User-Screen
multiplicity
End - Explanation of standard UML 2.3
![Page 22: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/22.jpg)
Telecom and Informatics
22
Service interface
A ServiceInterface: can type a service port. can specify a bi-directional service
(both the provider and consumer have responsibilities to send and receive messages and events).
A ServiceInterface is defined from the perspective of the service provider using three primary sections: provided and required Interfaces ServiceInterface class protocol Behavior.
![Page 23: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/23.jpg)
Telecom and Informatics
23
Participant with service and request ports
A Service Port is typed by a ServiceInterface A Request port is typed by a conjugate ServiceInterface (defines the use of a
service rather than its provision). This will allow us to connect service providers and consumers in a Participant.
Can be transformed to the appropriate interface/implementation code.
![Page 24: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/24.jpg)
Telecom and Informatics
Interfaces for ParticipantsEach role in the service
that receives interactions has an interface, this is
the interface for a logical technology component and is implemented by components providing or using this service.
This service is bi-directional - messages flow in both directions.
Interfaces will correspond with parts of WSDL in a web services mapping of SoaML
![Page 25: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/25.jpg)
Telecom and Informatics
Logical System ComponentsComponents
implement the service interfaces providing the link
to systems. Participants and services may be used in multiple
architectures.
“Ports” on the participating components provide and require the service
interfaces for each service provided or used
“Ports” on the participating components provide and require the service
interfaces for each service provided or used
![Page 26: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/26.jpg)
Telecom and Informatics
Composite Application Components
Components can be assembled from other components by linking their services. This corresponds to the architecture for
Acme.
Enterprise systems can be integrated with adapter components
Enterprise systems can be integrated with adapter components
Or, new implementation can be defined inside of components.
Or, new implementation can be defined inside of components.
This component is defined as a composition of other
components.
This component is defined as a composition of other
components.
![Page 27: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/27.jpg)
IKT 27
Model examples
ThiNgaminosknnndoZzzkf()karPhew(zAA)
EditortextfontchangeFont(font)addElem(elem)spellCheck()
NuclearReactorCore
add(ControlRod, int)ControlRod remove(int)
![Page 28: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/28.jpg)
IKT 28
Precise modeling – Details in models
Avoid misunderstanding Completeness Baseline for code generation Model analysis
Consistence among models Relationships and mappings between models Analysis of models
![Page 29: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/29.jpg)
IKT 29
Simplify with OCL
Flight Airplane
CargoFlightPassengerFlight
PasssengerPlane CargoPlane11
0..*0..*11
0..*0..*
0..*0..*11flights
![Page 30: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/30.jpg)
IKT 30
Diagram with invariants
context Flightinv: type = #cargo implies airplane.type = #cargoinv: type = #passenger implies airplane.type = #passenger
10..*Flight Airplane
type = enum{cargo, passenger}
type = enum{cargo, passenger}
flights
![Page 31: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/31.jpg)
IKT 31
Definition of constraint
“A constraint is a restriction on one or more values of (part of) an object-oriented model or system.”
![Page 32: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/32.jpg)
IKT 32
Object Constraint Language - OCL
OCL er del av UML Tekstlig språk for å beskrive beskrankninger Predikatlogikk gjort folkelig (ingen ) Constraints
begrensninger på modellene multiplisitet, etc er begrensinger!
ønsker ytterligere begrensninger
Brukes i definisjonen av UMLs metamodell må jo være presis!
Formelt entydig ingen side-effekter
![Page 33: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/33.jpg)
IKT 33
Example model
Airport
Flight
Passenger
Airline
*
**
*
$minAge: Integerage: IntegerneedsAssistance: Boolean
departTime: Time/arrivalTime: Timeduration : IntervalmaxNrPassengers: Integer
origin
desti-nation
name: String
name: String
{ordered}
arrivingFlights
departingFlights
CEO
0..1
flights
passengers
book(f : Flight)
0..1
airline
airline
![Page 34: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/34.jpg)
IKT 34
Constraint context and self
Every OCL expression is bound to a specific context. The context may be denoted within the expression using
the keyword ‘self’.
Who? Who? Me?Me?
![Page 35: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/35.jpg)
IKT 35
Notation
Constraints may be denoted within the UML model or in a separate document. the expression:
context Flight inv: self.duration < 4 is identical to:
context Flight inv: duration < 4 is identical to:
Flight
duration: Integer<<invariant>>duration < 4
![Page 36: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/36.jpg)
IKT 36
Elements of an OCL expression
In an OCL expression these elements may be used: basic types: String, Boolean, Integer, Real. classifiers from the UML model and their features
attributes, and class attributes query operations, and class query operations
associations from the UML model
![Page 37: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/37.jpg)
IKT 37
OCL types
Collection
Set Bag Sequence
OclTypeReal
Integer
String Boolean
OclState
OclExpression
OclAny
![Page 38: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/38.jpg)
IKT 38
Example: OCL basic types
context Airline inv:
name.toLower = ‘klm’
context Passenger inv:
age >= ((9.6 - 3.5)* 3.1).abs implies mature = true
![Page 39: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/39.jpg)
IKT 39
Model classes and attributes
“Normal” attributes context Flight inv:
self.maxNrPassengers <= 1000
Class attributescontext Passenger inv:
age >= Passenger.minAge
![Page 40: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/40.jpg)
IKT 40
Example: query operations
context Flight inv:
self.departTime.difference(self.arrivalTime)
.equals(self.duration)
Time
difference(t:Time):Intervalbefore(t: Time): Booleanplus(d : Interval) : Time
Interval
equals(i:Interval):Boolean$Interval(d, h, m : Integer) :
Interval
$midnight: Timemonth : Stringday : Integeryear : Integerhour : Integerminute : Integer
nrOfDays : IntegernrOfHours : IntegernrOfMinutes : Integer
![Page 41: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/41.jpg)
IKT 41
Example: navigations
Navigations
context Flight
inv: origin <> destination
inv: origin.name = ‘Amsterdam’
context Flight
inv: airline.name = ‘KLM’
![Page 42: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/42.jpg)
IKT 42
Basic “Navigation” expressions
i: Instructor, c: Course, s: Session The name of the course:
c.name
The date of the session: s.date
The instructor assigned to the session: s.instructor
The course of the session: s.course
The name of the course of the session: s.course.name
The instructors qualified for the session: s.course.qualifiedInstructors
Instructorname
Coursename
Sessiondate
qualifiedInstructors qualifiedFor
assignedTo*
0..1*
**
Let’s navigate on a model
![Page 43: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/43.jpg)
IKT 43
Navigation Example
What does a1.r1.r2.r3 yield? Assuming the B’s have a boolean attribute “black”; black=false for b6, b8 - what
expression refers from a2 to the set { b1 }
r2
a
* *
* 1
0..11
A B C
c1
c2
c3
c4
a1
a2
r3r1
b1
b2
b3
b4
b5
b6
b7
b8
![Page 44: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/44.jpg)
IKT 44
Association classes
context Person inv:
if employer.name = ‘Klasse Objecten’ then
job.type = #trainer
else
job.type = #programmer
endif
Person Company
Job
* 1employee employer
type : {trainer, programmer}
name : String
![Page 45: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/45.jpg)
IKT 45
Three subtypes to Collection
Set: arrivingFlights(from the context Airport)
Bag: arrivingFlights.duration (from the context Airport)
Sequence: passengers (from the context Flight)
![Page 46: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/46.jpg)
IKT 46
OCL has a great number of predefined operations on the collections types.
Syntax:
collection->operation
Collection operations
![Page 47: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/47.jpg)
IKT 47
The collect operation
Syntax:collection->collect(elem : T | expr)collection->collect(elem | expr)collection->collect(expr)
Shorthand:collection.expr
The collect operation results in the collection of the values resulting evaluating expr for all elements in the collection
![Page 48: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/48.jpg)
IKT 48
The select operation
Syntax:collection->select(elem : T | expression)
collection->select(elem | expression)
collection->select(expression)
The select operation results in the subset of all elements for which expression is true
![Page 49: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/49.jpg)
IKT 49
The forAll operation
Syntax:collection->forAll(elem : T | expr)
collection->forAll(elem | expr)
collection->forAll(expr)
The forAll operation results in true if expr is true for all elements of the collection
![Page 50: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/50.jpg)
IKT 50
The exists operation
Syntax:collection->exists(elem : T | expr)
collection->exists(elem | expr)
collection->exists(expr)
The exists operation results in true if there is at least one element in the collection for which the expression expr is true.
![Page 51: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/51.jpg)
IKT 51
Example: exists operation
context Airport inv:
self.departingFlights ->
exists(departTime.hour < 6)
![Page 52: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/52.jpg)
IKT 52
Other collection operations
isEmpty: true if collection has no elements notEmpty: true if collection has at least one element size: number of elements in collection count(elem): number of occurences of elem in collection includes(elem): true if elem is in collection excludes(elem): true if elem is not in collection includesAll(coll): true if all elements of coll are in collection
![Page 53: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/53.jpg)
IKT 53
Iterate example
Example iterate:context Airline inv:
flights->select(maxNrPassengers > 150)->notEmpty
Is identical to:context Airline inv:
flights->iterate(f : Flight; answer : Set(Flight) = Set{ } |
if f.maxNrPassengers > 150 then
answer->including(f)
else answer endif )->notEmpty
![Page 54: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/54.jpg)
IKT 54
OCL — Navigation Details
An association end with cardinality maximum > 1 yields a set or sequence anInstructor.Session yields a sequence anInstructor.qualifiedFor yields a set
An association end with cardinality maximum of 1 yields an object or a set (with zero or one elements) aSession.Instructor yields an object aSession.Instructor->isEmpty yields a Boolean
*
*
qualifiedFor
InstructorqualifiedFor
CoursequalifiedInstructors
Sessiondateevaluation
* {seq}
*
0..1
![Page 55: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/55.jpg)
IKT 55
Collections use
i: Instructor The courses an instructor is qualified to teach
Course.allInstances ->select ( c | c.qualifiedInstructors ->includes ( i ))
Sessions delivered by an instructor who is no longer qualified to teach it Session.allInstances ->select ( s | s.delivered and
s.course.qualifiedInstructors ->excludes ( s.instructor ) )
The last can be simplified significantly with “convenience” attributes Session.allInstances ->select ( s | s.teacherNotQualified )
Instructorname
Coursename
Sessiondatedelivered
qualifiedInstructors qualifiedFor
assignedTo*
0..1*
**
Let’s navigate on a model
![Page 56: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/56.jpg)
IKT 56
Another Invariant Formalized
Always combine formal and narrative descriptions
-- for every instructor ...Instructor::invariant -- for any courseCourse.allInstances->forAll ( c |-- if the evaluation bad Session->select(Course=c)->forAll(s |
s.evaluation = bad -- then instructor is disqualified for course implies qualifiedFor ->excludes (c)) )
Instructor
Course*
*
qualifiedFor
Sessiondateevaluation
* {seq}
*
qualifiedInstructors
![Page 57: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/57.jpg)
IKT 57
Same Invariant on Course
-- for every course ...Course::invariant -- for all sessionsSession->forAll ( s |-- if the evaluation is bad s.evaluation = bad implies -- then the instructor is not a qualified instructorqualifiedInstructors->excludes(s.Instructor) )
Instructor
Course*
*
qualifiedFor
Sessiondateevaluation
* {seq}
*
qualifiedInstructors
![Page 58: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/58.jpg)
IKT 58
Operation Specification
operation SeminarSystem::pay (in client:Client, out amount: Money)
-- When you pay off an invoice
pre -- Provided the payment amount is not negative and does not
-- exceed amount owed
client .balance >= amount and amount>=0
post -- The balance is reduced by the amount of the payment
client.balance@pre = client.balance + amount
SeminarSystempay(client:Client, amount: Money)
Clientbalance
![Page 59: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/59.jpg)
IKT 59
let, new: Convenient Names, New Objects
Any specification can introduce local names using let … in ...operation SeminarSystem::scheduleCourse
(client: Client, date: Date, course: Course)
let ( availableInstructors =
instructors ->select (qualifiedFor(course) and availableOn(date)) )
in ( -- the name “availableInstructors” can be used in pre or post
pre availableInstructors ->notEmpty
post -- some instructor from available instructors is assigned …
)
Actions often result in the creation of a new objectlet (s = Session.new) in ( -- s is a new member of Session type
s.client = client and s.date = date and s.course = course
and ….
)
![Page 60: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/60.jpg)
IKT 60
OCL — Misc.
Special words @pre designates a value at the start of an operation
total = total@pre + amount self designates the object itself
self.total = self.total@pre + amount result designates the returned object (if any)
result = total
Comments -- Two hyphens start a comment that goes through the end of line
![Page 61: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/61.jpg)
IKT 61
OCL Tools
Cybernetics ww.cybernetic.org
University of Dresden www-st.inf.tu-dresden.de/ocl/
Boldsoft www.boldsoft.com
ICON computing www.iconcomp.com
Royal Dutch Navy Others … …
![Page 62: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/62.jpg)
IKT 62
Conclusions and Tips
OCL invariants allow you to model more precisely stay implementation independent
OCL pre- and postconditions allow you to specify contracts (design by contract) precisely specify interfaces of components
OCL usage tips keep constraints simple always combine natural language with OCL use a tool to check your OCL
![Page 63: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/63.jpg)
IKT 63
Diskusjon
Sett dere sammen i grupper på 2-3 og diskuter følgende: Vil OCL være et nyttig bidrag i noen av deres modeller? På hvilken
måte? Kan dere gi eksempler fra øvingsoppgaven hvor OCL ville ha øket
presisjonen i deres modeller?
Er det noen ulemper med bruk av OCL?
![Page 64: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/64.jpg)
IKT 64
UML og OCL
Skriver OCL som tilleggsdokumentasjon til modeller
Skriver OCL i Constraints (Verktøy)problem: hvordan bruke aktivt
forfining konsistens kodegenerering
![Page 65: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/65.jpg)
IKT 65
Further resources on OCL
The Object Constraint Language ISBN 0-201-37940-6
OCL home page www.klasse.nl/ocl/index.htm
![Page 66: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/66.jpg)
IKT 66
OclAnyx,y:OclAny; T is a OclType
x = y
x < > y
x.oclIsNew
x.oclType
x.isKindOf(T)
x.isTypeOf(T)
x.asType(T)
x and y are the same object
not (x=y)
True if x is a new instance
The type of x
True if T is a supertype (transitive) of
the type of x
True if T is equal to the type of x
Results in x, but of type T.
![Page 67: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/67.jpg)
IKT 67
OclType and operators
Logical operators in Boolean expressions and, or, xor, not, implies
T is a OclTypeT.newT.allInstances
Create a new instance of type TAll of the instances of type T
![Page 68: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/68.jpg)
IKT 68
Collection (1)
c,c2 : Collection(T); x,e:T; P:T Boolean; f, f2: T Objectc->size Number of elementsc->sum Sum of elements (elements
must support addition)c->count(e) Number of times e is in cc->isEmpty c->size = 0c->notEmpty not c->isEmpty
![Page 69: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/69.jpg)
IKT 69
Collection (2)
c->includes(e) True if e is in cc->includesAll(c2) True if c2 in cc->excludes(e) True if e not in cc->exludesAll(c2) True if none in c2 is in cc->exists(P) True if an e makes P truec->forAll(P) True if P true for all e in cc->isUnique(f) True if f evaluates to
different value for all e in cc->sortedBy(f) Sequence sorted by fc->iterate(x;e=f;f2) Iterate x over c and apply f2,
initialise e to f
![Page 70: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/70.jpg)
IKT 70
Collection subtypes (1)
Applies to set and bagset, bag: Collection; e,x:T; P: TBoolean; f, f2: TObject
set->union(set2)set->union(bag)set = set2set->intersection(set2)set->intersection(bag)set – set2set->including(e)
![Page 71: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/71.jpg)
IKT 71
Collection subtypes (2)
set->excluding(e)set->symmetricDifference(set2)
The set of elements in set or set2, but not in both
set->select(x|P) All elements for which P is validset->select(P) Same as set->select(self|P)set->reject(x|P) Same as set->select(x|not P)set->reject(P) Same as set->select(self|not P)set->collect(x|f) The bag of elements which results
from applying f to every member of set
set->asSequenceset->asBag
![Page 72: Telecom and Informatics 1 INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 6: 20.02.2012 Arne-Jørgen Berre arneb@ifi.uio.noarneb@ifi.uio.no](https://reader031.vdocuments.mx/reader031/viewer/2022032802/56649e175503460f94b0358e/html5/thumbnails/72.jpg)
IKT 72
Sequence
seq->append(e) seq followed by eseq->prepend(e) e followed by seqseq->subSequence(lower, upper)
Subsequence in range [lower, upper]
seq->at(i) Element at position iseq->first seq->at(1)seq->last seq->at(seq->size)