@prefix celine: <https://w3id.org/celine#> .
@prefix owl:    <http://www.w3.org/2002/07/owl#> .
@prefix rdf:    <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs:   <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd:    <http://www.w3.org/2001/XMLSchema#> .
@prefix dct:    <http://purl.org/dc/terms/> .
@prefix time:   <http://www.w3.org/2006/time#> .
@prefix skos:   <http://www.w3.org/2004/02/skos/core#> .
@prefix vann:   <http://purl.org/vocab/vann/> .

@prefix peco:   <https://purl.org/peco/peco-core#> .
@prefix saref:  <https://saref.etsi.org/core/> .
@prefix sosa:   <http://www.w3.org/ns/sosa/> .
@prefix bigg:   <https://w3id.org/bigg/ontology#> .

################################################################################
# Ontology
################################################################################

<https://w3id.org/celine>
    a owl:Ontology ;
    owl:versionIRI      <https://w3id.org/celine/v0.3> ;
    owl:priorVersion    <https://w3id.org/celine/v0.2> ;
    owl:versionInfo     "0.3" ;
    dct:title           "CELINE Core Ontology" ;
    dct:description     """Lightweight orchestration ontology for Renewable Energy Communities
    and Digital Twin workflows. CELINE integrates PECO, SAREF, SOSA and BIGG
    without redefining domain semantics.""" ;
    dct:license         <https://creativecommons.org/licenses/by/4.0/> ;
    dct:created         "2026-03-23"^^xsd:date ;
    vann:preferredNamespacePrefix "celine" ;
    vann:preferredNamespaceUri    "https://w3id.org/celine#" ;
    owl:imports
        <https://purl.org/peco/peco-core> ,
        <https://saref.etsi.org/core/v3.1.1/saref.ttl> ,
        <https://saref.etsi.org/saref4ener/v1.2.1/saref4ener.ttl> ,
        <https://raw.githubusercontent.com/w3c/sdw/dee1bdd3c339d8a0ab512c7f9bc97a08912ad7d6/ssn/integrated/sosa.ttl> ,
        <https://raw.githubusercontent.com/BeeGroup-cimne/biggontology/776e245668bba171b0eacfccfa9d6e5166860d8e/ontology/ontology.ttl> ,
        <https://raw.githubusercontent.com/BeeGroup-cimne/biggontology/776e245668bba171b0eacfccfa9d6e5166860d8e/extensions/bigg4kpi.ttl> .

################################################################################
# Core Context Classes
################################################################################

celine:CommunityContext
    a owl:Class ;
    rdfs:isDefinedBy    <https://w3id.org/celine> ;
    rdfs:label          "Community Context" ;
    rdfs:comment        """Operational context binding a PECO Energy Community
    with assets, datasets and simulations.""" ;
    skos:example        """ex:ctx1 a celine:CommunityContext ;
    celine:hasCommunity    ex:rec_valdarno ;
    celine:usesAsset       ex:pv_panel_01 ;
    celine:hasSimulation   ex:sim_baseline .""" .

celine:Scenario
    a owl:Class ;
    rdfs:isDefinedBy    <https://w3id.org/celine> ;
    rdfs:label          "Scenario" ;
    rdfs:comment        """Definition of assumptions, temporal scope and configuration
    for one or more simulations.""" ;
    skos:example        """ex:sc_summer a celine:Scenario ;
    rdfs:label              "Summer 2025 baseline" ;
    dct:description         "24-hour simulation with historical irradiance data." ;
    celine:hasTimeInterval  ex:interval_2025_summer .""" .

celine:Simulation
    a owl:Class ;
    rdfs:isDefinedBy    <https://w3id.org/celine> ;
    rdfs:label          "Simulation" ;
    rdfs:comment        "Abstract simulation definition independent from execution." ;
    skos:example        """ex:sim1 a celine:Simulation ;
    celine:hasScenario      ex:sc_summer ;
    celine:hasSimulationRun ex:run_001 .""" .

celine:SimulationRun
    a owl:Class ;
    rdfs:isDefinedBy    <https://w3id.org/celine> ;
    rdfs:label          "Simulation Run" ;
    rdfs:comment        "Concrete execution of a Simulation under a specific Scenario." ;
    skos:example        """ex:run_001 a celine:SimulationRun ;
    celine:usesDataset      ex:ds_irradiance ;
    celine:producesDataset  ex:ds_energy_forecast ;
    celine:hasKPIEvaluation ex:kpi_self_sufficiency .""" .

################################################################################
# Dataset Abstraction
################################################################################

celine:DatasetReference
    a owl:Class ;
    rdfs:isDefinedBy    <https://w3id.org/celine> ;
    rdfs:label          "Dataset Reference" ;
    rdfs:comment        """Reference to an external dataset used as input or produced as output.
    CELINE does not define dataset schemas.""" ;
    skos:example        """ex:ds_irradiance a celine:DatasetReference ;
    dct:identifier  "irradiance-2025-07" ;
    dct:source      <https://data.example.org/weather/irradiance> .""" .

################################################################################
# KPI Evaluation Layer
################################################################################

celine:KPIEvaluation
    a owl:Class ;
    rdfs:isDefinedBy    <https://w3id.org/celine> ;
    rdfs:label          "KPI Evaluation" ;
    rdfs:comment        "Evaluation of a BIGG KPI in a specific Scenario or SimulationRun." ;
    skos:example        """ex:kpi_self_sufficiency a celine:KPIEvaluation ;
    celine:evaluatesKPI bigg:SelfSufficiencyRate ;
    rdf:value           "0.72"^^xsd:decimal .""" .

################################################################################
# Object Properties (Glue Layer)
################################################################################

celine:hasCommunity
    a owl:ObjectProperty ;
    rdfs:isDefinedBy    <https://w3id.org/celine> ;
    rdfs:domain         celine:CommunityContext ;
    rdfs:range          peco:EnergyCommunity ;
    rdfs:label          "has energy community" .

celine:usesAsset
    a owl:ObjectProperty ;
    rdfs:isDefinedBy    <https://w3id.org/celine> ;
    rdfs:domain         celine:CommunityContext ;
    rdfs:range          saref:Device ;
    rdfs:label          "uses asset" ;
    rdfs:comment        "References SAREF or SAREF4ENER devices." .

celine:hasScenario
    a owl:ObjectProperty ;
    rdfs:isDefinedBy    <https://w3id.org/celine> ;
    rdfs:domain         celine:Simulation ;
    rdfs:range          celine:Scenario ;
    rdfs:label          "has scenario" .

celine:hasSimulation
    a owl:ObjectProperty ;
    rdfs:isDefinedBy    <https://w3id.org/celine> ;
    rdfs:domain         celine:CommunityContext ;
    rdfs:range          celine:Simulation ;
    rdfs:label          "has simulation" .

celine:hasSimulationRun
    a owl:ObjectProperty ;
    rdfs:isDefinedBy    <https://w3id.org/celine> ;
    rdfs:domain         celine:Simulation ;
    rdfs:range          celine:SimulationRun ;
    rdfs:label          "has simulation run" .

celine:usesDataset
    a owl:ObjectProperty ;
    rdfs:isDefinedBy    <https://w3id.org/celine> ;
    rdfs:domain         celine:SimulationRun ;
    rdfs:range          celine:DatasetReference ;
    rdfs:label          "uses dataset" .

celine:producesDataset
    a owl:ObjectProperty ;
    rdfs:isDefinedBy    <https://w3id.org/celine> ;
    rdfs:domain         celine:SimulationRun ;
    rdfs:range          celine:DatasetReference ;
    rdfs:label          "produces dataset" .

celine:evaluatesKPI
    a owl:ObjectProperty ;
    rdfs:isDefinedBy    <https://w3id.org/celine> ;
    rdfs:domain         celine:KPIEvaluation ;
    rdfs:range          bigg:KPI ;
    rdfs:label          "evaluates KPI" .

celine:hasKPIEvaluation
    a owl:ObjectProperty ;
    rdfs:isDefinedBy    <https://w3id.org/celine> ;
    rdfs:domain         celine:SimulationRun ;
    rdfs:range          celine:KPIEvaluation ;
    rdfs:label          "has KPI evaluation" .

################################################################################
# Temporal Properties
################################################################################

celine:hasTimeInterval
    a owl:ObjectProperty ;
    rdfs:isDefinedBy    <https://w3id.org/celine> ;
    rdfs:range          time:Interval ;
    rdfs:label          "has time interval" .

################################################################################
# Measurement Linking (No Redefinition)
################################################################################

celine:usesObservation
    a owl:ObjectProperty ;
    rdfs:isDefinedBy    <https://w3id.org/celine> ;
    rdfs:domain         celine:SimulationRun ;
    rdfs:range          sosa:Observation ;
    rdfs:label          "uses observation" ;
    rdfs:comment        "References SOSA observations (e.g. weather, sensors)." .
