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

Commit 39b5111

Browse files
committed
Merge branch 'develop'
2 parents d6b978e + ff288ca commit 39b5111

File tree

61 files changed

+1603
-317
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1603
-317
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ project/plugins/project/
2121
*.iml
2222

2323
deptree.txt
24+
scalastyle-output.xml
2425

.travis.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
language: scala
2+
sudo: false
3+
cache:
4+
directories:
5+
- $HOME/.m2
6+
scala:
7+
- 2.11.11
8+
script:
9+
- mvn scalastyle:check
10+
- mvn clean install

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ Contains the SANSA Examples for [Apache Spark](http://spark.apache.org/).
1010

1111
### [sansa-examples-flink](https://github.com/SANSA-Stack/SANSA-Examples/tree/master/sansa-examples-flink)
1212
Contains the SANSA Examples for [Apache Flink](http://flink.apache.org/).
13+
14+
## How to Contribute
15+
We always welcome new contributors to the project! Please see [our contribution guide](http://sansa-stack.net/contributing-to-sansa/) for more details on how to get started contributing to SANSA.

pom.xml

Lines changed: 78 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>net.sansa-stack</groupId>
66
<artifactId>sansa-examples-parent_2.11</artifactId>
7-
<version>2018-06</version>
7+
<version>2018-12</version>
88
<packaging>pom</packaging>
99
<name>SANSA-Examples - Parent</name>
1010
<description>SANSA examples</description>
@@ -58,11 +58,16 @@
5858
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
5959
<scala.version>2.11.11</scala.version>
6060
<scala.binary.version>2.11</scala.binary.version>
61-
<spark.version>2.3.1</spark.version>
62-
<flink.version>1.5.0</flink.version>
61+
<spark.version>2.4.0</spark.version>
62+
<flink.version>1.7.0</flink.version>
6363
<hadoop.version>2.8.3</hadoop.version>
64-
<jena.version>3.7.0</jena.version>
65-
<sansa.version>0.4.0</sansa.version>
64+
<jena.version>3.9.0</jena.version>
65+
<sansa.rdf.version>0.5.0</sansa.rdf.version>
66+
<sansa.owl.version>0.4.1</sansa.owl.version>
67+
<sansa.query.version>0.5.0</sansa.query.version>
68+
<sansa.inference.version>0.5.0</sansa.inference.version>
69+
<sansa.ml.version>0.5.0</sansa.ml.version>
70+
<scalastyle.config.path>${project.basedir}/scalastyle-config.xml</scalastyle.config.path>
6671
</properties>
6772

6873
<dependencyManagement>
@@ -167,61 +172,55 @@
167172
<dependency>
168173
<groupId>${project.groupId}</groupId>
169174
<artifactId>sansa-rdf-spark_${scala.binary.version}</artifactId>
170-
<version>${sansa.version}</version>
175+
<version>${sansa.rdf.version}</version>
171176
</dependency>
172177

173178
<dependency>
174179
<groupId>${project.groupId}</groupId>
175180
<artifactId>sansa-rdf-flink_${scala.binary.version}</artifactId>
176-
<version>${sansa.version}</version>
181+
<version>${sansa.rdf.version}</version>
177182
</dependency>
178183
<!-- OWL Layer -->
179184
<dependency>
180185
<groupId>${project.groupId}</groupId>
181186
<artifactId>sansa-owl-spark_${scala.binary.version}</artifactId>
182-
<version>${sansa.version}</version>
187+
<version>${sansa.owl.version}</version>
183188
</dependency>
184189
<dependency>
185190
<groupId>${project.groupId}</groupId>
186191
<artifactId>sansa-owl-flink_${scala.binary.version}</artifactId>
187-
<version>${sansa.version}</version>
192+
<version>${sansa.owl.version}</version>
188193
</dependency>
189194

190195
<!-- Query Layer -->
191196
<dependency>
192197
<groupId>${project.groupId}</groupId>
193198
<artifactId>sansa-query-spark_${scala.binary.version}</artifactId>
194-
<version>${sansa.version}</version>
199+
<version>${sansa.query.version}</version>
195200
</dependency>
196201

197-
198202
<!-- Inference Layer -->
199-
<dependency>
200-
<groupId>${project.groupId}</groupId>
201-
<artifactId>sansa-inference-parent_${scala.binary.version}</artifactId>
202-
<version>${sansa.version}</version>
203-
</dependency>
204203
<dependency>
205204
<groupId>${project.groupId}</groupId>
206205
<artifactId>sansa-inference-spark_${scala.binary.version}</artifactId>
207-
<version>${sansa.version}</version>
206+
<version>${sansa.inference.version}</version>
208207
</dependency>
209208
<dependency>
210209
<groupId>${project.groupId}</groupId>
211210
<artifactId>sansa-inference-flink_${scala.binary.version}</artifactId>
212-
<version>${sansa.version}</version>
211+
<version>${sansa.inference.version}</version>
213212
</dependency>
214213

215214
<!-- ML Layer -->
216215
<dependency>
217216
<groupId>${project.groupId}</groupId>
218217
<artifactId>sansa-ml-spark_${scala.binary.version}</artifactId>
219-
<version>${sansa.version}</version>
218+
<version>${sansa.ml.version}</version>
220219
</dependency>
221220
<dependency>
222221
<groupId>${project.groupId}</groupId>
223222
<artifactId>sansa-ml-flink_${scala.binary.version}</artifactId>
224-
<version>${sansa.version}</version>
223+
<version>${sansa.ml.version}</version>
225224
</dependency>
226225

227226
<dependency>
@@ -231,6 +230,25 @@
231230
<scope>test</scope>
232231
</dependency>
233232

233+
<dependency>
234+
<groupId>org.glassfish.jersey</groupId>
235+
<artifactId>jersey-bom</artifactId>
236+
<version>2.26-b03</version>
237+
<type>pom</type>
238+
<scope>import</scope>
239+
</dependency>
240+
241+
<dependency>
242+
<groupId>commons-codec</groupId>
243+
<artifactId>commons-codec</artifactId>
244+
<version>1.11</version>
245+
</dependency>
246+
247+
<dependency>
248+
<groupId>org.apache.commons</groupId>
249+
<artifactId>commons-compress</artifactId>
250+
<version>1.18</version>
251+
</dependency>
234252

235253
</dependencies>
236254
</dependencyManagement>
@@ -281,6 +299,32 @@
281299
<version>2.19.1</version>
282300
</plugin>
283301

302+
<!-- Scalastyle -->
303+
<plugin>
304+
<groupId>org.scalastyle</groupId>
305+
<artifactId>scalastyle-maven-plugin</artifactId>
306+
<version>1.0.0</version>
307+
<configuration>
308+
<verbose>false</verbose>
309+
<failOnViolation>true</failOnViolation>
310+
<includeTestSourceDirectory>true</includeTestSourceDirectory>
311+
<failOnWarning>false</failOnWarning>
312+
<sourceDirectory>${project.basedir}/src/main/scala</sourceDirectory>
313+
<testSourceDirectory>${project.basedir}/src/test/scala</testSourceDirectory>
314+
<!-- we use a central config located in the root directory -->
315+
<configLocation>${scalastyle.config.path}</configLocation>
316+
<outputFile>${project.basedir}/scalastyle-output.xml</outputFile>
317+
<outputEncoding>UTF-8</outputEncoding>
318+
</configuration>
319+
<executions>
320+
<execution>
321+
<goals>
322+
<goal>check</goal>
323+
</goals>
324+
</execution>
325+
</executions>
326+
</plugin>
327+
284328
<!-- Scalatest -->
285329
<plugin>
286330
<groupId>org.scalatest</groupId>
@@ -304,6 +348,20 @@
304348
</pluginManagement>
305349
</build>
306350

351+
<profiles>
352+
<profile>
353+
<id>root-dir</id>
354+
<activation>
355+
<file>
356+
<exists>${project.basedir}/../../scalastyle-config.xml</exists>
357+
</file>
358+
</activation>
359+
<properties>
360+
<scalastyle.config.path>${project.basedir}/../scalastyle-config.xml</scalastyle.config.path>
361+
</properties>
362+
</profile>
363+
</profiles>
364+
307365
<repositories>
308366
<repository>
309367
<id>oss-sonatype</id>

sansa-examples-flink/pom.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>sansa-examples-parent_2.11</artifactId>
77
<groupId>net.sansa-stack</groupId>
8-
<version>2018-06</version>
8+
<version>2018-12</version>
99
</parent>
1010
<artifactId>sansa-examples-flink_2.11</artifactId>
1111
<name>SANSA Examples - Apache Flink</name>
@@ -197,6 +197,10 @@
197197
</execution>
198198
</executions>
199199
</plugin>
200+
<plugin>
201+
<groupId>org.scalastyle</groupId>
202+
<artifactId>scalastyle-maven-plugin</artifactId>
203+
</plugin>
200204
</plugins>
201205
</build>
202206

sansa-examples-flink/src/main/scala/net/sansa_stack/examples/flink/inference/RDFGraphInference.scala

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,17 @@ import java.util.Properties
77
import scala.io.Source
88

99
import com.typesafe.config.ConfigFactory
10-
import org.apache.flink.api.java.utils.ParameterTool
11-
import org.apache.flink.api.scala.ExecutionEnvironment
12-
import org.apache.flink.configuration.Configuration
13-
import org.apache.flink.runtime.webmonitor.WebMonitorUtils
14-
1510
import net.sansa_stack.inference.flink.data.{ RDFGraphLoader, RDFGraphWriter }
1611
import net.sansa_stack.inference.flink.forwardchaining.{
1712
ForwardRuleReasonerOWLHorst,
1813
ForwardRuleReasonerRDFS
1914
}
20-
import net.sansa_stack.inference.rules.ReasoningProfile._
2115
import net.sansa_stack.inference.rules.{ RDFSLevel, ReasoningProfile }
16+
import net.sansa_stack.inference.rules.ReasoningProfile._
17+
import org.apache.flink.api.java.utils.ParameterTool
18+
import org.apache.flink.api.scala.ExecutionEnvironment
19+
import org.apache.flink.configuration.Configuration
20+
import org.apache.flink.runtime.webmonitor.WebMonitorUtils
2221

2322
object RDFGraphInference {
2423

@@ -40,14 +39,14 @@ object RDFGraphInference {
4039
}
4140

4241
def run(
43-
args: Array[String],
44-
input: Seq[URI],
45-
output: URI,
46-
profile: ReasoningProfile,
42+
args: Array[String],
43+
input: Seq[URI],
44+
output: URI,
45+
profile: ReasoningProfile,
4746
writeToSingleFile: Boolean,
48-
sortedOutput: Boolean,
49-
propertiesFile: File,
50-
jobName: String): Unit = {
47+
sortedOutput: Boolean,
48+
propertiesFile: File,
49+
jobName: String): Unit = {
5150

5251
// read reasoner optimization properties
5352
val reasonerConf =
@@ -92,20 +91,17 @@ object RDFGraphInference {
9291
println(s"|G_inf| = ${inferredGraph.size()}")
9392

9493
val jn = if (jobName.isEmpty) s"RDF Graph Inference ($profile)" else jobName
95-
96-
// run the program
97-
env.execute(jn)
9894
}
9995

10096
// the config object
10197
case class Config(
102-
in: Seq[URI] = Seq(),
103-
out: URI = new URI("."),
104-
profile: ReasoningProfile = ReasoningProfile.RDFS,
105-
writeToSingleFile: Boolean = false,
106-
sortedOutput: Boolean = false,
107-
propertiesFile: File = null,
108-
jobName: String = "") // new File(getClass.getResource("reasoner.properties").toURI)
98+
in: Seq[URI] = Seq(),
99+
out: URI = new URI("."),
100+
profile: ReasoningProfile = ReasoningProfile.RDFS,
101+
writeToSingleFile: Boolean = false,
102+
sortedOutput: Boolean = false,
103+
propertiesFile: File = null,
104+
jobName: String = "") // new File(getClass.getResource("reasoner.properties").toURI)
109105

110106
// read ReasoningProfile enum
111107
implicit val profilesRead: scopt.Read[ReasoningProfile.Value] =
@@ -159,4 +155,4 @@ object RDFGraphInference {
159155

160156
}
161157
parser.showUsageOnError
162-
}
158+
}

sansa-examples-flink/src/main/scala/net/sansa_stack/examples/flink/ml/clustering/RDFByModularityClustering.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
package net.sansa_stack.examples.flink.ml.clustering
2+
23
import scala.collection.mutable
4+
35
import net.sansa_stack.ml.flink.clustering.{ RDFByModularityClustering => RDFByModularityClusteringAlg }
4-
import org.apache.flink.api.scala.ExecutionEnvironment
56
import org.apache.flink.api.scala._
7+
import org.apache.flink.api.scala.ExecutionEnvironment
68

79
object RDFByModularityClustering {
8-
910
def main(args: Array[String]) {
1011
parser.parse(args, Config()) match {
1112
case Some(config) =>
@@ -49,4 +50,4 @@ object RDFByModularityClustering {
4950

5051
help("help").text("prints this usage text")
5152
}
52-
}
53+
}

sansa-examples-flink/src/main/scala/net/sansa_stack/examples/flink/owl/OWLReaderDataSet.scala

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package net.sansa_stack.examples.flink.owl
22

3-
import net.sansa_stack.owl.flink.dataset.{ FunctionalSyntaxOWLAxiomsDataSetBuilder, ManchesterSyntaxOWLAxiomsDataSetBuilder }
4-
import org.apache.flink.api.scala.ExecutionEnvironment
3+
import de.javakaffee.kryoserializers.UnmodifiableCollectionsSerializer
54

65
import scala.collection.mutable
6+
import net.sansa_stack.owl.flink.owl._
7+
import org.apache.flink.api.scala.ExecutionEnvironment
8+
79

810
object OWLReaderDataSet {
911

@@ -20,13 +22,18 @@ object OWLReaderDataSet {
2022

2123
println(".============================================.")
2224
println("| Dataset OWL reader example (" + syntax + " syntax)|")
23-
println("`============================================´")
25+
println(".============================================.")
2426

2527
val env = ExecutionEnvironment.getExecutionEnvironment
28+
// scalastyle:off classforname
29+
env.getConfig.addDefaultKryoSerializer(
30+
Class.forName("java.util.Collections$UnmodifiableCollection"),
31+
classOf[UnmodifiableCollectionsSerializer])
32+
// scalastyle:on classforname
2633

2734
val dataSet = syntax match {
28-
case "fun" => FunctionalSyntaxOWLAxiomsDataSetBuilder.build(env, input)
29-
case "manch" => ManchesterSyntaxOWLAxiomsDataSetBuilder.build(env, input)
35+
case "fun" => env.owl(Syntax.FUNCTIONAL)(input)
36+
case "manch" => env.owl(Syntax.MANCHESTER)(input)
3037
case "owl_xml" =>
3138
throw new RuntimeException("'" + syntax + "' - Not supported, yet.")
3239
case _ =>
@@ -38,7 +45,7 @@ object OWLReaderDataSet {
3845
}
3946

4047
case class Config(
41-
in: String = "",
48+
in: String = "",
4249
syntax: String = "")
4350

4451
// the CLI parser
@@ -56,4 +63,4 @@ object OWLReaderDataSet {
5663

5764
help("help").text("prints this usage text")
5865
}
59-
}
66+
}

0 commit comments

Comments
 (0)