SmartDataAnalytics / jena-sparql-api

A collection of Jena-extensions for hiding SPARQL-complexity from the application layer
Other
57 stars 14 forks source link

Un-implemented case in CandidateViewSelectorBase #21

Closed patrickwestphal closed 4 years ago

patrickwestphal commented 6 years ago

I tried to rewrite this SPARQL query:

SELECT DISTINCT  ?s
WHERE
  { ?s  <http://www.specialprivacy.eu/langs/usage-policy#hasData>  ?s0
      { ?s0  a                     <http://www.specialprivacy.eu/langs/px#TV> }
    UNION
      { ?s0  a                     <http://www.specialprivacy.eu/langs/svd#Demographic> }
    UNION
      { ?s0  a                     <http://www.specialprivacy.eu/langs/svd#Location> }
    UNION
      { ?s0  a                     <http://www.specialprivacy.eu/langs/svd#Navigation> }
    ?s   <http://www.specialprivacy.eu/langs/usage-policy#hasProcessing>  ?s1 .
    ?s1  a                     <http://www.specialprivacy.eu/langs/px#Profiling> .
    ?s   <http://www.specialprivacy.eu/langs/usage-policy#hasPurpose>  ?s2 .
    ?s2  a                     <http://www.specialprivacy.eu/langs/px#Recommendation> .
    ?s   <http://www.specialprivacy.eu/langs/usage-policy#hasRecipient>  ?s3 .
    ?s3  a                     <http://www.specialprivacy.eu/langs/svr#Ours> .
    ?s   <http://www.specialprivacy.eu/langs/usage-policy#hasStorage>  ?s4 .
    ?s4  <http://www.specialprivacy.eu/langs/usage-policy#hasLocation>  ?s5 .
    ?s5  a                     <http://www.specialprivacy.eu/langs/svl#EU> ;
         a                     <http://www.specialprivacy.eu/langs/svl#OurServers> .
    ?s4  <http://www.specialprivacy.eu/langs/usage-policy#durationInDays>  ?s6
    FILTER ( ?s6 >= 0 )
  }

The code I ran it looked like this:

    val graphRdd: RDD[Triple] = MyExampleData.asRDD(spark.sparkContext)
    val partitions: Map[RdfPartitionDefault, RDD[Row]] = RdfPartitionUtilsSpark.partitionGraph(graphRdd)

    val rewriter = SparqlifyUtils3.createSparqlSqlRewriter(spark, partitions)
    val rewritten = rewriter.rewrite(res2)

I got this trace pointing to this line:

Exception in thread "main" java.lang.RuntimeException: TODO Merge the restrictions of both sides of the join
    at org.aksw.jena_sparql_api.views.CandidateViewSelectorBase.getRestrictions2(CandidateViewSelectorBase.java:1795)
    at org.aksw.sparqlify.core.algorithms.CandidateViewSelectorSparqlify.getRestrictions2(CandidateViewSelectorSparqlify.java:240)
    at org.aksw.jena_sparql_api.views.CandidateViewSelectorBase.processJoinSplitLhs(CandidateViewSelectorBase.java:1638)
    at org.aksw.jena_sparql_api.views.CandidateViewSelectorBase.getApplicableViews(CandidateViewSelectorBase.java:1541)
    at org.aksw.jena_sparql_api.views.CandidateViewSelectorBase._getApplicableViews(CandidateViewSelectorBase.java:1354)
    at org.aksw.jena_sparql_api.views.CandidateViewSelectorBase.getApplicableViews(CandidateViewSelectorBase.java:1518)
    at org.aksw.jena_sparql_api.views.CandidateViewSelectorBase._getApplicableViews(CandidateViewSelectorBase.java:1346)
    at org.aksw.jena_sparql_api.views.CandidateViewSelectorBase.getApplicableViews(CandidateViewSelectorBase.java:1429)
    at org.aksw.jena_sparql_api.views.CandidateViewSelectorBase._getApplicableViews(CandidateViewSelectorBase.java:1374)
    at org.aksw.jena_sparql_api.views.CandidateViewSelectorBase.getApplicableViews(CandidateViewSelectorBase.java:1769)
    at org.aksw.jena_sparql_api.views.CandidateViewSelectorBase._getApplicableViews(CandidateViewSelectorBase.java:1342)
    at org.aksw.jena_sparql_api.views.CandidateViewSelectorBase._getApplicableViews(CandidateViewSelectorBase.java:1327)
    at org.aksw.jena_sparql_api.views.CandidateViewSelectorBase.getApplicableViews(CandidateViewSelectorBase.java:491)
    at org.aksw.sparqlify.core.interfaces.SparqlSqlOpRewriterImpl.rewrite(SparqlSqlOpRewriterImpl.java:81)
    at org.aksw.sparqlify.core.algorithms.SparqlSqlStringRewriterImpl.rewrite(SparqlSqlStringRewriterImpl.java:44)
    at Foo$.main(Foo.scala:86)
    at Foo.main(Foo.scala)
Aklakan commented 4 years ago

Probably no longer relevant; reopen otherwise.