CS 6795 Semantic Web Techniques

Lab 3


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 (089_normalizer.xslt) by David Hirtle for normalizing the syntax used in a ‘stripe-skipped’ RuleML 0.89 instance, reconstructing all skipped role tags to be in a fully-expanded, normal form. For example, the compact version of the 'own' example,

 

<Assert>

  <And 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>

  </And>

</Assert>

 

is normalized to the expanded version:

 

<Assert>

  <content>

    <And innerclose="universal">

      <formula>

        <Implies>

          <body>

            <And>

              <formula>

                <Atom>

                  <opr><Rel>buy</Rel></opr>

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

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

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

                </Atom>

              </formula>

              <formula>

                <Atom>

                  <opr><Rel>keep</Rel></opr>

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

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

                </Atom>

              </formula>

            </And>

          </body>

          <head>

            <Atom>

              <opr><Rel>own</Rel></opr>

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

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

            </Atom>

          </head>

        </Implies>

      </formula>

      ...

      <formula>

        <Atom>

          <opr><Rel>keep</Rel></opr>

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

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

        </Atom>

      </formula>

    </And>

  </content>

</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 089_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