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

_mapview hack #105

Closed
NicoLaval opened this issue Sep 21, 2024 · 5 comments
Closed

_mapview hack #105

NicoLaval opened this issue Sep 21, 2024 · 5 comments

Comments

@NicoLaval
Copy link

Select *_mapview give petrimaps link in query result table.
Link contains query param, which is filling by the object, not a query.

@Qup42
Copy link
Member

Qup42 commented Sep 22, 2024

If variables end with the suffix _query or _mapview all result entries in that column are links to a new query or the map view. The value of that column is used for the new queries. This is not a substitute for the Map view discussed in #102. Does this clear up the question?

@NicoLaval
Copy link
Author

Sure, I understood it's 2 different things.

But what surprises me is the link built for ?XX_mapview results: PETRIMAPS_URL/?query=wkt_literal&mode=objects&backend=...

Petrimaps is not able to handle this "query", which is not a query but a wkt string object.

Taking your instance, with OSM sample, try this query:

PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX osmkey: <https://www.openstreetmap.org/wiki/Key:>
PREFIX ogc: <http://www.opengis.net/rdf#>
PREFIX osmrel: <https://www.openstreetmap.org/relation/>
SELECT ?osm_id ?hasgeometry_mapview WHERE {
  osmrel:1960198 ogc:sfContains ?osm_id .
  ?osm_id geo:hasGeometry/geo:asWKT ?hasgeometry_mapview .
  ?osm_id osmkey:building ?building .
}

Click a mapview link in a result row, petrimaps will throw an error.

Maybe mode=objects would have to handle this case in petrimaps?

Just to test, I tried a successful trick replacing PETRIMAPS_URL/?query=wkt_literal&mode=objects&backend=... by:

const query = `SELECT ?geo WHERE {BIND(${wktLiteral} as ?geo)}`;
return `PETRIMAPS_URL/?query=${encodeURI(query)}&mode=objects&backend=...`;

And built link is functional in petrimaps (example)

@NicoLaval
Copy link
Author

My hacky test is not really clean. We don't need to call API in petrimaps if we already have the object to display.

What do you think about:

  • building a link URL with an object param instead of query, filling it with the wkt literal
  • handling this case in petrimaps: if query param is missing, don't call API, if object is present, add directly this one

If you agree, I can try to provide pull requests on qlever-ui & petrimaps

@Qup42
Copy link
Member

Qup42 commented Sep 24, 2024

This should now longer be required as of #106 and 9f39f84?

@NicoLaval
Copy link
Author

Thanks @Qup42.
I close the issue.

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

No branches or pull requests

2 participants