Skip to content

Commit

Permalink
ont workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
situx committed Sep 25, 2024
1 parent 4430b2d commit f8b9849
Show file tree
Hide file tree
Showing 5 changed files with 171 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/workflows/blank.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ jobs:
sudo pip3 install wheel pylode==2.13.2
- name: Create Ontology Documentation 🔧
run: |
python3 scripts/buildsrs.py
mkdir docs
cd docs
pylode -o index.html -i ../crsdraft.ttl
pylode -o index.html -i geosrs.ttl
- name: Deploy 🚀
uses: JamesIves/[email protected]
with:
Expand Down
34 changes: 34 additions & 0 deletions csv/class/srs.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Concept,SuperClass,Label,Definition,ISO 2019,IGN 2019,Proj4RDF,GeoSPARQL,,Definition 1 - IGN Onto,Definition 2 ISO,Definition 3
,,,,,,geocrs:AreaOfUse,,,,,
,,,,,,geocrs:BoundCRS,,,,,
,,,,iso19111:CompoundCRS,ign:CompoundCRS,geocrs:CompoundCRS,,,"Coordinate reference system using at least two independent single coordinate reference systems. Cf. ISO 19111:2007:2007-07, parts 8.2.3.c, 8.2.4, table 6 and annex B.1.2.4.",coordinate reference system using at least two independent coordinate reference systems,
geosrs:CRS,geosrs:SpatialReferenceSystem,Coordinate Reference System,,iso19111:CRS,ign:CRS,geocrs:CRS,,Core Ontology,"Depending on the spatial dimension of coordinates (1D, 2D, 3D), this piece of metadata is used for specifying the elements of definition associated to a given set of coordinates: its datum, its ellipsoid, its prime meridian, the type of coordinates (geocentric, geographic, projected,...), the coordinates units of measure, when appropriate the cartographic projection used, the vertical coordinate reference system.",coordinate system that is related to an object by a datum,
,,,,iso19111:DerivedCRS,,,,,,coordinate reference system that is defined through the application of a specified coordinate conversion to the coordinates within a previously established coordinate reference system,
,,,,iso19111:DerivedEngineeringCRS,,,,,,,
,,,,iso19111:DerivedGeodeticCRS,,,,,,,
,,,,iso19111:DerivedGeographicCRS,,,,,,,
,,,,iso19111:DerivedParametricCRS,,geocrs:DerivedParametricCRS,,,,,
,,,,iso19111:DerivedProjectedCRS,,,,,,,
,,,,iso19111:DerivedTemporalCRS,,,,,,,
,,,,iso19111:DerivedVerticalCRS,,,,,,,
,,,,iso19111:EngineeringCRS,,geocrs:EngineeringCRS,,Core Ontology,,coordinate reference system based on an engineering datum,
,,,,,,geocrs:GeocentricCRS,,,,,
,,,,iso19111:GeodeticCRS,ign:GeodeticCRS,geocrs:GeodeticCRS,,Core Ontology,"Coordinate reference system associated with a geodetic datum. Cf. ISO 19111:2007:2007-07, part 8.2.2.a, table 10 and annex B.1.2.1.a.",three-dimensional coordinate reference system based on a geodetic reference frame and having either a three-dimensional Cartesian or a spherical coordinate system,
,,,,iso19111:GeographicCRS,,geocrs:GeographicCRS,,Core Ontology,,coordinate reference system that has a geodetic reference frame and an ellipsoidal coordinate system,
,,,,iso19111:ParametricCRS,,geocrs:ParametricCRS,,,,coordinate reference system based on a parametric datum,
,,,,iso19111:ProjectedCRS,ign:ProjectedCRS,geocrs:ProjectedCRS,,Core Ontology,"Coordinate reference system derived from a two-dimensional geodetic coordinate reference system by applying a map projection. Cf. ISO 19111:2007:2007-07, part 8.2.3.b, table 11 and annex B.1.2.3.",coordinate reference system derived from a geographic coordinate reference system by applying a map projection,
,,,,,,geocrs:SelenographicCRS,,,,,
geosrs:ReferenceSystem,,Reference System,,,,geocrs:ReferenceSystem,,,,,
,,,,iso19111:SingleCRS,ign:SingleCRS,geocrs:SingleCRS,,Core Ontology,"Coordinate reference system consisting of one coordinate system and one datum. Cf. ISO 19111:2007:2007-07, table 5.",,
geosrs:SpatialReferenceSystem,geosrs:ReferenceSystem,Spatial Reference System,,,,geocrs:SpatialReferenceSystem,,Core Ontology,,,
,,,,,,geocrs:SpatioParametricCompoundCRS,,,,,
,,,,,,geocrs:SpatioParametricTemporalCompoundCRS,,,,,
,,,,,,geocrs:SpatioTemporalCompoundCRS,,,,,
,,,,,,geocrs:SRSRegistry,,,,,
,,,,,,geocrs:StaticCRS,,,,coordinate reference system that has a static reference frame,
,,,,iso19111:TemporalCRS,,geocrs:TemporalCRS,,,,coordinate reference system based on a temporal datum,
,,,,iso19111:VerticalCRS,ign:VerticalCRS,geocrs:VerticalCRS,,,"One-dimensional coordinate reference system associated with a vertical datum and used for recording heights or depths.Ellipsoidal heights are not captured in a vertical coordinate reference system but as part of a 3D coordinates tuple defined in a geodetic 3D coordinate reference system. Cf. ISO 19111:2007:2007-07, parts 8.2.2.b, table 14 and annex B.1.2.1.b.",one-dimensional coordinate reference system based on a vertical reference frame,
,,,,,ign:Extent,,,,"Geographic area or time interval in which the referring object is valid. Cf. ISO 19115-1:2014:2014-04, part 6.6.1 and table B.15 line 335.",,
,,,,,ign:GeographicBoundingBox,,,,,,
,,,,,ign:AxesList,,,,,,
,,,,,ign:SingleCRSList,,,,,,
53 changes: 53 additions & 0 deletions csv/prop/objprop.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
Concept,Domain,Range,Label,Definition,Comment,ISO 19111,IGN 2019,Proj4RDF,GeoSPARQL,,IGN Definition,ISO Definition
,,,,,,iso19111:affineCS,,,,,,
,,,,,,,,geocrs:area_of_use,,,,
geosrs:axis,geosrs:CoordinateSystem,geosrs:Axis,axis,Coordinate System Axis,An axis of a CRS,iso19111:axis,ign:axis,geocrs:axis,,Core Ontology,"An axis used by some ellipsoidal or cartesian coordinate system. Cf. ISO 19111:2007:2007-07, table 17, association role axis.",
,,,,,,iso19111:axisUnitID,,,,,,
,,,,,,iso19111:baseCRS,ign:baseCRS,,,Core Ontology,"The geodetic coordinate reference system on which a projected coordinate reference system is based. Cf. ISO 19111:2007:2007-07, table 11, association role baseCRS.",
,,,,,,iso19111:calendar,,,,,,
,,,,,,iso19111:cartesianCS,ign:cartesianCS,,,,"The cartesian coordinate system used by some geodetic or projected coordinate reference system. Cf. ISO 19111:2007:2007-07, tables 10 et 11, association roles coordinateSystem.",
,,,,,,,ign:conversion,,,,"The conversion used to define a projected coordinate reference system. Cf. ISO 19111:2007:2007-07, table 7, named association Definition.",
,,,,,,iso19111:componentReferenceSystem,,,,,,
,,,,,,iso19111:conventionalRS,,,,,,
,,,,,,iso19111:coordinateOperationAccuracy,,,,,,
,,,,,,iso19111:coordinateSystem,ign:coordinateSystem,geocrs:coordinateSystem,,Core Ontology,"The coordinate system used by a coordinate reference system. Cf. ISO 19111:2007:2007-07, table 5, named association CoordinateSystem.",
,,,,,,iso19111:coordinateType,,,,,,
,,,,,,iso19111:cylindricalCS,,,,,,
,,,,,,iso19111:datum,ign:datum,geocrs:datum,,Core Ontology,"The datum used by a single coordinate reference system. Cf. ISO 19111:2007:2007-07, table 5, named association DefiningDatum.",
,,,,,,iso19111:datumDefiningParameter,,,,,,
,,,,,,iso19111:datumEnsemble,,,,,,
,,,,,,iso19111:derivingConversion,,,,,,
,,,,,,iso19111:axisDirection,,geocrs:direction,,Core Ontology,,
,,,,,,,ign:domainOfValidity,,,,"Geographic area or time interval in which the referring object is valid. Cf. ISO 19111:2007:2007-07, tables 4, 33 and 42, attribute domainOfValidity.",
,,,,,,iso19111:ellipsoid,ign:ellipsoid,,,,"The ellipsoid used by a geodetic datum. Cf. ISO 19111:2007:2007-07, table 34, association role ellipsoid.",
,,,,,,iso19111:ellipsoidalCS,ign:ellipsoidalCS,,,,"The ellipsoidal coordinate system used by a geodetic coordinate reference system. Cf. ISO 19111:2007:2007-07, table 10, named association CoordinateSystem.",
,,,,,,iso19111:ensembleAccuracy,,,,,,
,,,,,,iso19111:frameReferenceEpoch,,,,,,epoch of coordinates that define a dynamic reference frame
,,,,,,iso19111:greenwichLongitude,,,,,,
,,,,,,,ign:geodeticDatum,,,,"The geodetic datum used by a geodetic coordinate reference system. Cf. ISO 19111:2007:2007-07, table 10, named association DefiningDatum.",
,,,,,,,ign:geographicElement,,,,"The geographic bounding box used for defining a domain of validity. Cf. ISO 19115-1:2014:2014-04, part 6.6.1 and table B.15 line 337.",
,,,,,,iso19111:geoidModel,,,,,,
,,,,,,,ign:greenwichLongitude,,,,"Indicates the longitude from Greenwich meridian. Cf. ISO 19111:2007:2007-07, table 35, attribute prime meridian Greenwich longitude.",
,,,,,,,ign:includesSingleCRS,,,,"Indicates the single coordinate reference systems used by a compound coordinate reference system. Cf. ISO 19111:2007:2007-07, table 6, association role componentReferenceSystem.",
,,,,,,,,geocrs:includesSRS,,,,
,,,,,,iso19111:inverseFlattening,ign:inverseFlattening,,,,"Indicates the inverse flattening value of an ellipsoid, expressed as a number or a ratio (percentage rate, parts per million, etc.). Cf. ISO 19111:2007:2007-07, table 37, attribute inverse flattening",
,,,,,,iso19111:linearCS,,,,,,
,,,,,,iso19111:modifiedCoordinate,,,,,,
,,,,,,iso19111:origin,,,,,,
,,,,,,iso19111:ordinalCS,,,,,,
,,,,,,,ign:parameter,,,,"The parameter associated to a given value. Cf. ISO 19111:2007:2007-07, table 55, association role parameter.",
,,,,,,iso19111:parameterValue,,,,,,
,,,,,,iso19111:primeMeridian,ign:primeMeridian,,,,"The prime meridian used by a geodetic datum. Cf. ISO 19111:2007:2007-07, table 34, association role primeMeridian.",
,,,,,,iso19111:polarCS,,,,,,
,,,,,,iso19111:semiMedianAxis,,,,,,
,,,,,,iso19111:semiMajorAxis,ign:semiMajorAxis,,,,"Indicates the length of the semi major axis of an ellipsoid. Cf. ISO 19111:2007:2007-07, table 36, attribute length of semi-major axis.",semi-diameter of the longest axis of an ellipsoid
,,,,,,iso19111:semiMinorAxis,ign:semiMinorAxis,,,,"Indicates the length of the semi minor axis of an ellipsoid. Cf. ISO 19111:2007:2007-07, table 37, attribute length of semi-minor axis.",semi-diameter of the shortest axis of an ellipsoid
,,,,,,iso19111:sphericalCS,,,,,,
,,,,,,,ign:sourceCRS,geocrs:sourceCRS,,Core Ontology,"The coordinate reference system associated to the data used as input of a given operation. Cf. ISO 19111:2007:2007-07, table 42, named association Source.",
,,,,,,,ign:targetCRS,geocrs:targetCRS,,Core Ontology,"The coordinate reference system associated to the data obtained as output of a given operation. Cf. ISO 19111:2007:2007-07, table 42, named association Target.",
,,,,,,,ign:usesMethod,,,,"The method used by an operation on coordinates. Cf. ISO 19111:2007:2007-07, table 43, association role method.",
,,,,,,,ign:usesParameter,,,,"A parameter used by a method to perform an operation on coordinates. Cf. ISO 19111:2007:2007-07, table 48, association role parameter.",
,,,,,,,ign:usesValue,,,,"A value used by an operation on coordinates. Cf. ISO 19111:2007:2007-07, table 43, association role parameterValue.",
,,,,,,,ign:verticalCS,,,,"The vertical coordinate system used by a vertical coordinate reference system. Cf. ISO 19111:2007:2007-07, table 14, named association CoordinateSystem.",
,,,,,,,ign:verticalDatum,,,,"The vertical datum used by a vertical coordinate reference system. Cf. ISO 19111:2007:2007-07, table 14, named association DefiningDatum.",
,,,,,,iso19111:velocityModel,,,,,,
19 changes: 19 additions & 0 deletions geosrs.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@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#> .

<http://www.opengis.net/ont/crs/geosrs:CRS> a owl:Class ;
rdfs:label "Coordinate Reference System"@en .

<http://www.opengis.net/ont/crs/geosrs:ReferenceSystem> a owl:Class ;
rdfs:label "Reference System"@en .

<http://www.opengis.net/ont/crs/geosrs:SpatialReferenceSystem> a owl:Class ;
rdfs:label "Spatial Reference System"@en .

<http://www.opengis.net/ont/crs/geosrs:axis> a owl:ObjectProperty ;
rdfs:label "axis"@en ;
rdfs:domain <http://www.opengis.net/ont/crs/CoordinateSystem> ;
rdfs:range <http://www.opengis.net/ont/crs/Axis> ;
skos:definition "Coordinate System Axis"@en .

63 changes: 63 additions & 0 deletions scripts/srsbuild.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
from rdflib import Graph, URIRef, Literal
from rdflib.namespace import RDF, RDFS, OWL, SKOS
import csv
import os

g = Graph()
g.bind("geosrs", "http://www.opengis.net/ont/srs/")
g.bind("skos","http://www.w3.org/2004/02/skos/core#")

geocrsNS="http://www.opengis.net/ont/crs/"

dirname = os.path.dirname(__file__)
abspath = os.path.join(dirname, '../csv/class/')

directory = os.fsencode(abspath)

for file in os.listdir(directory):
filename = os.fsdecode(file)
if filename.endswith(".csv"):
with open(abspath+filename, newline='') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
if "Concept" in row and row["Concept"]!="":
g.add((URIRef(geocrsNS+row["Concept"]),RDF.type,OWL.Class))
if "Label" in row and row["Label"]!="":
g.add((URIRef(geocrsNS+row["Concept"]),RDFS.label,Literal(row["Label"],lang="en")))
if "Definition" in row and row["Definition"]!="":
g.add((URIRef(geocrsNS+row["Concept"]),SKOS.definition,Literal(row["Definition"],lang="en")))
if "SubClass" in row and row["SubClass"]!="":
g.add((URIRef(geocrsNS+row["Concept"]),RDFS.subClassOf,URIRef(row["SubClass"].replace("geosrs:",geocrsNS))))
else:
continue

dirname = os.path.dirname(__file__)
abspath = os.path.join(dirname, '../csv/prop/')
directory = os.fsencode(abspath)
print(abspath)
for file in os.listdir(directory):
filename = os.fsdecode(file)
if filename.endswith(".csv"):
with open(abspath+filename, newline='') as csvfile:
reader = csv.DictReader(csvfile)
objprop=False
if "obj" in filename:
objprop=True
for row in reader:
if "Concept" in row and row["Concept"]!="":
if objprop:
g.add((URIRef(geocrsNS+row["Concept"]),RDF.type,OWL.ObjectProperty))
else:
g.add((URIRef(geocrsNS+row["Concept"]),RDF.type,OWL.DatatypeProperty))
if "Label" in row and row["Label"]!="":
g.add((URIRef(geocrsNS+row["Concept"]),RDFS.label,Literal(row["Label"],lang="en")))
if "Definition" in row and row["Definition"]!="":
g.add((URIRef(geocrsNS+row["Concept"]),SKOS.definition,Literal(row["Definition"],lang="en")))
if "Range" in row and row["Range"]!="":
g.add((URIRef(geocrsNS+row["Concept"]),RDFS.range,URIRef(row["Range"].replace("geosrs:",geocrsNS))))
if "Domain" in row and row["Domain"]!="":
g.add((URIRef(geocrsNS+row["Concept"]),RDFS.domain,URIRef(row["Domain"].replace("geosrs:",geocrsNS))))
else:
continue
print(len(g))
g.serialize(destination="geosrs.ttl")

0 comments on commit f8b9849

Please sign in to comment.