Semantic Web Final Reportx - d-posl - Wikispaces

jumentousmanlyInternet και Εφαρμογές Web

21 Οκτ 2013 (πριν από 3 χρόνια και 9 μήνες)

111 εμφανίσεις

Introduction

PO
sitional
S
lotted
L
anguage or POSL is a rule based language that provides a more human readable
format for web rules. It is compatible, and convertible with the more generic xml based RuleML

which
has a format more suited for machine readability. The current version of POSL needs some modification
to bring its syntax more in line with the new version of RuleML. Uniform Resource Identifiers (URI) has
been renamed to the more appropriate Inte
rnet Resource Identifier (IRI). The syntax to type a variable
or independent has been changed from a colon (:) to a double hat (^^). This will allow us to use the
colon as a namespace identifier as it is being used in RuleML.

One thing POSL currently lac
ks is a mechanism for defining defeasible rules. Defeasible logic allows
certain rules to override other rules. By including a superiority list of which rule beats which we are able
to define the priority of our rules and allow knowledge
-
bases which have
an incomplete understanding
of their domain to function in an appropriate manner. This sort of prioritization of rules is important to
practical applications such as knowledge
-
bases in the domains of law and business. It is also “useful for
ontology inte
gration, where conflicting information arises naturally” [1].

This project will be to upgrade POSL to 1.0, as well was to create a grammar for defeasible POSL (d
-
POSL).




What is Defeasible Logic

“Defeasible logic, originally created by Donald Nute with
a particular concern about efficiency and
implementation, is a simple and efficient rule based non
-
monotonic formalism. Over the years the logic
has been developed and extended, and several variants have been proposed”. [23]

“The main intuition of the log
ic is to be able to derive “plausible” conclusions from partial and
sometimes conflicting information” [23]

Defeasible logic differs from other logic languages by introducing two new types of rules. As well as the
normal “strict” rules, which cannot be de
feated by other rules, defeasible logic introduces “Defeasible”
rules as well as “Defeaters”. Defeasible rules are rules that may be defeated by contrary evidence, such
as rules that are ranked as

more

superior and can therefore overrule it.

Defeaters on

the other hand
cannot be used to draw any conclusions, but only to prevent some conclusions from being made. We
also introduce a superiority relation between the rules to show which rules beat which.

As a simple
example we could consider two
defeasible

rules

and a superiority relation.

R
ule 1: X is a green_car IF X is green AND X is a car;

Rule2 : X is a green_and_blue_car IF X is green AND x is blue AND X is a car;

Rule2 > Rule1;

This example (written in English) shows two rules and a superiority relat
ion. The superiority relation
(the third line) says that if Rule2 is true it overrules rule1. Using these rules if we had a car that was
green and red Rule1 would still be true. However, if we had a car that was green and blue, Rule1 would
no longer be
true and Rule2 would defeat it.

Defeasible logic can be classified as a
sceptical

logic. This means that it doesn’t draw conclusions. If
there is evidence for concluding A and there is also evidence for concluding the compliment of A the
logic concludes
neither. Unless we have evidence for one that has higher priority, in which case that
one is concluded.

As Defeasible logic includes both strict and defeasible rules we can come to definite or defeasible
conclusions. In the case of a definite conclusion,

what we have concluded is not able to be changed
based on the acquisition of new information. Thus, it must be formed by examining only facts and strict
rules. On the other hand Defeasible conclusions can be formed using defeasible rules and can thus be

overruled based on new information entering the system.



Eclipse


Eclipse
is an open source community, whose projects are focused on building an open development
platform comprised of extensible frameworks, tools and runtimes for building, deploying

and managing
software across the lifecycle.

In our project we used Eclipse as an integrated development environment (IDE), to facilitate our
modifications of OO
-
jDREW.
By taking advantage of its code completion, syntax highlighting, and tools
to import n
eeded libraries, it made modifying the Java code much easier and more manageable.

We also used to in our demo to show the class the progress we had made without having to create an
executable that we could deploy.



Objectives
-

Changes to OO jDrew

One par
t of our project was to update OO jDrew’s Converter application. The main reason for updating
OO jDrew was to make it compliant with the new versions of POSL and RuleML. The application used to
convert POSL 0.91 into RuleML 0.88 or 0.91 and back from Rul
eML 0.88 or 0.91 into POSL 0.91. Since
the time this was coded POSL and RuleML both have been upgraded to a new 1.0 standard. To continue
being useful in the future as more people start writing code in the latest standard, the application had to
be updat
ed.

The version of POSL that was accepted in the POSL text field was version 0.91; we updated it to parse
POSL 1.0 instead.
The changes required to accomplish this was to update the POSL grammar file that
ANTLR uses to be POSL 1.0 compliant, then regenera
te the POSL Parser and Lexer. Then we simply
replaced the existing Parser and Lexer with our new POSL 1.0 versions and our application now parsed
POSL 1.0.

We realized that the people using OO jDrew to convert POSL 0.91 to RuleML

would have to manually
modify their POSL code if we didn’t provide some functionality to aid them. After considering our
options, we decided that we would create a button that when pressed, would take the code in the POSL
text field and perform the requi
red updates to make it POSL 1.0 compliant. This button allows users to
use their old code without having to research, and implement the changes that were made between
POSL 0.91 and 1.0.

Since the changes between RuleML 0.91 and 1.0 didn’t apply to our POS
L converter, another change
that we made was to simply modify the label on the button to convert POSL to RuleML 0.91. It now
reads POSL to RuleML 0.91/1.0. This informs the user that the RuleML produced is 1.0 compliant and
can be used as such.

We also c
leaned up the graphical user interface a little by aligning buttons, and making the empty space
on the dialog more symmetrical.
It was a change that looks small but makes the application look much
more appealing.






Original






Modified

Questions

What problem area does this tool address?

The implementation of our d
-
POSL

ANTLR

EBNF
grammar is the first step towards creating a human
readable
language for defeasible logic. Since defeasible logic has been identified as an are
a of interest
by groups such as law and business, making this first step opens the door to invite people to continue
the work and produce a functional application that could be used in these domains.

Exactly what does the tool do?

By inputting this

d
-
POSL
grammar
into ANTLR we have

the framework required to create a Parser and
Lexer for defeasible POSL. Since we now have this framework in place, anyone who wants to move
further in this field will have the tools to create a d
-
POSL compiler. They could then

compile d
-
POSL into
a language that could be used in the DR
-
DEVICE or they could write a stand
-
alone application that takes
d
-
POSL as input and makes conclusions using defeasible logic.

What are the characteristics of an ideal solution to the problems in
this area?

The ideal solution to the problems in this area would be to have a defeasible logic reasoning engine that
accepts d
-
POSL as input. Creating a grammar (which can be turned into a compiler using ANTLR) is the
first step to making this a reality.

Since we now have that grammar, we have provided researchers who
wish to proceed to work on this area with the tools they need to get started on the work to have a
reasoning engine accept d
-
POSL as input.

Does the tool offer an effective solution to such
problems? Why? Why not?

Using this grammar with ANTLR

is a good first step.
It offers the
means

to proceed with solving the
problems; however, i
t does not offer a complete solution as
making a reasoning engine accept d
-
POSL
was outside the scope of this p
roject.

Did the tool help you solve your chosen problem/task?

Using ANTLR did help us solve our chosen task quite well. Using it we only had to define the EBNF of the
compiler and ANTLR created the parser and lexer required.

What other tools might have b
een applied?

There are several other compiler compilers that we could have used instead of ANTLR such as Bison,
Coco/R, ELI, Lemon, parboiled, Packrat parser, PQCC, VisualLangLab, and Yacc. However ANTLR is by far
the most popular. Being the most popula
r application for this task provides certain advantages such as a
greater knowledge base to draw from while learning how to use it, m
ore support for when errors
occurred as well as an excellent integrated development environment call ANTLRWorks.

What other

work and ideas in the area are relevant?

There is a great website that shows what other work in the field of defeasible logic is being done called
defeasible.org. Some examples of other work listed there include, using defeasible logic in artificial
int
elligence for games, multi agent reasoning systems, and answering descriptive logic queries for
semantic web applications.

What extensions to the tool might be worth considering?

One area that this tool could use extending in would be unit tests. If the

grammar was augmented with
a suite of unit tests we could guarantee the behaviour is as expected. Another added benefit would be
that further modifications to the grammar would be under the test harness and therefor would not
break the functionality impl
emented thus far.

The next step in extending this tool would be to create an application to utilize the compiler created in
this project.
Having a tool that accepts d
-
POSL and makes conclusions using it would be an excellent
extension to the progress made

so far.



Methodology
-

OO
jDREW

Changes

The first step to changing OO jDrew was to modify the ANTLR grammar file for the POSL 0.91 grammar
to comply with the 1.0 changes. After we had the updated grammar file, we regenerated the POSL lexer

and parser and replaced them in the java source code. We now had an OO jDrew that would accept
POSL 1.0 in the POSL text input field.

The next step was to provide functionality for users with legacy code to upgrade to the new POSL
standard. We created

a new java button and attached a listener so that when the button was pressed
we would fire a method to upgrade the code in the POSL text input field. We then wrote the method
required. It was fairly simple to do. We
got a copy of the input text and par
sed through it tokenizing
colons. For each token that did not have a dash (
-
) following it we replaced with a double hat (^^). We
kept track of the number of substitutions performed and when complete, created a popup modal dialog
informing the user the u
pgrade was performed successfully and telling them the number of
substitutions made. In the event of an error, we restored the text to the way it was before the method
was invoked and reported the problem in a similar modal dialog.





Now that we had a method to upgrade POSL 0.91 to 1.0, we could automatically upgrade the output
after a RuleML to POSL conversion had taken place. This completed our upgrade to have the OO jDREW
converter use the new POSL 1.0 st
andard as it both accepted POSL 1.0 as input for conversion to
RuleML, and also converted RuleML to POSL 1.0.

The final change we made was to clean up the graphical user interface by modifying the coordinates and
widths/heights of the buttons and text fiel
ds. It was a fairly simple process of finding the initialization
code for the Java frame and changing some hard coded values.



POSL

:
-
>
^^

URI
-
>IRI

POSL 1.0



References :

1.

Boley, Harold. "Integrating Positional and Slotted Knowledge on the Semantic Web". Journal of
Emerging Technolog
ies in Web Intelligence (Nov 2010). 343
-
353.

2.

Kontopoulos, Efstratios and Bassiliades, Nick and Antoniou, Grigoris: "Visualizing Semantic
Web proofs of defeasible logic in the DR
-
DEVICE system". Knowledge
-
Based Systems (April
2011). 406
-
419.

3.

Parr, Terrence.

The Definitive ANTLR Reference: Building Domain
-
Specific Languages. 2007.

4.

Parr, Terrence. "ANTLRv3." ANTLR Parser Generator. University of San Francisco.
<www.antlr.org>.

5.

Ball, Marcel. "Object Oriented jDREW." OO jDREW. <ruleml.org/oojdrew/>.

6.

Boley,
Harold. "POSL: An Integrated Positional
-
Slotted Language for Semantic Web
Knowledge." 11 May 2004. <http://ruleml.org/submission/ruleml
-
shortation.html>.

7.

Nute, Donald. "Defeasible Logic". Handbook of Logic in Artificial Intelligence and Logic
Programming.
(2001). 353
-
395.

8.

Antoniou, Grigoris and Bikakis, Antonis. "A defeasible logic programming system for the Web".
16th IEEE International Conference on Tools with Artificial Intelligence (ICTAI'04). (2004).
756
-
757.

9.

G. Antoniou, M.J. Maher, D. Billington. "De
feasible logic versus logic programming without
negation as failure". Journal of Logic Programming 41 (1). (2000). 45

57.

10.

Odutola, Kunle. "Five minute introduction to ANTLR3". ANTLRv3. Nov 24, 2011.

<http://www.antlr.org/wiki/display/ANTLR3/Five+minute+int
roduction+to+ANTLR+3>.

11.

Craig, Ben. Download Newest Version (Recommended). OO jDREW. (Dec 3, 2008).
<http://ruleml.org/oojdrew/download/POSL.g>.

12.

Parr, Terrence. ANTLRWorks: The ANTLR GUI Development Environment. ANTLRv3.

<http://www.antlr.org/works/index.h
tml>.

13.

Parr, Terrence. What is the difference between ANTLR v2 and v3?. (May 05, 2007).

<http://www.antlr.org/wiki/pages/viewpage.action?pageId=719>.

14.

Antoniou , Grigorios and Kontopoulos, Efstratios. d
-
POSL, a POSL compatible syntax for
defeasible RuleML ru
les. DR
-
DEVICE.A Defeasible Logic Reasoner for the Semantic
Web.<http://lpis.csd.auth.gr/systems/dr
-
device/d
-
POSL.rar>.

15.

Ali, Chaudhry Usman. Grammar Generation. POSL to d
-
POSL. Making the Positional
-
Slotted
language Defeasible.

(Nov 15, 2011). <http://d
-
po
sl.wikispaces.com/file/view/posl.g>

16.

Ali, Chaudhry Usman. POSL d
-
POSL. Making the Positional
-
Slotted language Defeasible.

(Nov 15, 2011). <http://d
-
posl.wikispaces.com/file/view/DPosNew.g>

17.

Boley, Harold. <http://www.cs.unb.ca/~boley/>

18.

Eclipse Framework. <
http://www.eclipse.org/
>

19.

ANTLR IDE. An eclipse plugin for ANTLRv3 grammars.

<http://antlrv3ide.sourceforge.net/>.

20.

Parr, Terrence. The Definitive ANTLR Reference: Building Domain
-
Specific Languages. 2007.

21.

Ali, Chaudhry

Usman. POSL d
-
POSL. Making the Positional
-
Slotted language Defeasible.

<http://d
-
posl.wikispaces.com/file/view/demoDpos_fat.jar>

22.

Apache Maven Project.
http://maven.apache.org/

23.

“Defasible Logic” <
http://defeasible.org/
>