<?xml version="1.0" standalone="no"?>
<!DOCTYPE rulebase SYSTEM "http://www.ruleml.org/dtd/0.85/nafneg/nafnegdatalog.dtd">

<!-- a trivial example rulebase for testing the Datalog RuleML sublanguage, with both strong and weak negation -->

<rulebase
xmlns="http://www.ruleml.org/inspec"
xsi:schemaLocation="http://www.ruleml.org/inspec http://www.ruleml.org/modularization/star/nafnegdatalog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
direction="backward"
>

<imp>
  <_head>
     <atom>
      <_opr><rel>friend</rel></_opr>
      <_slot name="t"><var>b</var></_slot>
      <var>x</var>
      <var>y</var>
      <ind>Steph</ind>
     </atom>
  </_head>
  <_rlab><ind>(implication) rule label</ind></_rlab>
  <_body>
   <naf>
    <atom>
      <_opr><rel>friend</rel></_opr>
      <ind>Jane</ind>
      <ind>Joan</ind>
      <ind>Jack</ind>
      <var>y</var>
      <ind>Frank</ind>
    </atom>
   </naf>
  </_body>
</imp>

<imp>
  <_head>
     <atom>
      <_opr><rel>friend</rel></_opr>
      <_slot name="t"><var>b</var></_slot>
      <var>x</var>
      <var>y</var>
      <ind>Steph</ind>
     </atom>
  </_head>
  <_rlab><ind>(implication) rule label</ind></_rlab>
  <_body>
   <or>
    <naf>
     <atom>
      <_opr><rel>friend</rel></_opr>
      <ind>Jane</ind>
      <ind>Joan</ind>
      <ind>Jack</ind>
      <var>y</var>
      <ind>Frank</ind>
     </atom>
    </naf>
    <neg>
     <atom>
      <_opr><rel>friend</rel></_opr>
      <ind>Jane</ind>
      <ind>Joan</ind>
      <ind>Jack</ind>
      <var>y</var>
      <ind>Frank</ind>
     </atom>
    </neg>
   </or>
  </_body>
</imp>

<query>
  <_body>
    <and>
     <naf>
      <neg>
       <atom>
        <_opr><rel>some relation</rel></_opr>
        <_slot name="role_name1"><ind>role 1</ind></_slot>
        <ind>constant a</ind>
        <ind>constant b</ind>
        <_slot name="role_name2"><ind>role 2</ind></_slot>
       </atom>
      </neg>
     </naf>
      <neg>
       <atom>
        <_opr><rel>another relation</rel></_opr>
        <ind>constant c</ind>
        <ind>constant d</ind>
       </atom>
      </neg>
     <neg>
      <atom>
        <_opr><rel>some relation</rel></_opr>
        <_slot name="role_name1"><ind>role 1</ind></_slot>
        <ind>constant a</ind>
        <ind>constant b</ind>
        <_slot name="role_name2"><ind>role 2</ind></_slot>
      </atom>
     </neg>
     <neg>
      <atom>
        <_opr><rel>another relation</rel></_opr>
        <ind>constant c</ind>
        <ind>constant d</ind>
      </atom>
     </neg>
    </and>
  </_body>
  <_rlab><ind>rule (query) label</ind></_rlab>
</query>

<fact>
  <_rlab><ind>rule (fact) label</ind></_rlab>
  <_head>
    <atom>
      <_opr><rel>yet another relation</rel></_opr>
      <ind>constant e</ind>
      <ind>constant b</ind>
      <_slot name="role_name3"><ind>role 3</ind></_slot>
    </atom>
  </_head>
</fact>

<_rbaselab><ind>test rulebase</ind></_rbaselab>
</rulebase>
