Different results for same data when query executed via Stardog API and Web Console for geof:distance()

Hello,
When I run below query through Stardog API, SNARL I get different result for ‘dist’ parameter and when I execute same query for same data through Web Console (localhost:5820) I get different result.

PREFIX geof: http://www.opengis.net/def/function/geosparql/
PREFIX geo: http://www.opengis.net/ont/geosparql#
PREFIX units: http://www.opengis.net/def/uom/OGC/1.0/
PREFIX ont: http://www.co-ode.org/ontologies/ont.owl#
PREFIX data: http://www.semanticweb.org/yogitas/ontologies/2017/2/openStreetMapWithData.owl#
PREFIX tags: https://raw.github.com/doroam/planning-do-roam/master/Ontology/tags.owl#

SELECT DISTINCT ?way ?speed ?dist
WHERE {
?way geo:asWKT ?p1.
?way rdf:type data:way.
bind(geof:distance(?way," POINT(10.0210995 48.4333905)"^^geo:wktLiteral,units:metre) as ?dist)
?way ^data:tag_of_way ?tag.
?tag data:k_maxspeed ?speed.
} ORDER BY ASC(?dist)

–Through API—
±----------------------------------------------------------------±------±------------------------------------+
| way | speed | dist |
±-----------------------------------------------------------------±------±-----------------------------------+
| http://www.co-ode.org/ontologies/ont.owl#W1 | 30 | 4.1491360460238155E1 |
| http://www.co-ode.org/ontologies/ont.owl#W0 | 30 | 1.1613483244627406E2 |
±-----------------------------------------------------------------±------±----------------------------------+

Through UI i.e localhost:5820 :-- This seem to be correct to me.
±-----------------------------------------------------------------±-------±-----------------------------------+
| way | speed | dist |
±-----------------------------------------------------------------±-------±------------------------------------+
| http://www.co-ode.org/ontologies/ont.owl#W1 | 30 | 41.491360460238155E1 |
| http://www.co-ode.org/ontologies/ont.owl#W0 | 30 | 116.13483244627406E2 |
±----------------------------------------------------------------±------±-------------------------------------+

Is this a bug or do I have to mention units in some different way when running query through API?

Regards,
ysg

Hi,

What version of Stardog are you seeing this behavior on? On the latest (4.2.4), I do get what appear to be different results for my dataset:

# Through CLI
+------------------------------------------------------+----------------------+
|                         way                          |         dist         |
+------------------------------------------------------+----------------------+
| _:bnode_e5270036_6660_4b9d_bace_87bd14d6807e_1472566 | 8.959706856138907E4  |
| _:bnode_e5270036_6660_4b9d_bace_87bd14d6807e_1472565 | 1.0046348823313162E5 |
+------------------------------------------------------+----------------------+

# Through web console:
+------------------------------------------------------+----------------------+
|                         way                          |         dist         |
+------------------------------------------------------+----------------------+
 _:bnode_e5270036_6660_4b9d_bace_87bd14d6807e_1472566  | 89597.06856138907
 _:bnode_e5270036_6660_4b9d_bace_87bd14d6807e_1472565  | 100463.48823313162
+------------------------------------------------------+----------------------+

The only difference I am able to see is that the CLI gives the answer in scientific notation (8.9597068E4), while the web console is converting to decimal notation (89597.068). The numeric values themselves are equal.

In your original question, however, it looks like the web console is both expanding the number AND keeping the exponents? Is this accurate? If so, could you include a small data set that can reproduce the issue?

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