raytheonbbn/parliament

Help Requested: Query not yielding appropriate target

Closed this issue · 2 comments

@IanEmmons I'm hoping you can help me complete my mission. I need accurate answers to the following query. I've been using parliament, but I cannot seem to get the required answer, no matter what datasets I find and load. The query seems simple enough:

SELECT DISTINCT ?target, ?restingPlace WHERE {
	?target a foaf:Person ;
    	business:hasAddress ?restingPlace .
    ?buffer a spatial:Buffer ;
        spatial:distance "0.002"^^xsd:double;
        spatial:extent landmarks:ClintsOffice .
    ?restingPlace a bbn:Office ;
        georss:where ?point ;"
        georss:where [
            rcc:part ?buffer
        ] .

Do you have any ideas? I feel like such a fool.

This was a source of confusion because Parliament's GeoSPARQL implementation predates the finalization of the GeoSPARQL standard. You are using constructs from early versions of the standard. But before we get to that, a minor point: You need to remove the comma after ?target in the select line.

Your data should be encoded as follows:

@prefix geo: <http://www.opengis.net/ont/geosparql#> .
@prefix sf: <http://www.opengis.net/ont/sf#> .

:JoeSmith a foaf:Person ;
	business:hasAddress :JoeSmithOffice

:JoeSmithOffice a bbn:Office ;
	geo:hasGeometry :JoeSmithOfficeLocation .

# Order is important: point(longitude latitude)
:JoeSmithOfficeLocation a sf:Point ;
	geo:asWKT "point(30.6 -29.05)"^^geo:wktLiteral .

And then your query will look like this:

prefix geo: <http://www.opengis.net/ont/geosparql#>
prefix geof: <http://www.opengis.net/def/geosparql/function/>
prefix units: <http://www.opengis.net/def/uom/OGC/1.0/>
select distinct ?target ?restingPlace where {
	?target a foaf:Person ;
		business:hasAddress ?restingPlace .
	?restingPlace a bbn:Office ;
		geo:hasGeometry/geo:asWKT ?wkt .
	landmarks:ClintsOffice a bbn:Office ;
		geo:hasGeometry/geo:asWKT ?landmarkWkt .
	# Important: units:metre uses the British spelling
	filter (geof:distance(?wkt, ?landmarkWkt, units:metre) < 200)
}

(Disclaimer: I haven't actually run this example, so there may be a syntax error somewhere.)

Hope that helps.

Closing due to no recent activity.