CS 6905 Semantic Web Techniques

Lab 3


Syllabus
Assigns
Notes
Labs
Project
Resources

1.     Transform RuleML to a forward-rule language with XSLT
Consider the following resources:

An XSLT-specified translator that maps a Hornlog RuleML rulebase to a corresponding RFML program:
http://www.relfun.org/ruleml/ruleml2rfml.xsl

A sample RuleML business rulebase for discounting:
http://www.dfki.uni-kl.de/ruleml/exa/0.8/discount.ruleml 

 Go to the W3C XSLT Service:
http://www.w3.org/2001/05/xslt 

and give it the above URIs.

To see the result, in some browsers you need to do "View | Page Source".

 

2.     Work yourself into the new XSLT features of ruleml2rfml.xsl using the XML Bible, 2nd Edition, Chapter 17: http://www.ibiblio.org/xml/books/bible2/chapters/ch17.html .

 

3.     Why does Query 1 of discount.ruleml cause a problem? Omit it in your local URI copy, mydiscount.ruleml.

 

4.     Adapt ruleml2rfml.xsl to ruleml2forward.xsl, which maps Hornlog RuleML to a simple forward-rule language as defined by the below sample '====>' transformations. Again test things with the W3C XSLT Service.

 

  Facts:

 

  <fact>

   <_head>

    <atom>

      <_opr><rel>luxury</rel></_opr>

      <ind>Porsche</ind>

    </atom>

   </_head>

  </fact>

 

  ====>

 

  <assertion>

    <rel>luxury</rel>

    <con>Porsche</con>

  </assertion>

 

 

 

  <imp>

    <_body>

      <and>

        <atom>

          <_opr><rel>premium</rel></_opr>

          <var>customer</var>

        </atom>

        <atom>

          <_opr><rel>regular</rel></_opr>

          <var>product</var>

        </atom>

      </and>

    </_body>

    <_head>

      <atom>

        <_opr><rel>discount</rel></_opr>

        <var>customer</var>

        <var>product</var>

        <ind>5.0 percent</ind>

      </atom>

    </_head>

  </imp>

 

  ====>

 

  <forward>

    <if>

      <assertion>

        <rel>premium</rel>

        <var>customer</var>

      </assertion>

      <assertion>

        <rel>regular</rel>

        <var>product</var>

      </assertion>

    </if>

    <then>

      <assertion>

        <rel>discount</rel>

        <var>customer</var>

        <var>product</var>

        <ind>5.0 percent</ind>

      </assertion>

    <then>

  </forward>

 

 

  <imp>

    <_head>

      <atom>

        <_opr><rel>discount</rel></_opr>

        <var>customer</var>

        <var>product</var>

        <ind>5.0 percent</ind>

      </atom>

    </_head>

    <_body>

      <and>

        <atom>

          <_opr><rel>premium</rel></_opr>

          <var>customer</var>

        </atom>

        <atom>

          <_opr><rel>regular</rel></_opr>

          <var>product</var>

        </atom>

      </and>

    </_body>

  </imp>

 

  ====>

 

  <forward>

    <if>

      <assertion>

        <rel>premium</rel>

        <var>customer</var>

      </assertion>

      <assertion>

        <rel>regular</rel>

        <var>product</var>

      </assertion>

    </if>

    <then>

      <assertion>

        <rel>discount</rel>

        <var>customer</var>

        <var>product</var>

        <ind>5.0 percent</ind>

      </assertion>

    <then>

  </forward>

 

 

5.     Unzip the files in j-DREW-BU.zip to a new Java directory, and compile and run the file BUDCTree.java. Turn on tracing by changing the value of TRACE from false to true, then re-compile and re-run.  Try to make sense of the voluminous information.

 

6.     Where the file example.dc is loaded, change this so that the file test-subsume.dc is loaded. Re-compile and re-run, with trace still turned on.  Observe where the subsumption occurs. 

 

7.     Without testing for subsumption the program will run forever.  Observe this by commenting out the line of code in runForwardReasoner that calls the forward subsumption method.  Re-compile and re-run test-subsume.dc.

 

 


Maintained by Bruce Spencer