Skip to content

Commit

Permalink
CityGML-to-OWL full conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
Nataliya Keberle committed Nov 19, 2024
1 parent d9a4d30 commit 7547a58
Show file tree
Hide file tree
Showing 93 changed files with 17,496 additions and 4,609 deletions.
42 changes: 21 additions & 21 deletions citygml-owl/CityGML3.0_to_OWL_ontotext_config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<!-- <parameter name="inputModelType" value="EA7"/> -->
<parameter name="inputModelType" value="SCXML"/>
<parameter name="inputFile" value='$input$'/>
<parameter name="appSchemaNamespaceRegex" value="^(https://ogcblocks.org/|http://www.opengis.net/citygml/).*"/>
<parameter name="appSchemaNamespaceRegex" value="^(https://www.opengis.net/ont/citygml/|https://dataset-dl.liris.cnrs.fr/rdf-owl-urban-data-ontologies/Ontologies/|http://www.opengis.net/citygml/).*"/>
<parameter name="checkingConstraints" value="disabled"/>
<parameter name="addTaggedValues" value="itemType"/>
<xi:include href="http://shapechange.net/resources/config/StandardAliases.xml"/>
Expand Down Expand Up @@ -53,32 +53,32 @@
<targetParameter name="outputDirectory" value="$output$"/>
<targetParameter name="defaultEncodingRule" value="CityGML_RDF_Encoding_Rules"/>
<targetParameter name="defaultTypeImplementation" value="owl:Thing"/>
<targetParameter name="URIbase" value="https://ogcblocks.org/CityGML/3.0"/>
<targetParameter name="URIbase" value="https://www.opengis.net/ont/citygml"/>
<targetParameter name="language" value="en"/>
<xi:include href="https://shapechange.net/resources/config/StandardNamespaces-owl.xml"/>
<namespaces>
<!-- CityGML 3.0 namespaces -->
<Namespace nsabr="app" ns="https://ogcblocks.org/CityGML/3.0/appearance#"/>
<Namespace nsabr="brid" ns="https://ogcblocks.org/CityGML/3.0/bridge#"/>
<Namespace nsabr="bldg" ns="https://ogcblocks.org/CityGML/3.0/building#"/>
<Namespace nsabr="pcl" ns="https://ogcblocks.org/CityGML/3.0/pointcloud#"/>
<Namespace nsabr="frn" ns="https://ogcblocks.org/CityGML/3.0/cityfurniture#"/>
<Namespace nsabr="grp" ns="https://ogcblocks.org/CityGML/3.0/cityobjectgroup#"/>
<Namespace nsabr="con" ns="https://ogcblocks.org/CityGML/3.0/construction#"/>
<Namespace nsabr="core" ns="https://ogcblocks.org/CityGML/3.0/core#"/>
<Namespace nsabr="dyn" ns="https://ogcblocks.org/CityGML/3.0/dynamizer#"/>
<Namespace nsabr="gen" ns="https://ogcblocks.org/CityGML/3.0/generics#"/>
<Namespace nsabr="luse" ns="https://ogcblocks.org/CityGML/3.0/landuse#"/>
<Namespace nsabr="dem" ns="https://ogcblocks.org/CityGML/3.0/relief#"/>
<Namespace nsabr="tran" ns="https://ogcblocks.org/CityGML/3.0/transportation#"/>
<Namespace nsabr="tun" ns="https://ogcblocks.org/CityGML/3.0/tunnel#"/>
<Namespace nsabr="veg" ns="https://ogcblocks.org/CityGML/3.0/vegetation#"/>
<Namespace nsabr="vers" ns="https://ogcblocks.org/CityGML/3.0/versioning#"/>
<Namespace nsabr="wtr" ns="https://ogcblocks.org/CityGML/3.0/waterbody#"/>
<Namespace nsabr="app" ns="https://www.opengis.net/ont/citygml/appearance#"/>
<Namespace nsabr="brid" ns="https://www.opengis.net/ont/citygml/bridge#"/>
<Namespace nsabr="bldg" ns="https://www.opengis.net/ont/citygml/building#"/>
<Namespace nsabr="pcl" ns="https://www.opengis.net/ont/citygml/pointcloud#"/>
<Namespace nsabr="frn" ns="https://www.opengis.net/ont/citygml/cityfurniture#"/>
<Namespace nsabr="grp" ns="https://www.opengis.net/ont/citygml/cityobjectgroup#"/>
<Namespace nsabr="con" ns="https://www.opengis.net/ont/citygml/construction#"/>
<Namespace nsabr="core" ns="https://www.opengis.net/ont/citygml/core#"/>
<Namespace nsabr="dyn" ns="https://www.opengis.net/ont/citygml/dynamizer#"/>
<Namespace nsabr="gen" ns="https://www.opengis.net/ont/citygml/generics#"/>
<Namespace nsabr="luse" ns="https://www.opengis.net/ont/citygml/landuse#"/>
<Namespace nsabr="dem" ns="https://www.opengis.net/ont/citygml/relief#"/>
<Namespace nsabr="tran" ns="https://www.opengis.net/ont/citygml/transportation#"/>
<Namespace nsabr="tun" ns="https://www.opengis.net/ont/citygml/tunnel#"/>
<Namespace nsabr="veg" ns="https://www.opengis.net/ont/citygml/vegetation#"/>
<Namespace nsabr="vers" ns="https://www.opengis.net/ont/citygml/versioning#"/>
<Namespace nsabr="wtr" ns="https://www.opengis.net/ont/citygml/waterbody#"/>
<Namespace nsabr="xAL" ns="urn:oasis:names:tc:ciq:xal:3"/>
<!-- ADE namespaces -->
<Namespace nsabr="doc" ns="https://dataset-dl.liris.cnrs.fr/rdf-owl-urban-data-ontologies/Ontologies/Document/3.0/document#"/>
<Namespace nsabr="wksp" ns="https://dataset-dl.liris.cnrs.fr/rdf-owl-urban-data-ontologies/Ontologies/Workspace/3.0/workspace#"/>
<Namespace nsabr="doc" ns="https://www.opengis.net/ont/citygml/document#"/>
<Namespace nsabr="wksp" ns="https://www.opengis.net/ont/citygml/workspace#"/>
<!-- ISO TC211 namespaces -->
<Namespace nsabr="iso19103" ns="http://def.isotc211.org/iso19103/2005/UnitsOfMeasure#"/>
<Namespace nsabr="iso19107-cm" ns="http://def.isotc211.org/iso19107/2003/CoordinateGeometry#"/>
Expand Down
36 changes: 17 additions & 19 deletions citygml-owl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Resources described in CityGML WG proposal (thanks to Diego Vinasco-Alvarez)

* A Python script that fixes a few logical inconsistencies in the ShapeChange output: https://github.com/VCityTeam/UD-Graph/blob/master/Transformations/ShapeChange/ontologyPatcher.py

* A Repository serving as a source of evidence for generated OWL: https://github.com/VCityTeam/UD-Reproducibility/tree/master/Computations/RDF/CityOWL

## Current solution

We use [CityGML_3.0-workspaces-documents_shapechange-export.xml](https://github.com/VCityTeam/UD-Graph/blob/master/Transformations/test-data/UML/CityGML_3.0-workspaces-documents_shapechange-export.xml) as a source of CityGML3.0 model.
Expand Down Expand Up @@ -50,7 +52,7 @@ We extended this script to implement our vision on how we can benefit from custo

### Global Properties explication

There are some attributes named equally in different packages, such as `usage`, `class`, `function`, `address`, `value` and others.
There are some attributes named equally in different packages, such as `usage`, `class`, `function`, `address`, `value` and others, so there are `brid:usage` and `bldg:usage` that differ only on ranges of property and definitions.

In OWL object/datatype properties are first-class citizens whereas in UML and UML converted into OWL with ShapeChange they are converted into package-level and class-level attributes.

Expand Down Expand Up @@ -89,11 +91,11 @@ common:usage rdf:type owl:ObjectProperty;
rdfs:label "usage"@en;
```
We add the following:
- we introduce an ontology `/additional-triples/common.ttl` and a namespace `PREFIX common: <https://ogcblocks.org/CityGML/3.0/common#>` keeping all ObjectProperties and DatatypeProperties sharing the same domain and varying in the `rdfs:range` (and `rdfs:label/skos:definition`).
- we introduce an ontology `/additional-triples/common.ttl` and a namespace `PREFIX common: <https://www.opengis.net/ont/citygml/common#>` keeping all ObjectProperties and DatatypeProperties sharing the same domain and varying in the `rdfs:range` (and `rdfs:label/skos:definition`).

We apply four SPARQL queries ([##1-4 in the file](./update-triples.sh)) across all ontologies in `stage-2` to do this.

However some of the usages of such properties are in abstract classes. For example, object property `boundary` has domain in some abstract class 4 times, and 9 times is has a non-abstract domain (in total, 13 occurences) (see the full list of duplications in abstract classes [here](./statistics/citygml-duplications%20of%20properties%20with%20domain%20in%20Abstractclass.csv)). As we would like to avoid appearance of abstract classes in OWL (since they are not instantiated), the full list of actions on duplicated definitions of object/datatype properties is described below.
However there are object/datatype properties schematically presented as `packagename#Class.prop`. For example, object property `boundary` has domain in some abstract class 4 times, and 9 times is has a non-abstract domain (in total, 13 occurences) (see the full list of duplications in abstract classes [here](./statistics/citygml-duplications%20of%20properties%20with%20domain%20in%20Abstractclass.csv)). Following the same argument, we would like to avoid repetitions of definitions in package-level ontologies and apply some more actions on duplicated definitions of object/datatype properties as described below.

### ADE* classes/ade* properties removal
As far as the implementation of Application Domain Extensions (ADEs) is optional, we decided to remove mentioning of ADE* classes/ade* properties from CityGML ontologies.
Expand All @@ -118,12 +120,11 @@ luse:ADEOfLandUse a owl:Class ;
```
We apply one SPARQL query ([#5 in the file](./update-triples.sh)) across all ontologies in `stage-2` to do this.

### Abstract classes removal
As far as in practice Abstract* classes are not instantiated, we decided to have a possibility to "switch abstract classes/properties off" and do not have them declared in OWL.
### Removal duplicate definitions for properties of the kind `packagename#Class.property`

To keep the knowledge of which non-abstract classes can be domains/ranges of properties of those classes, we propose to do the following:
We propose to do the following:

each property of an Abstract class is defined as first-class citizen in OWL, with relaxed domain and range restriction using [schema:domainIncludes](https://schema.org/domainIncludes)/[schema:rangeIncludes](https://schema.org/rangeIncludes).
each property of the kind is defined with relaxed domain and range restriction using [schema:domainIncludes](https://schema.org/domainIncludes)/[schema:rangeIncludes](https://schema.org/rangeIncludes).

Qualifying query making use of the naming conventions in OWL generated by ShapeChange:

Expand All @@ -133,15 +134,12 @@ PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
select
(count(?classIndependentPropName) as ?countClasses)
# ?s
?classIndependentPropName
# ?classThePropDepends
where {
?s a owl:ObjectProperty .
optional{bind(strafter(str(?s),"#") as ?classIndependentPropName).}
optional{bind(strbefore(strafter(str(?s),"#"),".") as ?classThePropDepends).}
?s rdfs:label ?classIndependentPropName .
filter (strafter(str(?s),"Abstract") != "")
} group by ?classIndependentPropName having (count(?classIndependentPropName) > 1)
# group by ?classIndependentPropName having (count(?classIndependentPropName) = 1)
```
Expand Down Expand Up @@ -233,15 +231,15 @@ with the results:

| classIndependentPropName | classThePropDepends | domainToInclude | rangeToInclude |
|--------------------------|-----------------------|------------------------------------------------------------------------|--------------------------------------------------------------------------|
| boundary | WaterBody | https://ogcblocks.org/CityGML/3.0/waterbody#WaterBody | https://ogcblocks.org/CityGML/3.0/waterbody#AbstractWaterBoundarySurface |
| boundary | HollowSpace | https://ogcblocks.org/CityGML/3.0/tunnel#HollowSpace | https://ogcblocks.org/CityGML/3.0/core#AbstractThematicSurface |
| boundary | AuxiliaryTrafficSpace | https://ogcblocks.org/CityGML/3.0/transportation#AuxiliaryTrafficSpace | https://ogcblocks.org/CityGML/3.0/transportation#AuxiliaryTrafficArea |
| boundary | TrafficSpace | https://ogcblocks.org/CityGML/3.0/transportation#TrafficSpace | https://ogcblocks.org/CityGML/3.0/transportation#TrafficArea |
| boundary | Door | https://ogcblocks.org/CityGML/3.0/construction#Door | https://ogcblocks.org/CityGML/3.0/construction#DoorSurface |
| boundary | Window | https://ogcblocks.org/CityGML/3.0/construction#Window | https://ogcblocks.org/CityGML/3.0/construction#WindowSurface |
| boundary | BuildingRoom | https://ogcblocks.org/CityGML/3.0/building#BuildingRoom | https://ogcblocks.org/CityGML/3.0/core#AbstractThematicSurface |
| boundary | Storey | https://ogcblocks.org/CityGML/3.0/building#Storey | https://ogcblocks.org/CityGML/3.0/core#AbstractThematicSurface |
| boundary | BridgeRoom | https://ogcblocks.org/CityGML/3.0/bridge#BridgeRoom | https://ogcblocks.org/CityGML/3.0/core#AbstractThematicSurface |
| boundary | WaterBody | https://www.opengis.net/ont/citygml/waterbody#WaterBody | https://www.opengis.net/ont/citygml/waterbody#AbstractWaterBoundarySurface |
| boundary | HollowSpace | https://www.opengis.net/ont/citygml/tunnel#HollowSpace | https://www.opengis.net/ont/citygml/core#AbstractThematicSurface |
| boundary | AuxiliaryTrafficSpace | https://www.opengis.net/ont/citygml/transportation#AuxiliaryTrafficSpace | https://www.opengis.net/ont/citygml/transportation#AuxiliaryTrafficArea |
| boundary | TrafficSpace | https://www.opengis.net/ont/citygml/transportation#TrafficSpace | https://www.opengis.net/ont/citygml/transportation#TrafficArea |
| boundary | Door | https://www.opengis.net/ont/citygml/construction#Door | https://www.opengis.net/ont/citygml/construction#DoorSurface |
| boundary | Window | https://www.opengis.net/ont/citygml/construction#Window | https://www.opengis.net/ont/citygml/construction#WindowSurface |
| boundary | BuildingRoom | https://www.opengis.net/ont/citygml/building#BuildingRoom | https://www.opengis.net/ont/citygml/core#AbstractThematicSurface |
| boundary | Storey | https://www.opengis.net/ont/citygml/building#Storey | https://www.opengis.net/ont/citygml/core#AbstractThematicSurface |
| boundary | BridgeRoom | https://www.opengis.net/ont/citygml/bridge#BridgeRoom | https://www.opengis.net/ont/citygml/core#AbstractThematicSurface |

We aim at creating a definition of the kind:

Expand Down
36 changes: 18 additions & 18 deletions citygml-owl/additional-triples/CityOWL.ttl
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
@prefix owl: <http://www.w3.org/2002/07/owl#> .

<https://ogcblocks.org/CityOWL> a owl:Ontology ;
owl:imports <https://ogcblocks.org/appearance>,
<https://ogcblocks.org/bridge>,
<https://ogcblocks.org/building>,
<https://ogcblocks.org/pointcloud>,
<https://ogcblocks.org/cityfurniture>,
<https://ogcblocks.org/cityobjectgroup>,
<https://ogcblocks.org/construction>,
<https://ogcblocks.org/core>,
<https://ogcblocks.org/dynamizer>,
<https://ogcblocks.org/generics>,
<https://ogcblocks.org/landuse>,
<https://ogcblocks.org/relief>,
<https://ogcblocks.org/transportation>,
<https://ogcblocks.org/tunnel>,
<https://ogcblocks.org/vegetation>,
<https://ogcblocks.org/versioning>,
<https://ogcblocks.org/waterbody> .
<https://www.opengis.net/ont/citygml/CityOWL> a owl:Ontology ;
owl:imports <https://www.opengis.net/ont/citygml/appearance>,
<https://www.opengis.net/ont/citygml/bridge>,
<https://www.opengis.net/ont/citygml/building>,
<https://www.opengis.net/ont/citygml/pointcloud>,
<https://www.opengis.net/ont/citygml/cityfurniture>,
<https://www.opengis.net/ont/citygml/cityobjectgroup>,
<https://www.opengis.net/ont/citygml/construction>,
<https://www.opengis.net/ont/citygml/core>,
<https://www.opengis.net/ont/citygml/dynamizer>,
<https://www.opengis.net/ont/citygml/generics>,
<https://www.opengis.net/ont/citygml/landuse>,
<https://www.opengis.net/ont/citygml/relief>,
<https://www.opengis.net/ont/citygml/transportation>,
<https://www.opengis.net/ont/citygml/tunnel>,
<https://www.opengis.net/ont/citygml/vegetation>,
<https://www.opengis.net/ont/citygml/versioning>,
<https://www.opengis.net/ont/citygml/waterbody> .
2 changes: 1 addition & 1 deletion citygml-owl/additional-triples/alignments.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix geo: <http://www.opengis.net/ont/geosparql#> .
@prefix time: <http://www.w3.org/2006/time#> .
@prefix core: <https://ogcblocks.org/CityGML/3.0/#> .
@prefix core: <https://www.opengis.net/ont/citygml/core#> .

# GeoSPARQL alignments
core:AbstractSpace.lod0MultiCurve rdfs:subPropertyOf geo:hasGeometry .
Expand Down
2 changes: 1 addition & 1 deletion citygml-owl/additional-triples/citymodelmember.ttl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix core: <https://ogcblocks.org/CityGML/3.0/#> .
@prefix core: <https://www.opengis.net/ont/citygml/core#> .

core:CityModel.cityModelMember a owl:ObjectProperty ;
rdfs:label "cityModelMember"@en ;
Expand Down
8 changes: 4 additions & 4 deletions citygml-owl/additional-triples/cityobjectgroup.ttl
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
@prefix core: <https://ogcblocks.org/CityGML/3.0/#> .
@prefix grp: <https://ogcblocks.org/cityobjectgroup#> .
@prefix core: <https://www.opengis.net/ont/citygml/core#> .
@prefix grp: <https://www.opengis.net/ont/citygml/cityobjectgroup#> .
@prefix iso19150-2: <http://def.isotc211.org/iso19150/-2/2012/base#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<https://ogcblocks.org/cityobjectgroup> a owl:Ontology ;
<https://www.opengis.net/ont/citygml/cityobjectgroup> a owl:Ontology ;
rdfs:label "CityObjectGroup"@en ;
owl:imports <http://def.isotc211.org/iso19150/-2/2012/base>,
<https://ogcblocks.org/core> ;
<https://www.opengis.net/ont/citygml/core> ;
skos:definition "The CityObjectGroup module supports grouping of city objects. Arbitrary city objects may be aggregated in groups according to user-defined criteria. A group may be further classified by application-specific attributes."@en .

grp:CityObjectGroup.adeOfCityObjectGroup a owl:ObjectProperty ;
Expand Down
Loading

0 comments on commit 7547a58

Please sign in to comment.