view service/reasoning/rules.n3 @ 986:b279ca8d2894

new reasoning config for storage motion. Ignore-this: a7c024dd4e9226ac7a27c3c3ce98f165 darcs-hash:20150514083315-312f9-f8a020fb757f129bd4207b6e20cdafde472c9839
author drewp <drewp@bigasterisk.com>
date Thu, 14 May 2015 01:33:15 -0700
parents 3bb18b7d21df
children 7d897fe34306
line wrap: on
line source

# rules only! statements in this file will not be considered in the graph

@prefix : <http://projects.bigasterisk.com/room/>.
@prefix bigast: <http://bigasterisk.com/>.
@prefix dev: <http://projects.bigasterisk.com/device/>.
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix env: <http://projects.bigasterisk.com/device/environment>.
@prefix math: <http://www.w3.org/2000/10/swap/math#> .

{ <http://bigasterisk.com/wifiDevice/x> :connected bigast:wifiAccessPoints . } => { :auth :near :home } .
{ <http://bigasterisk.com/wifiDevice/x> :connected bigast:wifiAccessPoints . } => { :auth :near :home } .
{ <http://bigasterisk.com/wifiDevice/x> :connected bigast:wifiAccessPoints . } => { :playstation :powerState :on } .

{ env: :localHour 8 } => { env: :localHour :awakeTime } .
{ env: :localHour 9 } => { env: :localHour :awakeTime } .
{ env: :localHour 10 } => { env: :localHour :awakeTime } .
{ env: :localHour 11 } => { env: :localHour :awakeTime } .
{ env: :localHour 12 } => { env: :localHour :awakeTime } .
{ env: :localHour 13 } => { env: :localHour :awakeTime } .
{ env: :localHour 14 } => { env: :localHour :awakeTime } .
{ env: :localHour 15 } => { env: :localHour :awakeTime } .
{ env: :localHour 16 } => { env: :localHour :awakeTime } .
{ env: :localHour 17 } => { env: :localHour :awakeTime } .
{ env: :localHour 18 } => { env: :localHour :awakeTime } .
{ env: :localHour 19 } => { env: :localHour :awakeTime } .
{ env: :localHour 20 } => { env: :localHour :awakeTime } .
{ env: :localHour 21 } => { env: :localHour :awakeTime } .
{ env: :localHour 22 } => { env: :localHour :awakeTime } .
{ env: :localHour 23 } => { env: :localHour :awakeTime } .

{
  :auth :near :home .
  dev:theaterDoorOutsideMotion :state :sustainedMotion .
  dev:theaterDoorOpen :state :closed .
  env: :localHour :awakeTime .
} => { dev:theaterDoorLock :state :unlocked } .

{ dev:frontDoorOpen :state :closed } => { dev:frontDoorOpenIndicator :text "_" } .
{ dev:frontDoorOpen :state :open } => { dev:frontDoorOpenIndicator :text "D" } .

{ dev:frontDoorMotion :state :noMotion } => { 
  dev:frontDoorMotionIndicator :text "_" .
  dev:frontDoorLcd :brightness 0 .
} .
{ dev:frontDoorMotion :state :motion } => { 
  dev:frontDoorMotionIndicator :text "D" .
  dev:frontDoorLcd :brightness 255 .
} .

{ :darkKey :state :press } => {
  <http://bigasterisk.com/host/dash/monitor> :powerState :off .
} .

{ <http://projects.bigasterisk.com/room/star/button/blu> :change :down . } =>
{
  <http://bigasterisk.com/host/star/slideshow> :postAction <http://bigasterisk.com/host/star/slideshow/advance> .
  <http://bigasterisk.com/host/star/slideshow> :postAction <http://star:9049/effects/beep2> .
} .


{ <http://projects.bigasterisk.com/room/star/button/yel> :change :down . } =>
{
  <http://bigasterisk.com/host/star/slideshow> :postAction <http://bigasterisk.com/host/star/slideshow/toggleFeeder> .
  <http://bigasterisk.com/host/star/slideshow> :postAction <http://star:9049/effects/beep1> .
} .

{ <http://projects.bigasterisk.com/room/barcodeScan> <http://projects.bigasterisk.com/room/read> <http://projects.bigasterisk.com/room/barcode/UPC-A/4984343881945> } =>
{
  <http://bigasterisk.com/host/star/slideshow> :postAction <http://star:9049/effects/troyandabed> .
} .

@prefix bed: <http://projects.bigasterisk.com/room/ariBed/> . 
{ bed:button1 :change :down . } => {
  <http://bigasterisk.com/host/star/slideshow> :postAction <http://brace:9055/starTrekLight/toggle> .
  <http://bigasterisk.com/host/star/slideshow> :postAction <http://brace:9049/effects/highlight> .
} .
{ bed:button2 :change :down . } => { <http://bigasterisk.com/host/star/slideshow> :postAction <http://brace:9049/effects/troyandabed> . } .
{ bed:button3 :change :down . } => { <http://bigasterisk.com/host/star/slideshow> :postAction <http://brace:9049/effects/beep1> . } .
{ bed:button4 :change :down . } => { <http://bigasterisk.com/host/star/slideshow> :postAction <http://brace:9049/effects/beep1> . } .
{ bed:button5 :change :down . } => { <http://bigasterisk.com/host/star/slideshow> :postAction <http://brace:9049/effects/jazztrumpet> . } .


# sound wasn't responding; waiting for other button fixes
# { <http://projects.bigasterisk.com/room/star/button/yel> :change :down . } =>
# {
#   <http://bigasterisk.com/host/star/sound> :postAction <http://star:9049/sound?filename=/my/music/ubuntuone/Daft+Punk/Discovery/Harder+Better+Faster+Stronger.mp3> .
# } .

{ <http://projects.bigasterisk.com/room/livingRoom/shuttlepro/dial> :change :up . } => {
  <http://bigasterisk.com/host/slash/sound> :postAction <http://slash:9049/volume?offset=.05&max=.6> .
} .

{ <http://projects.bigasterisk.com/room/livingRoom/shuttlepro/dial> :change :down . } => {
  <http://bigasterisk.com/host/slash/sound> :postAction <http://slash:9049/volume?offset=-.05&max=.6> .
} .

#{ :playstation :powerState ?s } => { <http://bigasterisk.com/host/bang/monitor> :powerState ?s } .

{
  # this won't update right, currently, since I don't let the exact
  # idle time into the rules recalculator. This threshold should be
  # applied upstream.
 
  <http://bigasterisk.com/host/dash/xidle> :idleTimeMinutes ?idle .
  ?idle math:lessThan 30 .
} => {
  :drew :at :desk .
  # the plan here is that as soon as we can show that I'm not at my
  # desk (cell phone wifi, asleep, etc), power the screen off
} .

@prefix shuttle: <http://bigasterisk.com/room/livingRoom/shuttlepro/> .
@prefix mpd: <http://bigasterisk.com/host/slash/mpd> .

{ ?button :state :press . ?button :playsMusic ?song } => { mpd: :startMusic ?song } .
# the rest of this modeling is still a mess. Handled completely by special case in reasoning.py
{ shuttle:button12 :state :press         } => { mpd: :playState :pause } .
{ shuttle:dial :change :clockwise        } => { mpd: :audioState :volumeStepUp } .
{ shuttle:dial :change :counterclockwise } => { mpd: :audioState :volumeStepDown } .

{ <http://bigasterisk.com/homeauto/sensor/motion0> :seesRecently <http://projects.bigasterisk.com/room/noMotion> . } => {
  :storageCeilingLedCross :brightness "0" .
  :storageCeilingLedLong :brightness "0" .
} .

{ <http://bigasterisk.com/homeauto/sensor/motion0> :seesRecently <http://projects.bigasterisk.com/room/motion> . } => {
  :storageCeilingLedCross :brightness "1" .
  :storageCeilingLedLong :brightness "1" .
} .