From 2f8f3ee7f22f1c1dc6cbb112dea105cd2e38d31c Mon Sep 17 00:00:00 2001 From: Gobe Hobona Date: Fri, 8 Dec 2023 10:45:31 +0000 Subject: [PATCH 1/2] Update 20231206_url_statuses.csv @situx @avillar Error codes fixed expect the ones removed in this commit. --- incubation/geosparql/20231206_url_statuses.csv | 7 ------- 1 file changed, 7 deletions(-) diff --git a/incubation/geosparql/20231206_url_statuses.csv b/incubation/geosparql/20231206_url_statuses.csv index e57cb6a7..769bd3c5 100644 --- a/incubation/geosparql/20231206_url_statuses.csv +++ b/incubation/geosparql/20231206_url_statuses.csv @@ -36,11 +36,9 @@ code,url,alias 400,http://www.opengis.net/def/function/geosparql/ehCoveredBy_param1,CREATE 500,http://www.opengis.net/def/function/geosparql/maxy,LEAVE 400,http://www.opengis.net/def/function/geosparql/asKML_param1,CREATE -500,http://www.opengis.net/def/geosparql/servicedescription,CREATE 400,http://www.opengis.net/def/function/geosparql/maxY_output,CREATE 400,http://www.opengis.net/def/function/geosparql/geometryN_param1,CREATE 400,http://www.opengis.net/def/function/geosparql/sfOverlaps_param1,CREATE -400,http://www.opengis.net/def/geosparql/safuncs,CREATE 400,http://www.opengis.net/def/function/geosparql/ehMeet_param2,CREATE 400,http://www.opengis.net/def/function/geosparql/ehContains_output,CREATE 400,http://www.opengis.net/def/function/geosparql/asWKT_output,CREATE @@ -51,7 +49,6 @@ code,url,alias 400,http://www.opengis.net/def/function/geosparql/symDifference_param2,CREATE 400,http://www.opengis.net/def/function/geosparql/minX_param1,CREATE 400,http://www.opengis.net/def/function/geosparql/buffer_param2,CREATE -400,http://www.opengis.net/def/geosparql/geo-jsonldcontext,CREATE 400,http://www.opengis.net/def/function/geosparql/metricLength_output,CREATE 400,http://www.opengis.net/def/function/geosparql/union_param1,CREATE 400,http://www.opengis.net/def/function/geosparql/ehOverlap_param1,CREATE @@ -65,7 +62,6 @@ code,url,alias 400,http://www.opengis.net/def/function/geosparql/minz_output,LEAVE 400,http://www.opengis.net/def/function/geosparql/minY_param1,LEAVE 400,http://www.opengis.net/def/function/geosparql/boundary_output,CREATE -400,http://www.opengis.net/def/geosparql/sf-jsonldcontext,CREATE 400,http://www.opengis.net/def/function/geosparql/ehContains_param1,CREATE 400,http://www.opengis.net/def/function/geosparql/concaveHull_param1,CREATE 400,http://www.opengis.net/def/function/geosparql/sfContains_param2,CREATE @@ -161,8 +157,6 @@ code,url,alias 400,http://www.opengis.net/def/function/geosparql/minx_param1,LEAVE 400,http://www.opengis.net/def/function/geosparql/asDGGS_param2,CREATE 400,http://www.opengis.net/def/function/geosparql/ehEquals_output,CREATE -400,http://www.opengis.net/def/geosparql/extended-examples,CREATE -400,http://www.opengis.net/def/geosparql/validator,CREATE 400,http://www.opengis.net/def/function/geosparql/metricPerimeter_param1,CREATE 400,http://www.opengis.net/def/function/geosparql/perimeter_output,CREATE 400,http://www.opengis.net/def/function/geosparql/difference_param1,CREATE @@ -179,7 +173,6 @@ code,url,alias 400,http://www.opengis.net/def/function/geosparql/distance_output,CREATE 400,http://www.opengis.net/def/function/geosparql/getSRID_output,CREATE 400,http://www.opengis.net/def/function/geosparql/metricDistance_output,CREATE -400,http://www.opengis.net/def/geosparql/repository,CREATE 400,http://www.opengis.net/def/function/geosparql/maxX_output,CREATE 400,http://www.opengis.net/def/function/geosparql/area_output,CREATE 400,http://www.opengis.net/def/function/geosparql/asGeoJSON_output,CREATE From 11ed0b5f730b6695ef158abe0f190e34cc0df582 Mon Sep 17 00:00:00 2001 From: Gobe Hobona Date: Fri, 8 Dec 2023 10:45:46 +0000 Subject: [PATCH 2/2] fixed error codes --- .../20231206_insert_status_400_fixes.nt | 336 ++++++++++++++++++ incubation/geosparql/20231208_toplevel.csv | 8 + incubation/geosparql/create_subject_fixes.py | 190 ++++++++++ 3 files changed, 534 insertions(+) create mode 100644 incubation/geosparql/20231206_insert_status_400_fixes.nt create mode 100644 incubation/geosparql/20231208_toplevel.csv create mode 100644 incubation/geosparql/create_subject_fixes.py diff --git a/incubation/geosparql/20231206_insert_status_400_fixes.nt b/incubation/geosparql/20231206_insert_status_400_fixes.nt new file mode 100644 index 00000000..20c86b57 --- /dev/null +++ b/incubation/geosparql/20231206_insert_status_400_fixes.nt @@ -0,0 +1,336 @@ + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . + . diff --git a/incubation/geosparql/20231208_toplevel.csv b/incubation/geosparql/20231208_toplevel.csv new file mode 100644 index 00000000..3da38493 --- /dev/null +++ b/incubation/geosparql/20231208_toplevel.csv @@ -0,0 +1,8 @@ +code,url,alias +500,http://www.opengis.net/def/geosparql/servicedescription,CREATE +400,http://www.opengis.net/def/geosparql/safuncs,CREATE +400,http://www.opengis.net/def/geosparql/geo-jsonldcontext,CREATE +400,http://www.opengis.net/def/geosparql/sf-jsonldcontext,CREATE +400,http://www.opengis.net/def/geosparql/extended-examples,CREATE +400,http://www.opengis.net/def/geosparql/validator,CREATE +400,http://www.opengis.net/def/geosparql/repository,CREATE \ No newline at end of file diff --git a/incubation/geosparql/create_subject_fixes.py b/incubation/geosparql/create_subject_fixes.py new file mode 100644 index 00000000..ec792623 --- /dev/null +++ b/incubation/geosparql/create_subject_fixes.py @@ -0,0 +1,190 @@ +# Script created to support the generation of Turtle-encoded content for the OGC GeoTIFF Tag Register +# Created: 2021-02-16 +# Author: Gobe Hobona (OGC) + +import csv +import rdflib +from datetime import datetime +from rdflib.namespace import DC, DCTERMS, DOAP, FOAF, SKOS, OWL, RDF, RDFS, VOID, XMLNS, XSD + + +g = rdflib.Graph() +g.bind("foaf", FOAF) +g.bind("xsd", XSD) +g.bind("skos", SKOS) +g.bind("dcterms", DCTERMS) + + +csvFileName = "20231206_url_statuses.csv" +ttlOutputFileName = "20231206_insert_status_400_fixes.nt" + +csvfile = open(csvFileName,newline='\n') + +subjects = csv.reader(csvfile, delimiter=',') + +for subject in subjects: + print(subject[0]) + uri = str(subject[1]) + + if str(subject[0]) == '500': + print("==============") + continue + + if str(subject[2]) == 'LEAVE': + print("==============") + continue + + label = "" + if "http://www.opengis.net/def/function/geosparql/" in uri: + token = uri.replace("http://www.opengis.net/def/function/geosparql/","") + label = token.replace("_"," ") + print(label) + elif "http://www.opengis.net/def/geosparql/" in uri: + token = uri.replace("http://www.opengis.net/def/geosparql/","") + label = token.replace("_"," ") + print(label) + else: + label = uri + + conceptURI = uri + g.add(( + rdflib.URIRef(conceptURI), + RDF.type, + rdflib.URIRef(SKOS.Concept) + )) + +# g.add(( +# rdflib.URIRef(conceptURI), +# SKOS.definition, +# rdflib.Literal(label + " as defined in GeoSPARQL") +# )) + + g.add(( + rdflib.URIRef(conceptURI), + SKOS.inScheme, + rdflib.URIRef("http://www.opengis.net/def/function/geosparql") + )) + + +csvfile.close() + +fout = open(ttlOutputFileName,'w') +fout.write(g.serialize(format="nt")) +fout.close() + + +''' +# Do not edit below this line +collectionURI = schemeURI+"/" + +g = rdflib.Graph() +g.bind("foaf", FOAF) +g.bind("xsd", XSD) +g.bind("skos", SKOS) +g.bind("dcterms", DCTERMS) + +g.add(( + rdflib.URIRef("http://www.opengis.net/def/register/"), + SKOS.member, + rdflib.URIRef(collectionURI) +)) + +# Generation of Collection + +g.add(( + rdflib.URIRef(collectionURI), + SKOS.inScheme, + rdflib.URIRef(schemeURI) +)) +g.add(( + rdflib.URIRef(collectionURI), + RDF.type, + rdflib.URIRef(SKOS.Collection) +)) +g.add(( + rdflib.URIRef(collectionURI), + SKOS.prefLabel, + rdflib.Literal(collectionAndSchemeLabel) +)) +g.add(( + rdflib.URIRef(collectionURI), + RDFS.label, + rdflib.Literal(collectionAndSchemeLabel) +)) + +# Generation of ConceptScheme + +g.add(( + rdflib.URIRef(schemeURI), + SKOS.prefLabel, + rdflib.Literal(collectionAndSchemeLabel) +)) +g.add(( + rdflib.URIRef(schemeURI), + RDF.type, + rdflib.URIRef(SKOS.ConceptScheme) +)) +g.add(( + rdflib.URIRef(schemeURI), + RDFS.label, + rdflib.Literal(collectionAndSchemeLabel) +)) + +g.add(( + rdflib.URIRef(schemeURI), + rdflib.URIRef("http://www.opengis.net/def/metamodel/ogc-na/collectionView"), + rdflib.URIRef(collectionURI) +)) + +# Generation of Concept + +with open(csvFileName, 'r') as csvfile: + tagreader = csv.reader(csvfile, delimiter=',') + for row in tagreader: + conceptURI = conceptNamespace+"/"+row[0] + g.add(( + rdflib.URIRef(conceptURI), + RDF.type, + rdflib.URIRef(SKOS.Concept) + )) + g.add(( + rdflib.URIRef(conceptURI), + RDFS.label, + rdflib.Literal(row[2]) + )) + g.add(( + rdflib.URIRef(conceptURI), + SKOS.prefLabel, + rdflib.Literal(row[2]) + )) + g.add(( + rdflib.URIRef(conceptURI), + SKOS.definition, + rdflib.Literal(row[5]) + )) + g.add(( + rdflib.URIRef(conceptURI), + RDFS.seeAlso, + rdflib.URIRef(row[4]) + )) + g.add(( + rdflib.URIRef(conceptURI), + DCTERMS.created, + rdflib.Literal(datetime.now(), datatype=XSD.dateTime) + )) + g.add(( + rdflib.URIRef(conceptURI), + SKOS.notation, + rdflib.Literal(row[0], datatype=notationDataType) + )) + g.add(( + rdflib.URIRef(collectionURI), + SKOS.member, + rdflib.URIRef(conceptURI) + )) + + +fout = open(ttlOutputFileName,'w') +fout.write(g.serialize(format="turtle")) +fout.close() +''' \ No newline at end of file