=We present here MXSL, a subset of XSLT re-interpreted as a syntactic metalanguage for RuleML with operational semantics based on XSLT proc-essing. This metalanguage increases the expressivity of RuleML knowledge bases and queries, with syntactic access to the complete XML tree through the XPath Data Model. The metalanguage is developed in an abstract manner, as a paradigm applicable to other KR languages, in XML or in other formats.
Syntax Reuse: XSLT as a Metalanguage for Knowledge Representation Languages
1. Syntax Reuse: XSLT as a Metalanguage for
Knowledge Representation Languages
Tara Athan
Athan Services, West Lafayette, IN, USA
taraathan AT gmail.com
presented at RuleML 2012
August 29, 2012
Montpellier, France
4. Semantic Interoperability:
Translation or Coexistence (I)
● Between disparate KR languages
● Translation: RDF to OWL, KIF to CLIF, ...
– Issues: Incompatibility, redundancy, inefficiency, lossy
● Coexistence
– OntoIOp's DOL aims to allow heterogeneous knowledge bases
to interoperate without translation
● Between disparate data formats
● Translation for computation, optimized in domain-
specific applications such as GIS
● Coexistence for visualization (mashups, mapping)
5. Semantic Interoperability:
Translation or Coexistence (II)
● Between data and KR
● Translation:
– GML3 transforms shapefiles, databases, ...
● Has conceptual models, not model-theoretic, not grounded in ontology
● Not in general invertible
● Coexistence
– RDF, RuleML, CLIF allow embedded structured data
● XMLLiteral, <Data xsi:type="xs:any">, '...'
● IRI with XPath or XPointer provides fine access, but can't quantify
● Need: Metalanguage for Quantification within
Embedded Data
6. Metalanguage Strategy:
Semantic or Syntactic
● Semantic ● Syntactic
● RDF Graph ● XPath Data Model (XDM)
– Is a set of RDF triples – Is also a graph
– Model-theoretic – Each node of the graph
semantics has an information set
– (Limited) inferences may (infoset)
be drawn – No interpretations
● RuleML OrdLab Tree – No inferences
– Herbrand Semantics ● XSLT uses XDM
7. XSLT: W3C Recommendation
● Turing-complete language
● Takes well-formed XML input
● Produces arbitrary character string output
● Expressed in XML
● May be validated by
– Relax NG (https://github.com/ndw/xslt-relax-ng)
– XSD (http://www.w3.org/2007/schema-for-xslt20.xsd)
● Processed by
● Libxslt, Apache Xalan, Saxon XSLT, ...
8. Metalanguage MXSL Goals
● Enable reasoning over large, structured legacy
datasets (e.g. in XML or flat files) without large-
scale conversion of compact representations into
the more verbose RuleML format;
● Allow user-specified deductive systems for
reasoning over RuleML knowledge bases via
axiom schemas;
● Enhance the RuleML query capability.
9. MXSL Approach
● Use XSLT to represent the transformation of a set
of parameter bindings into the corresponding
instances of that axiom schema
● Interpret the case when a set of bindings is not
specified as an axiom schema
● Syntactically indicated by processing instruction
<?xml-stylesheet type="text/xsl" href="kb2.mxsl"?>
-->
<?mxsl type="text/xsl"?>
13. Two-Phase Interpretation
1. the application of a metainterpretation to
transform the metalanguage instance to another
instance that is purely in the base language;
2. the application of the base language’s model-
theoretic interpretation to transform the derived
instance to truth values.
14. Truth-Valuation (I)
● Assume an interpretation I, with vocabulary V and
metalanguage formula F.
● Each metainterpretation transformation
● uses one binding of the metalanguage parameters to
literals, constrained only by datatype
● produces a “preformula”
● Preformulas are “discarded” that either
● Are not syntactically valid RuleML
● Contain names that are not in vocabulary V
15. Truth-Valuation (II)
● Call the remaining set of RuleML formulas S
● The metalanguage formula F is “valid in an
interpretation I” if all RuleML formulas in S are
valid in the interpretation I.
● In (exactly) that case, I is a “model of F”.
16. Metalanguage Requirements (I)
● add element node to output tree, given local
name and namespace as parameters;
● add attribute node to element node, given local
name, name-space and value as parameters;
● add text node as child of element;
● iteratively add, in specified order, a number of
nodes to output tree, based on set of parameter
bindings represented in structured XML;
17. Metalanguage Requirements (II)
● express the hierarchical and sequential structure
of the output tree isomorphically according to the
corresponding structure of the metalanguage
instance.
● In addition, we have the following operational
requirements: Instances in metalanguage must:
● validate against the XSLT schema,
● be self-contained,
● be self-executing.
18. MXSL Syntax (I)
● <xsl:for-each>, for iteration
● <xsl:element>, for construction of XML elements
● <xsl:attribute>, for addition of attributes to XML
elements
● <xsl:copy-of> with @select, for generation of the
values of attributes and contents of element
19. MXSL Syntax (II)
● <xsl:stylesheet> (once as the root element)
● <xsl:variable> (once as a header to define the
parameter bindings and also as the first children
of <xsl:for-each>, once for each parameter in the
iteration)
● <xsl:template match="/"> (once for the MXSL
body)
● <xsl:processing-instruction> (zero to many times
as the first children of <xsl:template> )
20. MXSL Syntax (III)
● <ruleml:RuleML> (once as the last child of
<xsl:template> to define the root for the output
document)
● <xsl:comment> (arbitrarily within the
<ruleml:RuleML> element)
23. Overview of Infinitary Logic (I)
● Given a base (finitary) language L
●
Parameter κ : cardinality of sequences of
conjunctions and disjunctions, also cardinality of
set of variable symbols
∧ j∈ J Φ j ∨ j∈ J Φ j ∣J∣<κ
●
Parameter λ : cardinality of sequences of
quantifiers (λ <= κ)
● http://plato.stanford.edu/entries/logic-infinitary/
24. Overview of Infinitary Logic (II)
●
L(ω, ω) = L
● L(ω1, ω) = countable sequences of “junctions”
● If L is FOL, L(ω1, ω) is complete* but not compact** [Skolem, 1920]
● L(ω1, ω1) = countable sequences of quantifiers
● If L is FOL, L(ω1, ω1) is neither complete nor compact
*
● Completeness is defined with respect to a deductive system that
allows proofs of countable length, and assumes countable sets of
axioms
**
● Compact means if every finite subset of a set of formulas has a
model then the original set has a model
25. RuleML with MXSL Axiom
Schemas
●
Assert/Rulebase/xsl:for-each –> L(ω, ω) –>
complete, compact
● Assert/Rulebase/{And, Or}/xsl:for-each
● Disallowing mapClosure on Assert or Rulebase, nor
closure on And –> L(ω1, ω) -> complete, not compact*
● Allowing mapClosure on Assert or Rulebase, or closure
on And –> L(ω1, ω1) -> neither complete nor compact*
*Follows if RuleML is given FOL semantics, assumes
countable literals
26. Infinitary Case: In practice
● Nonliteral vocabulary is typically finite
● Literals can be introduced only as needed
● Consider the captured string axiom
● One binding needed for each nonliteral in vocabulary
● (= ('a') a) is discarded by the semantics if "a" is not in the
vocabulary
● So finite model property can be retained even
with MXSL axiom schemas
27. Extensions: xsl:for-each/Query
<xsl:for-each ...>
<Query>
<Atom><Rel>P</Rel>
<Ind>
<xsl:attribute name="type">
<xsl:copy-of select="$typeval/node()"/>
● Interpret as implicit disjunction of multiple queries
● Success = inconsistency of rulebase appended with
negations of query (Rulebase/xsl:for-each/Neg) - L(ω, ω)
● Bindings are lost – extended query capability is needed
28. Metalanguage Abstract Syntax
● Grouping symbols entered as pairs through one
command
● Mirrors the structure of the output document.
● Iteration command generates a set of sibling
items based on a pattern, instantiated with
parameters.
● Text always added through a metalanguage
command, implementing output-escaping of
punctuation characters
31. Conclusions
● MXSL: a (small) subset of the XSLT language,
which can be used as a syntactic metalanguage
for XML-based KR languages
● MXSL expresses
● axiom schemas
● semantics of structured data
● generalized queries.
● Paradigm for non-XML-based formats
● Future investigations: reasoning