Skip to content
This repository was archived by the owner on Oct 8, 2020. It is now read-only.

Commit 5d5cc45

Browse files
committed
Added RDFByModularityClustering example for Flink
1 parent 4b3a1bd commit 5d5cc45

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package net.sansa_stack.examples.flink.ml.clustering
2+
import scala.collection.mutable
3+
import net.sansa_stack.ml.flink.clustering.{ RDFByModularityClustering => RDFByModularityClusteringAlg }
4+
import org.apache.flink.api.scala.ExecutionEnvironment
5+
import org.apache.flink.api.scala._
6+
7+
object RDFByModularityClustering {
8+
def main(args: Array[String]) {
9+
if (args.length < 3) {
10+
System.err.println(
11+
"Usage: RDFByModularityClustering <input> <output> <numIterations>")
12+
System.exit(1)
13+
}
14+
val graphFile = args(0) //"src/main/resources/Clustering_sampledata.nt"
15+
val outputFile = args(1) //"src/main/resources/output"
16+
val numIterations = args(2).toInt // 5
17+
val optionsList = args.drop(3).map { arg =>
18+
arg.dropWhile(_ == '-').split('=') match {
19+
case Array(opt, v) => (opt -> v)
20+
case _ => throw new IllegalArgumentException("Invalid argument: " + arg)
21+
}
22+
}
23+
val options = mutable.Map(optionsList: _*)
24+
25+
options.foreach {
26+
case (opt, _) => throw new IllegalArgumentException("Invalid option: " + opt)
27+
}
28+
println("============================================")
29+
println("| RDF By Modularity Clustering example |")
30+
println("============================================")
31+
32+
val env = ExecutionEnvironment.getExecutionEnvironment
33+
34+
RDFByModularityClusteringAlg(env, numIterations, graphFile, outputFile)
35+
36+
}
37+
}

0 commit comments

Comments
 (0)