Download A Grailog Visualizer for Datalog RuleML via XSLT 2.0 Translation to

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
Transcript
University of New Brunswick
Faculty of Computer Science
CS 6795 Semantic Web Techniques
A Grailog Visualizer for Datalog RuleML
via XSLT 2.0 Translation to SVG
Project Proposal
Team 1:
Martin Koch
Sven Schmidt
[email protected]
[email protected]
October 29, 2012
Advisor:
Dr. Harold Boley
Contents
1 Introduction
1
2 Objectives
1
3 Methodology
2
4 Languages / Tools
4.1 Datalog RuleML . . . . . . . . . . . . . .
4.2 Grailog . . . . . . . . . . . . . . . . . . .
4.3 Scalable Vector Graphics (SVG) 1.1 . . .
4.4 XSL Transformations (XSLT) Version 2.0
ii
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
4
4
5
5
5
List of Figures
2.1
3.1
4.1
The translation takes place one at a time (normalization sequence) [3] . . . . .
(Current) Mapping of Datalog RuleML to Grailog, i.e. subset to subset [3] . . .
The left side shows a Datalog RuleML rule visualized as Order-Labeled (OrdLab)
Tree. On the right side is shown the corresponding XML code of the rule. [1] .
iii
2
3
4
1 Introduction
Datalog RuleML [1, 5] is a n-ary, rule based markup language that is a sublanguage of the
RuleML family [4]. Because of its usage for artificial intelligence (AI) and the Semantic Web,
it is built with a format that is more suitable for machine readability than for human readability. In spite of making the Datalog RuleML language more human readable, one natural
approach is to transform its knowledge base, consisting of facts, rules and queries, in a suitable way. One solution to that is to create a visualized representation of the knowledge base,
because of the fact that humans naturally better understand a well developed visualization
(abstraction) than a heavy bulk of text or code. Therefore, the final goal is to create a sufficient visualization, which is much easier to read, learn and remember. One of such well
developed approaches for visualizing major (Semantic Web) logics is Graph inscribed logic
invokes imagery for logic (Grailog) [3]. It describes the mapping for several defined graph
constructs to each corresponding symbolic logic construct of the considered knowledge base,
which leads to a better human readability. At this point, it seems likely, to try to automatize
this transformation as far as possible, so that finally each Datalog RuleML knowledge base
can be easily visualized as a Grailog representation.
2 Objectives
The final result of the project should be an initial version of a so called ’Grailog Visualizer’. This tool should handle the task described above, i.e. the transformation from Datalog
RuleML to a visualized SVG Grailog representation. The tool will be open source in its final
version and it will be available on the Web, accessible from the RuleML and the Grailog sites.
The main objective of the project is to define a mapping from Datalog RuleML, written in
Extensible Markup Language (XML) [9], to Scalable Vector Graphics (SVG) [6, 9], also written
in XML. This will be realized by using eXtensible Stylesheet Language Transformations 2.0
(XSLT 2.0) [7], a language that permits translations from a XML source document to a
newly generated XML document. By implementing different elements in the XSLT 2.0 XML
document, each Datalog RuleML fact, (as resources permits) rule and query in XML, will be
automatically translated to its corresponding SVG elements in XML. This will be done one
element at a time, as shown in Figure 2.1, to avoid highly complex layouting issues in the
SVG part of the project. So, for example, no ‘merging’ of box copies has to been handled.
The resulting SVG elements, which are based on a distinct Grailog subset can than be used
for rendering.
To put it all in a nutshell, the Grailog Visualizer translates Datalog’s n-ary relationships
to Grailog’s directed hyperarc arrows, that connect the argument-box nodes. The resulting
Grailog representation of the Datalog RuleML source document can than finally be rendered
by using suitable tools, for example one of the recent major web browsers.
For this initial version, the assumption is made that the source documents only consist of
Datalog RuleML knowledge bases and queries. The resulting visualization will be in a ‘fully
1
Figure 2.1: The translation takes place one at a time (normalization sequence) [3]
node copied’ normal form, which means that the separation of clauses of the symbolic form
in the Datalog RuleML source document is also kept in the resulting graphic form of the SVG
Grailog representation.
3 Methodology
Before the implementation part of the project can be started, it is essential to analyze and
completely understand the mapping between the Datalog RuleML symbolic subset and the
associated Grailog subset. At the same time, the necessary knowledge about SVG and XSLT
2.0 has to be acquired.
The chosen subset of Grailog has to be represented in a suitable subset of SVG, using XML.
This leads to combinations of several individual graphical elements, for example the different
arrows and rectangles of the Grailog visualization. To create these different graphical objects,
SVG provides many basic elements, like paths, lines or polylines, which can for example be
used for parts of the arrows. To represent the nodes, different rectangle variants of SVG can
be used. The so far considered subset of Grailog is shown in Figure 3.1. The subset that will
finally be used by the tool may change to some extent.
In the next step, the mapping from RuleML to SVG will be defined, using XSLT 2.0. Each
element of Datalog RuleML, facts, (as resources permits) rules and queries will be translated
in its corresponding graphical element, one at a time. This part of the project mainly depends
on the SVG part before, but nevertheless it should be possible to implement both parts nearly
in parallel, by using simple temporary graphical SVG elements for the transformation process,
which can be replaced by its actual counterparts further in the project.
For now, the mapping consists of five major parts, mapping individual constants and variables,
mapping binary relations, mapping n-ary relations, mapping single-premise rules and mapping
multi-premise rules. If resources permit, the mapping of queries will be considered, too. The
current mapping can be seen in Figure 3.1.
The final result of the implemented transformation process should be an automatically generated SVG document, which can then be used for rendering the Grailog representation of the
given Datalog RuleML knowledge base. To proof the reliability of the transformation process,
different kinds of source documents (in the range of the made assumptions) will be translated,
the results will be evaluated and possible further improvements will be discussed.
2
Figure 3.1: (Current) Mapping of Datalog RuleML to Grailog, i.e. subset to subset [3]
3
4 Languages / Tools
For this project, the rule language Datalog RuleML will be used as the language of the considered rules which should be visualized via Grailog. Grailog itself provides the systematics
for visualizing the logic knowledge representation as generalized graphs. For the implementation and the rendering of the visualization, the modularized language for describing twodimensional vector and mixed vector/raster graphics in XML, SVG will be used. The transformation language XSLT 2.0 provides the necessary tools to perform the transformation
from the Datalog RuleML knowlegde bases and queries to the SVG Grailog visualization. In
the following, each language/tool will be illustrated shortly.
4.1 Datalog RuleML
RuleML is a family of rule based languages, which are used for sharing rule bases written in
XML and publishing them on the Web. Datalog RuleML is one rule sublanguage of RuleML,
based on the Datalog logic. Moreover, Datalog is the semantic foundation of RuleML and can
be seen as an intersection of SQL and Prolog [1]. Datalog is used to define facts and rules and
therefore is used to create logic knowledge bases and queries. One simple Datalog RuleML
logic relation can be seen in Figure 4.1. It describes the logic relation that a customer is
premium, if the customer has spent at least 5000 euros in the previous year. The XML code,
the rule is written in, is exactly the code that will be translated to Grailog by the Grailog
Visualizer. The graph on the left side of the figure is an Ordered-Labeled (OrdLab) Tree. This
representation of the rule is another visualization approach, prior to Grailog.
Figure 4.1: The left side shows a Datalog RuleML rule visualized as Order-Labeled (OrdLab)
Tree. On the right side is shown the corresponding XML code of the rule. [1]
4
4.2 Grailog
Grailog describes systematics to visualize knowledge representations with graphical elements.
Each of the introduced graphical elements is mapped to its corresponding symbolic logic
construct. The benefit of Grailog is that its resulting visual representations of knowledge
sources are much easier to read for humans than the original source code is. Moreover, the
rules for the transformation are easy to learn and to remember.
One principle of Grailog is that the used graphs should be natural extensions of Directed Labeled Graphs (DLGs). Another principle dictates that the used Graphs should allow stepwise
refinements for logic constructs, like Description Logic constructors or general PSOA RuleML
terms. These principles all support the main goal of Grailog, namley easy understanding and
application of the systematics. Another major part of Grailogs visualization elements are the
directed hypergraphs. These are used for dealing with n-ary relationships, Datalog RuleML
(in contrast to Datalog) is capable of. Examples of the different Grailog elements can be seen
in Figure 3.1.
4.3 Scalable Vector Graphics (SVG) 1.1
With the languague SVG, two-dimensional graphics, both static and dynamic (i.e., interactive
or animated) can be described in XML. This documents are supported by all recent major
web browsers, so that the graphics can be rendered and visualized by them.
SVG allows three different types of graphical objects, the vector graphic shapes (e.g. paths
or polygon lines), images and text. For the different graphical objects SVG provides further
methods, like grouping objects, assigning different styles per object, and performing further
transformations. It is also possible to composite objects into previously rendered objects.
Moreover, SVG provides a rich feature set which includes nested transformations, clipping
paths, alpha masks, filter effects and template objects.
4.4 XSL Transformations (XSLT) Version 2.0
The XSLT language permits transformations of XML documents into other newly generated
XML documents or other objects like for example HTML, XHTML or SVG. The XSLT processor takes XML sources and a stylesheet, which describes the rules for the transformation.
These template rules associate patterns, which match nodes in the source document, with
a sequence constructor. In many cases evaluating the sequence constructor will cause new
nodes to be constructed that can be used to produce part of a result tree. The structure of the
result trees can be completely different from the structure of the source trees. In constructing
a result tree, nodes from the source trees can be filtered and reordered, and arbitrary structure
can be added.
5
References
[1] H. Boley; T. Athan. RuleML Primer, August 2012. Available online at http://ruleml.
org/papers/Primer/RuleMLPrimer2012-08-09/RuleMLPrimer-p0-2012-08-09.html,
visited on October 19th, 2012.
[2] H. Boley. CS 6795 Semantic Web Techniques - Fall 2012 Projects. Available online at
http://www.cs.unb.ca/~boley/cs6795swt/fall2012projects.html, visited on October 19th, 2012.
[3] H. Boley. The Grailog Systematics for Visual-Logic Knowledge Representation with Generalized Graphs, September 2012. Available online at http://www.cs.unb.ca/~boley/
talks/RuleMLGrailog.pdf, visited on October 19th, 2012.
[4] H. Boley. The Rule Markup Initiative, September 2012. Available online at http://
ruleml.org/, visited on October 23th, 2012.
[5] H. Boley; T.Athan; A. Paschke; S. Tabet; B. Grosof; N. Bassiliades; G. Governatori; F.
Olken; D. Hirtle. Schema Specification of Deliberation RuleML Version 1.0. Available
online at http://ruleml.org/1.0/, visited on October 19th, 2012.
[6] E. Dahlstroem; P. Dengler; A. Grasso; C. Lilley; C. McCormack; D. Schepers; J. Watt; J.
Ferraiolo; J. FujiSawa; D. Jackson. Scalable Vector Graphics (SVG) 1.1 (Second Edition) W3C Recommendation, August 2011. Available online at http://www.w3.org/TR/2011/
REC-SVG11-20110816/, visited on October 19th, 2012.
[7] M. Kay. XSL Transformations (XSLT) Version 2.0 - W3C Recommendation, January
2007. Available online at http://www.w3.org/TR/2007/REC-xslt20-20070123/, visited
on October 19th, 2012.
[8] Refsnes Data. W3Schools. Available online at http://www.w3schools.com/svg/svg_
intro.asp, visited on October 19th, 2012.
[9] T. Bray; J. Paoli; C. M. Sperberg-McQueen; E. Maler; F. Yergeau. Extensible Markup
Language (XML) 1.0 (Fifth Edition) - W3C Recommendation, November 2008. Available
online at http://www.w3.org/TR/2008/REC-xml-20081126/, visited on October 19th,
2012.
6