This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
en:site:recherche:logiciels:sparqlwithspark:chain6 [16/09/2016 23:04] hubert |
en:site:recherche:logiciels:sparqlwithspark:chain6 [16/09/2016 23:11] (current) hubert [Chain6 query plans] |
||
---|---|---|---|
Line 5: | Line 5: | ||
The plans produced by each method are: | The plans produced by each method are: | ||
* SPARQL RDD: | * SPARQL RDD: | ||
- | <code> | + | <code scala> |
val d1 = triples.filter{case(s,(p,o))=> p==P1}.map{case(x1,(p, x2))=> (x2, x1)} | val d1 = triples.filter{case(s,(p,o))=> p==P1}.map{case(x1,(p, x2))=> (x2, x1)} | ||
val d2 = triples.filter{case(s,(p,o))=> p==P2}.mapValues{case(p,x3) => x3} | val d2 = triples.filter{case(s,(p,o))=> p==P2}.mapValues{case(p,x3) => x3} | ||
Line 21: | Line 21: | ||
* SPARQL DF: | * SPARQL DF: | ||
- | <code> | + | <code scala> |
val t1 = df.where(s"p =$P1").select("s","o").withColumnRenamed("s", "x1").withColumnRenamed("o", "x2") | val t1 = df.where(s"p =$P1").select("s","o").withColumnRenamed("s", "x1").withColumnRenamed("o", "x2") | ||
val t2 = df.where(s"p=$P2").select("s","o").withColumnRenamed("s", "x2").withColumnRenamed("o", "x3") | val t2 = df.where(s"p=$P2").select("s","o").withColumnRenamed("s", "x2").withColumnRenamed("o", "x3") | ||
Line 33: | Line 33: | ||
* SPARQL Hybrid DF: | * SPARQL Hybrid DF: | ||
- | <code> | + | <code scala> |
val subg = df.where(s"p in ($P1, $P2, $P3, $P4, $P5, $P6)") | val subg = df.where(s"p in ($P1, $P2, $P3, $P4, $P5, $P6)") | ||
subg.persist | subg.persist |