@@ -8,24 +8,25 @@ import java.io.ByteArrayInputStream
88import org .apache .jena .riot .Lang
99import net .sansa_stack .rdf .spark .io ._
1010import net .sansa_stack .rdf .spark .model .graph ._
11+ import net .sansa_stack .rdf ._
1112import net .sansa_stack .ml .spark .clustering .RDFGraphPowerIterationClustering
1213
1314object RDFGraphPIClustering {
1415
1516 def main (args : Array [String ]) {
1617 parser.parse(args, Config ()) match {
1718 case Some (config) =>
18- run(config.in, config.out, config.outevl, config.outputsim, config. k, config.maxIterations)
19+ run(config.in, config.out, config.k, config.maxIterations)
1920 case None =>
2021 println(parser.usage)
2122 }
2223 }
2324
24- def run (input : String , output : String , outevl : String , outputsim : String , k : Int , maxIterations : Int ): Unit = {
25+ def run (input : String , output : String , k : Int , maxIterations : Int ): Unit = {
2526
2627 val spark = SparkSession .builder
2728 .appName(s " Power Iteration Clustering example ( $input ) " )
28- .master(" local[*] " )
29+ .master(" spark://172.18.160.16:3077 " )
2930 .config(" spark.serializer" , " org.apache.spark.serializer.KryoSerializer" )
3031 .getOrCreate()
3132 System .setProperty(" spark.akka.frameSize" , " 2000" )
@@ -40,15 +41,15 @@ object RDFGraphPIClustering {
4041
4142 val graph = triples.asStringGraph()
4243
43- RDFGraphPowerIterationClustering (spark, graph, output, outevl, outputsim , k, maxIterations)
44-
44+ val cluster = RDFGraphPowerIterationClustering (spark, graph, output, k, maxIterations)
45+ cluster.saveAsTextFile(output)
4546
4647 spark.stop
4748
4849 }
4950
5051
51- case class Config (in : String = " " , out : String = " " , outevl : String = " " , outputsim : String = " " , k : Int = 2 , maxIterations : Int = 5 )
52+ case class Config (in : String = " " , out : String = " " , k : Int = 2 , maxIterations : Int = 5 )
5253
5354 val defaultParams = Config ()
5455
@@ -64,14 +65,6 @@ object RDFGraphPIClustering {
6465 action((x, c) => c.copy(out = x)).
6566 text(" the output directory" )
6667
67- opt[String ]('e' , " outevl" ).optional().valueName(" <directory>" ).
68- action((x, c) => c.copy(outevl = x)).
69- text(" the outputevl directory" )
70-
71- opt[String ]('s' , " outputsim" ).optional().valueName(" <directory>" ).
72- action((x, c) => c.copy(outputsim = x)).
73- text(" the outputevl directory" )
74-
7568
7669 opt[Int ]('k' , " k" )
7770 .text(s " number of circles (/clusters), default: ${defaultParams.k}" )
0 commit comments