@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 schema: <http://schema.org/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

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 .
skos:Concept a owl:Class .
skos:example a owl:AnnotationProperty .
skos:note a owl:AnnotationProperty .

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

coswot:State a owl:Class ;
  rdfs:label "State"@en ;
  rdfs:comment "Identifiable conditions that features are or may be in, and that can be observed or controlled by devices. A state kind can apply to different features of interest, while a state of interest is specific to a feature of interest."@en ;
  owl:disjointUnionOf ( coswot:StateOfInterest coswot:StateKind ) ;
  rdfs:isDefinedBy coswot:core\/states .

coswot:StateKind a owl:Class ;
  rdfs:subClassOf coswot:State , skos:Concept ;  
  rdfs:label "State Kind"@en ;
  rdfs:comment "Identifiable conditions that features are or may be in, and that can be observed or controlled by devices. A state can apply to different features of interest."@en ;
  skos:note "Concepts from existing code lists, vocabularies, and taxonomies, may be used as instances of coswot:State."@en ;
  rdfs:subClassOf [ a owl:Restriction ; owl:onProperty skos:broader ; owl:allValuesFrom coswot:StateKind ] ;
  rdfs:subClassOf [ a owl:Restriction ; owl:onProperty skos:narrower ; owl:allValuesFrom coswot:StateKind ] ;
  rdfs:subClassOf [ a owl:Restriction ; owl:onProperty coswot:hasKind ; owl:allValuesFrom owl:Nothing ] ;
  rdfs:isDefinedBy coswot:core\/states .

coswot:StateOfInterest a owl:Class ;
  rdfs:subClassOf coswot:State ;
  rdfs:label "State of Interest"@en ;
  rdfs:comment "Identifiable conditions that features of interest are or may be in, and that can be observed or controlled by devices. An instance of coswot:StateOfInterest is specific to a feature of interest. It is inherent to and cannot exist without that feature of interest."@en ;
  skos:note "A state of interest is the state of (OP coswot:isStateOfInterestOf) exactly one feature of interest."@en ;
  skos:note "Per convention, the IRI of states of interest should consist of the IRI of their feature of interest, suffixed with a fragment identifier #{S} where {S} refers to the name of the state."@en ;
  skos:note """States of interest need not always be explicited. It depends on the use case. Typically, states of interest are useful in applications, where the association between a feature of interest and a state (i.e., the state of interest) needs to be identified and related to other states of interest."""@en ;
  rdfs:subClassOf [ a owl:Restriction ; owl:onProperty coswot:hasKind ; owl:allValuesFrom coswot:StateKind ];
  rdfs:subClassOf [ a owl:Restriction ; owl:onProperty coswot:hasKind ; owl:someValuesFrom coswot:StateKind ];
  rdfs:subClassOf [ a owl:Restriction ; owl:onProperty coswot:isStateOfInterestOf ; owl:cardinality 1 ] ;
  rdfs:isDefinedBy coswot:core\/states .


## The OP coswot:hasState may be used to link a feature to its states. Its inverse is coswot:isStateOf.

coswot:hasState a owl:ObjectProperty ;
  owl:inverseOf coswot:isStateOf ;
  rdfs:label "has state"@en ;
  rdfs:comment "Links a feature or state of interest to one of its states."@en ;
  rdfs:domain [ a owl:Class ; owl:unionOf ( coswot:Feature coswot:StateOfInterest ) ] ;
  rdfs:range coswot:State ;
  rdfs:isDefinedBy coswot:core\/states .

coswot:isStateOf a owl:ObjectProperty ;
  owl:inverseOf coswot:hasState ;
  rdfs:label "is state of"@en ;
  rdfs:comment "Links a state to the feature or state of interest it is a state of."@en ;
  rdfs:domain coswot:State ;
  rdfs:range [ a owl:Class ; owl:unionOf ( coswot:Feature coswot:StateOfInterest ) ] ;
  rdfs:isDefinedBy coswot:core\/states .


## The OP coswot:hasStateKind may be used to link a feature to its state kind. Its inverse is coswot:isStateKindOf.

coswot:hasStateKind a owl:ObjectProperty ;
  rdfs:subPropertyOf coswot:hasState ;
  owl:inverseOf coswot:isStateKindOf ;
  rdfs:label "has state kind"@en ;
  rdfs:comment "Links a feature to one of its state kinds."@en ;
  rdfs:domain [ a owl:Class ; owl:unionOf ( coswot:Feature coswot:StateOfInterest ) ] ;
  rdfs:range coswot:StateKind ;
  owl:propertyChainAxiom ( skos:broader coswot:hasStateKind ) ; ## Feature kinds inherit the states of their broader feature kinds.
  owl:propertyChainAxiom ( coswot:hasKind coswot:hasStateKind ) ; ## Features of interest inherit the states of their feature kinds.
  owl:propertyChainAxiom ( coswot:hasStateOfInterest coswot:hasKind ) ; ## Features of interest inherit the state kinds of their state of interest.
  rdfs:isDefinedBy coswot:core\/states .

coswot:isStateKindOf a owl:ObjectProperty ;
  rdfs:subPropertyOf coswot:isStateOf ;
  owl:inverseOf coswot:hasStateKind ;
  rdfs:label "is state kind of"@en ;
  rdfs:comment "Links a state kind to the feature it is a state of."@en ;
  rdfs:domain coswot:StateKind ;
  rdfs:range [ a owl:Class ; owl:unionOf ( coswot:Feature coswot:StateOfInterest ) ] ;
  rdfs:isDefinedBy coswot:core\/states .

## The OP coswot:hasStateOfInterest may be used to link a feature of interest to its states of interest. Its inverse is coswot:isStateOfInterestOf and is functional.

coswot:hasStateOfInterest a owl:ObjectProperty ;
  rdfs:subPropertyOf coswot:hasState ;
  owl:inverseOf coswot:isStateOfInterestOf ;
  rdfs:comment "Links a feature of interest to one of its states of interest."@en ;
  rdfs:label "has state of interest"@en ;
  rdfs:domain coswot:FeatureOfInterest ;
  rdfs:range coswot:StateOfInterest ;
  rdfs:isDefinedBy coswot:core\/states .

coswot:isStateOfInterestOf a owl:ObjectProperty , owl:FunctionalProperty ;
  rdfs:subPropertyOf coswot:isStateOf ;
  owl:inverseOf coswot:hasStateOfInterest ;
  rdfs:comment "Links a state of interest to the feature of interest it is a state of."@en ;
  rdfs:label "is state of interest of"@en ;
  rdfs:domain coswot:StateOfInterest ;
  rdfs:range coswot:FeatureOfInterest ;
  rdfs:isDefinedBy coswot:core\/states .


