PREFIX noa: PREFIX rdf: PREFIX strdf: PREFIX xsd: PREFIX gag: INSERT { ?h noa:isDiscarded "1"^^xsd:int . ?valid rdf:type noa:Hotspot ; noa:hasConfidence ?conf ; noa:hasGeometry ?dif ; gag:hasMunicipality ?muni ; noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime ; noa:isDerivedFromSensor "SENSOR"^^xsd:string ; noa:hasConfirmation noa:unknown ; noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string ; noa:isProducedBy noa:noa ; noa:isDerivedFromSatellite "SAT"^^xsd:string ; noa:refinedBy noa:coastlineRefinement ; noa:refinedBy ?refined . } WHERE { SELECT ?h (strdf:intersection(?hGeo, strdf:union(?cGeo)) AS ?dif) (URI(CONCAT(STR(?h),"/refined")) AS ?valid) ?conf ?muni WHERE { ?h noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime; noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string ; noa:isDerivedFromSensor "SENSOR"^^xsd:string ; noa:hasGeometry ?hGeo ; gag:hasMunicipality ?muni ; noa:hasConfidence ?conf . OPTIONAL{?h noa:refinedBy ?r. FILTER(?r=noa:coastlineRefinement)}. FILTER(!bound(?r)). ?c rdf:type gag:GeometryPart ; gag:hasGeometry ?cGeo . FILTER(strdf:mbbIntersects(?hGeo, ?cGeo)) . OPTIONAL { ?h noa:refinedBy ?refined } . } GROUP BY ?h ?hGeo ?conf ?muni HAVING strdf:overlaps(?hGeo, strdf:union(?cGeo)) }