Question

I am very new with GeoSPARQL. I downloaded the ontology, imported it in Protégé and created classes and individual following Appendix B in GeoSPARQL user guide (PDF).

  1. When using Parliament to ask for WKT, the values are being duplicated which is not happening in Protégé:

    SELECT ?geom 
    WHERE {
        ?x my:exactGeometry ?xGeom .
        ?xGeom geo:asWKT ?geom .
    }
    

    The result is showing every value 2 times.

  2. I am not getting any results when executing geof:sf functions.

Was it helpful?

Solution

I haven't used GeoSPARQL, so I can't address much of that, but, to the first point, a query like

SELECT ?geom WHERE {
    ?x my:exactGeometry ?xGeom .
    ?xGeom geo:asWKT ?geom .
}

will, by default, return one value for ?geom for each way that the graph pattern can match. E.g., if the graph contains

_:x1 my:exactGeometry _:xGeom1 .
_:xGeom1 geo:asWKT _:geom .
_:x2 my:exactGeometry _:xGeom2 .
_:xGeom2 geo:asWKT _:geom .

so that there are two patterns that match (one with ?x = _:x1 and ?xGeom = _:xGeom1, and the other with ?x = _:x2 and ?xGeom = _:xGeom2), you'll see _:geom in the results twice. You can remove these kinds of duplicates using distinct in your query:

SELECT DISTINCT ?geom WHERE {
    ?x my:exactGeometry ?xGeom .
    ?xGeom geo:asWKT ?geom .
}

To the second point, as I mentioned, I am not GeoSPARQL user, but I suspect that the specification merely defines what these extension functions should do. Unless you've downloaded some code (e.g., a Protégé plugin), I don't see where the implementation of these functions would have been provided. SPARQL extensions must be provided by the SPARQL endpoint implementation; they aren't defined in the ontologies that you download or the data over which you query. The Wikipedia article on GeoSPARQL has an Implementations section which lists three implementations that support GeoSPARQL. One of these is Parliament, which you mentioned, but you didn't mention whether the functions aren't working in Protégé or in Parliament.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top