Last active
September 30, 2015 18:11
-
-
Save kaychaks/a43900280b25f528a72f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.w3.banana.{Sesame,RDF,RDFModule,RDFOpsModule,TurtleWriterModule} | |
import org.apache.spark.rdd.RDD | |
// My Code | |
trait BlazeSesame extends Sesame | |
trait BlazeSesameModule extends SesameModule { | |
type Rdf = BlazeSesame | |
} | |
trait MyDependencies extends RDFModule with RDFOpsModule with TurtleWriterModule with Serializable | |
trait MyImpl extends MyDependencies { | |
def mapFn[Rdf <: RDF](r : (Seq[String],(String,String)))):Seq[Rdf#Triple] = { | |
val rdfs = RDFSPrefix[Rdf] | |
val sf = MyPrefix[Rdf] | |
val sub1:Rdf#URI = sf.getABox(x._1.head) | |
val sub2:Rdf#URI = sf.getABox(x._1(1)) | |
Seq( | |
Triple(sub2, rdf.typ, sf.MyObject), | |
Triple(sub2, rdf.typ, sf.MyObject) | |
) | |
} | |
def main() { | |
import ops._ | |
val r: RDD[(Seq[String],(String,String))] = getRDD() | |
val l = r.flatMap(mapFn).collect().toList // this is where I am getting the error "No ClassTag available for Rdf#Triple" | |
turtleWriter.asString(Graph(l),base = "") | |
} | |
} | |
object MyImplObj extends MyImpl with BlazeSesameModule |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I fixed it.
Spark's RDD require an implicit ClassTag with most of it's methods like map & flatMap. Since, being an user-defined type RDF#Triple's ClassTag had to be explicitly made available.
ctt
value as the ClassTag for the return type RDF#Triple