Examples of Using Builtins

POSL format

child(?person) :- hasAge(?person, ?age), lessThanOrEqual(?age, 18:Integer).
hasAge(baby, 5:Integer).

RuleML 0.88 format

<Assert>
   <And mapClosure="universal">
      <Implies>
         <And>
            <Atom>
               <Rel>hasAge</Rel>
               <Var>person</Var>
               <Var>age</Var>
            </Atom>
            <Atom>
               <Rel>lessThanOrEqual</Rel>
               <Var>age</Var>
               <Ind type="Integer">18</Ind>
            </Atom>
         </And>
         <Atom>
            <Rel>child</Rel>
            <Var>person</Var>
         </Atom>
      </Implies>
      <Atom>
         <Rel>hasAge</Rel>
         <Ind>baby</Ind>
         <Ind type="Integer">5</Ind>
      </Atom>
   </And>
</Assert>




POSL format

adult(?person) :- hasAge(?person,?age), greaterThan(?age,18:Integer).
hasAge(olderPerson,60:Integer).

RuleML 0.88 format

<Assert>
   <And mapClosure="universal">
      <Implies>
         <And>
            <Atom>
               <Rel>hasAge</Rel>
               <Var>person</Var>
               <Var>age</Var>
            </Atom>
            <Atom>
               <Rel>greaterThan</Rel>
               <Var>age</Var>
               <Ind type="Integer">18</Ind>
            </Atom>
         </And>
         <Atom>
            <Rel>adult</Rel>
            <Var>person</Var>
         </Atom>
      </Implies>
      <Atom>
         <Rel>hasAge</Rel>
         <Ind>olderPerson</Ind>
         <Ind type="Integer">60</Ind>
      </Atom>
   </And>
</Assert>





POSL format

result(?x) :- add(?x,10:Integer,15:Integer).

RuleML 0.88 format

<Assert>
   <And mapClosure="universal">
      <Implies>
         <Atom>
            <Rel>add</Rel>
            <Var>x</Var>
            <Ind type="Integer">10</Ind>
            <Ind type="Integer">15</Ind>
         </Atom>
         <Atom>
            <Rel>result</Rel>
            <Var>x</Var>
         </Atom>
      </Implies>
   </And>
</Assert>
	




Last Updated:
   December 2, 2006

By:
   Ben Craig