@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .

@prefix vann:   <http://purl.org/vocab/vann/> .
@prefix voaf:   <http://purl.org/vocommons/voaf#> .
@prefix dce:    <http://purl.org/dc/elements/1.1/> .
@prefix dct:    <http://purl.org/dc/terms/> .
@prefix widoco:	<https://w3id.org/widoco/vocab#>.

@prefix thing: <https://ontology.flandersmake.be/thing/ontology#> .
@prefix resource: <https://ontology.flandersmake.be/resource/ontology#> .
@prefix product: <https://ontology.flandersmake.be/product/ontology#> .

@base            <https://ontology.flandersmake.be/routing/ontology#> .
@prefix :        <https://ontology.flandersmake.be/routing/ontology#> .
@prefix routing: <https://ontology.flandersmake.be/routing/ontology#> .

<https://ontology.flandersmake.be/routing/ontology> 
    rdf:type owl:Ontology ;
    vann:preferredNamespaceUri    "https://ontology.flandersmake.be/routing/ontology#" ;
    vann:preferredNamespacePrefix "routing" ;
    owl:versionIRI <https://ontology.flandersmake.be/routing/ontology/1.0.1>;
    owl:versionInfo "1.0.0" ;
    rdfs:label "The Routing ontology"@en ;
    rdfs:comment "An ontology of Routings, representing production and logistics decisions";
    dct:created  "2026-01-21"^^xsd:date ;
    dct:modified "2026-01-21"^^xsd:date ;
    dct:issued   "2026-01-21"^^xsd:date ;
    dce:title "The Routing ontology"@en ;

    dce:abstract '''
A Routing is a decision involving Prouducts and Resources. Products are either consumed
or produced by a Routing. Resources are reserved by a Routing.
A routing can be a production process, a logistics action. A routing can also be an aggregation
of actions at some level (company, region) involving aggregated products and resources.
Routing can have an hierarchical structure. Routing can be defined and instantiated
'''@en;

    widoco:introduction '''
A production process (a bill of process) defines the production of 1 or several products. Its
execution requires input products that will be consumed and resources that will be reserved. 
A production process is a Routing.

A product transport will reserve resources (vehicle, personal), will make product unavailabe at 
the start location (read: consume), and will make product availabe that the end location (read 
product). A transport is a Routing.
'''@en;

    dce:description '''
## Concept Routing

A Routing is an activity (to be decided)
- that is executed at some level
- that consumes Products at some level (number of units)
- that produces Products at some level (number of units)
- that uses (or reserves) Resources at some level (number of hours)
     
A Routing may have an hierarchical structure:
- subelements are other activities to be executed

A collection of identical Routings will share a common Definition:
- the Routing definition is the description of what is about to be executed
- the Routing entity is a particular execution, planned or executed

The following concepts are defined in this ontology:
- a **Routing** is an activity 
  - generating Product consumption
  - generating Product production
  - generating Resource reservation
- a **Flow** is a quantity of Product consumed or produced by a Routing
- a **Reservation** is a capacity of Resource reserved by a Routing

```mermaid
classDiagram
    class Routing
    class Flow {
        flowQuantity: real
        flowSense: -1, +1
    }
    class Reservation {
        reservedQuantity: real
    }

    Reservation --> Resource: reservedResource
    Flow --> Product: flowProduct

    Routing o--> Flow : inputFlow
    Routing o--> Flow : outputFlow
    Routing o--> Reservation: reservation

    class  Product:::other
    class  Resource:::other

    classDef default fill:#f96,color:black
    classDef other fill:#e9edc9,color:black
    classDef user fill:white,color:black
```

## Concept Capability

A capability is an effect to be performed that is necessary for the execution of the activity (routing), as for instance painting, milling, lifting, moving. The expression of the activity is independent of the provider of the resource.

The following concepts are defined in this ontology:
- a **Capability** is some effect to be performed for the execution of the activity
  - a capability is required by a Routing
  - a capability is provided by a Resource
- a **CapabilityProvider** is an entity providing capability
  - e.g. a manufacturing resource
  - e.g. a supplier offering that capability
- a **CapabilityImplementation** is an implementation of a capability by a Provider
  - does not depend on the Routing, but only on the Resource
  - qualifies the Capability provided by the Resource
    - so reifies the association 'provides(Provider Capability)'
  - e.g. a supplier recommendation for a given capability request
  - e.g. a Resource capable of providing the capability

```mermaid
classDiagram
    class Routing

    class Capability {
        kind: Capability
    }
    Routing o--> Capability : capabilityRequired
    CapabilityProvider o--> CapabilityImplementation : capabilityImplementation

    class  Resource:::other
    Resource --|> CapabilityProvider
    class CapabilityImplementation {
        reservedQuantity: real
    }

    Capability "1" <-- CapabilityImplementation: capabilityProvided

    classDef default fill:#f96,color:black
    classDef other fill:#e9edc9,color:black
    classDef user fill:white,color:black
```
'''@en.  

###############################################################################
# Routing entities
###############################################################################
routing:Entity
    rdf:type owl:Class;
    rdfs:subClassOf thing:Entity;
    rdfs:comment '''A Routing is something executed, consuming and producing Products, reserving Resources'''@en.

routing:SubEntity
    rdf:type owl:Class;
    rdfs:subClassOf thing:SubEntity.

routing:subEntity
    rdf:type owl:ObjectProperty;
    rdfs:domain routing:Entity;
    rdfs:range routing:SubEntity.

routing:subEntityEntity
    rdf:type owl:ObjectProperty;
    rdfs:subPropertyOf thing:subEntityEntity;
    rdf:type owl:FunctionalProperty;
    rdfs:domain routing:SubEntity;
    rdfs:range routing:Entity.

routing:hasSubEntity
    rdf:type owl:ObjectProperty;
    rdfs:subPropertyOf thing:hasSubEntity;
    rdfs:domain routing:Entity;
    rdfs:range routing:Entity;
    owl:propertyChainAxiom (
         routing:subEntity 
         routing:subEntityEntity
    ).

###############################################################################
# Routing definitions
###############################################################################
routing:entityDefinition 
    rdf:type owl:ObjectProperty;
    rdfs:subPropertyOf thing:entityDefinition;
    rdfs:domain routing:Entity;
    rdfs:range routing:Definition.

routing:Definition
    rdf:type owl:Class;
    rdfs:subClassOf routing:Entity;
    rdfs:subClassOf thing:Definition.

routing:subEntityDefinition 
    rdf:type owl:ObjectProperty;
    rdfs:subPropertyOf thing:subEntityDefinition;
    rdfs:domain routing:SubEntity;
    rdfs:range routing:SubDefinition.

routing:SubDefinition
    rdf:type owl:Class;
    rdfs:subClassOf routing:SubEntity;
    rdfs:subClassOf thing:SubDefinition.

routing:subDefinition
    rdf:type owl:ObjectProperty;
    rdfs:subPropertyOf thing:subDefinition;
    rdfs:domain routing:Definition;
    rdfs:range routing:SubDefinition.

routing:subDefinitionDefinition
    rdf:type owl:ObjectProperty;
    rdfs:subPropertyOf thing:subDefinitionDefinition;
    rdf:type owl:FunctionalProperty;
    rdfs:domain routing:SubDefinition;
    rdfs:range routing:Definition.

routing:subDefinitionQuantity
    rdf:type owl:ObjectProperty;
    rdfs:domain routing:SubDefinition;
    rdfs:range xsd:decimal.

routing:hasSubDefinition
    rdf:type owl:ObjectProperty;
    rdfs:subPropertyOf thing:hasSubDefinition;
    rdfs:domain routing:Definition;
    rdfs:range routing:Definition;
    owl:propertyChainAxiom (
         routing:subDefinition 
         routing:subDefinitionDefinition
    ).

###############################################################################
# Routing products
###############################################################################
routing:flowDefinition
    rdf:type owl:ObjectProperty;
    rdfs:domain routing:Definition;
    rdfs:range routing:FlowDefinition.

routing:inputDefinition
    rdf:type owl:ObjectProperty;
    rdfs:subPropertyOf routing:flowDefinition.

routing:outputDefinition
    rdf:type owl:ObjectProperty;
    rdfs:subPropertyOf routing:flowDefinition.

routing:FlowDefinition
    rdf:type owl:Class;
    rdfs:comment '''A flow of Products created by a unit execution of this routing'''@en.

routing:flowProduct
    rdf:type owl:ObjectProperty;
    rdfs:domain routing:FlowDefinition;
    rdfs:range product:Definition.

routing:flowQuantity
    rdf:type owl:DatatypeProperty;
    rdfs:domain routing:FlowDefinition;
    rdfs:range xsd:decimal.

routing:flowSense
    rdf:type owl:DatatypeProperty;
    rdfs:domain routing:FlowDefinition;
    rdfs:range [ 
        owl:oneOf (
            "1.0"^^xsd:decimal 
            "-1.0"^^xsd:decimal 
        ) 
    ].

###############################################################################
# Routing resources
###############################################################################
routing:reservationDefinition
    rdf:type owl:ObjectProperty;
    rdfs:domain routing:Definition;
    rdfs:range routing:ReservationDefinition.

routing:ReservationDefinition
    rdf:type owl:Class;
    rdfs:comment '''A resource reservation created by a unit execution of this routing'''@en.

routing:reservationResource
    rdf:type owl:ObjectProperty;
    rdfs:domain routing:ReservationDefinition;
    rdfs:label "reservedResource";
    rdfs:range resource:Definition.

routing:reservationQuantity
    rdf:type owl:DatatypeProperty;
    rdfs:domain routing:RoutingReservationDefinition;
    rdfs:range xsd:decimal;
    rdfs:label "reservedQuantity";
    rdfs:comment '''Quantity of the Resource reserved of a unit execution of the Routing'''@en.

###############################################################################
# Capabilities
###############################################################################

resource:Definition 
    rdfs:subClassOf routing:CapabilityProvider.

routing:CapabilityProvider
    rdf:type owl:Class;
    rdfs:comment '''An entity (defintion) capable of providing capabilities'''@en.

routing:capabilityRequired
    rdf:type owl:ObjectProperty;
    rdfs:domain routing:Definition;
    rdfs:range routing:Capability;
    rdfs:comment '''A capability required by the Routing for a unit execution'''@en.

routing:Capability
    rdf:type owl:Class;
    rdfs:comment '''An effect required by a Routing and provided by a Resource (or some other provider)'''@en.

routing:capabilityImplementation
    rdf:type owl:ObjectProperty;
    rdfs:domain routing:CapabilityProvider;
    rdfs:range routing:CapabilityImplementation;
    rdfs:comment '''A capability provided by the Resource'''@en.

routing:CapabilityImplementation
    rdf:type owl:Class;
    rdfs:comment '''An implementation providing capability for this Resource (a reified provided capability)'''@en.

routing:capabilityProvided
    rdf:type owl:ObjectProperty;
    rdfs:domain routing:CapabilityImplementation;
    rdfs:range routing:Capability;
    rdfs:comment '''The capability provided by the Resource for this implementation'''@en.

routing:capabilityImplementationQuantity
    rdf:type owl:ObjectProperty;
    rdfs:domain routing:CapabilityImplementation;
    rdfs:range xsd:decimal;
    rdfs:label "reservedQuantity";
    rdfs:comment '''The amount of Resource reserved (a duration) for a unit execution of the Routing'''@en.

# Serialization annotations added by generate_docs.py
<https://ontology.flandersmake.be/routing/ontology>
    <https://w3id.org/widoco/vocab#turtleSerialization> "routing.ttl" ;
    <https://w3id.org/widoco/vocab#rdfxmlSerialization> "routing.rdf" ;
    <https://w3id.org/widoco/vocab#ntSerialization> "routing.nt" ;
    <https://w3id.org/widoco/vocab#jsonldSerialization> "routing.jsonld" .
