W3C home > Mailing lists > Public > www-rdf-rules@w3.org > January 2004

RE: A question on RuleML

From: Boley, Harold <Harold.Boley@nrc-cnrc.gc.ca>
Date: Thu, 8 Jan 2004 17:28:02 -0500
Message-ID: <10C94843061E094A98C02EB77CFC3287026DF78C@nrcmrdex1d.imsb.nrc.ca>
To: 'ntts264' <ntts264@hcmpt.vnn.vn>, www-rdf-rules@w3.org

Hello Sang Thi Thanh Nguyen,

> What is the inference in RuleML?

> Ex: If "A keeps a book" then "A owns the book".
> Is this rule the inference?

Well, the earlier RuleML 'own' rule example
(http://www.ruleml.org/indtd0.8.html) could now
be typed and restricted to books to represent

If
    a person P buys a book B from a merchant M
  and
    P keeps B
then
  P owns B

as part of the following rulebase:

<ruleml:rulebase
 xmlns:ruleml="http://www.ruleml.org/inspec"
 xmlns:t="http://ontolib.org#">

  <imp>
    <_body>
      <and>
        <atom>
          <_opr><rel>buy</rel></_opr>
          <var type="t:Person">P</var>
          <var type="t:Merchant">M</var>
          <var type="t:Book">B</var>
        </atom>
        <atom>
          <_opr><rel>keep</rel></_opr>
          <var type="t:Person">P</var>
          <var type="t:Book">B</var>
        </atom>
      </and>
    </_body>
    <_head>
      <atom>
        <_opr><rel>own</rel></_opr>
        <var type="t:Person">P</var>
        <var type="t:Book">B</var>
      </atom>
    </_head>
  </imp>

  <fact>
    <_head>
      <atom>
        <_opr><rel>buy</rel></_opr>
        <ind>Mary</ind>
        <ind>John</ind>
        <ind>XMLBible</ind>
      </atom>
    </_head>
  </fact>

  <fact>
    <_head>
      <atom>
        <_opr><rel>keep</rel></_opr>
        <ind>Mary</ind>
        <ind>XMLBible</ind>
      </atom>
    </_head>
  </fact>

</ruleml:rulebase>

Using this rule, the two facts, and appropriate (OWL/RDFS) types
for Mary, John, and XMLBible, the query

<ruleml:query
 xmlns:ruleml="http://www.ruleml.org/inspec"
 xmlns:t="http://ontolib.org#">
  <_body>
    <atom>
      <_opr><rel>own</rel></_opr>
      <ind>Mary</ind>
      <var type="t:Book">W</var>
    </atom>
  </_body>
</ruleml:query>

would successfully bind W to XMLBible as the result of an
inference.

Similarly, the query

<ruleml:query
 xmlns:ruleml="http://www.ruleml.org/inspec"
 xmlns:t="http://ontolib.org#">
  <_body>
    <atom>
      <_opr><rel>keep</rel></_opr>
      <ind>Mary</ind>
      <var type="t:Book">W</var>
    </atom>
  </_body>
</ruleml:query>

would successfully bind W to XMLBible as the result of a
direct lookup.

The system asking such queries would not need to know which
ones are being answered by inference vs. by direct lookup.
This will also permit to change the rulebase 'implementation'
(e.g. by adding often-used 'own' facts), without changing the
query interface.

Best,
Harold
Received on Thursday, 8 January 2004 17:58:45 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 2 March 2016 11:10:15 UTC