@prefix : <https://w3id.org/citydata/part2/v1/> .
@prefix cc: <http://creativecommons.org/ns#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix org: <http://www.w3.org/ns/org#> .
@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/CodePattern> rdf:type owl:Ontology ;
                                                  owl:imports cdm1:OrganizationStructurePattern ,
                                                              :CorePattern ;
                                                  cc:license "http://creativecommons.org/licenses/by/4.0/" ;
                                                  dcterms:creator "Kenneth Vaughn" ,
                                                                  "Mark Fox" ,
                                                                  "Megan Katsumi" ;
                                                  dcterms:modified "2026-02-12"^^xsd:date ;
                                                  dcterms:title "Information technology - City data model - Part 2: City level concepts - Code pattern" ;
                                                  dcterms:bibliographicCitation "ISO/IEC 5087-2:2024" ;
                                                  vann:preferredNamespacePrefix "cdm2" ;
                                                  vann:preferredNamespaceUri "https://w3id.org/citydata/part2/v1/" ;
                                                  rdfs:seeAlso <https://www.iso.org/standard/80742.html> ;
                                                  rdfs:comment "The prior version of this ontology used a different ontology IRI. This update remains semantically consistent with the version adopted as ISO 5087-2:2024." ;
                                                  owl:priorVersion <https://standards.iso.org/iso-iec/5087/-2/ed-1/en/ontology/Code/> ;
                                                  owl:versionIRI <https://w3id.org/citydata/part2/v1/CodePattern/r3.0/> ;
                                                  owl:versionInfo "1.3.0" ;
                                                  skos:definition """This ontology specifies the city-level concepts for the code pattern of the city data model. The Code Pattern provides a structure to address the challenge of value enumeration with a general approach. In city data there are many classes of things that are intended to be instantiated using a set list of values (e.g., classification systems), however these values may change based on application or context. 
        The Code Pattern introduces a generic set of classes and properties that can be used to extend such classes to define various classification systems in an integrated way. Instead of enumerating value sets for classes, values can be defined with an associated Code that specifies additional metadata about the value and its origins.""" .

#################################################################
#    Object Properties
#################################################################

###  https://w3id.org/citydata/part2/v1/CodeObjectProperty
:CodeObjectProperty rdf:type owl:ObjectProperty ;
                    rdfs:subPropertyOf :CityObjectProperty ;
                    skos:definition "Added for organizational purposes, to identify object properties defined for the Code Pattern in the City-level CDM ontology." .


###  https://w3id.org/citydata/part2/v1/definedBy
:definedBy rdf:type owl:ObjectProperty ;
           rdfs:subPropertyOf :CodeObjectProperty ;
           rdfs:range org:Organization ;
           skos:definition "Identifies the Organization that defined the Code." .


###  https://w3id.org/citydata/part2/v1/hasCode
:hasCode rdf:type owl:ObjectProperty ;
         rdfs:subPropertyOf :CodeObjectProperty ;
         rdfs:range :Code ;
         skos:definition "Identifies the code for the domain object." .


#################################################################
#    Data properties
#################################################################

###  https://w3id.org/citydata/part2/v1/CodeDataProperty
:CodeDataProperty rdf:type owl:DatatypeProperty ;
                  rdfs:subPropertyOf :CityDataProperty ;
                  skos:definition "Added for organizational purposes, to identify data properties defined in the City Code Pattern." .


###  https://w3id.org/citydata/part2/v1/specification
:specification rdf:type owl:DatatypeProperty ;
               rdfs:subPropertyOf :CodeDataProperty ;
               rdfs:range xsd:anyURI ;
               skos:definition "Provides a URI where the definition of the domain object can be found." .


#################################################################
#    Classes
#################################################################

###  https://w3id.org/citydata/part2/v1/Code
:Code rdf:type owl:Class ;
      rdfs:subClassOf :CodeThing ,
                      [ rdf:type owl:Restriction ;
                        owl:onProperty cdm1:hasDescription ;
                        owl:allValuesFrom xsd:string
                      ] ,
                      [ rdf:type owl:Restriction ;
                        owl:onProperty cdm1:hasName ;
                        owl:allValuesFrom xsd:string
                      ] ,
                      [ rdf:type owl:Restriction ;
                        owl:onProperty :specification ;
                        owl:allValuesFrom xsd:string
                      ] ,
                      [ rdf:type owl:Restriction ;
                        owl:onProperty :definedBy ;
                        owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger ;
                        owl:onClass cdm1:Organization
                      ] ,
                      [ rdf:type owl:Restriction ;
                        owl:onProperty cdm1:hasIdentifier ;
                        owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger ;
                        owl:onDataRange xsd:string
                      ] ;
      skos:definition "A code represents a possible set of values for a property, according to some predefined system of values." .


###  https://w3id.org/citydata/part2/v1/CodeThing
:CodeThing rdf:type owl:Class ;
           rdfs:subClassOf :CityThing ;
           skos:definition "Added for organizational purposes, to identify classes defined in the Code ontology." .
