-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathTestSchema02.scala
58 lines (48 loc) · 1.64 KB
/
TestSchema02.scala
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
package overflowdb.integrationtests
import overflowdb.schema.Property.ValueType
import overflowdb.schema._
/** For testing base node type functionality, e.g.
* - defining properties and edges on base node types
* - marker traits
*/
class TestSchema02 extends TestSchema {
val name = builder.addProperty("NAME", ValueType.String, "Name of represented object")
.mandatory("<[empty]>")
val order = builder.addProperty("ORDER", ValueType.Int, "General ordering property.")
val baseNode = builder.addNodeBaseType(
name = "BASE_NODE",
comment = "base node")
.addProperty(name)
.addMarkerTrait("MarkerTrait1")
val node1 = builder.addNodeType(
name = "NODE1",
comment = "sample node 1")
.addProperties(order)
.extendz(baseNode)
val node2 = builder.addNodeType(
name = "NODE2",
comment = "sample node 2")
.addMarkerTrait("MarkerTrait2")
val edge1 = builder.addEdgeType(
name = "EDGE1",
comment = "sample edge 1")
val edge2 = builder.addEdgeType(
name = "EDGE2",
comment = "sample edge 2").addProperty(name)
baseNode.addOutEdge(
edge = edge1,
inNode = node2,
cardinalityOut = EdgeType.Cardinality.List,
cardinalityIn = EdgeType.Cardinality.ZeroOrOne,
stepNameOut = "customStepName1",
stepNameOutDoc = "custom step name 1 documentation",
stepNameIn = "customStepName1Inverse")
node2.addOutEdge(
edge = edge2,
inNode = baseNode,
cardinalityOut = EdgeType.Cardinality.One,
cardinalityIn = EdgeType.Cardinality.One,
stepNameOut = "customStepName2",
stepNameOutDoc = "custom step name 2 documentation",
stepNameIn = "customStepName2Inverse")
}