Menu

RIL: A Taste of Knowledge

October 11, 2000

Uche Ogbuji

RIL: A Taste of Knowledge

The previous section illustrated the basics of 4RDF, yet 4RDF has many other features. One of the more ground-breaking among those is RDF Inference Language, or RIL. RIL is considered experimental in 4RDF 0.9.1, but it does perform some heavy duty work in the OpenTechnology.org code, and is maturing rapidly.

RIL is likely to be familiar to anyone who has worked with Expert Systems or Prolog. It is a way to view an RDF model as a Expert System Knowledge Base, containing mappings from RDF statements to predicates with one or two "parameters," or, more accurately, skolem variables. In short, it allows you to say things like, "if such-and-such is true, then so-and-so is also true."

Predicates of more parameters and uncertainty factors are not yet natively supported by RIL, but they'll soon be incorporated. Unfortunately there isn't sufficient space here for a full discussion of RIL (look for a future article on the topic), but I shall illustrate with a short example of the vocabulary.


<?xml version="1.0"?>

<ril:expression

  xmlns:ril="http://namespaces.rdfInference.org/ril"

  xmlns:ft="http://namespaces.fourthought.com/test">

  <ril:assert>

    <ft:running>

        <ril:string-list>

          <ril:string>Akhilleus</ril:string>

          <ril:string>Hektor</ril:string>

        </ril:string-list>

    </ft:running>

    <ft:out-of-shape>

        <ril:string>Aias</ril:string>

        <ril:string>Hektor</ril:string>

    </ft:out-of-shape>

    <ft:wet>

        <ril:string-list>

          <ril:string>Odysseus</ril:string>

          <ril:string>Aeneas</ril:string>

        </ril:string-list>

    </ft:wet>

    <ft:swimming>

        <ril:string>Odysseus</ril:string>

        <ril:string>Asteropaios</ril:string>

    </ft:swimming>

  </ril:assert>



  <!-- if RUNNING(X) and OUT-OF-SHAPE(X) or WET(X) 

        and not SWIMMING(X) then SWEATING(X) -->

  <ril:rule>

    <ril:premise>

      <ft:running>

        <ril:variable name='X'/>

      </ft:running>

      <ril:and>

        <ft:out-of-shape>

          <ril:variable name='X'/>

        </ft:out-of-shape>

      </ril:and>

      <ril:or>

        <ft:wet>

          <ril:variable name='X'/>

        </ft:wet>

      </ril:or>

      <ril:not>

        <ft:swimming>

          <ril:variable name='X'/>

        </ft:swimming>

      </ril:not>

    </ril:premise>

    <ril:conclusion>

      <ril:assert>

        <ft:sweating>

          <ril:variable name='X'/>

        </ft:sweating>

      </ril:assert>

    </ril:conclusion>

  </ril:rule>

  <ril:fire/>

  <ril:query>

    <ft:sweating>

      <ril:variable name='X'/>

    </ft:sweating>

  </ril:query>

</ril:expression>

Notice first that RIL is 100% XML. I'm sure I don't have to mention that it's verbose, even for an XML language. This is one of the issues being worked out for RIL, with several abbreviations under consideration.

The first section (ril:expression/ril:assert) asserts some facts, which are naturally coded into the RDF model. A rough natural language equivalent is of these facts is "Achilleus and Hektor are running; Aias and Hektor are out of shape; Odysseus and Aeneas are wet; Odysseus and Asteropaios are swimming." The tokens running, out-of-shape and wet are RIL predicates, which basically map to RDF predicates. Note that RIL uses XML namespaces to disambiguate predicates. (Such similarity to RDF means that data coded in RIL and RDF are freely interchangeable. But that is hardly the main point.)

The second part of the listing (ril:expression/ril:rule) is a RIL rule. A RIL processor such as 4RDF can use such rules to intelligently expand the knowledge base represented by an RDF model. For instance, with the above RIL input on an empty model, not only would the direct assertions be added to the model, but additional statements derived from processing the rule (or rules, in most cases) would be added also. An approximate natural language equivalent for the rule in the listing is "if X is running and X is out of shape or X is wet and X is not swimming, then X must be sweating." Yes, there is a bit of a logical leap in there, but this is only an example. The key is that after firing the rule, there will be additional statements in RDF, namely that "Hektor is sweating" and "Aeneas is sweating."

Of course this very simple example doesn't show off much of the power of inference, but there is a great body of work that shows how effective the extrapolation of these features can be. RIL does real work in the developing OpenTechnology.org project, and it's proven a scalable and practical tool for automated RDF query and processing. RIL is a completely open technology, and Fourthought welcomes criticism and contribution. For now, the best forum for this is the RIL mailing list.

Summary

More in-depth information and references on 4RDF are available in the 4Suite package (some of which is also on the web site).

At Fourthought, RDF is the key to a proven design pattern, in which we build portal and intranet-type Web applications by marshalling numerous XML snippets. It helps us build multi-dimensional structures of object relationships, which are usually cumbersome and unmanageable using traditional database designs.

We developed 4RDF to meet the needs that emerged from such use, and it therefore has a very practical background, and it has extensions that provide needed features for closed middleware. It hasn't yet had much exposure in the open Web for which RDF was designed, and this will probably be the biggest test of its scalability and extensibility.