diff --git a/behaviour/fsm.json b/behaviour/fsm.json new file mode 100644 index 0000000..3a71dd7 --- /dev/null +++ b/behaviour/fsm.json @@ -0,0 +1,68 @@ +{ + "@context": { + "fsm": "https://secorolab.github.io/metamodels/behaviour/fsm#", + "xsd": "http://www.w3.org/2001/XMLSchema#", + + "FSM": "fsm:FSM", + + "name": { "@id": "fsm:name", "@type": "xsd:string" }, + "description": { "@id": "fsm:description", "@type": "xsd:string" }, + + "State": "fsm:State", + "Transition": { + "@id": "fsm:Transition", + "@context": { + "transition-from": { + "@id": "fsm:transition-from", + "@type": "@id" + }, + "transition-to": { + "@id": "fsm:transition-to", + "@type": "@id" + } + } + }, + "Reaction": { + "@id": "fsm:Reaction", + "@context": { + "when-event": { + "@id": "fsm:when-event", + "@type": "@id" + }, + "do-transition": { + "@id": "fsm:do-transition", + "@type": "@id" + }, + "fires-events": { + "@id": "fsm:fires-events", + "@container": "@set", + "@type": "@id" + } + } + }, + + "states": { + "@id": "fsm:states", + "@container": "@set" + }, + + "start-state": { "@id": "fsm:start-state", "@type": "@id" }, + "current-state": { "@id": "fsm:current-state", "@type": "@id" }, + "end-state": { "@id": "fsm:end-state", "@type": "@id" }, + + "events": { + "@id": "fsm:events", + "@container": "@set" + }, + + "transitions": { + "@id": "fsm:transitions", + "@container": "@set" + }, + + "reactions": { + "@id": "fsm:reactions", + "@container": "@set" + } + } +} diff --git a/behaviour/fsm.shacl.ttl b/behaviour/fsm.shacl.ttl new file mode 100644 index 0000000..7196dfa --- /dev/null +++ b/behaviour/fsm.shacl.ttl @@ -0,0 +1,111 @@ +@prefix sh: . +@prefix xsd: . +@prefix fsm: . +@prefix el: . + +fsm:FSMShape + a sh:NodeShape ; + sh:targetClass fsm:FSM ; + + sh:property [ + sh:path fsm:name ; + sh:datatype xsd:string ; + sh:minCount 1 ; + sh:maxCount 1 ; + ] ; + + sh:property [ + sh:path fsm:description ; + sh:datatype xsd:string ; + sh:maxCount 1 ; + ] ; + + sh:property [ + sh:path fsm:states ; + sh:node fsm:StateShape ; + sh:minCount 1 ; + ] ; + + sh:property [ + sh:path fsm:start-state ; + sh:class fsm:State ; + sh:minCount 1 ; + sh:maxCount 1 ; + ] ; + + sh:property [ + sh:path fsm:end-state ; + sh:class fsm:State ; + sh:minCount 1 ; + sh:maxCount 1 ; + ] ; + + sh:property [ + sh:path fsm:current-state ; + sh:class fsm:State ; + sh:minCount 1 ; + sh:maxCount 1 ; + ] ; + + sh:property [ + sh:path fsm:events ; + sh:class el:Event ; + sh:minCount 1 ; + ] ; + + sh:property [ + sh:path fsm:transitions ; + sh:node fsm:TransitionShape ; + sh:minCount 1 ; + ] ; + + sh:property [ + sh:path fsm:reactions ; + sh:node fsm:ReactionShape ; + sh:minCount 1 ; + ] . + +fsm:StateShape + a sh:NodeShape ; + sh:targetClass fsm:State . + +fsm:TransitionShape + a sh:NodeShape ; + sh:targetClass fsm:Transition ; + + sh:property [ + sh:path fsm:transition-from ; + sh:class fsm:State ; + sh:minCount 1 ; + sh:maxCount 1 ; + ] ; + + sh:property [ + sh:path fsm:transition-to ; + sh:class fsm:State ; + sh:minCount 1 ; + sh:maxCount 1 ; + ] . + +fsm:ReactionShape + a sh:NodeShape ; + sh:targetClass fsm:Reaction ; + + sh:property [ + sh:path fsm:when-event ; + sh:class el:Event ; + sh:minCount 1 ; + sh:maxCount 1 ; + ] ; + + sh:property [ + sh:path fsm:do-transition ; + sh:class fsm:Transition ; + sh:minCount 1 ; + sh:maxCount 1 ; + ] ; + + sh:property [ + sh:path fsm:fires-events ; + sh:class el:Event ; + ] .