1 / 34

CS 6975 Web Semantics Normalizers for RuleML 1.0 in XSLT 2.0

CS 6975 Web Semantics Normalizers for RuleML 1.0 in XSLT 2.0. Nada Alsalmi ‍Leah Bidlake ‍ Ao Cheng ‍ Thea Gegenberg ‍Emily Wilson Instructor: Dr. Harold Boley Advisor: Dr. Tara Athan. Overview. Introduction Comparison to previous Normalizer Our 4-Phase Normalizer:

talasi
Download Presentation

CS 6975 Web Semantics Normalizers for RuleML 1.0 in XSLT 2.0

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS 6975 Web SemanticsNormalizers for RuleML 1.0 in XSLT 2.0 Nada Alsalmi ‍Leah Bidlake ‍Ao Cheng ‍TheaGegenberg ‍Emily Wilson Instructor: Dr. Harold Boley Advisor: Dr. Tara Athan

  2. Overview • Introduction • Comparison to previous Normalizer • Our 4-Phase Normalizer: • Phase 1 – Adding Role Tags • Phase 2 – Canonical Ordering • Phase 3 – Making attribute default values explicit • Phase 4 – Pretty Print • Demo

  3. Introduction • Work Flow diagram:

  4. Multiple Phases within a Single Stylesheet • Within a single stylesheet, a pipeline is expressed as a series of variables: <xsl:variable name="phase-1-output"> <xsl:apply-templates select="/" mode="phase-1"/> </xsl:variable> <xsl:variable name="phase-2-output"> <xsl:apply-templates select="$phase-1-output" mode="phase-2"/>  </xsl:variable>

  5. Comparison to Derek’s & David’s Normalizer • Performed transformation in 1 Pass/Phase <xsl:template match="*"> <xsl:choose> <xsl:when test="name(.)='Implies'"> … </xsl:when> <xsl:when test="name(.)='Expr'"> … </xsl:choose> <xsl:template match>

  6. PHASE 1

  7. RuleML 0.91 to 1.0 • All references for namespace and schema locations changed to: http://www.ruleml.org/1.0/xsd • Output from style sheet has RuleML Version 1.0 as default namespace.

  8. RuleML 0.91 to 1.0 Changes to names of role tags: • Children of <Implies> • Role tag <head> replaced with <then> • Role tag <body> replace with <if> • Children of <Equal> • Role tag <lhs> replaced with <left> • Role tag <rhs> replace with <right> • Name of interpretation attribute: • @in changed to @per

  9. RuleML 0.91 to 1.0 – Other Changes • Webizing attribute: • @uri changed to @iri • Name of type tag for unified term: • <Hterm> changed to <Uniterm> • Name of type tag for constant term: • <Con> changed to <Const> • Content of <RuleML> • Role tag <act> wraps all content of <RuleML>

  10. Phase 1 – Add Missing Edge Stripes • Edge is also referred to as role tag or method tag. • Match the elements using the parent tag. • Determine if the children were already wrapped with the appropriate tag. • Wrap the ‘naked’ children with the appropriate role tag. • For some elements an index attribute was also added.

  11. Phase 1 • Each time an element was matched there was a test to determine if the role tags were already present for any or all of the children. • In some cases the children may already be wrapped in role tags but in a different order, which had to be tested for. • Test cases developed including: relaxed, partially normalized and fully normalized.

  12. Phase 1 • Adding missing stripes to Implies and Entails – difficult because of the number of possibilities of missing <if>, <then> stripes. • As suggested by Tara Athan, our advisor, this was simplified by assuming that the <if> and <then> are in canonical position already if stripes are skipped.

  13. Phase 1 – Example <Equal> • 1st child wrapped with <left> • 2nd child wrapped with <right> • Check for partially normalized: • If the 1st child was already wrapped with <right> then the 2nd child has to be wrapped with <left>

  14. Phase 1: Example <Equal>

  15. Test Case Results Relaxed: Normalized:

  16. Test Case Results Partially Normalized: Normalized:

  17. Test Case Results Partially Normalized: Normalized:

  18. Test Case Results Fully Normalized: Normalized:

  19. PHASE 2 Canonical Ordering

  20. Phases 2: Canonical Order • Output Schema used to infer canonical ordering • e.g. <xsl:template match="Implies" mode="phase-2">    <xsl:copy><xsl:apply-templates select="oid" mode="phase-2"/> <xsl:apply-templates select="if" mode="phase-2"/> <xsl:apply-templates select="then" mode="phase-2"/> <xsl:apply-templates select="@*|*[name(.)!='oid' and name(.)!='if' and name(.) != 'then']" mode="phase-2"/>    </xsl:copy>     </xsl:template>

  21. Phase 2: <Implies> Example

  22. Phase 2: <Implies> Example (cont.)

  23. Phase 2: <Atom> Example <xsl:template match="Atom" mode="phase-2"> <xsl:copy> <xsl:apply-templates select="op" mode="phase-2"/> <xsl:apply-templates select="arg" mode="phase-2"/> <xsl:apply-templates select="slot" mode="phase-2"/> <xsl:apply-templates select="@*|*[name(.)!='op' and name(.)!='arg' and name(.) != 'slot']" mode="phase-2"/> </xsl:copy> </xsl:template>

  24. Phase 2: <Atom> Example (cont.) Before normalization: After normalization:

  25. PHASE 3 Default Values Treatment of attributes with default values Remain the original instinct of input

  26. Modes • Phase 1, Phase2, Phase3 are independently implemented. • Use the feature of “mode” from XSLT 2.0 • Format the same Data differently in different Places • XSLT<xsl:apply-templates>Element <xsl:apply-templates select=“XPath expression" mode="name">  <!-- Content:(xsl:sort|xsl:with-param)* --></xsl:apply-templates>

  27. Default Values List • @mapMaterial ( yes | no ) • @material ( yes | no ) • @mapDirection( bidirectional | forward | backward ) • @direction( bidirectional | forward | backward ) • @oriented ( no | yes ) • @val ( 0.. | 1 ) • @per ( no| yes )

  28. Problems • Then oxygen seemed to automatically put in all possible attributes listed with their default values. If list all the schemas in the ruleml file, i.e. <RuleMLxmlns="http://www.ruleml.org/1.0/xsd"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.ruleml.org/1.0/xsdhttp://www.ruleml.org/1.0/xsd/datalog.xsd"> • Oxygen explicit copying of default attributes won’t happen if you do delete the attributes of the RuleML tag that specify the schema.

  29. Results Ruleml File After normalized:

  30. PHASE 4 Pretty Print

  31. Pretty Print • Output RuleML nicely • Comments • For some tags we don’t want a new line

  32. Pretty Print – How? • Variables and params

  33. Pretty Print – Outline

  34. Final Demo • http://www.w3.org/2005/08/online_xslt/ • Normalizer: http://v37s3b4h7dn47s37hg1br4h7rs7n3du7s8nu.unbf.ca/~lbidlak1/100relaxed-to-normal.xslt • Handout Website: http://v37s3b4h7dn47s37hg1br4h7rs7n3du7s8nu.unbf.ca/~lbidlak1/

More Related