SANSA-Stack/Archived-SANSA-Examples

Error while running SPARQL query with property path.

Closed this issue · 1 comments

Hello, I was able to setup and run SANSA, followed instructions from #25.
But, was getting following error when I try to run query with property path https://jena.apache.org/documentation/query/property_paths.html
?x cim:Terminal.ConductingEquipment/cim:Terminal.ConductingEquipment ?y

Can you please help?


val sparqlPropertyPathQ =
  """
    |prefix cim: <http://iec.ch/TC57/2012/CIM-schema-cim16#>
    |prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    |select ?x  ?y where
    |{
    |  ?x rdf:type cim:EnergyConsumer.
    |  ?x cim:Terminal.ConductingEquipment/cim:Terminal.ConductingEquipment ?y .
    |}
  """.stripMargin

Error:
Exception in thread "main" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at org.aksw.commons.util.reflect.ClassUtils.forceInvoke(ClassUtils.java:38)
at org.aksw.commons.util.reflect.MultiMethod.invokeStatic(MultiMethod.java:92)
at org.aksw.jena_sparql_api.utils.ReplaceConstants.replace(ReplaceConstants.java:88)
at org.aksw.jena_sparql_api.views.CandidateViewSelectorBase.getApplicableViews(CandidateViewSelectorBase.java:478)
at org.aksw.sparqlify.core.interfaces.SparqlSqlOpRewriterImpl.rewrite(SparqlSqlOpRewriterImpl.java:81)
at org.aksw.sparqlify.core.algorithms.SparqlSqlStringRewriterImpl.rewrite(SparqlSqlStringRewriterImpl.java:44)
at net.sansa_stack.query.spark.query.package$SparqlifyAsDefault.sparql(package.scala:36)
at com.satish.scala.SansaGraphExample$.main(SansaGraphExample.scala:168)
at com.satish.scala.SansaGraphExample.main(SansaGraphExample.scala)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.aksw.commons.util.reflect.ClassUtils.forceInvoke(ClassUtils.java:35)
... 8 more
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at org.aksw.commons.util.reflect.ClassUtils.forceInvoke(ClassUtils.java:38)
at org.aksw.commons.util.reflect.MultiMethod.invokeStatic(MultiMethod.java:92)
at org.aksw.jena_sparql_api.utils.ReplaceConstants.replace(ReplaceConstants.java:88)
at org.aksw.jena_sparql_api.utils.ReplaceConstants._replace(ReplaceConstants.java:137)
... 13 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.aksw.commons.util.reflect.ClassUtils.forceInvoke(ClassUtils.java:35)
... 16 more
Caused by: No method '_replace' found for argument types [class org.apache.jena.sparql.algebra.op.OpGraph]
at org.aksw.commons.util.reflect.MultiMethod.findMethodByParams(MultiMethod.java:187)
at org.aksw.commons.util.reflect.MultiMethod.findMethodByParamsCached(MultiMethod.java:173)
at org.aksw.commons.util.reflect.MultiMethod.findMethodByArgs(MultiMethod.java:206)
at org.aksw.commons.util.reflect.MultiMethod.invokeStatic(MultiMethod.java:90)
at org.aksw.jena_sparql_api.utils.ReplaceConstants.replace(ReplaceConstants.java:88)
at org.aksw.jena_sparql_api.utils.ReplaceConstants._replace(ReplaceConstants.java:157)
... 21 more

Hi @snamburi12 ,

many thanks for using SANSA. Unfortunately, we do not support Property Path queries (yet) since default query engine for SANSA depends on Sparqlify as a SPARQL-to-SQL rewriter and it supports these features.

We are currently discussing and investigating different RDB2RDF tools (see SANSA-Stack/Archived-SANSA-Query#19 for more details) and hopefully soon we have a better support for SPARQL 1.1

Please, let us know if you encounter any other issue with the currently supported features on SANSA Query engine.

Best regards,