Transforming Process Safety Management: Challenges, Benefits, and Transition ...
CQL
1. @ncardoz
CQL
Nicolás Cardozo
Declarative language for context
activation
10th International Workshop on Context-Oriented Programming (COP’18) - Amsterdam, the Netherlands
n.cardozo@uniandes.edu.co
16-07-2018
5. Context activation3
Individual objects may
require different specialized
behavior at different times
Transport management system, to
control independent events in the
network
Reroute all busses in a line due to
an accident?
16. Context creation9
Context objects are declared within a context. Such context can be
used to enrich the knowledge about the context object
new cop.Context({
name: “developerBlue”
date: 160420171425
sensor: “login”
last_update: “260420181138”
})
{
Object properties describe the context’s context
21. CQL language10
activate: date > 160420171425 for: highlighter
Action Expression ForStatement
What to do Which context to use Which entity to affect
22. CQL and context traits11
activate: date between(010420170001,250520172350)
Activate all the contexts
created within the given date
range
23. CQL and context traits11
activate: date between(010420170001,250520172350)
Activate all the contexts
created within the given date
range
DevContextYellow
DevContextBlue
DevContextRed
DevContextPurple
DevContextOrange
24. CQL and context traits11
activate: date between(010420170001,250520172350)
Activate all the contexts
created within the given date
range
DevContextBlue.activate()
DevContextYellow.activate()
DevContextPurple.activate()
DevContextYellow
DevContextBlue
DevContextRed
DevContextPurple
DevContextOrange
25. Public transport management system12
FullStation
FullBus
RoadClosed AccidentOnRoad
NoBus
StationClosed
contexts
26. Public transport management system13
redBus
blueBus
whiteBus
yellowBus
Street
Avenue
station1
station2
station3
entities
27. 14
Context scoping mechanisms
activate: FullStation
Global context activation
Activate the FullStation context for all available stations
FullStation.adapt(Station, FullStationTrait)
FullStation.activate()
28. 15
Context scoping mechanisms
Per type context activation
activate: RoadClosed for: Avenue
Close all the ‘avenue’ roads
RoadClosed.adapt(Avenue, RoadClosedTrait)
RoadClosed.activate()
29. 16
Context scoping mechanisms
Per instance context activation
activate: FullBus for: redBus
Activate the FullBus context to the particular redBus instance
FullBus.adapt(redBus, FullBusTrait)
FullBus.activate()
30. 17
Context scoping mechanisms
Group context activation
activate: FullStation for: station1 & FullBus
for: line5
a particular station is full, and all the buses in the line with
that station are full
FullStation.activate()
32. Wrap-up18
@ncardoz
Activation of multiple contexts at once
Unified scoping mechanism for adaptations
Reduced development complexity
➡ Soundness of the unified scoping model
➡ Extension for different types of applications
(e.g., testing)
33. Wrap-up18
@ncardoz
Activation of multiple contexts at once
Unified scoping mechanism for adaptations
Reduced development complexity
➡ Soundness of the unified scoping model
➡ Extension for different types of applications
(e.g., testing)
Questions ?