Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
situx committed Oct 7, 2024
1 parent ffb4ef3 commit abf6806
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
7 changes: 7 additions & 0 deletions csv/alignment/alignment.csv
Original file line number Diff line number Diff line change
@@ -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
35 changes: 34 additions & 1 deletion scripts/srsbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -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#")
Expand All @@ -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):
Expand Down Expand Up @@ -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")
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")

0 comments on commit abf6806

Please sign in to comment.