-
Notifications
You must be signed in to change notification settings - Fork 0
/
3_Add_Subtract.gql
107 lines (102 loc) · 2.44 KB
/
3_Add_Subtract.gql
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
96
97
98
99
100
101
102
103
104
105
106
107
###### DOESN't WORK -old work, not correct
# sinple script to add context variables
# - context variables: near, maxtime, mintime
# - test event with time
# 13/09/2019 10:45:04
##
# insert context graql statements
##
# first there is a delete statement
match $a isa maxtime; delete $a;
##
##
#
match
$start isa start,
has hour $starthour,
has minute $startmin,
has second $startsec;
$near isa neartime,
has hour $nearhour,
has minute $nearmin,
has second $nearsec;
### Add seconds
(addees: $startsec,
addors: $nearsec,
results: $results,
resrem: $rems ) isa addsec;
### Depending on the Remainder from the seconds, add minutes
{
$rems == false;
$addm (addeem: $startmin,
addorm: $nearmin,
resultm: $resultm,
resrem: $remm ) isa addmin;
} or
{
$rems == true;
$addm (addeem: $startmin,
addorm: $nearmin,
remresm: $resultm,
remrem: $remm ) isa addmin;
};
### Depending on the Remainder from the minutes, add hours
{
$remm == false;
$addh (addeeh: $starthour,
addorh: $nearhour,
resulth: $resulth,
resrem: $remh ) isa addhour;
} or
{
$remm == true;
$addh (addeeh: $starthour,
addorh: $nearhour,
remresh: $resulth,
remrem: $remh ) isa addhour;
};
get
match
$start isa start,
has hour $starthour,
has minute $startmin,
has second $startsec;
$near isa neartime,
has hour $nearhour,
has minute $nearmin,
has second $nearsec;
$adds (addees: $startsec,
addors: $nearsec,
results: $results,
remres: $remres,
resrem: $rems,
remrem: $remss ) isa addsec;
{
$rems == false;
$addm (addeem: $startmin,
addorm: $nearmin,
resultm: $resultm,
resrem: $remm ) isa addmin;
} or
{
$rems == true;
$addm (addeem: $startmin,
addorm: $nearmin,
remresm: $resultm,
remrem: $remm ) isa addmin;
};
{
$remm == false;
$addh (addeeh: $starthour,
addorh: $nearhour,
resulth: $resulth,
resrem: $remh ) isa addhour;
} or
{
$remm == true;
$addh (addeeh: $starthour,
addorh: $nearhour,
remresh: $resulth,
remrem: $remh ) isa addhour;
};
get