SANSA-Stack / Archived-SANSA-Query

SANSA Query Layer
Apache License 2.0
31 stars 13 forks source link

Problem querying RDF containing a triple with an object of type XSD double #34

Closed jmaharramzade closed 4 years ago

jmaharramzade commented 5 years ago

I'll demonstrate the problem using the Sparqlify example: https://github.com/SANSA-Stack/SANSA-Examples/blob/develop/sansa-examples-spark/src/main/scala/net/sansa_stack/examples/spark/query/Sparqlify.scala.

Add a triple to src/main/resources/rdf.nt with an object of type XSD double. E.g., simply replace the following triple:

<http://commons.dbpedia.org/resource/Category:People> <http://commons.dbpedia.org/property/width> "100.0"^^<http://dbpedia.org/datatype/perCent> .

with:

<http://commons.dbpedia.org/resource/Category:People> <http://commons.dbpedia.org/property/width> "100.0"^^<http://www.w3.org/2001/XMLSchema#double> . 

Run the Sparqlify class in the server/endpoint mode pointing to the rdf.nt as input (--input src/main/resources/rdf.nt). Execute the simple SELECT * WHERE {?s ?p ?o} query in the browser. Observe the error in the server console.

Exception in thread "Thread-37" java.lang.RuntimeException: java.lang.RuntimeException: org.apache.spark.sql.catalyst.parser.ParseException: 
mismatched input 'FROM' expecting <EOF>(line 2, pos 0)
Aklakan commented 4 years ago

Fixed; This was a bug in the datatype to sql-string mapping: Instead of "double" in the generated Spark SQL it was incorrectly "double precision" resulting in the catalyst parse exception with the not very helpful message.