This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:site:recherche:logiciels:sparqlwithspark:chain4 [14/09/2016 12:38] hubert |
en:site:recherche:logiciels:sparqlwithspark:chain4 [16/09/2016 23:10] (current) hubert [Chain4 query plans] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Chain4 query====== | + | {{indexmenu_n>6}} |
+ | |||
+ | |||
+ | ====== Chain4 query plans====== | ||
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 16: | Line 20: | ||
* 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 25: | Line 29: | ||
* SPARQL Hybrid DF: | * SPARQL Hybrid DF: | ||
- | <code> | + | <code scala> |
val subg = df.where(s"p in ($P2, $P3, $P4)") | val subg = df.where(s"p in ($P2, $P3, $P4)") | ||
subg.persist | subg.persist | ||
Line 36: | Line 40: | ||
</code> | </code> | ||
- | Go to [[en:site:recherche:logiciels:sparqlwithspark| other queries]] | + | Go to [[en:site:recherche:logiciels:sparqlwithspark]] |