-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.vodsl
86 lines (71 loc) · 2.16 KB
/
example.vodsl
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
/*
* created on 25 Feb 2022
*/
model example (0.1) "An example data model showing the constructs available"
author "Paul Harrison"
author "An Other"
include "IVOA-v1.0.vodsl"
package p "top level package" {
package n "nested package" {
primitive angle "another primitive"
}
}
enum options "an enum" {
val1 "first option",
val2 "second option"
}
dtype aQuant -> ivoa:Quantity "an angle quantity" {
value : p.n.angle "angle";
}
abstract otype base {
q : ivoa:Quantity "a quantity";
}
abstract otype ad1 -> base "an abstract subtype "{
}
otype o1 {
/* the following attribute is a 'natural key' for the otype */
name : ivoa:string iskey "the identifier";
bv : ivoa:anyURI "Description";
/* note use of ^ to be able to
re-use reserved word.*/
^author: ivoa:string "author";
}
dtype myQuant -> ivoa:RealQuantity "a flagged quantity" {
flag : ivoa:boolean "the flag" ;
}
/* it should be noted in this example that
* @* and @+ are not "recommended" for attributes - it
might be better to use composition of otypes - but this is
not always the case */
otype multiplicities "the @ sign introduces a multiplicity"
{
m1 : ivoa:integer @? "0 or 1";
m2 : ivoa:integer @* "0 or many";
m3 : ivoa:integer @+ "1 or many";
m4 : ivoa:integer @[2] "twice (as an array?)";
}
/* this referred to otype is not affected by the lifecycle
of other instances in the model */
otype ReferedTo {
test1: ivoa:integer "";
}
/* instances of this contained class will only live
as long as the containing instance. */
otype Contained {
test2: ivoa:string "";
}
/* this example references and contains the above types */
otype RCTest {
ref references ReferedTo "";
contained : Contained @+ as composition "";
}
/* an example of subsetting */
otype subs -> base {
/* note that the requirement to refer to the q attribute of base */
subset base.q as myQuant; //the type of base.q is a supertype of myQuant
}
/* an example of the syntax for a constraint */
otype constrained {
val : ivoa:integer "just using a natural language constraint"
< "greater than 5" as Natural> ;
}