Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GEO namespace missing from 6.0.0 #1371

Closed
timcroydon opened this issue Jul 22, 2021 · 5 comments · Fixed by #1622
Closed

GEO namespace missing from 6.0.0 #1371

timcroydon opened this issue Jul 22, 2021 · 5 comments · Fixed by #1622

Comments

@timcroydon
Copy link

timcroydon commented Jul 22, 2021

I noticed the GEO namespace (http://www.opengis.net/ont/geosparql#) that was present in earlier commits is no longer available in 6.0.0.

I know it's not part of SPARQL 1.1 itself, but are there any plans to reintroduce it, or is best to reimplement it myself locally as a ClosedNamespace?

@edmondchuc
Copy link
Contributor

Hi @timcroydon, looks like the big pull request #1074 to migrate ClosedNamespace to DefinedNamespace accidentally excluded the GEO namespace.

The new DefinedNamespace namespaces are now generated using this tool https://github.com/hsolbrig/definednamespace. If you want, feel free to give it a go and generate it for GEO and make a PR, otherwise I can give it a go when I have some time.

Alternatively, you can use the Namespace, ClosedNamespace, or DefinedNamespace classes and implement it yourself in your application code.

@timcroydon
Copy link
Author

Thank you. I wasn't sure if its removal was an oversight or intentional.

I tried the tool suggested but I haven't immediately been able to get it running - I get a load of parsing errors like the following (using SKOS as an example):

owl:Ontology rdf:about="http://www.w3.org/2004/02/skos/core" does not look like a valid URI, trying to serialize this will break.

Not had time to investigate but will report back if I get time to try it properly.

In the meantime, if anyone needs a quick workaround, creating the following definition works fine:

from rdflib import URIRef
from rdflib.namespace import ClosedNamespace

# GEO namespace was removed in RDFLib 6.0.0 so recreate it ourselves here
GEO = ClosedNamespace(
    uri=URIRef("http://www.opengis.net/ont/geosparql#"),
    terms=[
        "Feature",
        "Geometry",
        "SpatialObject",
        "asGML",
        "asWKT",
        "coordinateDimension",
        "defaultGeometry",
        "dimension",
        "ehContains",
        "ehCoveredBy",
        "ehCovers",
        "ehDisjoint",
        "ehEquals",
        "ehInside",
        "ehMeet",
        "ehOverlap",
        "gmlLiteral",
        "hasGeometry",
        "hasSerialization",
        "isEmpty",
        "isSimple",
        "rcc8dc",
        "rcc8ec",
        "rcc8eq",
        "rcc8ntpp",
        "rcc8ntppi",
        "rcc8po",
        "rcc8tpp",
        "rcc8tppi",
        "sfContains",
        "sfCrosses",
        "sfDisjoint",
        "sfEquals",
        "sfIntersects",
        "sfOverlaps",
        "sfTouches",
        "sfWithin",
        "spatialDimension",
        "wktLiteral",
    ],
)

@niklasl
Copy link
Member

niklasl commented Jul 23, 2021

The parser error is since RDFLin 6.0 seems to have changed the default input format to Graph.parse from application/rdf+xml to text/turtle. While I know it is the modern way and more ideal (although one might suggest TriG is even more modern and ideal), I think it'll break a lot of existing code out there that just throws RDF/XML at the parser...

@timcroydon
Copy link
Author

Sorry, should have been clearer - those errors were when I tried running the definednamespace tool (which is still on RDFLib 5.0.0) rather than when I try and use the output it generates. I'm almost certainly running it wrong though - will try again later.

@ghost
Copy link

ghost commented Dec 28, 2021

those errors were when I tried running the definednamespace tool (which is still on RDFLib 5.0.0) rather than when I try and use the output it generates. I'm almost certainly running it wrong though - will try again later.

No, you're good. The definednamespace tool is slowly drifting out of scope - I had to put in a bit of effort to get it to work at all in an RDFLib 5.0.0 venv (but was eventually successful). I raised restorative PR #1622 in case the omission was inadvertent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants