-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCreateProject2.scala
More file actions
36 lines (26 loc) · 872 Bytes
/
CreateProject2.scala
File metadata and controls
36 lines (26 loc) · 872 Bytes
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
package example
import com.readr.client.document.{layerDefaults, layers}
import com.readr.client.{Client, projects}
import com.readr.model.Project
import com.readr.model.layer.Layer
// Create an empty project without annotation layers,
// and then manually create a few annotation layers
// and set defaults for different annotation types.
object CreateProject2 extends Settings {
def main(args:Array[String]):Unit = {
Client.open(host, user, password)
implicit val p = Project(ns, proj)
if (projects.exists(p))
println("Project already exists.")
else {
projects.create(p)
val l1 = Layer("text", "Text")
val l2 = Layer("tokens", "Token")
val id1 = layers.create(l1)
val id2 = layers.create(l2)
layerDefaults.set("Text", "", id1)
layerDefaults.set("Token", "", id2)
}
Client.close
}
}