Geo Spatcial query return Eval Query -1 Error

In the near future, I will need to perform geo spatial queries, therefore I decided to follow the thread # Cannot get geof:distance calculated closely and see how it works on my side.

Unfortunately I do not get to even run the query provided

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX unit: <http://qudt.org/vocab/unit#>

select ?distance
where {
BIND(geof:distance(
  <http://topology/location/geo/TOROON07HAS>,
  <http://topology/location/geo/TOROON09HAL>,
  unit:Meter) as ?distance)
}

and the logs are not very helpful in helping figuring out what the issue is.

ERROR 2019-04-08 10:37:05,437 [stardog-user-1]     com.complexible.stardog.protocols.http.server.StardogHttpServiceLoader:accept(235): An unexpected exception was handled by the server
com.stardog.stark.query.QueryExecutionFailure: -1
	at com.complexible.common.rdf.query.IteratorAsTupleQueryResult.hasNext(IteratorAsTupleQueryResult.java:82) ~[stardog-utils-rdf-6.1.2.jar:?]
	at com.stardog.stark.query.ClosingSpliterator.forEachRemaining(ClosingSpliterator.java:37) ~[stardog-stark-query-api-6.1.2.jar:?]
	at java.util.stream.ReferencePipeline$Head.forEach(Unknown Source) ~[?:1.8.0_201]
	at com.stardog.stark.query.io.QueryResultWriters.write(QueryResultWriters.java:142) ~[stardog-stark-query-io-6.1.2.jar:?]
	at com.stardog.stark.query.io.QueryResultWriters.write(QueryResultWriters.java:127) ~[stardog-stark-query-io-6.1.2.jar:?]
	at com.complexible.stardog.protocols.http.server.ProtocolUtils.writeTupleResponse(ProtocolUtils.java:579) ~[stardog-protocols-http-server-6.1.2.jar:?]
	at com.complexible.stardog.protocols.http.server.ProtocolUtils.executeReadQuery(ProtocolUtils.java:489) ~[stardog-protocols-http-server-6.1.2.jar:?]
	at com.complexible.stardog.protocols.http.server.ProtocolUtils.executeReadQuery(ProtocolUtils.java:474) ~[stardog-protocols-http-server-6.1.2.jar:?]
	at com.complexible.stardog.protocols.http.server.SPARQLProtocol.executeQuery(SPARQLProtocol.java:127) ~[stardog-protocols-http-server-6.1.2.jar:?]
	at com.complexible.stardog.protocols.http.server.SPARQLProtocol.post(SPARQLProtocol.java:91) ~[stardog-protocols-http-server-6.1.2.jar:?]
	at com.stardog.http.server.undertow.jaxrs.ExtractRoutes.lambda$handleIt$5(ExtractRoutes.java:192) ~[stardog-protocols-http-server-6.1.2.jar:?]
	at org.apache.shiro.subject.support.SubjectRunnable.doRun(SubjectRunnable.java:120) [shiro-core-1.2.3.jar:1.2.3]
	at org.apache.shiro.subject.support.SubjectRunnable.run(SubjectRunnable.java:108) [shiro-core-1.2.3.jar:1.2.3]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_201]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_201]
	at java.lang.Thread.run(Unknown Source) [?:1.8.0_201]
Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
	at com.complexible.stardog.plan.eval.operator.impl.LeanSolutionImpl.get(LeanSolutionImpl.java:89) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.spatial.db.query.DistancePropertyFunction$DistanceOperator.getPoint(DistancePropertyFunction.java:310) ~[stardog-spatial-core-6.1.2.jar:?]
	at com.complexible.stardog.spatial.db.query.DistancePropertyFunction$DistanceOperator.computeNext(DistancePropertyFunction.java:289) ~[stardog-spatial-core-6.1.2.jar:?]
	at com.complexible.stardog.spatial.db.query.DistancePropertyFunction$DistanceOperator.computeNext(DistancePropertyFunction.java:231) ~[stardog-spatial-core-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.SingleProjectionOp.computeNext(SingleProjectionOp.java:82) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.impl.SingleProjectionOp.computeNext(SingleProjectionOp.java:29) ~[stardog-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.util.AutoCloseOperator.computeNext(AutoCloseOperator.java:112) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.util.AutoCloseOperator.computeNext(AutoCloseOperator.java:25) ~[stardog-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.util.OpBasedBindingSetIteration.computeNext(OpBasedBindingSetIteration.java:116) ~[stardog-6.1.2.jar:?]
	at com.complexible.stardog.plan.eval.operator.util.OpBasedBindingSetIteration.computeNext(OpBasedBindingSetIteration.java:39) ~[stardog-6.1.2.jar:?]
	at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:141) ~[guava-26.0-jre.jar:?]
	at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:136) ~[guava-26.0-jre.jar:?]
	at com.complexible.common.rdf.query.IteratorAsTupleQueryResult.hasNext(IteratorAsTupleQueryResult.java:78) ~[stardog-utils-rdf-6.1.2.jar:?]
	... 15 more

Can you share the data over which you're running this query? At least for those two Geometries?

Sure no problem, this data is public

export.ttl.zip (386.7 KB)

Serge,

I am unable to reproduce this issue. If I spin up a fresh db on 6.1.2 with spatial.enabled=true and your data, I can run the query and get a distance of 4.9280619501054325E3.

Are you running this query federated in some way? Are you using CLI or Studio? Basically anything you might be doing that I'm not thinking to do?

I did nothing special, but just in case I started from scratch

  • I deleted the installation
  • reinstall,
  • created topology database with spatial.enabled=true
  • loaded data
  • ran via studio

But just tried with CLI and I get same result. I also tried loading it in a different database and I get the same issue. I will try to load it on another computer to see if the problem persist.

OK, thanks to @dlbis post Cannot get geof:distance calculated I have figure it out how to reproduce.

Create a table in a relational database (CSV may work) with 3 columns

  • name
  • long
  • lat

Create a SMS2 definition to load the data into a database. Then run query and voila Query Eval -1.

As mentioned I got the idea from @dlbis. If I export and import the data (which should be the same) in a different database (on the same installation) the query will work. So this confirm that the spatial index do not get setup properly when loaded with a specific syntax .

@stephen I believe that this is a bug, should we create something in the Bug forum to track? What's the process?

It wouldn't need to be a thread in the Bug forum; this thread is fine. What I basically need is a reliable way to reproduce the issue, since I keep having the unfortunate situation of my spatial index just working :slight_smile:

Edit: I haven't yet been able to try your process from a couple hours ago, but can you clarify a little bit with the mappings and such?

If you grab the data from the dataset I gave you and create a relational like data source. IE Table 'LOCATION' with 3 column (name, lat, long)

Then you create a mapping SMS2 file

MAPPING <urn:building>
FROM SQL {
    SELECT NAME, LAT, LONG
    FROM LOCATION
}

TO {
    ?geoiri a geo:Geometry ;
    wgs:lat "?COORDINATEX"^^xsd:float ;
    wgs:long "?COORDINATEY"^^xsd:float .
}
WHERE {  
    BIND(template("http://mytest/geo/{NAME}") as ?geoiri)
}

Then if you run the query provided before you will get an Query Eval -1. If you export and reload and run the query again it will work proving the data and query is fine.

Let me know if you need more info.

Hi just following up to see if you guys were able to reproduce the issue with the step given.

Thx

Yes, I was able to reproduce this issue using virtual import. We're continuing to look into what's going on

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.