Manoj Deshpande
Manoj Deshpande

Reputation: 311

Will RDFLIB Python supports Geosparql queries?

I am trying to execute Geosparql Queries using RDFLIB Python...But I am getting empty results....Is RDFLIB Python supports Geosparql queries ? Please suggest me regarding this. Below is my code to store tripples and query for execution.

from rdflib import Graph, Literal, URIRef, Namespace, RDFS
from rdflib.plugins.stores import sparqlstore


g1 = Graph()
g1.bind("geo", GEO)
x = URIRef("x:")

example = Namespace("http://example.org/#")

g1.add((x, GEO["asWKT"], Literal("LINESTRING (0 0, 0 10)", datatype=GEO.wktLiteral)))
g1.serialize(format="turtle").decode("utf-8")

qres = g1.query(
    """SELECT *
       WHERE {
          ?s ?p ?o FILTER (geo:sfEquals(?o, "LINESTRING (0 0, 0 5, 0 10)"^^geo:wktLiteral)) .
       }""")

print(g1.serialize(format="turtle").decode("utf-8"))

for row in qres:
    print(row)

Above code always returns me empty results.

Upvotes: 2

Views: 315

Answers (2)

There
There

Reputation: 516

How about https://github.com/RDFLib/geosparql-dggs?

From the docs:

An implementation of GeoSPARQL's Simple Features SPARQL functions for AusPIX Discreet Global Grid System (DGGS) geometries, as per GeoSPARQL

Upvotes: 0

Nicholas Car
Nicholas Car

Reputation: 1251

Sorry no, RDFLlib does not have an in-built GeoSPARQL extension, just SPARQL1.1.

We - RDFlib developers - would love to have someone contribute GeoSPARQL handling!

Upvotes: 3

Related Questions