CS 6795 Semantic Web Techniques

Lab 4


Syllabus
Assigns
Notes
Labs
Project
Resources

Transform RuleML to a normal form with XSLT


As shown in http://ruleml.org/0.89/#XSLT-Based%20Normalizer, an XSLT stylesheet has been developed by David Hirtle for normalizing the syntax used in a ‘stripe-skipped’ RuleML instance, which has been extended for RuleML 1.0 (http://ruleml.org/1.0/xslt/normalizer/100_normalizer.xslt) by Derek Smith. It reconstructs all skipped role tags to be in a fully-expanded, normal form. For example, the compact version of the 'own' example (http://ruleml.org/1.0/xslt/normalizer/own_compact.ruleml),

 

  <Assert mapClosure="universal">

    <Implies>

      <And>

        <Atom>

          <Rel>buy</Rel>

          <Var>person</Var>

          <Var>merchant</Var>

          <Var>object</Var>

        </Atom>

        <Atom>

          <Rel>keep</Rel>

          <Var>person</Var>

          <Var>object</Var>

        </Atom>

      </And>

      <Atom>

        <Rel>own</Rel>

        <Var>person</Var>

        <Var>object</Var>

      </Atom>

    </Implies>

    ...

    <Atom>

      <Rel>keep</Rel>

      <Ind>Mary</Ind>

      <Ind>XMLBible</Ind>

    </Atom>

  </Assert>

 

is normalized to the expanded version (http://ruleml.org/1.0/xslt/normalizer/own_expanded.ruleml):

 

  <Assert innerclose="universal">

     <formula>

        <Implies>

          <if>

            <And>

              <Atom>

                <op><Rel>buy</Rel></op>

                <arg index="1"><Var>person</Var></arg>

                <arg index="2"><Var>merchant</Var></arg>

                <arg index="3"><Var>object</Var></arg>

              </Atom>

              <Atom>

                <op><Rel>keep</Rel></op>

                <arg index="1"><Var>person</Var></arg>

                <arg index="2"><Var>object</Var></arg>

              </Atom>

            </And>

          </if>

          <then>

            <Atom>

              <op><Rel>own</Rel></op>

              <arg index="1"><Var>person</Var></arg>

              <arg index="2"><Var>object</Var></arg>

            </Atom>

          </then>

        </Implies>

     </formula>

      ...

     <formula>

        <Atom>

          <op><Rel>keep</Rel></op>

          <arg index="1"><Ind>Mary</Ind></arg>

          <arg index="2"><Ind>XMLBible</Ind></arg>

        </Atom>

     </formula>

  </Assert>

 

(See a comparison of these two files generated using HTML Diff.)

Additional examples are located in the Normalizer directory.

1.     Work yourself into the new XSLT features of 100_normalizer.xslt using the XML Bible, 3rd Edition, Chapter 15: http://www.cafeconleche.org/books/bible3/chapters/ch15.html .

2.     Go to the W3C XSLT Service:
http://www.w3.org/2005/08/online_xslt/ 

and give it the above URIs.

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

 

3.     How could the inverse direction be specified in XSLT? Is it easier?

 


Maintained by Harold Boley