File size: 2,462 Bytes
5070096 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
standard library package CausationConnections {
doc
/*
* This package provides a library model modeling causes, effects, and causation connections
* between them.
*/
private import SequenceFunctions::isEmpty;
private import SequenceFunctions::size;
private import SequenceFunctions::intersection;
abstract occurrence causes[*] {
doc /* Occurrences that are causes. */
}
abstract occurrence effects[*] {
doc /* Occurrences that are effects. */
}
abstract connection def Multicausation {
doc
/*
* A Multicausation connection models the situation in which one set of
* occurrences causes another.
*
* To create a Multicausation connection, specialize this connection definition
* adding specific end features of the relavent types. Ends representing causes
* should subset 'causes', while ends representing effects should subset 'effects'.
* There must be at least one cause and at least one effect.
*/
ref occurrence causes[1..*] :>> causes :> participant {
doc /* The causing occurrences. */
}
ref occurrence effects[1..*] :>> effects :> participant {
doc /* The effect occurrences caused by the causing occurrences. */
}
private assert constraint disjointCauseEffect {
doc /* causes must be disjoint from effects. */
isEmpty(intersection(causes, effects))
}
private succession causalOrdering first causes.startShot[nCauses] then effects[nEffects] {
doc /* All causes must exist before all effects. */
attribute nCauses = size(causes);
attribute nEffects = size(effects);
}
}
abstract connection multicausations : Multicausation[*] {
doc /* multicausations is the base feature for Multicausation ConnectionUsages. */
}
connection def Causation :> Multicausation {
doc
/*
* A Causation is a binary Multicausation in which a single cause occurrence
* causes a single effect occurrence. (However, a single cause can separately
* have multiple effects, and a single effect can have separate Causation
* connections with multiple causes.)
*/
end occurrence theCause[*] :>> causes :>> source {
doc /* The single causing occurrence. */
}
end occurrence theEffect[*] :>> effects :>> target {
doc /* The single effect occurrence resulting from the cause. */
}
}
abstract connection causations : Causation[*] :> multicausations {
doc /* causations is the base feature for Causation ConnectionUsages. */
}
} |