-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sbt
More file actions
95 lines (89 loc) · 3.99 KB
/
build.sbt
File metadata and controls
95 lines (89 loc) · 3.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name := """sf-converter"""
version := "1.0.0"
scalaVersion := "2.11.12"
organization := "fi.seco"
libraryDependencies ++= Seq(
"ch.qos.logback" % "logback-classic" % "1.2.3",
"com.typesafe" % "config" % "1.3.1",
"com.typesafe.play" %% "play-json" % "2.6.8",
"com.typesafe.scala-logging" %% "scala-logging" % "3.7.2",
"joda-time" % "joda-time" % "2.9.7",
"net.sourceforge.htmlcleaner" % "htmlcleaner" % "2.6.1",
"org.apache.jena" % "jena-core" % "3.4.0" exclude("org.slf4j","slf4j-log4j12") exclude("log4j","log4j") exclude("commons-logging", "commons-logging"),
"org.apache.jena" % "jena-arq" % "3.4.0" exclude("org.slf4j","slf4j-log4j12") exclude("log4j","log4j") exclude("commons-logging", "commons-logging"),
"org.clapper" %% "argot" % "1.0.3",
"org.scala-lang.modules" %% "scala-xml" % "1.0.2",
"org.scalaj" %% "scalaj-http" % "2.3.0",
"org.scalatest" % "scalatest_2.11" % "2.2.6" % "test"
)
// Change confDir to test to run tasks with test configuration
val confDir = "main"
lazy val configuration = com.typesafe.config.ConfigFactory.parseFile(new File(s"src/$confDir/resources/application.conf")).resolve
lazy val sourceDataPath = configuration.getString("sourcedata.path")
lazy val outputDataPath = configuration.getString("outputdata.path")
lazy val wwwDataPath = configuration.getString("wwwdata.path")
lazy val outputRdfPath = s"$outputDataPath/rdf"
lazy val tdbDataPath = s"$outputDataPath/jena/tdb"
lazy val luceneDataPath = s"$outputDataPath/jena/lucene"
lazy val backupsPath = s"$outputDataPath/jena/backups"
lazy val jenaPath = configuration.getString("jena.path")
lazy val fusekiPath = configuration.getString("fuseki.path")
lazy val sourceDataUrl = configuration.getString("sourcedata.url")
lazy val assemblerPath = s"${configuration.getString("app.path")}/src/main/resources/jena/assembler.ttl"
val makeDataDir = taskKey[Unit]("Build data directory tree")
val downloadSourceData = taskKey[Unit]("Download source data")
val loadDataToTripleStore = taskKey[Unit]("Create TDB and Lucene indices")
val publishData = taskKey[Unit]("Publish RDF and source XML")
val publishSourceData = taskKey[Unit]("Publish only source XML")
val runSparqlServer = taskKey[Unit]("Run SPARQL server locally")
makeDataDir := {
import sys.process._
val sourceDatasets = List("sd", "asd", "kho", "kko", "ho", "hao", "misc", "release")
sourceDatasets.foreach(
ds => {
println(s"Create directory: $sourceDataPath/$ds")
(s"mkdir -p $sourceDataPath/$ds").!
}
)
val rdfDatasets = List("sd", "asd", "kho", "kko", "ho", "hao", "misc", "voc", "schema")
rdfDatasets.foreach{
ds => {
println(s"Create directory: $outputRdfPath/$ds")
(s"mkdir -p $outputRdfPath/$ds").!
}
}
rdfDatasets.foreach{
ds => {
println(s"Create directory: $outputRdfPath/bulk/$ds")
(s"mkdir -p $outputRdfPath/bulk/$ds").!
}
}
println(s"Create directories:", wwwDataPath, tdbDataPath, luceneDataPath, backupsPath)
(s"mkdir -p $wwwDataPath $tdbDataPath $luceneDataPath $backupsPath").!
println(s"Succesfully created all the directories")
}
downloadSourceData := {
import sys.process._
(s"./src/main/resources/shell/download_source_data.sh $sourceDataPath $sourceDataPath/zip $sourceDataPath/tmp $sourceDataUrl").!
}
loadDataToTripleStore := {
import sys.process._
(s"./src/main/resources/shell/load_data_to_triple_store.sh $outputRdfPath $tdbDataPath $luceneDataPath $jenaPath $fusekiPath $assemblerPath $backupsPath").!
}
publishData := {
import sys.process._
(s"./src/main/resources/shell/publish.sh $wwwDataPath $sourceDataPath $outputRdfPath $tdbDataPath $luceneDataPath").!
}
publishSourceData := {
import sys.process._
(s"./src/main/resources/shell/publish_source_data.sh $wwwDataPath $sourceDataPath").!
}
runSparqlServer := {
import sys.process._
println(s"SPARQL SERVER: $fusekiPath/fuseki-server")
println(s"ASSEMBLER PATH: $assemblerPath")
(s"$fusekiPath/fuseki-server --config=$assemblerPath").!
}
parallelExecution in Test := false
fork in run := true
fork in Test := true