@prefix : <https://w3id.org/citydata/part2/v1/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix time: <http://www.w3.org/2006/time#> .
@prefix i72: <https://w3id.org/citydata/21972/v1/> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix vann: <http://purl.org/vocab/vann/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix cdm1: <https://w3id.org/citydata/part1/v1/> .
@base <https://w3id.org/citydata/part2/v1/> .

<https://w3id.org/citydata/part2/v1/BuildingSHACL> rdf:type owl:Ontology ;
                                                    owl:imports :BuildingPattern ,
                                                                :CoreSHACL ;
                                                    dcterms:title "City Data Model Part 2 - Building Pattern - SHACL constraints" ;
                                                    vann:preferredNamespacePrefix "cdm2" ;
                                                    vann:preferredNamespaceUri "https://w3id.org/citydata/part2/v1/" ;
                                                    skos:definition "SHACL validation shapes for the Building Pattern pattern module." .

#################################################################
#    Shapes
#################################################################

###  https://w3id.org/citydata/part2/v1/BuildingShape
:BuildingShape rdf:type sh:NodeShape ;
               sh:property [ sh:node :MaxOneShape ;
                             sh:path :propertyRegistrationID
                           ] ,
                           [ sh:datatype xsd:string ;
                             sh:path :builtAccordingToConstructionCode
                           ] ,
                           [ sh:class :BuildingUse ;
                             sh:path :use
                           ] ,
                           [ sh:class :Year ;
                             sh:node :MaxOneShape ;
                             sh:path :yearOfConstruction
                           ] ,
                           [ sh:class cdm1:Length ;
                             sh:path :hasBuildingHeight
                           ] ,
                           [ sh:class :BuildingUnit ;
                             sh:path :hasBuildingUnit
                           ] ,
                           [ sh:class :AreaRatio ;
                             sh:node :MaxOneShape ;
                             sh:path :floorAreaRatio
                           ] ,
                           [ sh:class :Facility ;
                             sh:path :buildingFacility
                           ] ,
                           [ sh:datatype xsd:nonNegativeInteger ;
                             sh:node :MaxOneShape ;
                             sh:path :numAboveGroundFloors
                           ] ,
                           [ sh:class cdm1:Area ;
                             sh:path :hasBuildingFloorArea
                           ] ,
                           [ sh:class :ConstructionStatus ;
                             sh:node :MaxOneShape ;
                             sh:path :hasConstructionStatus
                           ] ,
                           [ sh:datatype xsd:nonNegativeInteger ;
                             sh:node :ExactlyOneShape ;
                             sh:path :numFloors
                           ] ,
                           [ sh:class :AreaRatio ;
                             sh:node :MaxOneShape ;
                             sh:path :windowToWallRatio
                           ] ,
                           [ sh:class cdm1:Area ;
                             sh:path :hasBuildingFootprintArea
                           ] ,
                           [ sh:datatype xsd:nonNegativeInteger ;
                             sh:node :MaxOneShape ;
                             sh:path :numBuildingUnits
                           ] ;
               sh:targetClass :Building .


###  https://w3id.org/citydata/part2/v1/BuildingUnitShape
:BuildingUnitShape rdf:type sh:NodeShape ;
                   sh:property [ sh:datatype xsd:nonNegativeInteger ;
                                 sh:path :numberOfRooms
                               ] ,
                               [ sh:class cdm1:Area ;
                                 sh:path :hasUnitSize
                               ] ,
                               [ sh:class :Building ;
                                 sh:node :ExactlyOneShape ;
                                 sh:path :unitInBuilding
                               ] ,
                               [ sh:class cdm1:MonetaryValue ;
                                 sh:path :hasRent
                               ] ,
                               [ sh:datatype xsd:nonNegativeInteger ;
                                 sh:path :numberOfBedrooms
                               ] ,
                               [ sh:class :Facility ;
                                 sh:path :buildingFacility
                               ] ,
                               [ sh:class time:TemporalEntity ;
                                 sh:node :ExactlyOneShape ;
                                 sh:path cdm1:existsAt
                               ] ,
                               [ sh:class :Address ;
                                 sh:path :hasAddress
                               ] ,
                               [ sh:class cdm1:Length ;
                                 sh:path :floorToCeilingHeight
                               ] ,
                               [ sh:class cdm1:MonetaryValue ;
                                 sh:path i72:hasValue
                               ] ;
                   sh:targetClass :BuildingUnit .


###  https://w3id.org/citydata/part2/v1/BuildingUseShape
:BuildingUseShape rdf:type sh:NodeShape ;
                  sh:property [ sh:class :Code ;
                                sh:path :hasCode
                              ] ;
                  sh:targetClass :BuildingUse .


###  https://w3id.org/citydata/part2/v1/ConstructionStatusShape
:ConstructionStatusShape rdf:type sh:NodeShape ;
                         sh:property [ sh:class :Code ;
                                       sh:path :hasCode
                                     ] ;
                         sh:targetClass :ConstructionStatus .


###  https://w3id.org/citydata/part2/v1/FacilityShape
:FacilityShape rdf:type sh:NodeShape ;
               sh:property [ sh:class cdm1:Location ;
                             sh:node :ExactlyOneShape ;
                             sh:path cdm1:hasLocation
                           ] ;
               sh:targetClass :Facility .
