Mercurial > code > home > repos > homeauto
annotate service/reasoning/rules.n3 @ 283:0b0fb67b0b3a
fix input/output statement ambiguity problem by allowing quoted output statements
Ignore-this: 677a7f6bc1df1788c9b12d5fd87e841a
author | drewp@bigasterisk.com |
---|---|
date | Fri, 06 May 2016 18:38:18 -0700 |
parents | 4b0282900fd3 |
children | 95f72a22965d |
rev | line source |
---|---|
129
745eff67ad40
reasoning actions: generalize them a bit but then add a bunch of special cases for mpd for now
drewp@bigasterisk.com
parents:
118
diff
changeset
|
1 # rules only! statements in this file will not be considered in the graph |
745eff67ad40
reasoning actions: generalize them a bit but then add a bunch of special cases for mpd for now
drewp@bigasterisk.com
parents:
118
diff
changeset
|
2 |
21 | 3 @prefix : <http://projects.bigasterisk.com/room/>. |
4 @prefix bigast: <http://bigasterisk.com/>. | |
5 @prefix dev: <http://projects.bigasterisk.com/device/>. | |
6 @prefix foaf: <http://xmlns.com/foaf/0.1/> . | |
7 @prefix env: <http://projects.bigasterisk.com/device/environment>. | |
54
42411726a7ca
screen out more values that change on every update
drewp@bigasterisk.com
parents:
31
diff
changeset
|
8 @prefix math: <http://www.w3.org/2000/10/swap/math#> . |
21 | 9 |
248 | 10 @prefix star: <http://bigasterisk.com/host/star/> . |
11 @prefix dash: <http://bigasterisk.com/host/dash/> . | |
12 @prefix slash: <http://bigasterisk.com/host/slash/> . | |
13 | |
14 { ?d :deviceName "drew-phone"; :connected bigast:wifiAccessPoints . } => { :auth :near :home } . | |
15 { ?d :deviceName "Kelsis-iPhone"; :connected bigast:wifiAccessPoints . } => { :auth :near :home } . | |
21 | 16 |
17 { env: :localHour 8 } => { env: :localHour :awakeTime } . | |
18 { env: :localHour 9 } => { env: :localHour :awakeTime } . | |
19 { env: :localHour 10 } => { env: :localHour :awakeTime } . | |
20 { env: :localHour 11 } => { env: :localHour :awakeTime } . | |
21 { env: :localHour 12 } => { env: :localHour :awakeTime } . | |
22 { env: :localHour 13 } => { env: :localHour :awakeTime } . | |
23 { env: :localHour 14 } => { env: :localHour :awakeTime } . | |
24 { env: :localHour 15 } => { env: :localHour :awakeTime } . | |
25 { env: :localHour 16 } => { env: :localHour :awakeTime } . | |
26 { env: :localHour 17 } => { env: :localHour :awakeTime } . | |
27 { env: :localHour 18 } => { env: :localHour :awakeTime } . | |
28 { env: :localHour 19 } => { env: :localHour :awakeTime } . | |
29 { env: :localHour 20 } => { env: :localHour :awakeTime } . | |
30 { env: :localHour 21 } => { env: :localHour :awakeTime } . | |
31 { env: :localHour 22 } => { env: :localHour :awakeTime } . | |
32 { env: :localHour 23 } => { env: :localHour :awakeTime } . | |
33 | |
34 { | |
35 :auth :near :home . | |
118 | 36 dev:theaterDoorOutsideMotion :state :sustainedMotion . |
21 | 37 dev:theaterDoorOpen :state :closed . |
38 env: :localHour :awakeTime . | |
39 } => { dev:theaterDoorLock :state :unlocked } . | |
40 | |
41 { dev:frontDoorOpen :state :closed } => { dev:frontDoorOpenIndicator :text "_" } . | |
42 { dev:frontDoorOpen :state :open } => { dev:frontDoorOpenIndicator :text "D" } . | |
43 | |
44 { dev:frontDoorMotion :state :noMotion } => { | |
45 dev:frontDoorMotionIndicator :text "_" . | |
46 dev:frontDoorLcd :brightness 0 . | |
47 } . | |
48 { dev:frontDoorMotion :state :motion } => { | |
49 dev:frontDoorMotionIndicator :text "D" . | |
50 dev:frontDoorLcd :brightness 255 . | |
51 } . | |
31 | 52 |
54
42411726a7ca
screen out more values that change on every update
drewp@bigasterisk.com
parents:
31
diff
changeset
|
53 { :darkKey :state :press } => { |
248 | 54 dash:monitor :powerState :off . |
54
42411726a7ca
screen out more values that change on every update
drewp@bigasterisk.com
parents:
31
diff
changeset
|
55 } . |
42411726a7ca
screen out more values that change on every update
drewp@bigasterisk.com
parents:
31
diff
changeset
|
56 |
88
3988aaa5ea82
change cactus button to one that works. yellow button plays music
drewp@bigasterisk.com
parents:
67
diff
changeset
|
57 { <http://projects.bigasterisk.com/room/star/button/blu> :change :down . } => |
67 | 58 { |
248 | 59 star:slideshow :postAction star:slideshowadvance . |
60 star:slideshow :postAction <http://star:9049/effects/beep2> . | |
88
3988aaa5ea82
change cactus button to one that works. yellow button plays music
drewp@bigasterisk.com
parents:
67
diff
changeset
|
61 } . |
3988aaa5ea82
change cactus button to one that works. yellow button plays music
drewp@bigasterisk.com
parents:
67
diff
changeset
|
62 |
3988aaa5ea82
change cactus button to one that works. yellow button plays music
drewp@bigasterisk.com
parents:
67
diff
changeset
|
63 |
3988aaa5ea82
change cactus button to one that works. yellow button plays music
drewp@bigasterisk.com
parents:
67
diff
changeset
|
64 { <http://projects.bigasterisk.com/room/star/button/yel> :change :down . } => |
3988aaa5ea82
change cactus button to one that works. yellow button plays music
drewp@bigasterisk.com
parents:
67
diff
changeset
|
65 { |
248 | 66 star:slideshow :postAction star:slideshowtoggleFeeder . |
67 star:slideshow :postAction <http://star:9049/effects/beep1> . | |
88
3988aaa5ea82
change cactus button to one that works. yellow button plays music
drewp@bigasterisk.com
parents:
67
diff
changeset
|
68 } . |
3988aaa5ea82
change cactus button to one that works. yellow button plays music
drewp@bigasterisk.com
parents:
67
diff
changeset
|
69 |
181
71577a849628
new reasoning config for storage motion.
drewp@bigasterisk.com
parents:
129
diff
changeset
|
70 { <http://projects.bigasterisk.com/room/barcodeScan> <http://projects.bigasterisk.com/room/read> <http://projects.bigasterisk.com/room/barcode/UPC-A/4984343881945> } => |
71577a849628
new reasoning config for storage motion.
drewp@bigasterisk.com
parents:
129
diff
changeset
|
71 { |
248 | 72 star:slideshow :postAction <http://star:9049/effects/troyandabed> . |
181
71577a849628
new reasoning config for storage motion.
drewp@bigasterisk.com
parents:
129
diff
changeset
|
73 } . |
71577a849628
new reasoning config for storage motion.
drewp@bigasterisk.com
parents:
129
diff
changeset
|
74 |
71577a849628
new reasoning config for storage motion.
drewp@bigasterisk.com
parents:
129
diff
changeset
|
75 @prefix bed: <http://projects.bigasterisk.com/room/ariBed/> . |
71577a849628
new reasoning config for storage motion.
drewp@bigasterisk.com
parents:
129
diff
changeset
|
76 { bed:button1 :change :down . } => { |
248 | 77 star:slideshow :postAction <http://brace:9055/starTrekLight/toggle> . |
78 star:slideshow :postAction <http://brace:9049/effects/highlight> . | |
181
71577a849628
new reasoning config for storage motion.
drewp@bigasterisk.com
parents:
129
diff
changeset
|
79 } . |
248 | 80 { bed:button2 :change :down . } => { star:slideshow :postAction <http://brace:9049/effects/troyandabed> . } . |
81 { bed:button3 :change :down . } => { star:slideshow :postAction <http://brace:9049/effects/beep1> . } . | |
82 { bed:button4 :change :down . } => { star:slideshow :postAction <http://brace:9049/effects/beep1> . } . | |
83 { bed:button5 :change :down . } => { star:slideshow :postAction <http://brace:9049/effects/jazztrumpet> . } . | |
181
71577a849628
new reasoning config for storage motion.
drewp@bigasterisk.com
parents:
129
diff
changeset
|
84 |
129
745eff67ad40
reasoning actions: generalize them a bit but then add a bunch of special cases for mpd for now
drewp@bigasterisk.com
parents:
118
diff
changeset
|
85 |
745eff67ad40
reasoning actions: generalize them a bit but then add a bunch of special cases for mpd for now
drewp@bigasterisk.com
parents:
118
diff
changeset
|
86 # sound wasn't responding; waiting for other button fixes |
745eff67ad40
reasoning actions: generalize them a bit but then add a bunch of special cases for mpd for now
drewp@bigasterisk.com
parents:
118
diff
changeset
|
87 # { <http://projects.bigasterisk.com/room/star/button/yel> :change :down . } => |
745eff67ad40
reasoning actions: generalize them a bit but then add a bunch of special cases for mpd for now
drewp@bigasterisk.com
parents:
118
diff
changeset
|
88 # { |
248 | 89 # star:sound :postAction <http://star:9049/sound?filename=/my/music/ubuntuone/Daft+Punk/Discovery/Harder+Better+Faster+Stronger.mp3> . |
129
745eff67ad40
reasoning actions: generalize them a bit but then add a bunch of special cases for mpd for now
drewp@bigasterisk.com
parents:
118
diff
changeset
|
90 # } . |
745eff67ad40
reasoning actions: generalize them a bit but then add a bunch of special cases for mpd for now
drewp@bigasterisk.com
parents:
118
diff
changeset
|
91 |
88
3988aaa5ea82
change cactus button to one that works. yellow button plays music
drewp@bigasterisk.com
parents:
67
diff
changeset
|
92 { <http://projects.bigasterisk.com/room/livingRoom/shuttlepro/dial> :change :up . } => { |
248 | 93 slash:sound :postAction <http://slash:9049/volume?offset=.05&max=.6> . |
88
3988aaa5ea82
change cactus button to one that works. yellow button plays music
drewp@bigasterisk.com
parents:
67
diff
changeset
|
94 } . |
3988aaa5ea82
change cactus button to one that works. yellow button plays music
drewp@bigasterisk.com
parents:
67
diff
changeset
|
95 |
3988aaa5ea82
change cactus button to one that works. yellow button plays music
drewp@bigasterisk.com
parents:
67
diff
changeset
|
96 { <http://projects.bigasterisk.com/room/livingRoom/shuttlepro/dial> :change :down . } => { |
248 | 97 slash:sound :postAction <http://slash:9049/volume?offset=-.05&max=.6> . |
67 | 98 } . |
99 | |
54
42411726a7ca
screen out more values that change on every update
drewp@bigasterisk.com
parents:
31
diff
changeset
|
100 { |
42411726a7ca
screen out more values that change on every update
drewp@bigasterisk.com
parents:
31
diff
changeset
|
101 # this won't update right, currently, since I don't let the exact |
42411726a7ca
screen out more values that change on every update
drewp@bigasterisk.com
parents:
31
diff
changeset
|
102 # idle time into the rules recalculator. This threshold should be |
42411726a7ca
screen out more values that change on every update
drewp@bigasterisk.com
parents:
31
diff
changeset
|
103 # applied upstream. |
42411726a7ca
screen out more values that change on every update
drewp@bigasterisk.com
parents:
31
diff
changeset
|
104 |
248 | 105 dash:xidle :idleTimeMinutes ?idle . |
199 | 106 # broken with new fuxi- needs review: ?idle math:lessThan 30 . |
54
42411726a7ca
screen out more values that change on every update
drewp@bigasterisk.com
parents:
31
diff
changeset
|
107 } => { |
42411726a7ca
screen out more values that change on every update
drewp@bigasterisk.com
parents:
31
diff
changeset
|
108 :drew :at :desk . |
42411726a7ca
screen out more values that change on every update
drewp@bigasterisk.com
parents:
31
diff
changeset
|
109 # the plan here is that as soon as we can show that I'm not at my |
42411726a7ca
screen out more values that change on every update
drewp@bigasterisk.com
parents:
31
diff
changeset
|
110 # desk (cell phone wifi, asleep, etc), power the screen off |
42411726a7ca
screen out more values that change on every update
drewp@bigasterisk.com
parents:
31
diff
changeset
|
111 } . |
129
745eff67ad40
reasoning actions: generalize them a bit but then add a bunch of special cases for mpd for now
drewp@bigasterisk.com
parents:
118
diff
changeset
|
112 |
745eff67ad40
reasoning actions: generalize them a bit but then add a bunch of special cases for mpd for now
drewp@bigasterisk.com
parents:
118
diff
changeset
|
113 @prefix shuttle: <http://bigasterisk.com/room/livingRoom/shuttlepro/> . |
745eff67ad40
reasoning actions: generalize them a bit but then add a bunch of special cases for mpd for now
drewp@bigasterisk.com
parents:
118
diff
changeset
|
114 @prefix mpd: <http://bigasterisk.com/host/slash/mpd> . |
745eff67ad40
reasoning actions: generalize them a bit but then add a bunch of special cases for mpd for now
drewp@bigasterisk.com
parents:
118
diff
changeset
|
115 |
745eff67ad40
reasoning actions: generalize them a bit but then add a bunch of special cases for mpd for now
drewp@bigasterisk.com
parents:
118
diff
changeset
|
116 { ?button :state :press . ?button :playsMusic ?song } => { mpd: :startMusic ?song } . |
745eff67ad40
reasoning actions: generalize them a bit but then add a bunch of special cases for mpd for now
drewp@bigasterisk.com
parents:
118
diff
changeset
|
117 # the rest of this modeling is still a mess. Handled completely by special case in reasoning.py |
745eff67ad40
reasoning actions: generalize them a bit but then add a bunch of special cases for mpd for now
drewp@bigasterisk.com
parents:
118
diff
changeset
|
118 { shuttle:button12 :state :press } => { mpd: :playState :pause } . |
745eff67ad40
reasoning actions: generalize them a bit but then add a bunch of special cases for mpd for now
drewp@bigasterisk.com
parents:
118
diff
changeset
|
119 { shuttle:dial :change :clockwise } => { mpd: :audioState :volumeStepUp } . |
745eff67ad40
reasoning actions: generalize them a bit but then add a bunch of special cases for mpd for now
drewp@bigasterisk.com
parents:
118
diff
changeset
|
120 { shuttle:dial :change :counterclockwise } => { mpd: :audioState :volumeStepDown } . |
181
71577a849628
new reasoning config for storage motion.
drewp@bigasterisk.com
parents:
129
diff
changeset
|
121 |
71577a849628
new reasoning config for storage motion.
drewp@bigasterisk.com
parents:
129
diff
changeset
|
122 { <http://bigasterisk.com/homeauto/sensor/motion0> :seesRecently <http://projects.bigasterisk.com/room/noMotion> . } => { |
276 | 123 :storageCeilingLedCross :brightness 0 . |
124 :storageCeilingLedLong :brightness 0 . | |
181
71577a849628
new reasoning config for storage motion.
drewp@bigasterisk.com
parents:
129
diff
changeset
|
125 } . |
71577a849628
new reasoning config for storage motion.
drewp@bigasterisk.com
parents:
129
diff
changeset
|
126 |
71577a849628
new reasoning config for storage motion.
drewp@bigasterisk.com
parents:
129
diff
changeset
|
127 { <http://bigasterisk.com/homeauto/sensor/motion0> :seesRecently <http://projects.bigasterisk.com/room/motion> . } => { |
276 | 128 :storageCeilingLedCross :brightness 1 . |
129 :storageCeilingLedLong :brightness 1 . | |
181
71577a849628
new reasoning config for storage motion.
drewp@bigasterisk.com
parents:
129
diff
changeset
|
130 } . |
247 | 131 |
251
254df9f881a6
start sending oneshot events from some devices
drewp@bigasterisk.com
parents:
248
diff
changeset
|
132 { <http://bigasterisk.com/homeauto/sensor/motion0> :sees <http://projects.bigasterisk.com/room/motionStart> . } => { |
276 | 133 :storageCeilingLedCross :brightness 1 . |
134 :storageCeilingLedLong :brightness 1 . | |
251
254df9f881a6
start sending oneshot events from some devices
drewp@bigasterisk.com
parents:
248
diff
changeset
|
135 } . |
254df9f881a6
start sending oneshot events from some devices
drewp@bigasterisk.com
parents:
248
diff
changeset
|
136 |
247 | 137 @prefix bed: <http://bigasterisk.com/homeauto/sensor/bed/> . |
138 | |
251
254df9f881a6
start sending oneshot events from some devices
drewp@bigasterisk.com
parents:
248
diff
changeset
|
139 { bed:greenButton :buttonState :press } => { |
276 | 140 :headboardWhite :brightness 0.0 . |
247 | 141 } . |
142 | |
278
4b0282900fd3
try a 2-mode rule for redButton, but this can't work as-is
drewp@bigasterisk.com
parents:
277
diff
changeset
|
143 { bed:redButton :buttonState :press . :headboardWhite :brightness 0.0 . } => { |
283
0b0fb67b0b3a
fix input/output statement ambiguity problem by allowing quoted output statements
drewp@bigasterisk.com
parents:
278
diff
changeset
|
144 # Desired: |
0b0fb67b0b3a
fix input/output statement ambiguity problem by allowing quoted output statements
drewp@bigasterisk.com
parents:
278
diff
changeset
|
145 # :output :subgraph { :headboardWhite :brightness 0.2 } |
0b0fb67b0b3a
fix input/output statement ambiguity problem by allowing quoted output statements
drewp@bigasterisk.com
parents:
278
diff
changeset
|
146 # but I haven't been able to extract the inner graph triples yet. |
0b0fb67b0b3a
fix input/output statement ambiguity problem by allowing quoted output statements
drewp@bigasterisk.com
parents:
278
diff
changeset
|
147 :output :statement [ :subj :headboardWhite; :pred :brightness; :obj 0.2 ] . |
278
4b0282900fd3
try a 2-mode rule for redButton, but this can't work as-is
drewp@bigasterisk.com
parents:
277
diff
changeset
|
148 } . |
4b0282900fd3
try a 2-mode rule for redButton, but this can't work as-is
drewp@bigasterisk.com
parents:
277
diff
changeset
|
149 |
4b0282900fd3
try a 2-mode rule for redButton, but this can't work as-is
drewp@bigasterisk.com
parents:
277
diff
changeset
|
150 { bed:redButton :buttonState :press . :headboardWhite :brightness 0.2 . } => { |
283
0b0fb67b0b3a
fix input/output statement ambiguity problem by allowing quoted output statements
drewp@bigasterisk.com
parents:
278
diff
changeset
|
151 :output :statement [ :subj :headboardWhite; :pred :brightness; :obj 1 ] . |
254
ba1149814877
pi device support for motionStart edge trigger
drewp@bigasterisk.com
parents:
251
diff
changeset
|
152 } . |
ba1149814877
pi device support for motionStart edge trigger
drewp@bigasterisk.com
parents:
251
diff
changeset
|
153 |
ba1149814877
pi device support for motionStart edge trigger
drewp@bigasterisk.com
parents:
251
diff
changeset
|
154 @prefix sensor: <http://bigasterisk.com/homeauto/sensor/> . |
ba1149814877
pi device support for motionStart edge trigger
drewp@bigasterisk.com
parents:
251
diff
changeset
|
155 { sensor:buttonAriBed :buttonState :press } => { |
ba1149814877
pi device support for motionStart edge trigger
drewp@bigasterisk.com
parents:
251
diff
changeset
|
156 :starTrekLight :brightness 0.0 . |
ba1149814877
pi device support for motionStart edge trigger
drewp@bigasterisk.com
parents:
251
diff
changeset
|
157 } . |
ba1149814877
pi device support for motionStart edge trigger
drewp@bigasterisk.com
parents:
251
diff
changeset
|
158 |
277
960a587e51d7
updates to changingtable motion rules
drewp@bigasterisk.com
parents:
276
diff
changeset
|
159 { sensor:motionChanging :seesRecently30 :noMotion } => { |
254
ba1149814877
pi device support for motionStart edge trigger
drewp@bigasterisk.com
parents:
251
diff
changeset
|
160 :changingWhite :brightness 0.0 . |
ba1149814877
pi device support for motionStart edge trigger
drewp@bigasterisk.com
parents:
251
diff
changeset
|
161 } . |
ba1149814877
pi device support for motionStart edge trigger
drewp@bigasterisk.com
parents:
251
diff
changeset
|
162 |
277
960a587e51d7
updates to changingtable motion rules
drewp@bigasterisk.com
parents:
276
diff
changeset
|
163 { sensor:motionChanging :seesRecently30 :motion } => { |
960a587e51d7
updates to changingtable motion rules
drewp@bigasterisk.com
parents:
276
diff
changeset
|
164 :changingWhite :brightness 0.3 . |
254
ba1149814877
pi device support for motionStart edge trigger
drewp@bigasterisk.com
parents:
251
diff
changeset
|
165 } . |
ba1149814877
pi device support for motionStart edge trigger
drewp@bigasterisk.com
parents:
251
diff
changeset
|
166 |
277
960a587e51d7
updates to changingtable motion rules
drewp@bigasterisk.com
parents:
276
diff
changeset
|
167 { sensor:motionChanging :sees :motionStart90 } => { |
254
ba1149814877
pi device support for motionStart edge trigger
drewp@bigasterisk.com
parents:
251
diff
changeset
|
168 :changingCam :grab <http://bang:9057/changing.jpg> . |
264 | 169 } . |
170 | |
171 { :bookSwitch :buttonState :press . :livingRoomLamp1 :brightness 0.0 . } => { | |
172 :livingRoomLamp1 :brightness 1.0 . :livingRoomLamp2 :brightness 1.0 } . | |
173 { :bookSwitch :buttonState :press . :livingRoomLamp1 :brightness 1.0 . } => { | |
174 :livingRoomLamp1 :brightness 0.0 . :livingRoomLamp2 :brightness 0.0 } . | |
276 | 175 |