Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libspatialjoin integretion #1742

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

patrickbr
Copy link
Member

@patrickbr patrickbr commented Jan 31, 2025

This PR aims to add our libspatialjoin to the spatialjoin SERVICE. Currently highly experimental and largely untested, but should work.

Supported geometry types are POINT, MULTIPOINT, LINESTRING, MULTILINESTRING, POLYGON, MULTIPOLYGON. GEOMETRYCOLLECTIONS are not supported atm, but this is mainly because I have to first outfactor the parsing code into its own function in libspatialjoin to re-use it here.

For example, the following query dynamically calculates a self-join on <touches> on all geometries contained in Liechtenstein. To do this, set the qlss:algorithm to <libspatialjoin> and set the qlss:joinType to <touches>. Supported join types are <intersects>, <contains>,<covers>, <crosses>, <touches>, <equals> and <overlaps>.

PREFIX osmkey: <https://www.openstreetmap.org/wiki/Key:>
PREFIX osmrel: <https://www.openstreetmap.org/relation/>
PREFIX ogc: <http://www.opengis.net/rdf#>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX qlss: <https://qlever.cs.uni-freiburg.de/spatialSearch/>

SELECT ?a ?b
WHERE {
  osmrel:1155955 ogc:sfContains ?a .
  ?a geo:hasGeometry/geo:asWKT ?a_location .
  SERVICE qlss: {
    _:config qlss:algorithm <libspatialjoin> ;
             qlss:left ?a_location ;
             qlss:right ?b_location ;
             qlss:payload ?b ;
             qlss:joinType <touches> .
    {
      osmrel:1155955 ogc:sfContains ?b .
      ?b geo:hasGeometry/geo:asWKT ?b_location .
    }
  }
}

Running time to generate the 59,982 rows of the query above (full self-join on everything in Liechtenstein):

2025-01-31 12:34:50.778 - INFO: Done processing query and sending result, total time was 2,155 ms

@sparql-conformance
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant