Skip to content

Commit

Permalink
Merge pull request #252 from opengeospatial/20231011_interpolation
Browse files Browse the repository at this point in the history
interpolation methods
  • Loading branch information
ghobona authored Oct 11, 2023
2 parents 8cd3c7d + 808ba15 commit 14b1fc3
Show file tree
Hide file tree
Showing 3 changed files with 204 additions and 0 deletions.
7 changes: 7 additions & 0 deletions incubation/interpolation/interpolation.csv
Original file line number Diff line number Diff line change
@@ -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
65 changes: 65 additions & 0 deletions incubation/interpolation/interpolation.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<http://www.opengis.net/def/interpolation/OGC/1/> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2004/02/skos/core#Collection> .
<http://www.opengis.net/def/interpolation/OGC/1/> <http://www.w3.org/2004/02/skos/core#member> <http://www.opengis.net/def/interpolation/OGC/1/linear> .
<http://www.opengis.net/def/interpolation/OGC/1/lost-area> <http://www.w3.org/2004/02/skos/core#inScheme> <http://www.opengis.net/def/interpolation/OGC/1> .
<http://www.opengis.net/def/interpolation/OGC/1/bicubic> <http://www.w3.org/2004/02/skos/core#prefLabel> "bicubic interpolation" .
<http://www.opengis.net/def/interpolation/OGC/1/nearest-neighbor> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2004/02/skos/core#Concept> .
<http://www.opengis.net/def/interpolation/OGC/1/nearest-neighbor> <http://purl.org/dc/terms/created> "2023-10-11T16:24:36.243418"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
<http://www.opengis.net/def/interpolation/OGC/1/nearest-neighbor> <http://www.w3.org/2004/02/skos/core#definition> "nearest-neighbor interpolation method" .
<http://www.opengis.net/def/interpolation/OGC/1/> <http://www.w3.org/2004/02/skos/core#member> <http://www.opengis.net/def/interpolation/OGC/1/cubic> .
<http://www.opengis.net/def/interpolation/OGC/1/> <http://www.w3.org/2004/02/skos/core#member> <http://www.opengis.net/def/interpolation/OGC/1/quadratic> .
<http://www.opengis.net/def/interpolation/OGC/1/linear> <http://purl.org/dc/terms/created> "2023-10-11T16:24:36.243091"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
<http://www.opengis.net/def/interpolation/OGC/1/barycentric> <http://purl.org/dc/terms/created> "2023-10-11T16:24:36.243982"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
<http://www.opengis.net/def/interpolation/OGC/1/linear> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2004/02/skos/core#Concept> .
<http://www.opengis.net/def/interpolation/OGC/1/bicubic> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2004/02/skos/core#Concept> .
<http://www.opengis.net/def/interpolation/OGC/1/quadratic> <http://www.w3.org/2004/02/skos/core#inScheme> <http://www.opengis.net/def/interpolation/OGC/1> .
<http://www.opengis.net/def/interpolation/OGC/1/cubic> <http://www.w3.org/2000/01/rdf-schema#seeAlso> <https://portal.ogc.org/files/12-049> .
<http://www.opengis.net/def/interpolation/OGC/1/nearest-neighbor> <http://www.w3.org/2000/01/rdf-schema#label> "nearest-neighbor interpolation" .
<http://www.opengis.net/def/interpolation/OGC/1/> <http://www.w3.org/2004/02/skos/core#member> <http://www.opengis.net/def/interpolation/OGC/1/bicubic> .
<http://www.opengis.net/def/interpolation/OGC/1/> <http://www.w3.org/2004/02/skos/core#member> <http://www.opengis.net/def/interpolation/OGC/1/lost-area> .
<http://www.opengis.net/def/interpolation/OGC/1/barycentric> <http://www.w3.org/2004/02/skos/core#inScheme> <http://www.opengis.net/def/interpolation/OGC/1> .
<http://www.opengis.net/def/interpolation/OGC/1/quadratic> <http://www.w3.org/2000/01/rdf-schema#seeAlso> <https://portal.ogc.org/files/12-049> .
<http://www.opengis.net/def/interpolation/OGC/1/cubic> <http://www.w3.org/2000/01/rdf-schema#label> "cubic interpolation" .
<http://www.opengis.net/def/interpolation/OGC/1/> <http://www.w3.org/2004/02/skos/core#member> <http://www.opengis.net/def/interpolation/OGC/1/barycentric> .
<http://www.opengis.net/def/interpolation/OGC/1/cubic> <http://www.w3.org/2004/02/skos/core#prefLabel> "cubic interpolation" .
<http://www.opengis.net/def/interpolation/OGC/1/linear> <http://www.w3.org/2000/01/rdf-schema#label> "linear interpolation" .
<http://www.opengis.net/def/interpolation/OGC/1/lost-area> <http://www.w3.org/2004/02/skos/core#definition> "lost area interpolation method" .
<http://www.opengis.net/def/interpolation/OGC/1/cubic> <http://purl.org/dc/terms/created> "2023-10-11T16:24:36.243553"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
<http://www.opengis.net/def/interpolation/OGC/1/lost-area> <http://www.w3.org/2000/01/rdf-schema#seeAlso> <https://portal.ogc.org/files/?artifact_id=22364> .
<http://www.opengis.net/def/interpolation/OGC/1/> <http://www.w3.org/2004/02/skos/core#member> <http://www.opengis.net/def/interpolation/OGC/1/nearest-neighbor> .
<http://www.opengis.net/def/interpolation/OGC/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2004/02/skos/core#ConceptScheme> .
<http://www.opengis.net/def/interpolation/OGC/1/linear> <http://www.w3.org/2004/02/skos/core#prefLabel> "linear interpolation" .
<http://www.opengis.net/def/interpolation/OGC/1> <http://www.w3.org/2000/01/rdf-schema#label> "Interpolation Method Register" .
<http://www.opengis.net/def/interpolation/OGC/1/cubic> <http://www.w3.org/2004/02/skos/core#definition> "cubic interpolation method" .
<http://www.opengis.net/def/interpolation/OGC/1/quadratic> <http://purl.org/dc/terms/created> "2023-10-11T16:24:36.243276"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
<http://www.opengis.net/def/interpolation/OGC/1/barycentric> <http://www.w3.org/2004/02/skos/core#definition> "barycentric interpolation method" .
<http://www.opengis.net/def/interpolation/OGC/1/linear> <http://www.w3.org/2004/02/skos/core#definition> "linear interpolation method" .
<http://www.opengis.net/def/interpolation/OGC/1/bicubic> <http://www.w3.org/2000/01/rdf-schema#seeAlso> <https://portal.ogc.org/files/?artifact_id=22364> .
<http://www.opengis.net/def/interpolation/OGC/1/bicubic> <http://www.w3.org/2000/01/rdf-schema#label> "bicubic interpolation" .
<http://www.opengis.net/def/interpolation/OGC/1/nearest-neighbor> <http://www.w3.org/2004/02/skos/core#inScheme> <http://www.opengis.net/def/interpolation/OGC/1> .
<http://www.opengis.net/def/interpolation/OGC/1/quadratic> <http://www.w3.org/2000/01/rdf-schema#label> "quadratic interpolation" .
<http://www.opengis.net/def/interpolation/OGC/1> <http://www.w3.org/2004/02/skos/core#prefLabel> "Interpolation Method Register" .
<http://www.opengis.net/def/interpolation/OGC/1/lost-area> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2004/02/skos/core#Concept> .
<http://www.opengis.net/def/interpolation/OGC/1/cubic> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2004/02/skos/core#Concept> .
<http://www.opengis.net/def/interpolation/OGC/1/linear> <http://www.w3.org/2004/02/skos/core#inScheme> <http://www.opengis.net/def/interpolation/OGC/1> .
<http://www.opengis.net/def/interpolation/OGC/1/> <http://www.w3.org/2000/01/rdf-schema#label> "Interpolation Method Register" .
<http://www.opengis.net/def/interpolation/OGC/1/> <http://www.w3.org/2004/02/skos/core#prefLabel> "Interpolation Method Register" .
<http://www.opengis.net/def/interpolation/OGC/1/nearest-neighbor> <http://www.w3.org/2000/01/rdf-schema#seeAlso> <https://portal.ogc.org/files/12-049> .
<http://www.opengis.net/def/interpolation/OGC/1/quadratic> <http://www.w3.org/2004/02/skos/core#prefLabel> "quadratic interpolation" .
<http://www.opengis.net/def/interpolation/OGC/1/cubic> <http://www.w3.org/2004/02/skos/core#inScheme> <http://www.opengis.net/def/interpolation/OGC/1> .
<http://www.opengis.net/def/interpolation/OGC/1/barycentric> <http://www.w3.org/2000/01/rdf-schema#seeAlso> <https://portal.ogc.org/files/?artifact_id=22364> .
<http://www.opengis.net/def/interpolation/OGC/1/bicubic> <http://www.w3.org/2004/02/skos/core#definition> "bicubic interpolation method" .
<http://www.opengis.net/def/interpolation/OGC/1/quadratic> <http://www.w3.org/2004/02/skos/core#definition> "quadratic interpolation method" .
<http://www.opengis.net/def/interpolation/OGC/1/quadratic> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2004/02/skos/core#Concept> .
<http://www.opengis.net/def/interpolation/OGC/1/bicubic> <http://www.w3.org/2004/02/skos/core#inScheme> <http://www.opengis.net/def/interpolation/OGC/1> .
<http://www.opengis.net/def/interpolation/OGC/1/linear> <http://www.w3.org/2000/01/rdf-schema#seeAlso> <https://portal.ogc.org/files/12-049> .
<http://www.opengis.net/def/interpolation/OGC/1/nearest-neighbor> <http://www.w3.org/2004/02/skos/core#prefLabel> "nearest-neighbor interpolation" .
<http://www.opengis.net/def/interpolation/OGC/1/bicubic> <http://purl.org/dc/terms/created> "2023-10-11T16:24:36.243705"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
<http://www.opengis.net/def/interpolation/OGC/1/lost-area> <http://www.w3.org/2000/01/rdf-schema#label> "lost area interpolation" .
<http://www.opengis.net/def/interpolation/OGC/1/lost-area> <http://www.w3.org/2004/02/skos/core#prefLabel> "lost area interpolation" .
<http://www.opengis.net/def/interpolation/OGC/1/barycentric> <http://www.w3.org/2000/01/rdf-schema#label> "barycentric interpolation" .
<http://www.opengis.net/def/interpolation/OGC/1/barycentric> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2004/02/skos/core#Concept> .
<http://www.opengis.net/def/interpolation/OGC/1/barycentric> <http://www.w3.org/2004/02/skos/core#prefLabel> "barycentric interpolation" .
<http://www.opengis.net/def/interpolation/OGC/1/lost-area> <http://purl.org/dc/terms/created> "2023-10-11T16:24:36.243843"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
<http://www.opengis.net/def/interpolation/OGC/1> <http://www.opengis.net/def/metamodel/ogc-na/collectionView> <http://www.opengis.net/def/interpolation/OGC/1/> .
<http://www.opengis.net/def/interpolation/OGC/1/> <http://www.w3.org/2004/02/skos/core#inScheme> <http://www.opengis.net/def/interpolation/OGC/1> .
<http://www.opengis.net/def/register/> <http://www.w3.org/2004/02/skos/core#member> <http://www.opengis.net/def/interpolation/OGC/1/> .
132 changes: 132 additions & 0 deletions incubation/interpolation/process.py
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit 14b1fc3

Please sign in to comment.