BASE <https://w3id.org/itsdata/regulation/v1/>
PREFIX : <https://w3id.org/itsdata/regulation/v1/>
PREFIX sh: <http://www.w3.org/ns/shacl#>
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 i72: <https://w3id.org/citydata/21972/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 rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX vann: <http://purl.org/vocab/vann/>

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

# ================================================
#                 Traffic Control Device Classes
# ================================================

:TrafficControlDeviceShape a sh:NodeShape ;
    sh:targetClass :TrafficControlDevice ;

    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 :image ;
        sh:node its-core:MaxOneShape ;
        sh:datatype xsd:base64Binary ;
    ] ;

    sh:property [
        sh:path :url ;
        sh:node its-core:MaxOneShape ;
        sh:datatype xsd:anyURI ;
    ] .

:AccessControlDeviceShape a sh:NodeShape ;
    sh:targetClass :AccessControlDevice ;
    sh:and ( :TrafficControlDeviceShape ) ;
    sh:and ( its-location:PointFeatureShape ) ;

    sh:property [
        sh:path :accessControlType ;
        sh:node its-core:ExactlyOneShape ;
        sh:class :AccessControlTypeCode ;
    ] .

:ChannelizationDeviceShape a sh:NodeShape ;
    sh:targetClass :ChannelizationDevice ;
    sh:and ( :TrafficControlDeviceShape ) ;
    sh:and ( its-location:LinearFeatureShape ) ;

    sh:property [
        sh:path :channelizationType ;
        sh:node its-core:ExactlyOneShape ;
        sh:class :ChannelizationTypeCode ;
    ] .

:InternationalSignShape a sh:NodeShape ;
    sh:targetClass :InternationalSign ;
    sh:and ( :TrafficControlDeviceShape ) ;
    sh:and ( its-location:PointFeatureShape ) ;

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

    sh:property [
        sh:path :pictogram ;
        sh:node its-core:ExactlyOneShape ;
        sh:datatype its-core:oidstring ;
    ] ;

    sh:property [
        sh:path :hasCondition ;
        sh:node its-core:MaxOneShape ;
        sh:class :Condition ;
    ] ;

    sh:property [
        sh:path :hasContext ;
        sh:node its-core:UnlimitedShape ;
        sh:class :RegulationContextCode ;
    ] ;

    sh:property [
        sh:path :hasFeeSchedule ;
        sh:node its-core:MaxOneShape ;
        sh:class :FeeSchedule ;
    ] ;

    sh:property [
        sh:path :hasThreshold ;
        sh:node its-core:MaxOneShape ;
        sh:class i72:Measure ;
    ] ;

    sh:property [
        sh:path :hasTextualRestriction ;
        sh:node its-core:MaxOneShape ;
        sh:class rdf:langString ;
    ] ;

    sh:property [
        sh:path :hasComponentSign ;
        sh:node its-core:UnlimitedShape ;
        sh:class :InternationalSign ;
        skos:note "The component signs are an ordered list of supplemental signs."@en ;
        skos:editorsNote "GDD defines as a SimpleSign, but presumably, the intent was for a SEQUENCE OF SimpleSign. This places the main sign as part of the InternationalSign and supplemental signs as a sequence of component signs (which can be complex themselves)."@en ;
    ] .

:PavementMarkingShape a sh:NodeShape ;
    sh:targetClass :PavementMarking ;
    sh:and ( :TrafficControlDeviceShape ) ;
    sh:and ( its-location:LinearFeatureShape ) ;

    sh:property [
        sh:path :pavementMarkingType ;
        sh:node its-core:ExactlyOneShape ;
        sh:class :PavementMarkingTypeCode ;
    ] .

:RoadSurfaceFeatureShape a sh:NodeShape ;
    sh:targetClass :RoadSurfaceFeature ;
    sh:and ( :TrafficControlDeviceShape ) ;
    sh:and ( its-location:LinearFeatureShape ) ;

    sh:property [
        sh:path :roadSurfaceFeatureType ;
        sh:node its-core:ExactlyOneShape ;
        sh:class :RoadSurfaceFeatureTypeCode ;
    ] .

:TrafficSignalDeviceShape a sh:NodeShape ;
    sh:targetClass :TrafficSignalDevice ;
    sh:and ( :TrafficControlDeviceShape ) ;
    sh:and ( its-location:PointFeatureShape ) .

:TrafficSignalShape a sh:NodeShape ;
    sh:targetClass :TrafficSignal ;
    sh:and ( :TrafficSignalDeviceShape ) .

:WarningBeaconShape a sh:NodeShape ;
    sh:targetClass :WarningBeacon ;
    sh:and ( :TrafficSignalDeviceShape ) .

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

:SignDestinationShape a sh:NodeShape ;
    sh:targetClass :SignDestination ;

    sh:property [
        sh:path :arrowDirection ; #The direction of the arrow as it appears on the sign, which represents the direction of the egress roadway
        sh:class :OrdinalDirectionCode ;
    ] ;

    sh:property [
        sh:path :destinationHorizon ;
        sh:node its-core:MaxOneShape ;
        sh:class :Horizon ;
    ] ;

    sh:property [
        sh:path :destinationPlace ;
        sh:class :DestinationPlace ;
    ] ;

    sh:property [
        sh:path :destinationRoad ;
        sh:class :DestinationRoad ;
    ] ;

    sh:property [
        sh:path :divergeHorizon ; #The distance between the junction and the point of interest (e.g., destination or current location for direction 0)
        sh:class cdm1:Length ;
    ] ;

    sh:property [
        sh:path :divergeName ;
        sh:datatype rdf:langString ;
    ] ;

    sh:property [
        sh:path :divergeRoute ;
        sh:datatype rdf:langString ;
    ] .

:TextCompositeShape a sh:NodeShape ;
    sh:targetClass :TextComposite ;

    sh:property [
        sh:path :compositeText ;
        sh:node its-core:ExactlyOneMultilingualShape ;
    ] .
