Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieve data from linkedgeodata.org

Tags:

sparql

I am trying to retrieve data from linkedgeodata.org/sparql

Prefix lgdo: <http://linkedgeodata.org/ontology/>
Select *
From <http://linkedgeodata.org>
{
    ?s a lgdo:Restaurant .
    ?s rdfs:label ?l .
    ?s geo:geometry ?g .
    Filter(bif:st_intersects (?g, bif:st_point (48.143889, 17.109722), 5.1)) .
}

But response is empty. I want to retrieve restaurants in Bratislava....5km from coordinates.

I used similar sparql code like in the example, I changed only class to restaurant and coordinates of the city, so I dont know where I am doing mistake.(http://linkedgeodata.org/OnlineAccess/SparqlEndpoints?v=bpg)

Prefix lgdo: <http://linkedgeodata.org/ontology/>
Select *
From <http://linkedgeodata.org>
{
    ?s a lgdo:Amenity .
    ?s rdfs:label ?l .
    ?s geo:geometry ?g .
    Filter(bif:st_intersects (?g, bif:st_point (12.372966, 51.310228), 0.1)) .
}
like image 458
bugisoft Avatar asked Oct 24 '22 11:10

bugisoft


1 Answers

You can see all types of things that fall within those coordinates by running the following query:

Prefix lgdo: <http://linkedgeodata.org/ontology/>
Select ?type, count(?s)
From <http://linkedgeodata.org>
{
    ?s a ?type .
    ?s rdfs:label ?l .
    ?s geo:geometry ?g .
Filter(bif:st_intersects (?g, bif:st_point (48.143889, 17.109722), 5.1)) .
} GROUP BY ?type

This query, using GROUP BY and COUNT, gives you counts for all different types. As you can see there are no restaurants falling in geographical area. Your query is not wrong, the database does not contain any restaurants for the given coordinates.

like image 105
Manuel Salvadores Avatar answered Nov 24 '22 00:11

Manuel Salvadores