<?xml version="1.0" standalone="no"?>
<!DOCTYPE rulebase SYSTEM "http://www.dfki.de/ruleml/dtd/0.8/ruleml-datalog.dtd">

<!--  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  -->
<!--                                                               -->
<!--  From Mike Dean to JC, on Monday May 12th, 2003:              -->
<!--                                                               -->
<!--  I promised to suggest several examples to help us compare    -->
<!--  the Horn clause subsets of RuleML and SCL:                   -->
<!--                                                               -->
<!--  1) An employee of a (subsidiary) Company is also an employee -->
<!--     of its parent Company.                                    -->
<!--                                                               -->
<!--  2) The uncle of a Person is either the brother of their      -->
<!--     parent, or the husband of their aunt.                     -->
<!--                                                               -->
<!--  3) 2 *distinct* children in the same Family are siblings.    -->
<!--                                                               -->
<!--	Mike                                                       -->
<!--                                                               -->
<!--  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  -->
<!--  Implementation of rules 1) and 2) in Datalog                 -->
<!--  Said Tabet, May 13th, 2003.                                  -->
<!--  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  -->

<rulebase>

<!--  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  -->
<!--  RULE 1. label: employeerule1                                 -->
<!--  An employee of a (subsidiary) Company is also an employee    -->
<!--  of its parent Company.                                       -->
<!--  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  -->

<imp>
  <_rlab><ind>employeerule1</ind></_rlab>
  <_head>
    <atom>
      <_opr><rel>employeeof</rel></_opr>
      <var>employee</var>
      <var>parentcompany</var>
    </atom>
  </_head>
  <_body>
    <atom>
      <_opr><rel>employeeof</rel></_opr>
      <var>employee</var>
      <var>company</var>
    </atom>
    <atom>
      <_opr><rel>subsidiaryof</rel></_opr>
      <var>company</var>
      <var>parentcompany</var>
    </atom>
  </_body>
</imp>

<!--  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  -->
<!--  RULE 2a (divided into 2 rules). label: unclerule1             -->
<!--  The brother of a parent of a Person is                       -->
<!--  the uncle of that Person.                                    -->
<!--                                                               -->
<!--  NOTE: This rule has already been implemented by Mike Dean.   -->
<!--                                                               -->
<!--  SEE: http://www.daml.org/2001/02/gedcom-ruleml/              -->
<!--  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  -->

<imp>
  <_rlab><ind>unclerule1</ind></_rlab>
  <_head>
    <atom>
      <_opr><rel>uncle</rel></_opr>
      <var>b</var>
      <var>p</var>
    </atom>
  </_head>
  <_body>
    <atom>
      <_opr><rel>person</rel></_opr>
      <var>p</var>
    </atom>
    <atom>
      <_opr><rel>parent</rel></_opr>
      <var>pa</var>
      <var>p</var>
    </atom>
    <atom>
      <_opr><rel>brother</rel></_opr>
      <var>b</var>
      <var>pa</var>
    </atom>
  </_body>
</imp>

<!--  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  -->
<!--  RULE 2b. label: unclerule2                                   -->
<!--  The husband of the aunt of a Person is                       -->
<!--  the uncle of that Person.                                    -->
<!--                                                               -->
<!--  NOTE: This rule has already been implemented by Mike Dean.   -->
<!--                                                               -->
<!--  SEE: http://www.daml.org/2001/02/gedcom-ruleml/              -->
<!--  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  -->

<imp>
  <_rlab><ind>unclerule2</ind></_rlab>
  <_head>
    <atom>
      <_opr><rel>uncle</rel></_opr>
      <var>h</var>
      <var>p</var>
    </atom>
  </_head>
  <_body>
    <atom>
      <_opr><rel>person</rel></_opr>
      <var>p</var>
    </atom>
    <atom>
      <_opr><rel>aunt</rel></_opr>
      <var>a</var>
      <var>p</var>
    </atom>
    <atom>
      <_opr><rel>husband</rel></_opr>
      <var>h</var>
      <var>a</var>
    </atom>
  </_body>
</imp>

<!--  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  -->
<!--  FACTS                                                        -->
<!--  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  -->



<!--  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  -->
<!--  FACT1: BBN is a subsidiary of Verizon                        -->
<!--  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  -->
<fact>
 <_head>
  <atom>
    <_opr><rel>subsidiaryof</rel></_opr>
    <ind>"BBN"</ind>
    <ind>"Verizon"</ind>
  </atom>
 </_head>
</fact>


<!--  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  -->
<!--  FACT2: Mike Dean is an employee of BBN                       -->
<!--  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  -->
<fact>
 <_head>
  <atom>
    <_opr><rel>employeeof</rel></_opr>
    <ind>"Mike Dean"</ind>
    <ind>"BBN"</ind>
  </atom>
 </_head>
</fact>


</rulebase>

