@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#>.

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

#################################################################
#    Observable ontology
#################################################################

<https://ontology.flandersmake.be/event/ontology> 
    rdf:type owl:Ontology ;
    vann:preferredNamespaceUri    "https://ontology.flandersmake.be/event/ontology#" ;
    vann:preferredNamespacePrefix "obs" ;
    owl:versionIRI <https://ontology.flandersmake.be/event/ontology/1.0.1>;
    owl:versionInfo "1.1.0" ;
    rdfs:label "The Event ontology"@en ;
    rdfs:comment "An ontology of Events, allowing to associate probabilities to the Event outcomes";
    dct:created  "2026-01-01"^^xsd:date ;
    dct:modified "2026-01-09"^^xsd:date ;
    dct:issued   "2026-01-09"^^xsd:date ;
    dce:title "The Event ontology"@en ;

    dce:abstract '''
The Event ontology is a vocabulary for describing uncertain Events, their outcomes and their dependencies.
Furthermore, the vocabulary allows to describe Predictions and Realizations. A Prediction is a belief
on the Event outcomes, namely (conditional) probabilities for those outcomes. A Realization is a possible 
outcome for a set of Events and is associated with a probability that all those outcomes happen. A Realization can take into account stated outcomes of dependent events.
'''@en;

    widoco:introduction '''
An Event is something that happens and can have different outcomes.
Those outcomes are uncertain, and can be associated with probabilities.

Examples of Events are:
- the demand of a given product to a given organization
- the price of a given product in a given market
- the availability of a given machine in a given time period

Events can depend on each other. For example the price of product can depend on the demand for that product.

Outcomes of Events are associated with probabilities. These probabilities can be conditional to outcomes
of Events this Event depends on.
'''@en;

    dce:description '''
## Prediction

The following concepts are formalized:
- an **Event** is something that happens and that can have different outcomes
- an **Outcome** is an outcome that a given Event can take
- a **dependency** between 2 Events states that the probabilities of the dependent Event are impacted by the Outcomes of the other Event
- a **Prediction** is a belief over the outcomes of a set of Events
- an **EventPredicted** is a probability for an event outcome, possibly conditionnaly to other event outcomes

A Prediction is actually a Bayesian network. 
An Outcome is a column in a Bayesian table/node of a Bayesian network.
An EventPredicted is a cell in a Bayesian table/node.  

For a given Prediction, the sets of Realizations with their corresponding probabilities can be derived (see next section).

```mermaid
classDiagram
    class Event  
    Event --> "1" Event: dependency
    class Outcome {
        outcomeValue: real
    }
    Event o--> Outcome

    class Prediction:::top 
    Prediction o--> EventPredicted
    class EventPredicted:::pred {
        probability: real
    }
    class Prediction:::pred 

    EventPredicted --> "1" Outcome: predictedOutcome
    EventPredicted --> "*" Outcome: dependencyOutcome

    classDef default fill:#f96,color:black
    classDef pred fill:#e9edc9,color:black
    classDef rea fill:#e1c8ea,color:black
```

## Realization

The following concepts are formalized:
- a **PredictionRealization** receives a set (possibly empty) of stated Outcomes for the Prediction events and provides all the possible EventRealizations of the non-stated Events
- an **EventRealization** is a combination of EventOutcomes, with the probability that all these outcomes happen; it is associated to
  - an outcome of an event
  - a precedent EventRealization, with dependent event outcomes

```mermaid
classDiagram
    class PredictionRealization:::rea 
    PredictionRealization --> "0..*" Outcome: statedOutcome

    PredictionRealization o--> EventRealization 
    class EventRealization:::rea {
        probability: real
    }

    class Prediction:::pred 

    PredictionRealization <--o Prediction
    EventRealization --> Outcome: eventOutcome
    EventRealization --> "1" EventRealization : precedent

    classDef default fill:#f96,color:black
    classDef pred fill:#e9edc9,color:black
    classDef rea fill:#e1c8ea,color:black
```
'''@en.  
    

###############################################################################
# Event 
###############################################################################
event:Event 
    rdf:type owl:Class;
    rdfs:label "Event"@en;
    rdfs:comment '''An uncertain event impacting the production, with different possible outcomes; 
    a prowl:Node and a a prowl:PR-OWL table'''@en.

event:Events
    rdf:type owl:Class;
    rdfs:subClassOf rdf:List;
    rdfs:comment '''A list of Events (possibly sorted from most dependent to least dependent)'''@en.

event:eventOutcome
    rdf:type owl:ObjectProperty;
    rdfs:domain event:Event;
    rdfs:range event:Outcome.

event:outcomeEvent
    rdf:type owl:ObjectProperty;
    owl:inverseOf event:eventOutcome;
    rdfs:domain event:Outcome;
    rdfs:range event:Event.

event:Outcome 
    rdf:type owl:Class;
    rdfs:label "Outcome"@en;
    rdfs:comment '''An outcome of an event (a column of a Bayesian table)'''@en.

event:Outcomes
    rdf:type owl:Class;
    rdfs:subClassOf rdf:List. # list of  prd:EventOutcome.

# value events (or quantity events)
event:ValueEvent 
    rdf:type owl:Class;
    rdfs:subClassOf event:Event;
    rdfs:comment '''An Event whose outcomes are values (quantities)'''@en.

event:eventOutcomeValue
    rdf:type owl:ObjectProperty;
    rdfs:subPropertyOf event:eventOutcome;
    rdfs:domain event:ValueEvent;
    rdfs:range event:ValueOutcome.

event:ValueOutcome 
    rdf:type owl:Class;
    rdfs:subClassOf event:Outcome;
    rdfs:comment '''A value (quantity) outcome of an event'''@en.

event:outcomeValue
    rdf:type owl:DatatypeProperty;
    rdfs:domain event:ValueOutcome;
    rdfs:range xsd:decimal;
    rdfs:label "OutcomeValue"@en;
    rdfs:comment '''The actual value outcome'''@en.

# event dependency
event:eventDependency
    rdf:type owl:ObjectProperty;
    rdf:type owl:TransitiveProperty;
    rdfs:domain event:Event;
    rdfs:range event:Event; 
    rdfs:comment '''An event impacting the subject event (an Edge in the Bayesian network);
    the subject Event depends on the object Event. '''@en.

event:eventDependencyNot
    rdf:type owl:ObjectProperty;
    rdfs:domain event:Event;
    rdfs:range event:Event; 
    rdfs:comment '''The subject event is not dependent on the object event. 
    This is the complement of the extension of event:eventDependenty in a given context'''@en.

###############################################################################
# Prediction
###############################################################################

event:Prediction
    rdf:type owl:Class;
    rdfs:label "Prediction"@en;
    rdfs:comment '''A prediction of a set of Events, possibly provided by the Impact Prediction Tool;
    a Prediction i a belief on uncertain events (Events), namely their (conditional) probabilities'''@en.

event:predictionSortedEventsAll
    rdf:type owl:ObjectProperty;
    rdfs:domain event:Prediction;
    rdfs:range event:Events;
    rdfs:comment '''The list of events in the Prediction, sorted from most dependent to less dependent. 
    Used as topological order for the derivations (derived)'''@en.

event:predictionSortedEvents
    rdf:type owl:ObjectProperty;
    rdfs:domain event:Prediction;
    rdfs:range event:Events;
    rdfs:comment '''A sublist of predictionSortedEventsAll, from some arbitrary element to the end (derived)'''@en.

event:predictedEvent
    rdf:type owl:ObjectProperty;
    rdfs:domain event:Prediction;
    rdfs:range event:EventPredicted.

event:EventPredicted
    rdf:type owl:Class;
    rdfs:comment '''The outcome of an event with a probability, 
    possibly conditionnally to other event outcomes (a cell of a Bayesian table); 
    a prowl:ProbabilityAssignment (input)'''@en.

event:eventPredictedOutcome
    rdf:type owl:ObjectProperty;
    rdf:type owl:FunctionalProperty;
    rdfs:domain event:EventPredicted;
    rdfs:range event:Outcome.

event:eventPredictedProbability
    rdf:type owl:DatatypeProperty;
    rdfs:domain event:EventPredicted;
    rdfs:range xsd:decimal.

event:eventPredictedDependencyOutcome
    rdf:type owl:ObjectProperty;
    rdf:type owl:FunctionalProperty;
    rdfs:domain event:EventPredicted;
    rdfs:range event:Outcomes.
    
###############################################################################
# Realization
###############################################################################
event:predictionRealization  
    rdf:type owl:ObjectProperty;
    rdfs:domain event:Prediction;
    rdfs:range event:PredictionRealization.

event:realizationPrediction  
    rdf:type owl:ObjectProperty;
    owl:inverseOf event:predictionRealization;
    rdfs:domain event:PredictionRealization;
    rdfs:range event:Prediction.

event:PredictionRealization
    rdf:type owl:Class;
    rdfs:comment '''A Realization for a Prediction. Provides the set of all possible Realizations of
    the Prediction Events assuming a number of Events (possibly none) have a stated outcome'''@en.

event:statedOutcomes
    rdf:type owl:ObjectProperty;
    rdf:type owl:FunctionalProperty;
    rdfs:domain event:PredictionRealization;
    rdfs:range event:Outcomes;
    rdfs:comment '''Event Outcomes assumed to have happened in the context of this realization (input)'''@en.

event:statedEvents
    rdf:type owl:ObjectProperty;
    rdf:type owl:FunctionalProperty;
    rdfs:domain event:PredictionRealization;
    rdfs:range event:Events;
    rdfs:comment '''The stated events for this Realization(derived)'''@en.

event:realizationEventsTop
    rdf:type owl:ObjectProperty;
    rdfs:domain event:PredictionRealization;
    rdfs:range event:RealizationEvents;
     rdfs:comment '''The complete list of events (stated or predicted) in the Realization, sorted according to the dependencies (derived)'''@en.

event:realizationEvents
    rdf:type owl:ObjectProperty;
    rdfs:domain event:PredictionRealization;
    rdfs:range event:RealizationEvents;
    rdfs:comment '''A sublist of predictionAllEvents, from an arbitrary element to the end (least dependent event)(derived)'''@en.

event:RealizationEvents
    rdf:type owl:Class;
    rdfs:comment '''A list of Events with associated EventRealization's, for which event realizations will be derived.'''@en.

event:realizationEventsEvents
    rdf:type owl:ObjectProperty;
    rdfs:domain event:RealizationEvents;
    rdfs:range event:Events.
    
event:precedentRealizationEvents
    rdf:type owl:ObjectProperty;
    rdfs:domain event:RealizationEvents;
    rdfs:range event:RealizationEvents.

event:eventRealization
    rdf:type owl:ObjectProperty;
    rdfs:domain event:RealizationEvents;
    rdfs:range event:EventRealization;
    rdfs:comment '''A event realization of the Events in the subject list.'''@en.
    
event:EventRealization
    rdf:type owl:Class;
    rdfs:comment '''An event realization specifies an outcome for an event and all its dependencies, 
    it is associated with the probability that all these outcomes happen (or the probability that this
    outcome happens conditonnaly to all dependent events)'''@en.

event:eventRealizationPrecedent
    rdf:type owl:DatatypeProperty;
    rdfs:domain event:EventRealization;
    rdfs:range event:EventRealization;
    rdfs:comment '''The Realization of the precedent event, to be used with the subject Realization'''@en.

event:eventRealizationOutcome
    rdf:type owl:DatatypeProperty;
    rdf:type owl:FunctionalProperty;
    rdfs:domain event:EventRealization;
    rdfs:range event:Outcome;
    rdfs:comment '''The realized outcome of the subject Realization'''@en.

event:eventRealizationProbability
    rdf:type owl:DatatypeProperty;
    rdf:type owl:FunctionalProperty;
    rdfs:domain event:EventRealization;
    rdfs:range xsd:decimal;
    rdfs:comment '''The probability that all the outcomes in the Event Realization happen'''@en.
# Serialization annotations added by generate_docs.py
<https://ontology.flandersmake.be/event/ontology>
    <https://w3id.org/widoco/vocab#turtleSerialization> "event.ttl" ;
    <https://w3id.org/widoco/vocab#rdfxmlSerialization> "event.rdf" ;
    <https://w3id.org/widoco/vocab#ntSerialization> "event.nt" ;
    <https://w3id.org/widoco/vocab#jsonldSerialization> "event.jsonld" .
