Responses interleaved ...
Le dim. 1 nov. 2020 à 20:49, Greg <[email protected]> a écrit : > Hi Jean-Marc, > > You refer to a remote endpoint for your example data and don't indicate > any data loading into the TDB dataset. They were loaded since a long time. As mentioned, I just checked by this query that they are here on my local server with this query: PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> SELECT * WHERE { ?S geo:lat ?LAT . ?S geo:long ?LON . } LIMIT 100 ... The GeoSPARQL functionality needs to be setup in the application or > Fuseki server where the dataset is located." In fact I developed over the years an equivalent of Fuseki with Scala, the Jena API and PlayFramework, although that was not planned at the beginning. The line > `TDBFactory.createDataset` only creates an empty in-memory dataset. > Either of these may be why you are receiving no results. > > I'm not sure how you've got the impression that no configuration is > required when there is a section titled `SPARQL Query Configuration` > which states "Using the library for SPARQL querying requires one line of > code." followed by a series of configuration examples. > My setup now as : org.apache.jena.geosparql.configuration.GeoSPARQLConfig.setupMemoryIndex() org.apache.jena.geosparql.configuration.GeoSPARQLConfig.setupSpatialIndex(dataset) The log now says: 07:34:09.817 [play-dev-mode-akka.actor.default-dispatcher-44] INFO o.a.j.g.c.GeoSPARQLOperations - Find Mode SRS - Started 07:34:40.170 [play-dev-mode-akka.actor.default-dispatcher-44] INFO o.a.j.g.c.GeoSPARQLOperations - Find Mode SRS - Completed 07:34:40.170 [play-dev-mode-akka.actor.default-dispatcher-44] INFO o.a.j.geosparql.spatial.SpatialIndex - Building Spatial Index - Started 07:34:40.219 [play-dev-mode-akka.actor.default-dispatcher-44] INFO o.a.j.geosparql.spatial.SpatialIndex - Geo predicate statements found. 07:34:40.238 [play-dev-mode-akka.actor.default-dispatcher-44] ERROR jena - !!!!! createDatabase: configureLuceneIndex: Exception: http://www.w3.org/2003/01/geo/wgs84_pos#long 07:34:40.238 [play-dev-mode-akka.actor.default-dispatcher-44] ERROR jena - Exception class org.apache.jena.shared.PropertyNotFoundException 07:34:40.238 [play-dev-mode-akka.actor.default-dispatcher-44] ERROR jena - Exception org.apache.jena.shared.PropertyNotFoundException: http://www.w3.org/2003/01/geo/wgs84_pos#long NOTE: I have disconnected the Lucene indexing as I fear a detrimental interference . The Spatial Index section in the documentation may assist with the error > you are now encountering. I've added an additional note to the > `jena-spatial` section in documentation to make the solution clearer in > the future. It should only require invoking > `GeoSPARQLConfig.setupSpatialIndex(dataset);` or similar on the target > dataset.|| > > All the best, > > Greg > > On 29/10/2020 09:23, Jean-Marc Vanel wrote: > > Hi Greg > > > > The data are available at this SPARQL endpoint : > > http://semantic-forms.cc:1952/sparql2 > > the queries are given in this thread. > > > > BUT, I reread the documentation, and added > > > org.apache.jena.geosparql.configuration.GeoSPARQLConfig.setupMemoryIndex() > > before calling TDBFactory.createDataset() > > > > And now , with the same very simple query with spatial:withinBox() , it > > says : > > org.apache.jena.sparql.expr.ExprEvalException: Dataset Context does not > > contain SpatialIndex. > > > > From the documentation, it is not clear what is the minimal, or optimal, > > configuration. A casual reading even gives the impression that no > > configuration is necessary. > > > > Jean-Marc Vanel > > < > http://semantic-forms.cc:9112/display?displayuri=http://jmvanel.free.fr/jmv.rdf%23me > > > > +33 > > (0)6 89 16 29 52 > > > > > > Le mer. 28 oct. 2020 à 23:29, Greg <[email protected]> a écrit : > > > >> Hi Jean-Marc, > >> > >> If you have an sample of data then I can take a look into this further. > >> > >> Thanks, > >> > >> Greg > >> > >> On 26/10/2020 16:56, Jean-Marc Vanel wrote: > >>> Indeed this helps, but it's still not clear weather and how I have to > >>> prepare the database for GeoSparlql queries. > >>> > >>> I changed my query according to Greg's advice: > >>> PREFIX spatial: <http://jena.apache.org/spatial#> > >>> SELECT * WHERE { > >>> ?feature spatial:withinBox( 43.0 0.0 48.0 10.0 100 ) > >>> } LIMIT 100 > >>> but no results. > >>> Of course I checked that I have many triples with geo: coordinates > within > >>> that rectangle : > >>> PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> > >>> SELECT * WHERE { > >>> ?S geo:lat ?LAT . > >>> ?S geo:long ?LON . > >>> } LIMIT 100 > >>> > >>> Regarding simple export from triples with geo: coordinates to GML or > >>> GeoJson, I'll write some code that I'll share. > >>> > >>> Jean-Marc Vanel > >>> < > >> > http://semantic-forms.cc:9112/display?displayuri=http://jmvanel.free.fr/jmv.rdf%23me > >>> +33 > >>> (0)6 89 16 29 52 > >>> > >>> > >>> Le lun. 26 oct. 2020 à 16:38, Greg Albiston <[email protected]> a > >> écrit : > >>>> Hi Jena-Marc, > >>>> > >>>> The namespace <http://geovocab.org/spatial#> is for NeoGeo Spatial > >>>> ontology, which has similarities to GeoSPARQL specification but is not > >>>> fully compliant. > >>>> > >>>> The Apache Jena spatial property functions use > >>>> <http://jena.apache.org/spatial#>. These are additional functions > that > >>>> extend the GeoSPARQL standard. > >>>> > >>>> So you are likely getting no result as the "spatial:withinBox" > function > >>>> in the query is undefined. > >>>> > >>>> Regarding your other question about GML and GeoJSON documents. The > >>>> GeoSPARQL standard doesn't cover serialisation from or to geospatial > >>>> document formats into the GeoSPARQL "Feature/Geometry/GeometryLiteral" > >>>> structure. This is likely because it is expected that most use cases > >>>> would stay in RDF format once setup. From my experience the GML > >>>> standards are also unbelievably convoluted to fully support. > >>>> > >>>> It may be straight forward to convert a list of points to a minimum > GML > >>>> document that QGIS accepts. > >>>> > >>>> The "convert" functions are to harmonise a dataset to a single SRS and > >>>> datatype to reduce overhead and confusion from switching between > >>>> different formats when querying the data. Or to switch a dataset from > >>>> one SRS or datatype to another, i.e. consolidating diverse data > sources. > >>>> They aren't for generating non-RDF spatial documents. These are also > for > >>>> GeoSPARQL structure datasets so a dataset using the LatLon geo > >>>> predicates would need to be converted (for which the > >>>> "convertGeoPredicates" might be useful). > >>>> > >>>> Hope this helps, > >>>> > >>>> Greg > >>>> > >>>> > >>>> On 26/10/2020 14:17, Jean-Marc Vanel wrote: > >>>>> I missed ApacheCon, and I need some concrete hints sooner than next > >> year. > >>>>> Currently my database gives an empty answer to : > >>>>> PREFIX spatial: <http://geovocab.org/spatial#> > >>>>> # ?feature spatial:withinBox(?latMin ?lonMin ?latMax ?lonMax [ > ?limit]) > >>>>> SELECT * WHERE { > >>>>> ?feature spatial:withinBox( 43.0 0.0 46.0 10.0 100 ) > >>>>> } LIMIT 100 > >>>>> > >>>>> Should I apply once for all GeoSPARQLOperations.convert() ? > >>>>> static Dataset > >>>>> < > >> > https://jena.apache.org/documentation/javadoc/arq/org/apache/jena/query/Dataset.html?is-external=true > >>>>> convert > >>>>> < > >> > https://jena.apache.org/documentation/javadoc/geosparql/org/apache/jena/geosparql/configuration/GeoSPARQLOperations.html#convert-org.apache.jena.query.Dataset- > >>>>> (Dataset > >>>>> < > >> > https://jena.apache.org/documentation/javadoc/arq/org/apache/jena/query/Dataset.html?is-external=true > >>>>> dataset) > >>>>> Convert the input dataset to the most frequent coordinate reference > >>>> system > >>>>> and default datatype. > >>>>> > >>>>> Jean-Marc Vanel > >>>>> < > >> > http://semantic-forms.cc:9112/display?displayuri=http://jmvanel.free.fr/jmv.rdf%23me > >>>>> +33 > >>>>> (0)6 89 16 29 52 > >>>>> > >>>>> > >>>>> Le lun. 26 oct. 2020 à 11:02, Marco Neumann <[email protected] > > > >> a > >>>>> écrit : > >>>>> > >>>>>> good questions Jean-Marc, I will organize a session early in the new > >>>> year > >>>>>> to address some of them. In your case geo:lat and geo:long are not > >> part > >>>> of > >>>>>> OGC GeoSPARQL but require a transformation. We have a tool in place > >> for > >>>>>> that in Jena. And yes displaying large datasets need dedicated > >>>> strategies > >>>>>> for efficient processing. The points raised by you would make a good > >>>>>> problem statement for our session next year. Not sure if you have > >>>> attended > >>>>>> the ApachCon 2020 GeoSPARQL session last month but it's where I > >>>>>> mentioned further collaboration with third party tool developers as > a > >>>>>> possibility. stay tuned. > >>>>>> > >>>>>> Marco > >>>>>> > >>>>>> > >>>>>> On Mon, Oct 26, 2020 at 9:14 AM Jean-Marc Vanel < > >>>> [email protected]> > >>>>>> wrote: > >>>>>> > >>>>>>> After reading the official > >>>>>>> https://jena.apache.org/documentation/geosparql/ > >>>>>>> I'm puzzled as to concrete how to . > >>>>>>> > >>>>>>> My simple export use case > >>>>>>> > >>>>>>> - I have a TDB 1 database with geo:lat and long properties; > the > >>>> Jena > >>>>>>> geosparql dependency is added to my application > >>>>>>> - I have a LeafLet viewer able to display any RDF document > with > >>>>>> geo:lat > >>>>>>> and long properties ; example map > >>>>>>> < > >>>>>>> > >> > https://semantic-forms.cc:1953/assets/geo-map/geo-map.html?link-prefix=http://semantic-forms.cc:1953/display?displayuri=&lang=fr&url=https://semantic-forms.cc:1953/sparql?query=%0APREFIX+form%3A+%3Chttp%3A%2F%2Fraw.githubusercontent.com%2Fjmvanel%2Fsemantic_forms%2Fmaster%2Fvocabulary%2Fforms.owl.ttl%23%3E+%0APREFIX+rdfs%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E+%0APREFIX+geo%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2003%2F01%2Fgeo%2Fwgs84_pos%23%3E+%0APREFIX+foaf%3A+%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2F%3E+%0A%0ACONSTRUCT+%7B%0A++%3Fthing+geo%3Along+%3FLONG+.%0A++%3Fthing+geo%3Alat+%3FLAT+.%0A++%3Fthing+rdfs%3Alabel+%3FLAB+.%0A++%3Fthing+foaf%3Adepiction+%3FIMG+.%0A%7D+WHERE+%7B%0A++graph+%3Fg+%7B%0A++++%3Fthing+%3Chttp%3A%2F%2Fpurl.org%2FNET%2Fc4dm%2Fevent.owl%23produced_in%3E+%3Chttp%3A%2F%2Fsemantic-forms.cc%3A1952%2Fldp%2FCormoz%3E+.%0A++%7D%0A++graph+%3Fgcoord+%7B%0A++++%3Fthing+geo%3Along+%3FLONG+.%0A++++%3Fthing+geo%3Alat+%3FLAT+.%0A++%7D%0A++OPTIONAL+%7B%0A+++graph+%3Fg1+%7B%0A++++%3Fthing+rdfs%3Alabel+%3FLAB+%7D+%7D%0A++OPTIONAL+%7B%0A+++graph+%3Fg2+%7B%0A++++%3Fthing+%3Curn%3AdisplayLabel%3E+%3FLAB+%7D+%7D%0A%0A++OPTIONAL+%7B%0A+++graph+%3Fg3+%7B%0A++++%3Fthing+foaf%3Adepiction+%3FIMG+%7D+%7D%0A++OPTIONAL+%7B%0A+++graph+%3Fg4+%7B%0A++++%3Fthing+foaf%3Aimg+%3FIMG+%7D+%7D%0A%0A++++OPTIONAL+%7B%0A+++graph+%3FgrCount+%7B%0A++++%3Fthing+form%3AlinksCount+%3FCOUNT.%0A++%7D+%7D%0A%7D%0AORDER+BY+DESC%28%3FCOUNT%29%0A > >>>>>>> ; but I found that JavaScript based displayers are falling on > >> their > >>>>>>> knees > >>>>>>> (becoming very slow) for thousands of points > >>>>>>> - so I plan to use QGIS, so I need an export from RDF to one > of > >> the > >>>>>>> formats QGIS supports: GML, GeoJSON , etc > >>>>>>> > >>>>>>> How can I do that ? > >>>>>>> Do I have to use one of the convert* methods in > >>>>>>> > >>>>>>> > >> > https://jena.apache.org/documentation/javadoc/geosparql/index.html?org/apache/jena/geosparql/configuration/GeoSPARQLOperations.html > >>>>>>> ? > >>>>>>> > >>>>>>> Jean-Marc Vanel > >>>>>>> < > >>>>>>> > >> > http://semantic-forms.cc:1952/display?displayuri=http://jmvanel.free.fr/jmv.rdf%23me > >>>>>>> +33 (0)6 89 16 29 52 > >>>>>>> Twitter: @jmvanel , @jmvanel_fr ; chat: irc:// > >>>> irc.freenode.net#eulergui > >>>>>>> Chroniques jardin > >>>>>>> < > >>>>>>> > >> > http://semantic-forms.cc:1952/history?uri=http%3A%2F%2Fdbpedia.org%2Fresource%2FChronicle > >>>>>> -- > >>>>>> > >>>>>> > >>>>>> --- > >>>>>> Marco Neumann > >>>>>> KONA > >>>>>> > >> >
