BASE <https://w3id.org/itsdata/regulation/v1/>
PREFIX : <https://w3id.org/itsdata/regulation/v1/>
PREFIX sh: <http://www.w3.org/ns/shacl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX vann: <http://purl.org/vocab/vann/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX cdm1: <https://w3id.org/citydata/part1/v1/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX cdm2: <https://w3id.org/citydata/part2/v1/>
PREFIX its-core: <https://w3id.org/itsdata/core/v1/>
PREFIX its-time: <https://w3id.org/itsdata/time/v1/>
PREFIX its-location: <https://w3id.org/itsdata/location/v1/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX dcterms: <http://purl.org/dc/terms/>

:ConditionSHACL a owl:Ontology ;
    dcterms:title "SHACL constraints for the Condition pattern"@en ;
    skos:definition "Validation shapes for traffic regulation condition concepts."@en ;
    owl:imports <https://w3id.org/itsdata/core/v1/CoreSHACL> ;
    vann:preferredNamespacePrefix "its-regulation" ;
    vann:preferredNamespaceUri    "https://w3id.org/itsdata/regulation/v1/" .

# ================================================
#                 Condition Classes
# ================================================

:ConditionShape a sh:NodeShape ;
    sh:targetClass :Condition ;

    sh:property [
        sh:path :hasLegalBasis ;
        sh:node its-core:ExactlyOneShape;
        sh:class :LegalBasis ;
        skos:editorialNote "DATEX II indicates this is optional; does this really describe the TRO or just the regulation? Recommend deletion for TRO?"@en ;
    ] ;

    sh:property [
        sh:path :isActive ;
        sh:node its-core:ExactlyOneShape ;
        sh:datatype xsd:boolean ;
    ] ;

    sh:property [
        sh:path :negate ;
        sh:node its-core:ExactlyOneShape;
        sh:datatype xsd:boolean ;
    ] .

:EnumeratedConditionShape a sh:NodeShape ;
    sh:targetClass :EnumeratedCondition ;

    sh:property [
        sh:path :forEnumeratedCondition ;
        sh:node its-core:ExactlyOneShape ;
        sh:class :ConditionCode ;
    ] ;

    sh:property [
        sh:path :otherCondition ;
        sh:node its-core:MaxOneMultilingualShape ;
    ] .

:LocationConditionShape a sh:NodeShape ;
    sh:targetClass :LocationCondition ;

    sh:property [
        sh:path :implementedLocation ;
        sh:node its-core:MaxOneShape ;
        sh:class its-location:Feature ;
    ] ;

    sh:property [
        sh:path :locationByOrder ;
        sh:node its-core:ExactlyOneShape ;
        sh:class its-location:Feature ;
    ] ;

    sh:property [
        sh:path :trafficImpactLocation ;
        sh:node its-core:MaxOneShape ;
        sh:class its-location:Feature ;
    ] .

:MeasurableConditionShape a sh:NodeShape ;
    sh:targetClass :MeasurableCondition ;

    sh:property [
        sh:path :comparisonOperator ;
        sh:node its-core:ExactlyOneShape ;
        sh:class its-core:ComparisonOperatorCode ;
    ] ;

    sh:property [
        sh:path :forMeasurableCondition ;
        sh:node its-core:ExactlyOneShape ;
        sh:class :MeasurableConditionCode ;
    ] ;

    sh:property [
        sh:path :valueToCompare ;
        sh:node its-core:ExactlyOneShape ;
        sh:class i72:Measure ;
    ] .

:PermitRequiredConditionShape a sh:NodeShape ;
    sh:targetClass :PermitRequiredCondition ;

    sh:property [
        sh:path :requiredDesignation ;
        sh:node its-core:ExactlyOneShape;
        sh:class :PermitDesignationCode ;
        rdfs:seeAlso "DATEX-II PermitInformation.disabledParkingPermit" ;
        skos:editorialNote "DATEX II has a boolean for disabledParkingPermit; this allows a broader set of general permits and focuses on the designation rather than the permission. For example, rather than disabledParkingPermit, it would be a disability permit and potentially provide facility access privileges in addition to parking."@en ;
    ] ;

    sh:property [
        sh:path :requiredDisplayType ;
        sh:node its-core:MaxOneShape;
        sh:class :PermitDisplayTypeCode ;
        rdfs:seeAlso "DATEX-II permitType"
    ] ;

    sh:property [
        sh:path :requiredGrantor ;
        sh:node its-core:MaxOneShape;
        sh:class cdm2:Organization ;
        rdfs:seeAlso "DATEX-II issuingAuthority"
    ] ;

    sh:property [
        sh:path :requiredGrantorType ;
        sh:node its-core:MaxOneShape;
        sh:class :PermitGrantorTypeCode ;
        skos:editorialNote "A regulation can accept permits issued by any grantor, by any type of grantor (e.g., government agency), or by a specific grantor (e.g., a parking permit specific to a particular parking facility)."@en ;
    ] ;

    sh:property [
        sh:path :requiredPermitIdentifier ;
        sh:node its-core:ExactlyOneShape ;
        sh:datatype xsd:string ;
        rdfs:seeAlso "DATEX-II identifier"
    ] .

:TimeValidityConditionShape a sh:NodeShape ;
    sh:targetClass :TimeValidityCondition ;

    sh:property [
        sh:path :implementedValidity ;
        sh:node its-core:MaxOneShape ;
        sh:class its-time:Schedule ;
    ] ;

    sh:property [
        sh:path :validityByOrder ;
        sh:node its-core:ExactlyOneShape ;
        sh:class its-time:Schedule ;
    ] .

# ================================================
#                 Other Classes
# ================================================

:LegalBasisShape a sh:NodeShape ;
    sh:targetClass :LegalBasis ;

    sh:property [
        sh:path its-time:approvedOn ;
        sh:node its-core:MaxOneShape ;
        sh:datatype xsd:date ;
    ] ;

    sh:property [
        sh:path cdm1:hasName ;
        sh:node its-core:MinOneMultilingualShape ;
    ] ;

    sh:property [
        sh:path its-core:version ;
        sh:node its-core:MaxOneShape ;
        sh:datatype xsd:string ;
    ] .
