AceRules Webservice

Introduction

This document describes the AceRules webservice. The service executes rules written in ACE and supports three different semantics. It uses SOAP 1.1 for communication and it can be accessed over the HTTP protocol using POST. The URL of the service is

http://attempto.ifi.uzh.ch/ws/acerules/acerulesws.perl

There is a WSDL file that defines the interface to the web service. Furthermore, there are two web interfaces that rely on the webservice. One of them is a technical interface that allows the user to observe the communication with the webservice. The other web interface focuses on usability and is intended for end users.

The rest of this document gives a short description of how the SOAP messages have to look like, in order to be accepted by the AceRules webservice.

Request

A request to the AceRules webservice needs one single Request-element inside of the body-part of the SOAP-envelope. This element can contain the following sub-elements:

Element NameCountContentDefaultDescription
Program 1 text The AceRules program as an ACE text.
Mode 0-1 court | stable | stable_strong court The mode (i.e. semantics) to be used to calculate the answer: courteous, stable, or stable with strong negation.
UserLexiconURL 0-1 URL If this element is present then the user lexicon is fetched from the specified URL and loaded before parsing the ACE text. Otherwise, no user lexicon is used.
Guess 0-1 on | off off If on, unknown words are guessed. (Unknown proper names are recognized anyway.)
MaxAnswers 0-1 positive-integer 1 The maximal number of answers that should be calculated. It has no effect in courteous mode, since there is always exactly one answer.
RulesOutput 0-1 on | off off Rules in internal Prolog notation are returned.
SimpleRulesOutput 0-1 on | off off Rules in a simplified Prolog representation are returned.
AnswersetOutput 0-1 on | off off Answersets are returned (Prolog notation).
AnswertextOutput 0-1 on | off on Answertexts are returned.
TraceOutput 0-1 on | off off Trace is returned in Prolog notation (courteous mode only).
ACETraceOutput 0-1 on | off off Verbalized trace is returned (courteous mode only).

Note that only Program is mandatory. For example, a request to get back only the simple-rules and using word-guessing would look like this:

<?xml version="1.0" encoding="UTF-8"?>

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
    <env:Body>
        <ar:Request xmlns:ar="http://attempto.ifi.uzh.ch/acerules">
            <ar:Program>John is a customer.</ar:Program>
            <ar:Guess>on</ar:Guess>
            <ar:SimpleRulesOutput>on</ar:SimpleRulesOutput>
            <ar:AnswertextOutput>off</ar:AnswertextOutput>
        </ar:Request>
    </env:Body>
</env:Envelope>

Reply

The reply of the AceRules webservice has a single Reply-element inside of the body-part of the SOAP-message. The sub-elements of this element depend on the request:

ElementCountDescription
Rules 0-1 The rules in internal Prolog notation.
SimpleRules 0-1 The rules in simplified Prolog notation.
Answerset 0-n An answerset of the program in Prolog notation.
Answertext 0-n An answertext of the program (i.e. a verbalized answerset).
Trace 0-1 The trace of the program execution in Prolog notation.
ACETrace 0-1 The verbalized trace of the program.

For example, the request of the previous section would lead to the following reply:

<?xml version="1.0" encoding="UTF-8"?>

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
    <env:Body>
        <ar:Reply xmlns:ar="http://attempto.ifi.uzh.ch/acerules">
            <ar:SimpleRules>customer('John').</ar:SimpleRules>
        </ar:Reply>
    </env:Body>
</env:Envelope>

For reading the rules (internal or simplified) with a Prolog engine, you need the following operator declarations:

:- op(400, fy, -).      % strong negation
:- op(400, fy, ~).      % negation as failure
:- op(1000, xfx, <-).   % rule
:- op(1100, xfx, ::).   % label attachment

The elements Trace and ACETrace contain a sequence of Step-elements. In the case of Trace, each of these Step-elements contains three elements describing the state of one inference step: Raw, Delete, and Consistent. In the case of ACETrace, there are only the two elements Raw and Consistent. Since both trace outputs are only allowed for courteous mode (which has always exactly one answer), there cannot be more than one of each trace output.

Contact

If you have questions, comments, bug reports, etc. don't hesitate to contact the developer.

Tobias Kuhn, 2007-08-20