From 808ba1528db352138bace478e6f547718dc12976 Mon Sep 17 00:00:00 2001 From: Gobe Hobona Date: Wed, 11 Oct 2023 16:31:22 +0100 Subject: [PATCH] interpolation methods --- incubation/interpolation/interpolation.csv | 7 ++ incubation/interpolation/interpolation.ttl | 65 ++++++++++ incubation/interpolation/process.py | 132 +++++++++++++++++++++ 3 files changed, 204 insertions(+) create mode 100644 incubation/interpolation/interpolation.csv create mode 100644 incubation/interpolation/interpolation.ttl create mode 100644 incubation/interpolation/process.py diff --git a/incubation/interpolation/interpolation.csv b/incubation/interpolation/interpolation.csv new file mode 100644 index 00000000..2b61671c --- /dev/null +++ b/incubation/interpolation/interpolation.csv @@ -0,0 +1,7 @@ +linear,,linear interpolation,linear interpolation method,https://portal.ogc.org/files/12-049 +quadratic,,quadratic interpolation,quadratic interpolation method,https://portal.ogc.org/files/12-049 +nearest-neighbor,,nearest-neighbor interpolation,nearest-neighbor interpolation method,https://portal.ogc.org/files/12-049 +cubic,,cubic interpolation,cubic interpolation method,https://portal.ogc.org/files/12-049 +bicubic,,bicubic interpolation,bicubic interpolation method,https://portal.ogc.org/files/?artifact_id=22364 +lost-area,,lost area interpolation,lost area interpolation method,https://portal.ogc.org/files/?artifact_id=22364 +barycentric,,barycentric interpolation,barycentric interpolation method,https://portal.ogc.org/files/?artifact_id=22364 \ No newline at end of file diff --git a/incubation/interpolation/interpolation.ttl b/incubation/interpolation/interpolation.ttl new file mode 100644 index 00000000..59ca69c6 --- /dev/null +++ b/incubation/interpolation/interpolation.ttl @@ -0,0 +1,65 @@ + . + . + . + "bicubic interpolation" . + . + "2023-10-11T16:24:36.243418"^^ . + "nearest-neighbor interpolation method" . + . + . + "2023-10-11T16:24:36.243091"^^ . + "2023-10-11T16:24:36.243982"^^ . + . + . + . + . + "nearest-neighbor interpolation" . + . + . + . + . + "cubic interpolation" . + . + "cubic interpolation" . + "linear interpolation" . + "lost area interpolation method" . + "2023-10-11T16:24:36.243553"^^ . + . + . + . + "linear interpolation" . + "Interpolation Method Register" . + "cubic interpolation method" . + "2023-10-11T16:24:36.243276"^^ . + "barycentric interpolation method" . + "linear interpolation method" . + . + "bicubic interpolation" . + . + "quadratic interpolation" . + "Interpolation Method Register" . + . + . + . + "Interpolation Method Register" . + "Interpolation Method Register" . + . + "quadratic interpolation" . + . + . + "bicubic interpolation method" . + "quadratic interpolation method" . + . + . + . + "nearest-neighbor interpolation" . + "2023-10-11T16:24:36.243705"^^ . + "lost area interpolation" . + "lost area interpolation" . + "barycentric interpolation" . + . + "barycentric interpolation" . + "2023-10-11T16:24:36.243843"^^ . + . + . + . diff --git a/incubation/interpolation/process.py b/incubation/interpolation/process.py new file mode 100644 index 00000000..22132b77 --- /dev/null +++ b/incubation/interpolation/process.py @@ -0,0 +1,132 @@ +# 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 + + +csvFileName = "interpolation.csv" +ttlOutputFileName = "interpolation.ttl" +conceptNamespace = "http://www.opengis.net/def/interpolation/OGC/1" +schemeURI = "http://www.opengis.net/def/interpolation/OGC/1" +collectionAndSchemeLabel = "Interpolation Method Register" +collectionAndSchemeDefinition = "This is a register of Interpolation Methods used by OGC Standards. " + +# 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[3]) + )) + 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.inScheme, + rdflib.URIRef(schemeURI) + )) + + g.add(( + rdflib.URIRef(collectionURI), + SKOS.member, + rdflib.URIRef(conceptURI) + )) + + + +fout = open(ttlOutputFileName,'w') +fout.write(g.serialize(format="nt")) +fout.close()