Zapisanie reguł thermostatu za pomocą formatu RIF

<?xml version="1.0" encoding="UTF-8"?>
 
<Group xmlns="http://www.w3.org/2007/rif#">
 <sentence>
  <Implies>
   <if>
    <Or>
     <formula>
      <Equal>
       <side><Var>dayofweek</Var></side>
       <side><Const type="xsd:string">Monday</Const></side>
      </Equal>
     </formula>
     <formula>
      <Equal>
       <side><Var>dayofweek</Var></side>
       <side><Const type="xsd:string">Tuesday</Const></side>
      </Equal>
     </formula>
     <formula>
      <Equal>
       <side><Var>dayofweek</Var></side>
       <side><Const type="xsd:string">Wednesday</Const></side>
      </Equal>
     </formula>
     <formula>
      <Equal>
       <side><Var>dayofweek</Var></side>
      <side><Const type="xsd:string">Thursday</Const></side>
       </Equal>
     </formula>
     <formula>
      <Equal>
       <side><Var>dayofweek</Var></side>
       <side><Const type="xsd:string">Friday</Const></side>
      </Equal>
     </formula>
    </Or>
   </if>
   <then>
    <Atom>
     <op><Const type="rif:iri">thrm:is-workday</Const></op>
     <arg><Var>dayofweek</Var></arg>
    </Atom>
   </then>
  </Implies>
 </sentence>
 
 <sentence>
  <Implies>
   <if>
    <Or>
     <formula>
      <Equal>
       <side><Var>dayofweek</Var></side>
       <side><Const type="xsd:string">Saturday</Const></side>
      </Equal>
     </formula> 
     <formula>
      <Equal>
       <side><Var>dayofweek</Var></side>
       <side><Const type="xsd:string">Sunday</Const></side>
      </Equal>
     </formula>
    </Or>
   </if>
   <then>
     <Atom>
      <op><Const type="rif:iri">thrm:is-weekend</Const></op>
      <arg><Var>dayofweek</Var></arg>
     </Atom>
   </then>
  </Implies>
 </sentence>  
 
 <sentence>
  <Implies>
   <if>
    <And>
     <formula>
      <Atom>
       <op><Const type="rif:iri">thrm:is-weekend</Const></op>
       <arg>
        <External>
         <content>
          <Expr>
           <op><Const type="rif:iri">fn:get-dayOfWeek-from-DateTime</Const></op>
           <arg><Var>today</Var></arg>
          </Expr>
         </content>
        </External>
       </arg>
      </Atom>
     </formula>
     <formula>
      <External>
       <content>
        <Atom>
         <op><Const type="rif:iri">op:numeric-between</Const></op>
         <arg>
          <External>
           <content>
            <Expr>
             <op><Const type="rif:iri">fn:hours-from-dateTime</Const></op>
             <arg><Var>today</Var></arg>
            </Expr>
           </content>
          </External>
         </arg>
         <arg><Const type="xsd:DateTime">9am</Const></arg>
         <arg><Const type="xsd:DateTime">5pm</Const></arg>
        </Atom>
       </content>
      </External>
     </formula>
    </And>
   </if>
   <then>
    <Atom>
     <op><Const type="rif:iri">thrm:is-during-business-hours</Const></op>
     <arg><Var>today</Var></arg>
    </Atom>
   </then>
  </Implies>
 </sentence>
 
 <sentence>
  <Implies>
   <if>
    <And>
     <formula>
      <Atom>
       <op><Const type="rif:iri">thrm:is-workday</Const></op>
       <arg>
        <External>
         <content>
          <Expr>
           <op><Const type="rif:iri">fn:get-dayOfWeek-from-DateTime</Const></op>
           <arg><Var>today</Var></arg>
          </Expr>
         </content>
        </External>
       </arg>
      </Atom>
     </formula>
     <formula>
      <External>
       <content>
        <Atom>
         <op><Const type="rif:iri">op:numeric-less-than</Const></op>
         <arg>
          <External>
           <content>
            <Expr>
             <op><Const type="rif:iri">fn:hours-from-dateTime</Const></op>
             <arg><Var>today</Var></arg>
            </Expr>
           </content>
          </External>
         </arg>
         <arg><Const type="xsd:DateTime">9am</Const></arg>
        </Atom>
       </content>
      </External>
     </formula>
    </And>
   </if>
   <then>
    <Atom>
     <op><Const type="rif:iri">thrm:is-not-during-business-hours</Const></op>
    <arg><Var>today</Var></arg>
     </Atom>
   </then>
  </Implies>
 </sentence>
 
 <sentence>
  <Implies>
   <if>
    <And>
     <formula>
      <Atom>
       <op><Const type="rif:iri">thrm:is-workday</Const></op>
       <arg>
        <External>
         <content>
          <Expr>
           <op><Const type="rif:iri">fn:get-dayOfWeek-from-DateTime</Const></op>
           <arg><Var>today</Var></arg>
          </Expr>
         </content>
        </External>
       </arg>
      </Atom>
     </formula>
     <formula>
      <External>
       <content>
        <Atom>
         <op><Const type="rif:iri">op:numeric-greater-than</Const></op>
         <arg>
          <External>
           <content>
            <Expr>
             <op><Const type="rif:iri">fn:hours-from-dateTime</Const></op>
             <arg><Var>today</Var></arg>
            </Expr>
           </content>
          </External>
         </arg>
         <arg><Const type="xsd:DateTime">5pm</Const></arg>
        </Atom>
       </content>
      </External>
     </formula>
    </And>
   </if>
   <then>
     <Atom>
      <op><Const type="rif:iri">thrm:is-not-during-business-hours</Const></op>
      <arg><Var>today</Var></arg>
     </Atom>
   </then>
  </Implies>
 </sentence>   
 
 <sentence>
  <Implies>
   <if>
    <Atom>
     <op><Const type="rif:iri">thrm:is-weekend</Const></op>
     <arg>
      <External>
       <content>
        <Expr>
         <op><Const type="rif:iri">fn:get-dayOfWeek-from-DateTime</Const></op>
         <arg><Var>today</Var></arg>
        </Expr>
       </content>
      </External>
     </arg>
    </Atom>
   </if>
   <then>
    <Atom>
     <op><Const type="rif:iri">thrm:is-not-during-business-hours</Const></op>
     <arg><Var>today</Var></arg>
    </Atom>
   </then>
  </Implies>
 </sentence> 
 
 <sentence>
  <Implies>
   <if>
    <Or>
     <formula>
      <Equal>
       <side><Var>month</Var></side>
       <side><Const type="rds:string">January</Const></side>
      </Equal>
     </formula>
     <formula>
      <Equal>
       <side><Var>month</Var></side>
       <side><Const type="rds:string">February</Const></side>
      </Equal>
     </formula>
     <formula>
      <Equal>
       <side><Var>month</Var></side>
       <side><Const type="rds:string">December</Const></side>
      </Equal>
     </formula>
    </Or>
   </if>
   <then>
     <Atom>
      <op><Const type="rif:iri">thrm:is-summer</Const></op>
      <arg><Var>month</Var></arg>
     </Atom>
   </then> 
  </Implies>
 </sentence> 
 
 <sentence>
  <Implies>
   <if>
    <Or>
     <formula>
      <Equal>
       <side><Var>month</Var></side>
       <side><Const type="rds:string">March</Const></side>
      </Equal>
     </formula>
     <formula>
      <Equal>
       <side><Var>month</Var></side>
       <side><Const type="rds:string">April</Const></side>
      </Equal>
     </formula>
     <formula>
      <Equal>
       <side><Var>month</Var></side>
       <side><Const type="rds:string">May</Const></side>
      </Equal>
     </formula>
    </Or>
   </if>
   <then>
     <Atom>
      <op><Const type="rif:iri">thrm:is-atumn</Const></op>
      <arg><Var>month</Var></arg>
     </Atom>
    </then> 
  </Implies>
 </sentence> 
 
 
 <sentence>
  <Implies>
   <if>
    <Or>
     <formula>
      <Equal>
       <side><Var>month</Var></side>
       <side><Const type="rds:string">June</Const></side>
      </Equal>
     </formula>
     <formula>
      <Equal>
       <side><Var>month</Var></side>
       <side><Const type="rds:string">July</Const></side>
      </Equal>
     </formula>
     <formula>
      <Equal>
       <side><Var>month</Var></side>
       <side><Const type="rds:string">August</Const></side>
      </Equal>
     </formula>
    </Or>
   </if>
   <then>
     <Atom>
      <op><Const type="rif:iri">thrm:is-winter</Const></op>
      <arg><Var>month</Var></arg>
     </Atom>
   </then> 
  </Implies>
 </sentence> 
 
 
 <sentence>
  <Implies>
   <if>
    <Or>
     <formula>
      <Equal>
       <side><Var>month</Var></side>
       <side><Const type="rds:string">September</Const></side>
      </Equal>
     </formula>
     <formula>
      <Equal>
       <side><Var>month</Var></side>
       <side><Const type="rds:string">October</Const></side>
      </Equal>
     </formula>
     <formula>
      <Equal>
       <side><Var>month</Var></side>
       <side><Const type="rds:string">November</Const></side>
      </Equal>
     </formula>
    </Or>
   </if>
   <then>
     <Atom>
      <op><Const type="rif:iri">thrm:is-spring</Const></op>
      <arg><Var>month</Var></arg>
     </Atom>
   </then> 
  </Implies>
 </sentence>    
 
 
 <sentence>
  <Implies>
   <if>
    <And>
     <formula>
      <Atom>
       <op><Const type="rif:iri">thrm:is-spring</Const></op>
       <arg>
        <External>
         <content>
          <Expr>
           <op><Const type="rif:iri">fn:month-from-dateTime</Const></op>
           <arg><Var>date</Var></arg>
          </Expr>
         </content>
        </External> 
       </arg>
      </Atom>
     </formula>
     <formula>
      <Atom>
       <op><Const type="rif:iri">thrm:is-during-buisness-hours</Const></op>
       <arg><Var>date</Var></arg>
      </Atom>
     </formula> 
    </And>
   </if>
   <then>
     <Atom>
      <op><Const type="rif:iri">thrm:thermostat-setting</Const></op>
      <arg><Const type="rds:long">20</Const></arg>
     </Atom>
   </then>
  </Implies>
 </sentence> 
 
  <sentence>
  <Implies>
   <if>
    <And>
     <formula>
      <Atom>
       <op><Const type="rif:iri">thrm:is-spring</Const></op>
       <arg>
        <External>
         <content>
          <Expr>
           <op><Const type="rif:iri">fn:month-from-dateTime</Const></op>
           <arg><Var>date</Var></arg>
          </Expr>
         </content>
        </External> 
       </arg>
      </Atom>
     </formula>
     <formula>
      <Atom>
       <op><Const type="rif:iri">thrm:is-not-during-buisness-hours</Const></op>
       <arg><Var>date</Var></arg>
      </Atom>
     </formula> 
    </And>
   </if>
   <then>
     <Atom>
      <op><Const type="rif:iri">thrm:thermostat-setting</Const></op>
      <arg><Const type="rds:long">15</Const></arg>
     </Atom>
   </then>
  </Implies>
 </sentence>  
 
 <sentence>
  <Implies>
   <if>
    <And>
     <formula>
      <Atom>
       <op><Const type="rif:iri">thrm:is-summer</Const></op>
       <arg>
        <External>
         <content>
          <Expr>
           <op><Const type="rif:iri">fn:month-from-dateTime</Const></op>
           <arg><Var>date</Var></arg>
          </Expr>
         </content>
        </External> 
       </arg>
      </Atom>
     </formula>
     <formula>
      <Atom>
       <op><Const type="rif:iri">thrm:is-during-buisness-hours</Const></op>
       <arg><Var>date</Var></arg>
      </Atom>
     </formula> 
    </And>
   </if>
   <then>
     <Atom>
      <op><Const type="rif:iri">thrm:thermostat-setting</Const></op>
      <arg><Const type="rds:long">24</Const></arg>
     </Atom>
   </then>
  </Implies>
 </sentence>
 
 <sentence>
  <Implies>
   <if>
    <And>
     <formula>
      <Atom>
       <op><Const type="rif:iri">thrm:is-summer</Const></op>
       <arg>
        <External>
         <content>
          <Expr>
           <op><Const type="rif:iri">fn:month-from-dateTime</Const></op>
           <arg><Var>date</Var></arg>
          </Expr>
         </content>
        </External> 
       </arg>
      </Atom>
     </formula>
     <formula>
      <Atom>
       <op><Const type="rif:iri">thrm:is-not-during-buisness-hours</Const></op>
       <arg><Var>date</Var></arg>
      </Atom>
     </formula> 
    </And>
   </if>
   <then>
     <Atom>
      <op><Const type="rif:iri">thrm:thermostat-setting</Const></op>
      <arg><Const type="rds:long">27</Const></arg>
     </Atom>
   </then>
  </Implies>
 </sentence>
 
 <sentence>
  <Implies>
   <if>
    <And>
     <formula>
      <Atom>
       <op><Const type="rif:iri">thrm:is-atumn</Const></op>
       <arg>
        <External>
         <content>
          <Expr>
           <op><Const type="rif:iri">fn:month-from-dateTime</Const></op>
           <arg><Var>date</Var></arg>
          </Expr>
         </content>
        </External> 
       </arg>
      </Atom>
     </formula>
     <formula>
      <Atom>
       <op><Const type="rif:iri">thrm:is-during-buisness-hours</Const></op>
       <arg><Var>date</Var></arg>
      </Atom>
     </formula> 
    </And>
   </if>
   <then>
     <Atom>
      <op><Const type="rif:iri">thrm:thermostat-setting</Const></op>
      <arg><Const type="rds:long">20</Const></arg>
     </Atom>
   </then>
  </Implies>
 </sentence>
 
 <sentence>
  <Implies>
   <if>
    <And>
     <formula>
      <Atom>
       <op><Const type="rif:iri">thrm:is-atumn</Const></op>
       <arg>
        <External>
         <content>
          <Expr>
           <op><Const type="rif:iri">fn:month-from-dateTime</Const></op>
           <arg><Var>date</Var></arg>
          </Expr>
         </content>
        </External> 
       </arg>
      </Atom>
     </formula>
     <formula>
      <Atom>
       <op><Const type="rif:iri">thrm:is-not-during-buisness-hours</Const></op>
       <arg><Var>date</Var></arg>
      </Atom>
     </formula> 
    </And>
   </if>
   <then>
     <Atom>
      <op><Const type="rif:iri">thrm:thermostat-setting</Const></op>
      <arg><Const type="rds:long">16</Const></arg>
     </Atom>
   </then>
  </Implies>
 </sentence>
 
 <sentence>
  <Implies>
   <if>
    <And>
     <formula>
      <Atom>
       <op><Const type="rif:iri">thrm:is-winter</Const></op>
       <arg>
        <External>
         <content>
          <Expr>
           <op><Const type="rif:iri">fn:month-from-dateTime</Const></op>
           <arg><Var>date</Var></arg>
          </Expr>
         </content>
        </External> 
       </arg>
      </Atom>
     </formula>
     <formula>
      <Atom>
       <op><Const type="rif:iri">thrm:is-during-buisness-hours</Const></op>
       <arg><Var>date</Var></arg>
      </Atom>
     </formula> 
    </And>
   </if>
   <then>
     <Atom>
      <op><Const type="rif:iri">thrm:thermostat-setting</Const></op>
      <arg><Const type="rds:long">18</Const></arg>
     </Atom>
   </then>
  </Implies>
 </sentence>
 
 <sentence>
  <Implies>
   <if>
    <And>
     <formula>
      <Atom>
       <op><Const type="rif:iri">thrm:is-winter</Const></op>
       <arg>
        <External>
         <content>
          <Expr>
           <op><Const type="rif:iri">fn:month-from-dateTime</Const></op>
           <arg><Var>date</Var></arg>
          </Expr>
         </content>
        </External> 
       </arg>
      </Atom>
     </formula>
     <formula>
      <Atom>
       <op><Const type="rif:iri">thrm:is-not-during-buisness-hours</Const></op>
       <arg><Var>date</Var></arg>
      </Atom>
     </formula> 
    </And>
   </if>
   <then>
     <Atom>
      <op><Const type="rif:iri">thrm:thermostat-setting</Const></op>
      <arg><Const type="rds:long">14</Const></arg>
     </Atom>
   </then>
  </Implies>
 </sentence>
 
</Group>

Powrót do dokumentu

pl/miw/miw08_xtt_rif/thermostat.txt · ostatnio zmienione: 2017/07/17 08:08 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0