@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@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 obs: <https://ontology.flandersmake.be/observable/ontology#> .
@prefix dep: <https://ontology.flandersmake.be/dependency/ontology#> .

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

<https://ontology.flandersmake.be/dependency/ontology> 
    rdf:type owl:Ontology ;
    owl:versionIRI <https://ontology.flandersmake.be/dependency/ontology/1.0.0>;
    owl:versionInfo "1.0.0" ;
    rdfs:label "The Dependency Ontology"@en ;
    rdfs:comment "An ontology of dependencies, allowing specify to derived properties and their derivations";
    vann:preferredNamespaceUri    "https://ontology.flandersmake.be/dependency/ontology#" ;
    vann:preferredNamespacePrefix "dep" ;
    dct:created  "2026-01-02"^^xsd:date ;
    dct:modified "2026-01-02"^^xsd:date ;
    dct:issued   "2026-01-02"^^xsd:date ;
    dce:title "The Dependency Ontology"@en ;

    dce:abstract '''
A Dependency specifies a derived property - the outputDimension - as a function of other
properties - the inputDimensions. An OperatorDependency is a Dependency specifying the 
derivation logic with an Operator (builtin, or conform to the Expression ontology). A 
Constraint is a Dependency specifying the feasibility of an instance with a boolean
outputDimension. An Aggregation is a Dependency gathering the inputs from a set of associated 
instances: the Aggregation scope.
'''@en;

    widoco:introduction '''
The Dependency ontology allows to specify derived properties and their derivations.

A derived property is a property of an Observable that depends (is derived from) on
other Dimensions of that Observable.

The Dimensions the derived property depends on can be a given set of Dimensions, or a given Dimension
on a set of associated instances (the scope of the aggregation).

A particular case of Dependency is a Constraint, where the derived property is a boolean 
specifying the validity (or feasibility) of the Observable.
'''@en;

    dce:description '''
The Dependency ontology allows to specify derived properties and their derivations.

## Concept Dependency

The following concepts are formalized:

- **Dependency**: specifies a derived Dimension of an Observable
- **InputsDependency**: specifies the derivation from a set of Dimensions
- **Aggregation**: specifies the derivation from a scope of associated objects

```mermaid
classDiagram 
  direction TB
  namespace observable {
    class Observation:::obs 
    class Dimension:::obs 
  }
    Observation --> Dimension :observedDimensions
    class Dependency {
      operator: Operator
    }
    Dependency --|> Observation

    class InputsDependency 
    class Aggregation {
      scope
    }
  Dependency <|-- Aggregation
  Dependency <|-- InputsDependency
  Dimension <-- InputsDependency : inputDimensions
  Dimension <-- Dependency : outputDimension
  Dimension <-- Aggregation : inputDimensionScope
  Dimension <-- Aggregation : inputDimensionThis

  classDef default fill:#f96,color:black
  classDef obs fill:#e9edc9,color:black
```

## Concept Constraint

The following concepts are formalized:

- **Constraint**: a Dependency specifying the feasibility of the Observable
- **ConstrainedObservable**: the class of Observables with Constraints
- **Constrained**: the base class of ConstrainedObservable's

```mermaid
classDiagram 
  direction BT
  
  namespace UpperOntology {
    class Constraint
    class Dependency
    class Observable
    class ConstrainedObservable
    class Observation 
  }  
  Observable <-- Observation : observationObservable
  Dependency --|> Observation
  Constraint --|> Dependency
  ConstrainedObservable --|> Observable
  namespace DomainOntology{
    class Constrained{
      feasible: boolean
    }
    class aConstrained:::user
    class aConstraint:::user

  }
  aConstraint --> Constraint : type
  aConstrained --> ConstrainedObservable : type
  aConstrained --|> Constrained
  Constrained --> Constraint: violatingConstraint

  namespace DomainData{
    class aConstrainedInstance:::user{
      feasible: false
    }
  }
  aConstrainedInstance --> aConstrained : type

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

```
'''@en.  
        
#################################################################
#    Ontology
#       for dependencies between observable dimensions
#################################################################

#################################################################
# Dependency
#   a Dependency is an Observation
#   expressing the dependency of an ouputDimension
#################################################################
dep:Dependency 
    rdf:type rdfs:Class ;
    rdfs:subClassOf obs:Observation;
    rdfs:comment '''An Observation specifying a derived Dimension'''@en  .

dep:outputDimension 
    rdf:type  rdf:Property ;
    rdfs:subPropertyOf obs:observedDimension;
    rdfs:domain dep:Dependency ;
    rdfs:range  obs:Dimension;
    rdfs:comment '''The derived Dimension specified by the Dependency'''@en  .

dep:Dependencies
    rdf:type rdfs:Class ;
    rdfs:subClassOf rdf:List.

dep:firstDependency
    rdf:type rdf:Property;
    rdfs:subPropertyOf rdf:first;
    rdfs:domain dep:Dependencies;
    rdfs:range dep:Dependency.    

dep:restDependencies
    rdf:type rdf:Property;
    rdfs:subPropertyOf rdf:rest;
    rdfs:domain dep:Dependencies;
    rdfs:range dep:Dependencies.    

#################################################################
# DependencyInputs
#   a dependency for a set of input properties
#################################################################
dep:InputsDependency 
    rdf:type rdfs:Class ;
    rdfs:subClassOf dep:Dependency;
    rdfs:comment '''A Dependency with a set of input Dimensions'''@en .

dep:inputDimensions 
    rdf:type  rdf:Property ;
    rdfs:subPropertyOf obs:observedDimensions;
    rdfs:domain dep:InputsDependency ;
    rdfs:range  obs:Dimensions;
    rdfs:comment '''The Dimensions the derived Dimension depends on'''@en  . 

#################################################################
# OperatorDependency
#    A dependency expressed by an Operator
#    An Operator is a predicate that 
#       associates a list of values
#       with a value
#    math: N3 builtins are Operators
#    exp: Expressions are Operators
#################################################################
dep:OperatorDependency 
    rdf:type rdfs:Class ;
    rdfs:subClassOf dep:Dependency;
    rdfs:comment '''A Dependency specifying the derivation logic with an Operator'''@en . 

dep:operator
    rdfs:subClassOf owl:ObjectProperty;
    rdfs:domain dep:OperatorDependency;
    rdfs:range rdfs:Resource. 

#################################################################
# Aggregation
#    A dependency expressed by an Operator
#    An Operator is a predicate that 
#       associates a list of values
#       with a value
#    math: N3 builtins are Operators
#    exp: Expressions are Operators
#################################################################
dep:Aggregation 
    rdf:type rdfs:Class ;
    rdfs:subClassOf dep:Dependency;
    rdfs:comment '''A Dependency specifying its inputs wiht a scope and a Dimension in that scope'''@en .

# the set of elements to be aggregated
#   Question: is this compatible with the OWA? How to close the scope?
dep:aggregationScope
    rdfs:subClassOf owl:ObjectProperty;
    rdfs:domain dep:Aggregation;
    rdfs:range owl:ObjectProperty;
    rdfs:comment '''The property specifying the scope of the aggregation'''@en  .     

# the aggregated dimension, expected to be present on the elements in scope
dep:inputDimensionScope
    rdf:type  rdf:Property ;
    rdfs:subPropertyOf obs:observedDimension;
    rdfs:domain dep:Aggregation ;
    rdfs:range  obs:Dimension ;
    rdfs:comment '''The aggregated Dimension (over the scope)'''@en  .

# some dimension on the aggregation context (observable)
#    that will contribute to the aggregation
dep:inputDimensionThis
    rdf:type  rdf:Property ;
    rdfs:subPropertyOf obs:observedDimension;
    rdfs:domain dep:Aggregation ;
    rdfs:range  obs:DimensionOrNull ;
    rdfs:comment '''An extra Dimension on the Observable that will be considered in the aggregation'''@en  .    

#################################################################
# Constraint
#################################################################

dep:Constraint
    rdf:type rdfs:Class ;
    rdfs:subClassOf dep:InputsDependency;
    rdfs:comment "A Constraint is an Dependency with observed dimensions as inputs and BooleanDimension as ouput" .

dep:feasibleDimension 
    rdf:type  rdf:Property ;
    rdfs:subPropertyOf dep:outputDimension;
    rdfs:domain dep:Constraint ;
    rdfs:range  obs:BooleanDimension .

dep:ConstrainedObservable
    rdfs:subClassOf obs:Observable;
    rdfs:comment "The class ConstrainedObservable is the subset of Observables with Constraints" .

_:ObservableWithConstraint
    rdfs:subClassOf dep:ConstrainedObservable;
    rdf:type owl:Restriction ;
    owl:someValuesFrom dep:Constraint;
    owl:onProperty  obs:observableObservation;
    rdfs:comment "Observable with Constraints are members of ConsrainedObservable".

# elements of ConstrainedObservable are subclasses of Constrained
dep:SubClassOfConstrained
    rdf:type owl:Restriction ;
    owl:onProperty rdfs:subClassOf;
    owl:hasValue dep:Constrained;
    rdfs:comment "Members of ConstrainedObservable are subClassOf Constrained" .
dep:ConstrainedObservable rdfs:subClassOf dep:SubClassOfConstrained.

dep:Constrained 
    rdf:type owl:Class;
    rdfs:comment "The class of instances with constraints. The base class of ConstrainedObservable's".

dep:feasible 
   rdf:type owl:DatatypeProperty;
   rdfs:domain dep:Constrained;  
   rdfs:range xsd:boolean.

dep:violatingConstraint
   rdf:type owl:ObjectProperty;
   rdfs:domain  dep:Constrained;
   rdfs:range dep:Constraint.    

dep:Constraints
    rdf:type rdfs:Class ;
    rdfs:subClassOf rdf:List.

dep:firstConstraint
    rdf:type rdf:Property;
    rdfs:subPropertyOf rdf:first;
    rdfs:domain dep:Constraints;
    rdfs:range dep:Constraint.    

dep:restConstraints
    rdf:type rdf:Property;
    rdfs:subPropertyOf rdf:rest;
    rdfs:domain dep:Constraints;
    rdfs:range dep:Constraints.    


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