# Copyright 2016 ITEA 12004 SEAS Project.
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#      http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing,
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix dc: <http://purl.org/dc/terms/> .
@prefix vann: <http://purl.org/vocab/vann/> .
@prefix voaf: <http://purl.org/vocommons/voaf#> .
@prefix vs: <http://www.w3.org/2003/06/sw-vocab-status/ns#> .
@prefix cc: <http://creativecommons.org/ns#>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
@prefix saref: <http://ontology.tno.nl/saref#>. #SAREF smart building appliances ontology
@prefix qudt: <http://data.qudt.org/qudt/owl/1.0.0/qudt.owl#> .
@prefix qudt-unit: <http://data.qudt.org/qudt/owl/1.0.0/unit.owl#> . #QUDT units
@prefix ssn: <http://www.w3.org/ns/ssn/>.

@prefix seas: <https://w3id.org/seas/>.
@base <https://w3id.org/seas/>.

seas:SystemOntology rdf:type voaf:Vocabulary , owl:Ontology ;
  dc:title "SEAS-System ontology"@en ;
  dc:description """The System Ontology defines Systems, Connections between systems, and Connection Points at which systems may be connected. This ontology is then specialized for multiple domains. For example:
  - In electric energy: 
    - power systems consume, produce, store, and exchange electricity;
    - power connections are where electricity flows between systems;
    - power connection points are plugs, sockets, or power busses.
  - In the electricity market:
    - players and markets are systems;
    - connections are contracts or transactions between two players, or between a player and a market;
    - connection points include offers and bids."""@en ;
  dc:description <https://w3id.org/seas/system.png> ;
  dc:issued "2016-06-06"^^xsd:date ;
  dc:modified "2016-07-22"^^xsd:date ;
  dc:creator <http://www.maxime-lefrancois.info/me#> ;
  cc:license <https://creativecommons.org/licenses/by/4.0> ;
  vann:preferredNamespacePrefix "seas" ;
  vann:preferredNamespaceUri <https://w3id.org/seas/> ; 
  owl:imports seas:FeatureOfInterestOntology ;
  owl:versionIRI <https://w3id.org/seas/SystemOntology-1.0> ;
  owl:versionInfo "v1.0" .

# systems

seas:System a owl:Class ;
  rdfs:label "System"@en ;
  rdfs:comment """The class of systems, i.e., systems virtually isolated from the environment, whose behaviour and interactions with the environment are modeled.

  Systems can be connected to other systems. Connected systems interact in some ways. For example:

```
  <electric_vehicle> seas:connectedTo <electric_vehicle_service_equipment> .
```

  Systems can also have subsystems. Properties of subsystems somehow contribute to the properties of the supersystem. For example:

```
<battery> seas:subSystemOf <electric_vehicle> .
```
"""@en ;
  rdfs:subClassOf seas:FeatureOfInterest ;
  vs:term_status "stable" ;
  rdfs:isDefinedBy seas:SystemOntology .

seas:connectedTo a owl:ObjectProperty , owl:SymmetricProperty ;
  rdfs:label "connected to"@en ;
  rdfs:comment """Links a system to a system it is connected to. Connected systems interact in some ways. 
  This is a symmetric property: if system A is connected to system B, then system B is also connected to system A.
  For example, for the electricity to directly flow between an electric vehicle service equipment and an electric vehicle, then they must be connected: 

```
  <electric_vehicle> seas:connectedTo <electric_vehicle_service_equipment> .
```

  This property can be qualified using class seas:Connection, which connects the two systems.
  If there is a connection between several systems, then one may infer these systems are pairwise connected."""@en ;
  rdfs:domain seas:System ;
  rdfs:range seas:System ;
  vs:term_status "stable" ;
  rdfs:isDefinedBy seas:SystemOntology .

seas:subSystemOf a owl:ObjectProperty , owl:TransitiveProperty ;
  rdfs:label "sub system of"@en ;
  rdfs:comment """Links a system to its super system.
  This is a strict order relation (asymmetric and transitive).
  Properties of subsystems somehow contribute to the properties of the supersystem.
  For example, if a battery is a subsystem of an electric vehicle, then its consumption power contributes to the consumption power of the electric vehicle:

```
  <battery> seas:subSystemOf <electric_vehicle> .
```
"""@en ;
  rdfs:domain seas:System ;
  rdfs:range seas:System ;
  vs:term_status "stable" ;
  rdfs:isDefinedBy seas:SystemOntology .

# connections

seas:Connection a owl:Class ;
  rdfs:label "Connection"@en ;
  rdfs:comment """The class of connections between systems.
  This class qualifies property seas:connectedTo. 
  A connection describes potential interactions between systems. 
  For example, a power connection between power systems describes the fact that these systems may exchange electricity.

```
  <connection> seas:connectsSystem <electric_vehicle> , <electric_vehicle_service_equipment> .
  <electric_vehicle> seas:connectedThrough <connection> .
  <electric_vehicle_service_equipment> seas:connectedThrough <connection> .
```

  Any two connected systems are connected through a connection:
  if:

```
  <system1> a seas:System .
  <system2> a seas:System .
  <system1> seas:connectedTo <system2> .
```

  then there exists `_:connection` such that:

```
  <connection> seas:connectsSystem <system1> , <system2> .
```

    A connection can connect more than two systems at the same time."""@en ;
  rdfs:subClassOf seas:FeatureOfInterest ;
  rdfs:subClassOf [ owl:onProperty seas:connectsSystem ; owl:someValuesFrom  seas:System ] ;
  rdfs:subClassOf [ owl:onProperty seas:connectsSystemAt ; owl:someValuesFrom  seas:ConnectionPoint ] ;
  owl:disjointWith seas:System ;
  vs:term_status "stable" ;
  rdfs:isDefinedBy seas:SystemOntology .

seas:connectsSystem a owl:ObjectProperty ;
  rdfs:label "connects system"@en ;
  rdfs:comment "Links a connection to one of the systems it connects."@en ;
  rdfs:domain seas:Connection ;
  rdfs:range seas:System ;
  owl:inverseOf seas:connectedThrough ;
  vs:term_status "stable" ;
  rdfs:isDefinedBy seas:SystemOntology .

seas:connectedThrough a owl:ObjectProperty ;
  rdfs:label "connected through"@en ;
  rdfs:comment "Links a system to one of its connections to other systems."@en ;
  rdfs:domain seas:System ;
  rdfs:range seas:Connection ;
  owl:inverseOf seas:connectsSystem ;
  vs:term_status "stable" ;
  rdfs:isDefinedBy seas:SystemOntology .

# seas:connectedTo owl:propertyChainAxiom ( seas:connectedThrough seas:connectsSystem ) .
# this axiom is not true: it would imply that every connected system is connected to itself


# connection points

seas:ConnectionPoint a owl:Class ;
  rdfs:label "Connection Point"@en ;
  rdfs:comment """The class of connection points of systems, at which they may be connected to other systems.
  This class qualifies properties seas:connectsSystem and seas:connectedThrough.
  A connection point belongs to exactly one system.

  For example, an electric vehicle service equipment may have three power connection points: two different kinds of plugs that enable to charge electric vehicles, and a three phase power bus connection point to the grid:

```
  <electric_vehicle> seas:connectsAt <plug_high_voltage> , <normal_plug> , <three_phase_connection_point> .
```

  Any system connected through a connection is connected at one of its connection points to the connection:
  if:

```
  <system> a seas:System .
  <system> seas:connectedThrough <connection> .
  <connection> a seas:Connection .
```

  then there exists `_:connectionPoint` such that:

```
  <system> seas:connectsAt _:connectionPoint .
  _:connectionPoint seas:connectsSystemAt <connection> .
```


  The system of a connection point that is connected through a connection is itself connected through the connection:
  if:

```
  <connection> a seas:Connection .
  <system> a seas:System .
  <connectionPoint> a seas:ConnectionPoint ;
  <connectionPoint> seas:connectsSystemThrough <connection> .
```

  then it is true that:

```
  <connectionPoint> seas:connectionPointOf <system> .
```
"""@en ;
  rdfs:subClassOf seas:FeatureOfInterest ;
  rdfs:subClassOf [ owl:onProperty seas:connectionPointOf ; owl:cardinality 1 ] ;
  owl:disjointWith seas:System, seas:Connection ;
  vs:term_status "stable" ;
  rdfs:isDefinedBy seas:SystemOntology .

seas:connectedThrough owl:propertyChainAxiom ( seas:connectsAt seas:connectsSystemThrough ) .
seas:connectsSystem owl:propertyChainAxiom ( seas:connectsSystemAt seas:connectionPointOf ) .


seas:connectsAt a owl:ObjectProperty, owl:InverseFunctionalProperty ;
  rdfs:label "connects at"@en ;
  rdfs:comment "Links a system to one of the connection points at which it connects."@en ;
  rdfs:domain seas:System ;
  rdfs:range seas:ConnectionPoint ;
  owl:inverseOf seas:connectionPointOf ;
  vs:term_status "stable" ;
  rdfs:isDefinedBy seas:SystemOntology .

seas:connectionPointOf a owl:ObjectProperty, owl:FunctionalProperty ;
  rdfs:label "connection point to"@en ;
  rdfs:comment "Links a connection point to the one and only system it belongs to."@en ;
  rdfs:domain seas:ConnectionPoint ;
  rdfs:range seas:System ;
  owl:inverseOf seas:connectsAt ;
  vs:term_status "stable" ;
  rdfs:isDefinedBy seas:SystemOntology .

seas:connectsSystemAt a owl:ObjectProperty ;
  rdfs:label "connects system at"@en ;
  rdfs:comment "Links a connection to one of the connection points at which it connects a system."@en ;
  rdfs:domain seas:Connection ;
  rdfs:range seas:ConnectionPoint ;
  owl:inverseOf seas:connectsSystemThrough ;
  vs:term_status "stable" ;
  rdfs:isDefinedBy seas:SystemOntology .

seas:connectsSystemThrough a owl:ObjectProperty ;
  rdfs:label "connects system through"@en ;
  rdfs:comment "Links a connection point to one of the connections through which it connects its system."@en ;
  rdfs:domain seas:ConnectionPoint ;
  rdfs:range seas:Connection ;
  owl:inverseOf seas:connectsSystemAt ;
  vs:term_status "stable" ;
  rdfs:isDefinedBy seas:SystemOntology .

