BASE <https://w3id.org/itsdata/regulation/v1/>
PREFIX : <https://w3id.org/itsdata/regulation/v1/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX sh: <http://www.w3.org/ns/shacl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX vann: <http://purl.org/vocab/vann/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX cdm1: <https://w3id.org/citydata/part1/v1/>
PREFIX cdm2: <https://w3id.org/citydata/part2/v1/>
PREFIX its-core: <https://w3id.org/itsdata/core/v1/>
PREFIX its-communications: <https://w3id.org/itsdata/communications/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/>

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

# ================================================
#                 Regulation Classes
# ================================================

:TrafficRegulationShape a sh:NodeShape ;
    sh:targetClass :TrafficRegulation ;

    sh:property [
        sh:path :associatedTrafficControlDevice ;
        sh:class :TrafficControlDevice;
    ] ;

    sh:property [
        sh:path its-core:hasActivationStatus ;
        sh:node its-core:ExactlyOneShape ;
        sh:class its-core:ActivationStatusCode ;
    ] ;

    sh:property [
        sh:path :hasAssociatedRestriction ;
        sh:node its-core:MaxOneShape ;
        sh:class :TrafficRegulation ;
        skos:editorsNote "DATEX II does not have this concept, rather it embeds related restrictions as attributes (e.g., respectBicycle)."@en ;
    ] ;

    sh:property [
        sh:path :hasCondition ;
        sh:node its-core:MaxOneShape ;
        skos:editorsNote "DATEX II indicates this is optional, but if we decide location or validity is required as a part of the TR, this should become exactly 1."@en ;
        sh:class :Condition ;
    ] ;

    sh:property [
        sh:path :hasPermitType ;
        sh:class :PermitType ;
    ] ;

    sh:property [
        sh:path :hasRegulationCategory ;
        sh:node its-core:MinOneShape ;
        sh:class :RegulationCategoryCode ;
    ] ;
    sh:property [
        sh:path :requiresSupplementalData ;
        sh:node its-core:UnlimitedShape ;
        sh:class :RequiredSupplementalData ;
    ] ;
    sh:property [
        sh:path :hasTrustworthiness ;
        sh:node its-core:MaxOneShape ;
        sh:class :Trustworthiness ;
    ] ;
    sh:property [
        sh:path :hasEnforcementMethod ;
        sh:node its-core:UnlimitedShape ;
        sh:class :EnforcementMethod ;
    ] ;
    sh:property [
        sh:path :hasLegalStatus ;
        sh:node its-core:MinOneShape ;
        sh:class :LegalStatusCode ;
    ] ;
    sh:property [
        sh:path :hasInceptionDate ;
        sh:node its-core:MaxOneShape ;
        sh:class xsd:date;
    ] ;
    sh:property [
        sh:path :hasTerminationDate ;
        sh:node its-core:MaxOneShape ;
        sh:class xsd:date;
    ] ;
    sh:property [
        sh:path :isSuspect ;
        sh:node its-core:MaxOneShape ;
        sh:class :SuspectStatusCode ;
    ] .

:TrafficRegulationOrderShape a sh:NodeShape ;
    sh:targetClass :TrafficRegulationOrder ;

    sh:property [
        sh:path cdm1:hasDescription ;
        sh:node its-core:MaxOneMultilingualShape ;
    ] ;

    sh:property [
        sh:path cdm1:hasIdentifier ;
        sh:node its-core:ExactlyOneShape ;
        sh:datatype xsd:string ;
    ] ;

    sh:property [
        sh:path :hasLegalBasis ;
        sh:node its-core:MaxOneShape ;
        sh:class :LegalBasis ;
        skos:editorsNote "DATEX II indicates this is optional at the TRO and TR level. Does this really describe the TRO or just the regulation? Recommend deletion for TRO?"@en ;
    ] ;

    sh:property [
        sh:path :implementedLocation ;
        sh:node its-core:MaxOneShape ;
        sh:class its-location:LocationReference ;
        skos:editorsNote "DATEX II indicates this is optional and if not present, it must be defined for each traffic regulation. Does this really describe the TRO or just the regulation? Recommend deletion for TRO."@en ;
    ] ;

    sh:property [
        sh:path :implementedValidity ;
        sh:node its-core:MaxOneShape ;
        sh:class its-time:Validity ;
        skos:editorsNote "DATEX II indicates this is optional and if not present, it must be defined for each traffic regulation. Does this really describe the TRO or just the regulation? Recommend deletion for TRO."@en ;
    ] ;

    sh:property [
        sh:path :locationByOrder ;
        sh:node its-core:MaxOneShape ;
        sh:class its-location:LocationReference ;
        skos:editorsNote "DATEX II indicates this is optional and if not present, it must be defined for each traffic regulation. Does this really describe the TRO or just the regulation? Recommend deletion for TRO."@en ;
    ] ;

    sh:property [
        sh:path :memberTrafficRegulation ;
        sh:node its-core:MinOneShape ;
        sh:class :TrafficRegulation ;
        skos:editorsNote "What is the preferred naming convention for properties with multiples allowed? Should we use a singular or plural name?"@en ;
    ] ;

    sh:property [
        sh:path :reasonCode ;
        sh:class :ReasonCode ;
    ] ;

    sh:property [
        sh:path :troStatus ;
        sh:node its-core:ExactlyOneShape ;
        sh:class :TroStatusCode ;
    ] ;

    sh:property [
        sh:path :validityByOrder ;
        sh:node its-core:MaxOneShape ;
        sh:class its-time:Validity ;
        skos:editorsNote "DATEX II indicates this is optional and if not present, it must be defined for each traffic regulation. Does this really describe the TRO or just the regulation? Recommend deletion for TRO."@en ;
    ] .

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

:RuleMakerRoleShape a sh:NodeShape ;
    sh:targetClass :RuleMakerRole ;

    sh:property [
        sh:path :issuedTro ;
        sh:class :TrafficRegulationOrder
    ] ;

    sh:property [
        sh:path its-core:jurisdiction ;
        sh:node its-core:MinOneShape ;
        sh:class cdm2:JurisdictionalArea ;
    ] ;

    sh:property [
        sh:path :regulatoryScope ;
        sh:node its-core:MinOneShape ;
        sh:class :RegulatoryScopeCode ;
    ] .

:RequiredSupplementalDataShape a sh:NodeShape ;
    sh:targetClass :RequiredSupplementalData ;

    sh:property [
        sh:path :type ;
        sh:node its-core:MinOneShape ;
        sh:class :SupplementalDataTypeCode ;
    ] ;
    sh:property [
        sh:path :source ;
        sh:node its-core:UnlimitedShape ;
        sh:class its-communications:TrustedCyberLocation ;
    ] .

    :TrustworthinessShape a sh:NodeShape ;
    sh:targetClass :Trustworthiness ;

    sh:property [
        sh:path :hasOverallTrustworthiness ;
        sh:node its-core:UnlimitedShape ;
        sh:class :TrustworthinessCode ;
    ] .