@prefix coswot: <https://w3id.org/coswot/> .
@prefix cc: <http://creativecommons.org/ns#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix vann: <http://purl.org/vocab/vann/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix time: <http://www.w3.org/2006/time#>.

cc:license a owl:AnnotationProperty .
dct:issued a owl:AnnotationProperty .
dct:title a owl:AnnotationProperty .
dct:description a owl:AnnotationProperty .
dct:modified a owl:AnnotationProperty .
dct:contributor a owl:AnnotationProperty .
vann:preferredNamespacePrefix a owl:AnnotationProperty .
vann:preferredNamespaceUri a owl:AnnotationProperty .
rdfs:comment a owl:AnnotationProperty .
skos:Concept a owl:Class .
skos:example a owl:AnnotationProperty .
skos:note a owl:AnnotationProperty .
time:TemporalEntity a owl:Class .
time:TemporalInterval a owl:Class .

coswot:core\/procedures a owl:Ontology ;
  cc:license <https://creativecommons.org/licenses/by/4.0/> ;
  dct:description "The CoSWoT Core Procedure Execution module describes the act of carrying executions."@en ;
  dct:contributor "Maxime Lefrançois", "Catherine Roussey", "Fatma-Zohra Hannou" ;
  dct:title "CoSWoT Core Procedure Execution module"@en ;
  owl:imports coswot:core\/features ;
  vann:preferredNamespacePrefix "coswot" ;
  vann:preferredNamespaceUri "https://w3id.org/coswot/" .


coswot:Procedure a owl:Class ;
  rdfs:label "Procedure Execution"@en ;
  rdfs:comment "A workflow, protocol, plan, algorithm, or computational method. A Procedure is re-usable, and might be executed multiple times. It explains the steps to be carried out to arrive at reproducible results."@en ;
  rdfs:isDefinedBy coswot:core\/procedures .

coswot:ProcedureCollection a owl:Class ;
  rdfs:label "Procedure Collection"@en ;
  rdfs:comment "A logical grouping of procedures."@en ;
  rdfs:isDefinedBy coswot:core\/procedures .

## A coswot:ProcedureExecution represents the act of carrying out a procedure. 

coswot:ProcedureExecution a owl:Class ;
  rdfs:label "Procedure Execution"@en ;
  rdfs:comment "Act of carrying out a Procedure. This class generalizes the Observation, Actuation, OperationExecution, and CommandExecution classes, and is not expected to be used directly."@en ;
  rdfs:isDefinedBy coswot:core\/procedures .


coswot:ProcedureExecutionCollection a owl:Class ;
  rdfs:label "Procedure Execution Collection"@en ;
  rdfs:comment "Logical grouping of procedure executions. This is a convenient class that is not expected to be used directly."@en ;
  rdfs:isDefinedBy coswot:core\/procedures .


## OP coswot:madeBy links a procedure execution to the entity that made it (including, but not only, devices).

coswot:madeBy a owl:ObjectProperty  ;
    owl:inverseOf coswot:madeExecution ;
    rdfs:label "made by"@en ;
    rdfs:comment "Links a procedure execution to the entity (e.g., device) that made it."@en ;
    rdfs:domain coswot:ProcedureExecution ;
    rdfs:range coswot:FeatureOfInterest ;
    rdfs:isDefinedBy coswot:core\/procedures .

coswot:madeExecution a owl:ObjectProperty  ;
    owl:inverseOf coswot:madeBy ;
    rdfs:label "made execution"@en ;
    rdfs:comment "Links an entity (e.g., device) to the procedure execution it made."@en ;
    rdfs:domain coswot:FeatureOfInterest ;
    rdfs:range coswot:ProcedureExecution ;
    rdfs:isDefinedBy coswot:core\/procedures .


## A procedure or procedure execution may be described in terms of its input parameters using OP coswot:hasInput. Typically, input parameters are features, properties, or states.

coswot:hasInput a owl:ObjectProperty ;
  rdfs:label "has input"@en ;
  rdfs:comment "Links a procedure (e.g., a command) or procedure execution (e.g., an observation) to its inputs."@en ;
  rdfs:domain [ a owl:Class ; owl:unionOf ( coswot:Procedure coswot:ProcedureExecution ) ] ;
  skos:example "Different complementary commands can be defined for controlling a light. Turn on or off the light based on a desired state, toggle the light status of a specific light, set the luminosity level with a transition time, set the default transition time, start comfort."@en ;
  rdfs:isDefinedBy coswot:core\/functions_commands .

## A procedure may be described in terms of its outputs using OP coswot:hasOutput. Typically, outputs are properties or states.

coswot:hasOutput a owl:ObjectProperty ;
  rdfs:label "has output"@en ;
  rdfs:comment "Links a procedure (e.g., an operation) to its outputs."@en ;
  rdfs:domain coswot:Procedure ;
  skos:example "Different complementary commands can be defined for observing a smart home. Observe the temperature once will output the indoor temperature property; observe status of the entry door will output an open/close state."@en ;
  rdfs:isDefinedBy coswot:core\/functions_commands .

## A procedure execution may be linked to its result using OP coswot:hasResult. 

coswot:hasResult a owl:ObjectProperty ;
    rdfs:label "has result"@en ;
    rdfs:comment "Links a procedure execution (e.g., an observation) to its result (e.g., a property value)."@en ;
    rdfs:domain coswot:ProcedureExecution ;
    rdfs:isDefinedBy coswot:core\/procedures .


## DP coswot:hasStartTime links a procedure execution to the instant of time when the procedure was initiated or tasked, expressed as an xsd:dateTime literal.

coswot:hasStartTime a owl:DatatypeProperty ;
  rdfs:label "has start time"@en ;
  rdfs:comment """Links a procedure execution to the instant of time when the activity was initiated or tasked, expressed as an xsd:dateTime literal"""@en ;
  rdfs:domain coswot:ProcedureExecution ;
  rdfs:range xsd:dateTime ;
  rdfs:isDefinedBy coswot:core\/procedures .


## DP coswot:hasResultTime links a procedure execution to the instant of time when the procedure is completed, expressed as an xsd:dateTime literal.

coswot:hasResultTime a owl:DatatypeProperty ;
  rdfs:label "has result time"@en ;
  rdfs:comment "Links a procedure execution to the instant of time when the activity was completed, expressed as an xsd:dateTime literal."@en ;
  rdfs:domain coswot:ProcedureExecution ;
  rdfs:range xsd:dateTime ;
  rdfs:isDefinedBy coswot:core\/procedures .

## OP coswot:hasPhenomenonTime links a procedure execution to the time that the result applies. It may be an interval or an instant, or some other compound temporal entity expressed using OWL Time.

coswot:hasPhenomenonTime a owl:ObjectProperty ;
  rdfs:label "has phenomenon time"@en ;
  rdfs:comment """Links a procedure execution to the time that the result applies. It may be an interval or an instant, or some other compound temporal entity expressed using OWL Time.
    
The phenomenonTime is not necessarily the same as the resultTime. 

In the case of Actuation, phenomenonTime should indicate the time that the actuator was active. 

In the case of Observation, the phenomenonTime may be distant from the resultTime, for example in the case of forecasts the phenomenonTime is after the resultTime."""@en ;
  rdfs:domain coswot:ProcedureExecution ;
  rdfs:range time:TemporalEntity ;
  rdfs:isDefinedBy coswot:core\/procedures .


## When the start time, the result time, and the phenomenon time are the same time instants, then DP coswot:hasTimestamp can be used to simply link a procedure execution to the time of these instants, expressed as an xsd:dateTime literal.

coswot:hasTimestamp a owl:DatatypeProperty ;
  rdfs:label "has timestamp"@en ;
  rdfs:comment "Links a procedure execution to an instant. When the start time, the result time, and the phenomenon time are the same time instants, then DP coswot:hasTimestamp can be used to simply link a procedure execution to the time of these instants, expressed as an xsd:dateTime literal."@en ;
  rdfs:domain coswot:ProcedureExecution ;
  rdfs:range xsd:dateTime ;
  rdfs:isDefinedBy coswot:core\/procedures .


## OP coswot:isExecutionOf links a procedure execution to the procedure that was executed.

coswot:isExecutionOf a owl:ObjectProperty ;
  rdfs:label "is execution of"@en ;
  rdfs:comment "Links a procedure execution to the procedure that was executed."@en ;
  rdfs:domain coswot:ProcedureExecution ;
  rdfs:range coswot:Procedure ;
  owl:propertyChainAxiom ( coswot:isExecutionOf skos:broader ) ; ## If a procedure execution is an execution of a procedure kind, it is also the execution of its broader procedure kinds.
  owl:propertyChainAxiom ( coswot:isExecutionOf coswot:hasKind ) ; ## If a procedure execution is an execution of a procedure of interest, it is also the execution of its procedure kind.
  rdfs:isDefinedBy coswot:core\/procedures .



