From abf680615d41e1fe63764035c956d37378e9afdd Mon Sep 17 00:00:00 2001 From: Timo Date: Mon, 7 Oct 2024 20:57:33 +0200 Subject: [PATCH] fixes --- csv/alignment/alignment.csv | 7 +++++++ scripts/srsbuild.py | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 csv/alignment/alignment.csv diff --git a/csv/alignment/alignment.csv b/csv/alignment/alignment.csv new file mode 100644 index 00000000..fe7ceb41 --- /dev/null +++ b/csv/alignment/alignment.csv @@ -0,0 +1,7 @@ +Concept source,Property,Concept target +geosrs:CoordinateSystem,owl:equivalentClass,ign:CoordinateSystem +geosrs:CoordinateSystem,owl:equivalentClass,iso19111:CoordinateSystem +geosrs:Datum,owl:equivalentClass,iso19111:Datum +geosrs:Datum,owl:equivalentClass,ign:Datum +geosrs:Ellipsoid,owl:equivalentClass,iso19111:Ellipsoid +geosrs:Ellipsoid,owl:equivalentClass,ign:Ellipsoid \ No newline at end of file diff --git a/scripts/srsbuild.py b/scripts/srsbuild.py index fed259ef..5056e966 100644 --- a/scripts/srsbuild.py +++ b/scripts/srsbuild.py @@ -3,6 +3,12 @@ import csv import os +extontmapping={ +"srs.csv":"core.ttl", +"cs.csv":"cs.ttl", +"projections.csv":"projections.ttl" +} + g = Graph() g.bind("geosrs", "http://www.opengis.net/ont/srs/") g.bind("skos","http://www.w3.org/2004/02/skos/core#") @@ -17,6 +23,8 @@ dirname = os.path.dirname(__file__) abspath = os.path.join(dirname, '../csv/class/') + + directory = os.fsencode(abspath) for file in os.listdir(directory): @@ -64,5 +72,30 @@ g.add((URIRef(geocrsNS+row["Concept"]),RDFS.domain,URIRef(row["Domain"].replace("geosrs:",geocrsNS)))) else: continue + print(len(g)) -g.serialize(destination="geosrs.ttl") \ No newline at end of file +g.serialize(destination="index.ttl") + +g=Graph() +g.bind("ign","http://data.ign.fr/def/ignf#") +g.bind("iso19112","http://def.isotc211.org/iso19112/2019/SpatialReferencingByGeographicIdentifier#") +g.bind("geosrs", "http://www.opengis.net/ont/srs/") +dirname = os.path.dirname(__file__) +abspath = os.path.join(dirname, '../csv/alignment/') +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 source" in row and row["Concept source"]!="" and "Concept target" in row and row["Concept target"]!="" and "Property" in row and row["Property"]!="": + g.add((URIRef(row["Concept source"].replace("geosrs:",geocrsNS).replace("ign:","http://data.ign.fr/def/ignf#").replace("iso19112:","http://def.isotc211.org/iso19112/2019/SpatialReferencingByGeographicIdentifier#")),URIRef(row["Property"].replace("owl:","http://www.w3.org/2002/07/owl#").replace("rdfs:","http://www.w3.org/2000/01/rdf-schema#")),URIRef(geocrsNS+row["Concept target"].replace("geosrs:",geocrsNS).replace("ign:","http://data.ign.fr/def/ignf#").replace("iso19112:","http://def.isotc211.org/iso19112/2019/SpatialReferencingByGeographicIdentifier#"))) + else: + continue + +g.serialize(destination="alignments.ttl") \ No newline at end of file