diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index 9e12bc6..f97e05e 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -23,7 +23,13 @@ jobs: mkdir docs mv *.ttl docs/ cd docs + pylode -o application.html -i application.ttl pylode -o index.html -i index.ttl + pylode -o co.html -i co.ttl + pylode -o cs.html -i cs.ttl + pylode -o datum.html -i datum.ttl + pylode -o planet.html -i planet.ttl + pylode -o projection.html -i projection.ttl - name: Deploy 🚀 uses: JamesIves/github-pages-deploy-action@v4.3.3 with: diff --git a/csv/class/co.csv b/csv/class/co.csv index 0729f56..81226de 100644 --- a/csv/class/co.csv +++ b/csv/class/co.csv @@ -1,4 +1,4 @@ -Concept,SuperClass,Label,Definition,ISO 19111,IGN 2019,Proj4RDF,GeoSPARQL,,Who?,Definition IGN,Definition ISO +Concept,SuperClass,Label,Definition,ISO 19111,IGN 2019,Proj4RDF,GeoSPARQL,Core Class?,Who?,Definition IGN,Definition ISO geosrs:CoordinateOperation,,coordinate operation,,iso19111:CoordinateOperation,ign:CoordinateOperation,,,Core Ontology,suggested by Ghislain,"Mathematical operation on coordinates, based on one-to-one relationship, that changes coordinates from one coordinate reference system to another. Cf. ISO 19111:2007:2007-07, part 11.1, table 42 and annex B.4.","process using a mathematical model, based on a one-to-one relationship, that changes coordinates in a source coordinate reference system to coordinates in a target coordinate reference system, or that changes coordinates at a source coordinate epoch to coordinates at a target coordinate epoch within the same coordinate reference system" ,,,,iso19111:PassThroughOperation,,,,,,, ,,,,iso19111:ConcatenatedOperation,,,,,,,coordinate operation consisting of the sequential application of multiple coordinate operations diff --git a/csv/class/cs.csv b/csv/class/cs.csv index 2d48938..8799f8f 100644 --- a/csv/class/cs.csv +++ b/csv/class/cs.csv @@ -1,4 +1,4 @@ -Concept,SuperClass,Label,Definition,ISO 19111,IGN 2019,Proj4RDF,GeoSPARQL,,Definition 1 IGN,Definition 2 ISO +Concept,SuperClass,Label,Definition,ISO 19111,IGN 2019,Proj4RDF,GeoSPARQL,Core Class?,Definition 1 IGN,Definition 2 ISO ,,,,,,geocrs:1DCS,,,, ,,,,,,geocrs:3DCS,,,, geosrs:CoordinateSystem,,coordinate system,,iso19111:CoordinateSystem,ign:CoordinateSystem,geocrs:CoordinateSystem,,Core Ontology,"Set of axes that spans a given coordinate space and of mathematical rules for specifying how coordinates are to be assigned to points. Cf. ISO 19111:2007:2007-07, part 9.2, table 17 and annex B.2.",set of mathematical rules for specifying how coordinates are to be assigned to points diff --git a/csv/class/datum.csv b/csv/class/datum.csv index 4090a6a..f0d7cdd 100644 --- a/csv/class/datum.csv +++ b/csv/class/datum.csv @@ -1,4 +1,4 @@ -Concept,SuperClass,Label,Definition,ISO 19111,IGN 2019,Proj4RDF,GeoSPARQL,,Definition IGN,Definition ISO +Concept,SuperClass,Label,Definition,ISO 19111,IGN 2019,Proj4RDF,GeoSPARQL,Core Class?,Definition IGN,Definition ISO geosrs:Datum,,Datum,,iso19111:Datum,ign:Datum,geocrs:Datum,,Core Ontology,"Parameter or set of parameters that define the position of the origin, the scale and the orientation of a coordinate system. Cf. ISO 19111:2007:2007-07, part 10.1, table 33 and annex B.3.","parameter or set of parameters that realize the position of the origin, the scale, and the orientation of a coordinate system" ,,,,iso19111:GeodeticReferenceFrame,ign:GeodeticDatum,geocrs:GeodeticReferenceFrame,,Core Ontology,"Datum describing the relation of a two- or three-dimensional coordinate system to the Earth. Cf. ISO 19111:2007:2007-07, part 10.2, table 34 and annex B.3.2.",reference frame or datum describing the relationship of a two- or three-dimensional coordinate system to the Earth ,,,,iso19111:DynamicGeodeticReferenceFrame,,geocrs:DynamicGeodeticReferenceFrame,,,, diff --git a/csv/class/planet.csv b/csv/class/planet.csv index 6d7fc37..a867879 100644 --- a/csv/class/planet.csv +++ b/csv/class/planet.csv @@ -1,12 +1,12 @@ -Concept,SuperClass,Label,Definition,ISO 19111,IGN 2019,Proj4RDF,GeoSPARQL -,,,,,,geocrs:ArtificialSatellite, -,,,,,,geocrs:Asteroid, -,,,,,,geocrs:Comet, -,,,,,,geocrs:DwarfPlanet, -,,,,,,geocrs:InterstellarBody, -,,,,,,geocrs:Moon, -,,,,,,geocrs:NaturalSatellite, -,,,,,,geocrs:Planet, -,,,,,,geocrs:PlanetStatus, -,,,,,,geocrs:Plutoid, -,,,,,,geocrs:Star, \ No newline at end of file +Concept,SuperClass,Label,Definition,ISO 19111,IGN 2019,Proj4RDF,GeoSPARQL,Core Class? +,,,,,,geocrs:ArtificialSatellite,, +,,,,,,geocrs:Asteroid,, +,,,,,,geocrs:Comet,, +,,,,,,geocrs:DwarfPlanet,, +,,,,,,geocrs:InterstellarBody,, +,,,,,,geocrs:Moon,, +,,,,,,geocrs:NaturalSatellite,, +,,,,,,geocrs:Planet,, +,,,,,,geocrs:PlanetStatus,, +,,,,,,geocrs:Plutoid,, +,,,,,,geocrs:Star,, \ No newline at end of file diff --git a/csv/class/projection.csv b/csv/class/projection.csv index 44cf3ab..e1bf587 100644 --- a/csv/class/projection.csv +++ b/csv/class/projection.csv @@ -1,4 +1,4 @@ -Concept,SuperClass,Label,Definition,ISO 19111,IGN 2019,Proj4RDF,GeoSPARQL, +Concept,SuperClass,Label,Definition,ISO 19111,IGN 2019,Proj4RDF,GeoSPARQL,Core Class? ,,,,,,geocrs:A4Projection,,Extension ,,,,,,geocrs:AdamsProjection,,Extension ,,,,,,geocrs:AdamsWorldInASquareIIProjection,,Extension diff --git a/csv/class/srs.csv b/csv/class/srs.csv index 6add0bc..617c0ce 100644 --- a/csv/class/srs.csv +++ b/csv/class/srs.csv @@ -1,4 +1,4 @@ -Concept,SuperClass,Label,Definition,ISO 2019,IGN 2019,Proj4RDF,GeoSPARQL,,Definition 1 - IGN Onto,Definition 2 ISO,Definition 3 +Concept,SuperClass,Label,Definition,ISO 2019,IGN 2019,Proj4RDF,GeoSPARQL,Core Class?,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, @@ -31,4 +31,4 @@ geosrs:SpatialReferenceSystem,geosrs:ReferenceSystem,Spatial Reference System,,, ,,,,,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,,,,"Frame delimiting an area of interest. See ISO 19115-1:2014:2014-04, part 6.6.1 and table B.15.1 line 344.",, ,,,,,ign:AxesList,,,,Ordered list of coordinate system axes.,, -,,,,,ign:SingleCRSList,,,,Ordered list of simple reference coordinate systems.,, +,,,,,ign:SingleCRSList,,,,Ordered list of simple reference coordinate systems.,, \ No newline at end of file diff --git a/csv/prop/datatypeprop.csv b/csv/prop/datatypeprop.csv index 0bcbf8c..56dadcd 100644 --- a/csv/prop/datatypeprop.csv +++ b/csv/prop/datatypeprop.csv @@ -1,34 +1,34 @@ -Concept,Domain,Range,Label,Definition,Comment,ISO 19111,IGN 2019,Proj4RDF,GeoSPARQL,,IGN Definition,ISO Definition -,,,,,,,ign:axisAbbrev,geocrs:abbreviation,,,"The abbreviation used to identify an axis. Cf. ISO 19111:2007:2007-07, table 27, attribute coordinate system axis abbreviation.", -,,,,,,,,geocrs:asProj4,,,, -,,,,,,,,geocrs:asProjJSON,,,, -,,,,,,,,geocrs:asWKT,gsp:asWKT,,, -,,,,,,iso19111:anchorDefinition,,,,,, -,,,,,,,ign:axisDirection,,,,"The direction of an axis. Cf. ISO 19111:2007:2007-07, table 27, attribute coordinate system axis direction.", -,,,,,,,ign:codeSpace,,,,"Rule or authority for a code, name, term or category.", -,,,,,,,,geocrs:coordinateEpoch,,,, -,,,,,,,ign:eastBoundLongitude,,,,"Indicates the east bound longitude of a bounding box. Cf. ISO 19115-1:2014:2014-04, part 6.6.1 and table B.15.1 line 346.", -,,,,,,,ign:epsgID,geocrs:epsgCode,,,The EPSG identifier of the resource., -,,,,,,,,geocrs:eccentricity,,,, -,,,,,,iso19111:formula,,,,,, -,,,,,,iso19111:formulaCitation,,,,,, -,,,,,,,,geocrs:isBound,,,, -,,,,,,,,geocrs:isDeprecated,,,, -,,,,,,,,geocrs:isGeocentric,,,, -,,,,,,,,geocrs:isGeographic,,,, -,,,,,,,,geocrs:isProjected,,,, -,,,,,,iso19111:isSphere,ign:isSphere,geocrs:isSphere,,,"Indicates whether the ellipsoid is a sphere. Cf. ISO 19111:2007:2007-07, table 37, attribute ellipsoid=sphere indicator.", -,,,,,,,,geocrs:isVertical,,,, -,,,,,,iso19111:maximumOccurs,,,,,, -,,,,,,,ign:methodFormula,,,,"The formula used by a method to perform an operation on coordinates. Cf. ISO 19111:2007:2007-07, table 48, attribute coordinate operation method formula reference.", -,,,,,,iso19111:minimumOccurs,,,,,, -,,,,,,,ign:northBoundLatitude,,,,"Indicates the north bound longitude of a bounding box. Cf. ISO 19115-1:2014:2014-04, part 6.6.1 and table B.15.1 line 348.", -,,,,,,iso19111:operationVersion,ign:operationVersion,,,,"The version of an operation performed on coordinates. Cf. ISO 19111:2007:2007-07, table 42, attribute coordinate operation version.", -,,,,,,iso19111:parameterValue,,,,,, -,,,,,,iso19111:publicationDate,,,,,, -,,,,,,iso19111:realizationMethod,,,,,, -,,,,,,,ign:scope,geocrs:scope,,,"The scope of the referring object. Cf. ISO 19111:2007:2007-07, tables 4, 33 et 42, attribute scope.", -,,,,,,,ign:sourceDimension,,,,"The dimension of the coordinate reference system associated with the data used as input of an operation. Cf. ISO 19111:2007:2007-07, table 48, attribute dimension of source CRS.", -,,,,,,,ign:southBoundLatitude,,,,"Indicates the south bound latitude of a bounding box. Cf. ISO 19115-1:2014:2014-04, part 6.6.1 and table B.15.1 line 347.", -,,,,,,,ign:targetDimension,,,,"The dimension of the coordinate reference system associated with the data obtained as output of an operation. Cf. ISO 19111:2007:2007-07, table 48, attribute dimension of target CRS.", -,,,,,,,ign:westBoundLongitude,,,,"Indicates the west bound longitude of a bounding box. Cf. ISO 19115-1:2014:2014-04, part 6.6.1 and table B.15.1 line 345.", \ No newline at end of file +Concept,Domain,Range,Label,Definition,Comment,Core Property?,ISO 19111,IGN 2019,Proj4RDF,GeoSPARQL,,IGN Definition,ISO Definition +,,,,,,,,ign:axisAbbrev,geocrs:abbreviation,,,"The abbreviation used to identify an axis. Cf. ISO 19111:2007:2007-07, table 27, attribute coordinate system axis abbreviation.", +,,,,,,,,,geocrs:asProj4,,,, +,,,,,,,,,geocrs:asProjJSON,,,, +,,,,,,,,,geocrs:asWKT,gsp:asWKT,,, +,,,,,,,iso19111:anchorDefinition,,,,,, +,,,,,,,,ign:axisDirection,,,,"The direction of an axis. Cf. ISO 19111:2007:2007-07, table 27, attribute coordinate system axis direction.", +,,,,,,,,ign:codeSpace,,,,"Rule or authority for a code, name, term or category.", +,,,,,,,,,geocrs:coordinateEpoch,,,, +,,,,,,,,ign:eastBoundLongitude,,,,"Indicates the east bound longitude of a bounding box. Cf. ISO 19115-1:2014:2014-04, part 6.6.1 and table B.15.1 line 346.", +,,,,,,,,ign:epsgID,geocrs:epsgCode,,,The EPSG identifier of the resource., +,,,,,,,,,geocrs:eccentricity,,,, +,,,,,,,iso19111:formula,,,,,, +,,,,,,,iso19111:formulaCitation,,,,,, +,,,,,,,,,geocrs:isBound,,,, +,,,,,,,,,geocrs:isDeprecated,,,, +,,,,,,,,,geocrs:isGeocentric,,,, +,,,,,,,,,geocrs:isGeographic,,,, +,,,,,,,,,geocrs:isProjected,,,, +,,,,,,,iso19111:isSphere,ign:isSphere,geocrs:isSphere,,,"Indicates whether the ellipsoid is a sphere. Cf. ISO 19111:2007:2007-07, table 37, attribute ellipsoid=sphere indicator.", +,,,,,,,,,geocrs:isVertical,,,, +,,,,,,,iso19111:maximumOccurs,,,,,, +,,,,,,,,ign:methodFormula,,,,"The formula used by a method to perform an operation on coordinates. Cf. ISO 19111:2007:2007-07, table 48, attribute coordinate operation method formula reference.", +,,,,,,,iso19111:minimumOccurs,,,,,, +,,,,,,,,ign:northBoundLatitude,,,,"Indicates the north bound longitude of a bounding box. Cf. ISO 19115-1:2014:2014-04, part 6.6.1 and table B.15.1 line 348.", +,,,,,,,iso19111:operationVersion,ign:operationVersion,,,,"The version of an operation performed on coordinates. Cf. ISO 19111:2007:2007-07, table 42, attribute coordinate operation version.", +,,,,,,,iso19111:parameterValue,,,,,, +,,,,,,,iso19111:publicationDate,,,,,, +,,,,,,,iso19111:realizationMethod,,,,,, +,,,,,,,,ign:scope,geocrs:scope,,,"The scope of the referring object. Cf. ISO 19111:2007:2007-07, tables 4, 33 et 42, attribute scope.", +,,,,,,,,ign:sourceDimension,,,,"The dimension of the coordinate reference system associated with the data used as input of an operation. Cf. ISO 19111:2007:2007-07, table 48, attribute dimension of source CRS.", +,,,,,,,,ign:southBoundLatitude,,,,"Indicates the south bound latitude of a bounding box. Cf. ISO 19115-1:2014:2014-04, part 6.6.1 and table B.15.1 line 347.", +,,,,,,,,ign:targetDimension,,,,"The dimension of the coordinate reference system associated with the data obtained as output of an operation. Cf. ISO 19111:2007:2007-07, table 48, attribute dimension of target CRS.", +,,,,,,,,ign:westBoundLongitude,,,,"Indicates the west bound longitude of a bounding box. Cf. ISO 19115-1:2014:2014-04, part 6.6.1 and table B.15.1 line 345.", \ No newline at end of file diff --git a/csv/prop/objprop.csv b/csv/prop/objprop.csv index 2dfcd0a..43baf10 100644 --- a/csv/prop/objprop.csv +++ b/csv/prop/objprop.csv @@ -1,7 +1,7 @@ -Concept,Domain,Range,Label,Definition,Comment,ISO 19111,IGN 2019,Proj4RDF,GeoSPARQL,,IGN Definition,ISO Definition +Concept,Domain,Range,Label,Definition,Comment,ISO 19111,IGN 2019,Proj4RDF,GeoSPARQL,Core Property?,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.", +geosrs:axis,geosrs:CoordinateSystem,geosrs:Axis,axis,The property relates a coordinate system to one of its axis,,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,,,,,, @@ -10,16 +10,16 @@ geosrs:axis,geosrs:CoordinateSystem,geosrs:Axis,axis,Coordinate System Axis,An a ,,,,,,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.", +geosrs:coordinateSystem,geosrs:CRS,geosrs:CoordinateSystem,coordinate system,The property relates a coordinate reference system to its coordinate system,,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.", +geosrs:datum,geosrs:CRS,geosrs:Datum,datum,The property relates a coordinate reference system to a datum,,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,, +geosrs:axisDirection,geosrs:Axis,,axisdirection,The property relates a coordinate system axis to its axis direction,,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.", +geosrs:ellipsoid,geosrs:Datum,geosrs:Ellipsoid,ellipsoid,The properties relates a datum to its ellipsoid definition,,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 diff --git a/scripts/srsbuild.py b/scripts/srsbuild.py index b554df8..bbbb45a 100644 --- a/scripts/srsbuild.py +++ b/scripts/srsbuild.py @@ -3,20 +3,18 @@ import csv import os -extontmapping={ -"srs.csv":"core.ttl", -"cs.csv":"cs.ttl", -"projections.csv":"projections.ttl" -} +exont={} + +gcore = Graph() +gcore.bind("geosrs", "http://www.opengis.net/ont/srs/") +gcore.bind("skos","http://www.w3.org/2004/02/skos/core#") + +gcore.add((URIRef("http://www.opengis.net/ont/srs/geosrs"),RDF.type,OWL.Ontology)) +gcore.add((URIRef("http://www.opengis.net/ont/srs/geosrs"),RDFS.label,Literal("SRS Ontology",lang="en"))) +gcore.add((URIRef("http://www.opengis.net/ont/srs/geosrs"),VANN.preferredNamespacePrefix,Literal("geosrs",datatype=XSD.string))) +gcore.add((URIRef("http://www.opengis.net/ont/srs/geosrs"),VANN.preferredNamespaceUri,Literal("http://www.opengis.net/ont/srs/",datatype=XSD.anyURI))) -g = Graph() -g.bind("geosrs", "http://www.opengis.net/ont/srs/") -g.bind("skos","http://www.w3.org/2004/02/skos/core#") -g.add((URIRef("http://www.opengis.net/ont/srs/geosrs"),RDF.type,OWL.Ontology)) -g.add((URIRef("http://www.opengis.net/ont/srs/geosrs"),RDFS.label,Literal("SRS Ontology",lang="en"))) -g.add((URIRef("http://www.opengis.net/ont/srs/geosrs"),VANN.preferredNamespacePrefix,Literal("geosrs",datatype=XSD.string))) -g.add((URIRef("http://www.opengis.net/ont/srs/geosrs"),VANN.preferredNamespaceUri,Literal("http://www.opengis.net/ont/srs/",datatype=XSD.anyURI))) geocrsNS="http://www.opengis.net/ont/srs/" @@ -29,20 +27,43 @@ for file in os.listdir(directory): filename = os.fsdecode(file) + g = Graph() + exont[filename.replace(".csv","")]=g + curprefix="geo"+filename.replace(".csv","") + curns="http://www.opengis.net/ont/srs/"+filename.replace(".csv","")+"/" + g.bind(curprefix,curns) + g.bind("skos","http://www.w3.org/2004/02/skos/core#") + + g.add((URIRef("http://www.opengis.net/ont/srs/geosrs/"+filename.replace(".csv","")),RDF.type,OWL.Ontology)) + g.add((URIRef("http://www.opengis.net/ont/srs/geosrs/"+filename.replace(".csv","")),RDFS.label,Literal("SRS Ontology",lang="en"))) + g.add((URIRef("http://www.opengis.net/ont/srs/geosrs/"+filename.replace(".csv","")),VANN.preferredNamespacePrefix,Literal(curprefix,datatype=XSD.string))) + g.add((URIRef("http://www.opengis.net/ont/srs/geosrs/"+filename.replace(".csv","")),VANN.preferredNamespaceUri,Literal("http://www.opengis.net/ont/srs/"+filename.replace(".csv","")+"/",datatype=XSD.anyURI))) 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(row["Concept"].replace("geosrs:",geocrsNS)),RDF.type,OWL.Class)) - if "Label" in row and row["Label"]!="": - g.add((URIRef(row["Concept"].replace("geosrs:",geocrsNS)),RDFS.label,Literal(row["Label"],lang="en"))) - if "Definition" in row and row["Definition"]!="": - g.add((URIRef(row["Concept"].replace("geosrs:",geocrsNS)),SKOS.definition,Literal(row["Definition"],lang="en"))) - if "SubClass" in row and row["SubClass"]!="": - g.add((URIRef(row["Concept"].replace("geosrs:",geocrsNS)),RDFS.subClassOf,URIRef(row["SubClass"].replace("geosrs:",geocrsNS)))) + core=False + if "Core Class?" in row and row["Core Class?"]=="Core Ontology": + core=True + gcore.add((URIRef(row["Concept"].replace(curprefix+":",curns)),RDF.type,OWL.Class)) + if "Label" in row and row["Label"]!="": + gcore.add((URIRef(row["Concept"].replace(curprefix+":",curns)),RDFS.label,Literal(row["Label"],lang="en"))) + if "Definition" in row and row["Definition"]!="": + gcore.add((URIRef(row["Concept"].replace(curprefix+":",curns)),SKOS.definition,Literal(row["Definition"],lang="en"))) + if "SubClass" in row and row["SubClass"]!="": + gcore.add((URIRef(row["Concept"].replace(curprefix+":",curns)),RDFS.subClassOf,URIRef(row["SubClass"].replace("geosrs:",geocrsNS)))) + else: + g.add((URIRef(row["Concept"].replace(curprefix+":",curns)),RDF.type,OWL.Class)) + if "Label" in row and row["Label"]!="": + g.add((URIRef(row["Concept"].replace(curprefix+":",curns)),RDFS.label,Literal(row["Label"],lang="en"))) + if "Definition" in row and row["Definition"]!="": + g.add((URIRef(row["Concept"].replace(curprefix+":",curns)),SKOS.definition,Literal(row["Definition"],lang="en"))) + if "SubClass" in row and row["SubClass"]!="": + g.add((URIRef(row["Concept"].replace(curprefix+":",curns)),RDFS.subClassOf,URIRef(row["SubClass"].replace("geosrs:",geocrsNS)))) else: continue + dirname = os.path.dirname(__file__) abspath = os.path.join(dirname, '../csv/prop/') @@ -50,6 +71,17 @@ print(abspath) for file in os.listdir(directory): filename = os.fsdecode(file) + g = Graph() + curprefix="geo"+filename.replace(".csv","") + curns="http://www.opengis.net/ont/srs/"+filename.replace(".csv","")+"/" + g.bind(curprefix, curns) + g.bind("skos","http://www.w3.org/2004/02/skos/core#") + + + g.add((URIRef("http://www.opengis.net/ont/srs/geosrs/"+filename.replace(".csv","")),RDF.type,OWL.Ontology)) + g.add((URIRef("http://www.opengis.net/ont/srs/geosrs/"+filename.replace(".csv","")),RDFS.label,Literal("SRS Ontology",lang="en"))) + g.add((URIRef("http://www.opengis.net/ont/srs/geosrs/"+filename.replace(".csv","")),VANN.preferredNamespacePrefix,Literal(curprefix,datatype=XSD.string))) + g.add((URIRef("http://www.opengis.net/ont/srs/geosrs/"+filename.replace(".csv","")),VANN.preferredNamespaceUri,Literal(curns,datatype=XSD.anyURI))) if filename.endswith(".csv"): with open(abspath+filename, newline='') as csvfile: reader = csv.DictReader(csvfile) @@ -57,24 +89,45 @@ if "obj" in filename: objprop=True for row in reader: + print(row) if "Concept" in row and row["Concept"]!="": - if objprop: - g.add((URIRef(row["Concept"].replace("geosrs:",geocrsNS)),RDF.type,OWL.ObjectProperty)) - else: - g.add((URIRef(row["Concept"].replace("geosrs:",geocrsNS)),RDF.type,OWL.DatatypeProperty)) - if "Label" in row and row["Label"]!="": - g.add((URIRef(row["Concept"].replace("geosrs:",geocrsNS)),RDFS.label,Literal(row["Label"],lang="en"))) - if "Definition" in row and row["Definition"]!="": - g.add((URIRef(row["Concept"].replace("geosrs:",geocrsNS)),SKOS.definition,Literal(row["Definition"],lang="en"))) - if "Range" in row and row["Range"]!="": - g.add((URIRef(row["Concept"].replace("geosrs:",geocrsNS)),RDFS.range,URIRef(row["Range"].replace("geosrs:",geocrsNS)))) - if "Domain" in row and row["Domain"]!="": - g.add((URIRef(row["Concept"].replace("geosrs:",geocrsNS)),RDFS.domain,URIRef(row["Domain"].replace("geosrs:",geocrsNS)))) + if "Core Property?" in row: + if row["Core Property?"]=="Core Ontology": + core=True + if objprop: + gcore.add((URIRef(row["Concept"].replace(curprefix+":",curns)),RDF.type,OWL.ObjectProperty)) + else: + gcore.add((URIRef(row["Concept"].replace(curprefix+":",curns)),RDF.type,OWL.DatatypeProperty)) + if "Label" in row and row["Label"]!="": + gcore.add((URIRef(row["Concept"].replace(curprefix+":",curns)),RDFS.label,Literal(row["Label"],lang="en"))) + if "Definition" in row and row["Definition"]!="": + gcore.add((URIRef(row["Concept"].replace(curprefix+":",curns)),SKOS.definition,Literal(row["Definition"],lang="en"))) + if "Range" in row and row["Range"]!="": + gcore.add((URIRef(row["Concept"].replace(curprefix+":",curns)),RDFS.range,URIRef(row["Range"].replace("geosrs:",geocrsNS)))) + if "Domain" in row and row["Domain"]!="": + gcore.add((URIRef(row["Concept"].replace(curprefix+":",curns)),RDFS.domain,URIRef(row["Domain"].replace("geosrs:",geocrsNS)))) + else: + if row["Core Property?"].lower() in exont: + if objprop: + exont[row["Core Property?"].lower()].add((URIRef(row["Concept"].replace(curprefix+":",curns)),RDF.type,OWL.ObjectProperty)) + else: + exont[row["Core Property?"].lower()].add((URIRef(row["Concept"].replace(curprefix+":",curns)),RDF.type,OWL.DatatypeProperty)) + if "Label" in row and row["Label"]!="": + exont[row["Core Property?"].lower()].add((URIRef(row["Concept"].replace(curprefix+":",curns)),RDFS.label,Literal(row["Label"],lang="en"))) + if "Definition" in row and row["Definition"]!="": + exont[row["Core Property?"].lower()].add((URIRef(row["Concept"].replace(curprefix+":",curns)),SKOS.definition,Literal(row["Definition"],lang="en"))) + if "Range" in row and row["Range"]!="": + exont[row["Core Property?"].lower()].add((URIRef(row["Concept"].replace(curprefix+":",curns)),RDFS.range,URIRef(row["Range"].replace("geosrs:",geocrsNS)))) + if "Domain" in row and row["Domain"]!="": + exont[row["Core Property?"].lower()].add((URIRef(row["Concept"].replace(curprefix+":",curns)),RDFS.domain,URIRef(row["Domain"].replace("geosrs:",geocrsNS)))) + g.serialize(destination=filename.replace(".csv","")+".ttl") else: continue print(len(g)) -g.serialize(destination="index.ttl") +for item in exont: + exont[item].serialize(destination=item+".ttl") +gcore.serialize(destination="index.ttl") g=Graph() g.bind("ign","http://data.ign.fr/def/ignf#")