<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>MYNG: Validation with RuleML 1.0 Parameterized Relax NG Schemas</article-title>
      </title-group>
      <contrib-group>
        <aff id="aff0">
          <label>0</label>
          <institution>Athan Services</institution>
          ,
          <addr-line>Ukiah, CA, USA taraathan AT gmail.com</addr-line>
        </aff>
      </contrib-group>
      <abstract>
        <p>The knowledge representation language RuleML Version 1.0 has recently been re-engineered using the Relax NG schema language, introducing several new features, including on-the-fly schemas with finegrained, freely-combinable modules. The web application Modular sYNtax confiGurator (MYNG) provides GUI access to a PHP-based parameterized schema. To ensure monotonicity when combined, the modules follow a schema design pattern that is enforced by a meta-schema. The schema design pattern also facilitates user-extension of the language. The usage of these new features of RuleML are demonstrated at the website http://wiki.ruleml.org/index.php/MYNG#Demo using H. Sivonen's online, open source validator, http://Validator.nu.</p>
      </abstract>
      <kwd-group>
        <kwd>Tara Athan</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>Advanced users who wish to fully exploit the customizability and extensibility
of the RuleML Relax NG schemas require a thorough understanding of these
features.</p>
      <p>Therefore we present a demonstration of validation using RuleML 1.0 schemas,
beginning with the simplest case based on validation of a pure RuleML instance
using a redirected link, progressing to validation of mixed-namespace instances
using customized and user-extended schemas, and finishing with validation of
Relax NG schemas against a meta-schema defining a schema design pattern.
2</p>
    </sec>
    <sec id="sec-2">
      <title>Overview of Validator.nu</title>
      <p>For this demo, we will make use of Henri Sivonen’s Validator.nu2, a free
validation webservice [Siv07] that can validate an XML instance against schemas,
including Relax NG schemas and Namespace-Based Validation Dispatching
Language3. The validation engine used by Validator.nu is Jing4, an opensource
application with command-line interface developed by James Clark, one of the
authors of Relax NG [ISO08] itself.</p>
      <p>Validator.nu has a simple user interface, allowing the user to specify a single
instance document and zero to many schemas. Options include namespace-based
filtering, allowing a particular namespace to be ignored by the validator.
3</p>
    </sec>
    <sec id="sec-3">
      <title>Examples</title>
      <p>3.1</p>
      <sec id="sec-3-1">
        <title>Redirected Links</title>
        <p>The following Validator.nu cases may be accessed via links from the RuleML
wiki5.</p>
        <p>Example 1 demonstrates an attempt to validate a test RuleML instance in the
bindatagroundlog sublanguage with the bindatagroundfact relaxed schema6,
accessed via a redirected link to the parameterized schema. As expected, the
validator finds errors.</p>
        <p>The actual URL that is accessed in this example is http://www.ruleml.org/
1.0/relaxng/schema_rnc.php?backbone=x1&amp;default=x7&amp;termseq=x2&amp;lng=x1&amp;propo=
xf&amp;implies=x6&amp;terms=xf0f&amp;quant=x1&amp;expr=x0&amp;serial=xf. Redirections to the
parameterized schema have been implemented for the original fifteen named</p>
        <sec id="sec-3-1-1">
          <title>2 Validator.nu: http://validator.nu</title>
          <p>3 NVDL: http://nvdl.org
4 Jing: http://code.google.com/p/jing-trang/
5 Validator.nu Links:http://wiki.ruleml.org/index.php/MYNG#Validator.nu_</p>
          <p>Examples
6 See http://ruleml.org/1.0/relaxng/bindatagroundfact_relaxed.rnc for the
most inclusive schema.
RuleML sublanguages in the Deliberation family (except for the SWSL
languages), from bindatagroundfact to naffologeq, in both serializations
(normal and relaxed form). A complete listing of these redirects is available at the
website http://ruleml.org/1.0/relaxng/.
3.2</p>
        </sec>
      </sec>
      <sec id="sec-3-2">
        <title>Direct Links</title>
        <p>In example 2, we use a direct link to the PHP-driven parameterized schema for
validating a RuleML instance with a foreign namespace element. Any elements
or attributes whose names belong to the foreign namespace are ignored by the
validator. This mode of validation accepts RuleML that is emebedded in other
documents.
3.3</p>
      </sec>
      <sec id="sec-3-3">
        <title>NVDL</title>
        <p>Example 3 shows the validation of a RuleML instance against an NVDL script
that refers to the parameterized schema and also allows arbitrary elements from
foreign namespaces. The NVDL script is:
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;rules xmlns="http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0"
xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"&gt;
&lt;namespace ns="http://www.ruleml.org/0.91/xsd"&gt;
&lt;validate</p>
        <p>schema="http://ruleml.org/0.91/relaxng/schema_rnc.php?backbone=x3f&amp;default=x7&amp;
termseq=x7&amp;lng=x1&amp;propo=x3f&amp;implies=x7&amp;terms=xf3f&amp;quant=x7&amp;expr=xf&amp;serial=xf"
schemaType="application/relax-ng-compact-syntax"/&gt;
&lt;/namespace&gt;
&lt;anyNamespace&gt;</p>
        <p>&lt;allow/&gt;
&lt;/anyNamespace&gt;
&lt;/rules&gt;
3.4</p>
      </sec>
      <sec id="sec-3-4">
        <title>Static Schema</title>
        <p>There are several reasons why a user may want to validate against a static copy
of the RuleML schema, including performance and o✏ ine operation. Example
4 demonstrates validation of a RuleML instance against a static copy of the
default output of the parameterized schema. The schema may be obtained by
two methods:
– use the MYNG GUI7 to display a direct link to the PHP script, click on the
link, and save the output to a file;
– scrape the schema driver displayed on the RuleML MYNG GUI;
– download one of the zip archives, built on-demand for either normal and
relaxed form, (see http://ruleml.org/1.0/relaxng/ and extract the schema
driver file for any of the named sublanguages;
In all cases, the directory containing the schema driver must also contain the
module directory, which is included in both of the zip archives.</p>
        <sec id="sec-3-4-1">
          <title>7 MYNG GUI: http://ruleml.org/1.0/myng</title>
          <p>Users may wish to extend the RuleML syntax, and the Relax NG modular
schema was designed to make such extensions as convenient as possible. As a
template for such extensions, we show in example 5 the expansion of the RuleML
parameterized schema by a Boolean operator for exclusive disjunction.</p>
          <p>Four modules were written to implement this extension:
– the definition module8 contains the definition of new elements;
– the stripe-skipping module9 contains the code that allows redundant edge
elements to be skipped;
– the dishornlog expressivity module10 contains the code that makes the
extended schema compatible with languages having
– the folog expressivity module11 contains the code that makes the extended
schema compatible with languages having at least the expressive power of
first-order logic.</p>
          <p>Other modules might be required for some extensions, including:
– specification of di↵ erent content models for normal and relaxed serializations;
– specification of di↵ erent content models for attributes with default values;
– additional expressivity modules if content models change with other levels
of expressivity;</p>
          <p>The schema driver contains the following include statements:
namespace rulemlx = "http://www.ruleml.org/0.91/ext"
include "http://ruleml.org/0.91/relaxng/schema_rnc.php"
include "http://ruleml.org/0.91/relaxng/modules-ext/xor_expansion_module.rnc"
inherit = rulemlx {start |= notAllowed}
include "http://ruleml.org/0.91/relaxng/modules-ext/xor_stripe_skipping_expansion_module.rnc"
inherit = rulemlx {start |= notAllowed}
include "http://ruleml.org/0.91/relaxng/modules-ext/xor_dis_expansion_module.rnc"
inherit = rulemlx {start |= notAllowed}
include "http://ruleml.org/0.91/relaxng/modules-ext/xor_fo_expansion_module.rnc"
inherit = rulemlx {start |= notAllowed}</p>
          <p>The first statement includes the RuleML language naffologeq with the
relaxed serialziation. The second statement includes the required expansion
module for the Xor element. The other three statements include optional expansion
modules that
– allow the formula edge to be skipped;
– allow the Xor element to appear in the conclusions of implications;
– allow the Xor element to appear in rulebase assertions and retractions.
8 http://ruleml.org/1.0/relaxng/modules-ext/xor_expansion_module.rnc
9 http://ruleml.org/0.91/relaxng/modules-ext/xor_stripe_skipping_
expansion_module.rnc
10 http://ruleml.org/1.0/relaxng/modules-ext/xor_dis_expansion_module.rnc
11 http://ruleml.org/1.0/relaxng/modules-ext/xor_fo_expansion_module.rnc</p>
        </sec>
      </sec>
      <sec id="sec-3-5">
        <title>3.6 In xhtml</title>
        <p>In keeping with the original purpose of Validator.nu, which is (X)HTML5
validation, we demonstrate the validation of RuleML that is embedded in the header
section of an xhtml document in Example 6. NVDL is used to validate against
three schemas, the xhtml Relax NG schema, the xhtml Schematron restrictions
and a RuleML schema.
3.7</p>
      </sec>
      <sec id="sec-3-6">
        <title>RNG Schema Validation</title>
        <p>In [ABss], a schema design pattern was introduced that ensures monotonicity
of the language when modules are freely mixed. Validator.nu can be used to
validate a schema in the XML-based Relax NG syntax (RNG) against the
metaschema, also in the RNG syntax, that defines the schema design pattern. The
meta-schema includes and redefines the standard RuleML schema12, restricting
the vocabulary of named patterns to three categories based on their su xes:
– Choice combine elements: with su xes</p>
        <p>( choice | main | content | value | datatype | sequence | defs )
– Interleave combine elements: with su xes</p>
        <p>( attlist | header | notallowed )
– No combine elements: with su x</p>
        <p>( def )
Monotonicity is achieved by restricting patterns in the interleave combine
category to be optional [ABss].
3.8</p>
      </sec>
      <sec id="sec-3-7">
        <title>Performance</title>
        <p>The greatest part of the execution time of these examples is spent on remote
access of the schemas and instance. Thus any XML validation with serious
concerns about performance must utilize local copies of the validator and schemas,
or use caching, a feature not available in Validator.nu.
4</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>Conclusion</title>
      <p>We have demonstrated a number of examples of instance validation using the
RuleML Relax NG schemas, ranging from simple cases to multi-namespace
instances, and customized, user-extended schemas. We have also shown how a
schema in the XML-based Relax NG syntax may be validated against a custom
schema that enforces a schema design pattern.</p>
      <p>Because of the limitations of the Validation.nu webservice, there are several
uses of these schemas that we are not able to demonstrate here, including
12 Standard Relax NG schema in RNG: http://relaxng.org/relaxng.rng
– validation of a schema in the compact Relax NG syntax
– conversion between schema languages (Relax NG compact, XML-based, XSD)
– conversion of a modular Relax NG schema into a simplified monolithic
schema
– generation of an XML parser from a Relax NG schema
All of these tasks can be accomplished on the desktop using opensource
software13 and all but the last are available in the commercial oXygen framework.
Future work includes the development of Java Webstart services that provide
these additional capabilities.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [ABss]
          <string-name>
            <given-names>Tara</given-names>
            <surname>Athan</surname>
          </string-name>
          and
          <string-name>
            <given-names>H.</given-names>
            <surname>Boley</surname>
          </string-name>
          .
          <article-title>Design and implementation of highly modular schemas for xml: Customization of ruleml in relax ng</article-title>
          . In F. Olken,
          <string-name>
            <given-names>M.</given-names>
            <surname>Palmirani</surname>
          </string-name>
          , and D. Sottara, editors,
          <source>Rule-Based Modeling and Computing on the Semantic Web. RuleML 2011 - America</source>
          , LNCS
          <volume>7018</volume>
          , in press.
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [Gen07]
          <string-name>
            <given-names>Pierre</given-names>
            <surname>Geneves</surname>
          </string-name>
          .
          <article-title>Logics for xml</article-title>
          . http://hal.inria.fr/docs/00/13/35/91/ PDF/geneves-phd.pdf,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          <article-title>[ISO08] ISO</article-title>
          . ISO/IEC 19757-2:
          <string-name>
            <given-names>Document</given-names>
            <surname>Schema Definition</surname>
          </string-name>
          <article-title>Language (DSDL) Part 2: Regular-grammar-based validation - RELAX NG</article-title>
          . http://standards.iso.org/ittf/PubliclyAvailableStandards/c052348_ ISO_IEC_
          <fpage>19757</fpage>
          -
          <lpage>2</lpage>
          _2008(E).zip,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [Siv07]
          <string-name>
            <given-names>Henri</given-names>
            <surname>Sivonen</surname>
          </string-name>
          .
          <article-title>About validator</article-title>
          .nu. http://about.validator.nu,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [SK07]
          <string-name>
            <given-names>Mikko</given-names>
            <surname>Saesmaa</surname>
          </string-name>
          and
          <string-name>
            <given-names>Pekka</given-names>
            <surname>Kilpelinen</surname>
          </string-name>
          .
          <article-title>On-the-fly validation of xml markup languages using o↵ -the-shelf tools</article-title>
          . http://conferences.idealliance.org/ extreme/html/2007/Saesmaa01/EML2007Saesmaa01.html,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>