<!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>A PROLOG Framework for Integrating Business Rules into JAVA Applications</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Ludwig Ostermayer</string-name>
          <email>ludwig.ostermayer@uni-wuerzburg.de</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Dietmar Seipel</string-name>
          <email>dietmar.seipel@uni-wuerzburg.de</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>University of Würzburg, Department of Computer Science Am Hubland</institution>
          ,
          <addr-line>D - 97074 Würzburg</addr-line>
          ,
          <country country="DE">Germany</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>Business specifications - that formerly only supported IT development - increasingly become business configurations in the form of rules that can be loaded directly into IT solutions. PROLOG is well-known for its qualities in the development of sophisticated rule systems. It is desirable to combine the advantages of PROLOG with JAVA, since JAVA has become one of the most used programming languages in industry. However, experts of both programming languages are rare. To overcome the resulting interoperability problems, we have developed a framework which generates a JAVA archive that provides methods to query a given set of PROLOG rules; it ensures that valid knowledge bases are transmitted between JAVA and PROLOG. We use XML Schema for describing the format for exchanging a knowledge base between PROLOG and JAVA. From the XML Schema desciption, we scaffold JAVA classes; the JAVA programmer can use them and fill in the open slots by statements accessing other JAVA data structures. The data structure on the JAVA side reflects the complex structured knowledge base, with which the PROLOG rules work, in an object-oriented way. We can to some extend verify the correctness of the data set / knowledge base sent from JAVA to PROLOG using standard methods for XML Schema. Moreover, we can add constraints that go beyond XML. For instance, we can specify standard integrity constraints known from relational databases, such as primary key, foreign key, and not-null constraints. Since we are dealing with complex structured XML data, however, there can be far more general integrity constraints. These can be expressed by standard PROLOG rules, which can be evaluated on the PROLOG side; they could also be compiled to JAVA by available PROLOG to JAVA converters such as Prolog Cafe - since they will usually be written in a supported subset of PROLOG. We have used our framework for integrating PROLOG business rules into a commercial E-Commerce system written in JAVA.</p>
      </abstract>
      <kwd-group>
        <kwd />
        <kwd>Business Rules</kwd>
        <kwd>Logic Programming</kwd>
        <kwd>PROLOG</kwd>
        <kwd>JAVA</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        allows to integrate PROLOG rules seamlessly into JAVA applications. We could largely
automate the integration process with our framework PBR4J (PROLOG Business Rules
for JAVA). PBR4J uses XML Schema documents, from which it generates (scaffolds)
JAVA classes containing the information necessary for utilizing the business rules. The
business rules are accessed from JAVA simply by invoking the generated JAVA
methods. From the JAVA point of view, the fact that a set of PROLOG rules is requested is
hidden. The derived facts can be accessed as a result set by JAVA getter methods. In
terms of Domain Specific Languages (DSL) [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ], we use PROLOG as an external DSL
for expressing rules. Thus, our approach enables a clean separation between a JAVA
application and the business logic, and applications can benefit from the strengths of both
programming languages.
      </p>
      <p>
        There exists the following related work. We have already discussed the usage of
DROOLS [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ], a popular JAVA tool for business rules development, and the advantages
of knowledge engineering for business rules in PROLOG [
        <xref ref-type="bibr" rid="ref11 ref12">11, 12</xref>
        ]. There are several
solutions for a communication between JAVA and PROLOG, for instance the bidirectional
PROLOG/JAVA interface JPL [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ] that combines certain C functions and JAVA classes.
On the JAVA side, JPL uses the JAVA Native Interface (JNI), on the PROLOG side it
uses the PROLOG Foreign Language Interface (FLI). When working with JPL, one has
to create rather complex query strings and explicitly construct term structures prior to
querying. Slower in performance than JPL, INTERPROLOG [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] provides a direct
mapping from JAVA objects to PROLOG terms, and vice versa. PROLOG CAFE [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] translates
a PROLOG program into a JAVA program via the Warren Abstract Machine (WAM), and
then compiles it using a standard JAVA compiler. PROLOG CAFE offers a core PROLOG
functionality, but it lacks support for many PROLOG built–in predicates from the ISO
standard.
      </p>
      <p>However, the challenge of our work was not to develop another interface between
JAVA and PROLOG, but to simplify the access to the PROLOG rules and data structures
in JAVA. We did not mix PROLOG and JAVA syntax for querying the PROLOG rules in
JAVA. Rules can be developed independently from JAVA, and our framwork ensures only
valid calls from JAVA to the PROLOG rules. We just write the rules in PROLOG and use
PBR4J to generate JAVA classes; request and result handling are encapsulated in
standard JAVA objects. Therefore in JAVA, the flavour of programming is unchanged. On
the other side, the easy–to–handle term structures and the powerful meta–predicates of
PROLOG can be used to develop sophisticated rule systems. Furthermore, using
PROLOG’s parsing techniques (DCGs) and infix operators, the rule syntax can be largely
adapted to a natural language level, which simplifies the rule creation process and
improves the readability of the rules. In particular, this is important to bridge the gap
between software engineers and business analysts without programming background.</p>
      <p>The structure of this paper is as follows. Section 2 presents a set of business rules
written in PROLOG, which will serve as a running example. In Section 3, we describe
our framework: first, we represent a knowledge base in XML and generate a
corresponding XML Schema. Then, we generate JAVA classes from the XML schema. In Section 4,
we give an example of a JAVA call to the business rules in PROLOG. Finally, we
summarize our work in Section 5.</p>
    </sec>
    <sec id="sec-2">
      <title>Business Rules in PROLOG</title>
      <p>In the following, we present a set of business rules in PROLOG, that is part of a real
commercial Enterprise Resource Planning (ERP) system for online merchants. The purpose
of the business rules is to infer financial key data and costs in a given E–Commerce
scenario that is dealing with articles, online shopping platforms, shipping parameters, and
various other parameters. The derived data support the business intelligence module of
the application, which is implemented in JAVA.</p>
      <p>Due to space restrictions, we present only a simplified version of the original set of
business rules used in the application. We focus on a constellation consisting of order,
platform and shipment charges. For every shipment, taxes have to be paid according to
the country of dispatch. In our example, the inferred financial key data are gross margin,
contribution margin and profit ratio. First, we describe the input data format necessary
for a valid request, then we take a closer look at the business rules. Finally, we explain
how to describe relationships between facts in a knowledge base and how to check them
in PROLOG.
2.1</p>
      <sec id="sec-2-1">
        <title>The Knowledge Base</title>
        <p>
          The input knowledge base consists of global data and orders. A PROLOG fact of the
form tax(Country, Rate) describes the purchase tax rate of a country. The
PROLOG facts of the form platform_charges(Category, Commission,
Discount) describe the different commissions that online shopping platforms charge
according to article categories and merchants discount [
          <xref ref-type="bibr" rid="ref7">7</xref>
          ]. A PROLOG fact of the form
shipping_charges(Country, Logistician, Charges) shows the price
that a logistician charges for a shipment to a given country.
        </p>
        <sec id="sec-2-1-1">
          <title>Listing 1.1: Global Data</title>
          <p>tax(’Germany’, 0.190).
platform_charges(’Books’, 0.11, 0.05).
shipping_charges(’Germany’, ’Fast Logistics’, 4.10).
An order is a complex data structure – represented by a PROLOG term – consisting of
an article, the country of dispatch, and the used logistician. An article is a data structure
relating a category and the prices (in Euro), i.e., base price and market price; every
article has a unique identifier EAN (European Article Number; usually 13 digits, but
we use only 5 digits in this paper).</p>
        </sec>
        <sec id="sec-2-1-2">
          <title>Listing 1.2: An Order</title>
          <p>order( article(’98765’, ’Books’, prices(29.00, 59.99)),
’Germany’, ’Fast Logistics’ ).
2.2</p>
        </sec>
      </sec>
      <sec id="sec-2-2">
        <title>The Rule Base</title>
        <p>The following business rule demonstrates the readability and compactness offered by
PROLOG. Join conditions can be formulated easily by common variable symbols, and
the term notation offers a convenient access to objects and subobjects in PROLOG; more
than one component can be accessed in a single line. Usually, If–Then–Else statements
with many alternatives are hard to review in JAVA, but much easier to write and read
in PROLOG. Due to the rules approach, multiple results are inferred implicitly; in a
DATALOG style evaluation, there is no need to explicitly encode a loop. In a PROLOG
style evaluation, all results can be derived using the meta–predicate findall/3.</p>
        <p>
          Using the PROLOG package DATALOG [
          <xref ref-type="bibr" rid="ref14">14</xref>
          ] from the DISLOG Developers’ Kit
(DDK), we can, e.g., support the development phase in PROLOG by visualizing the rule
execution with proof trees [
          <xref ref-type="bibr" rid="ref11">11</xref>
          ]. DATALOG allows for a larger set of connectives
(including conjunction and disjunction), for function symbols, and for stratified PROLOG
meta–predicates (including aggregation and default negation) in rule bodies.
        </p>
        <p>The main predicate in the business rule base computes the financial key data for a
single order. The facts of the input knowledge base will be provided by the JAVA
application, as we will see later. Derived financial_key_data/2 facts are collected in
a PROLOG list, which will be presented as a result set to JAVA.</p>
        <sec id="sec-2-2-1">
          <title>Listing 1.3: Business Rules for Financial Key Data</title>
          <p>financial_key_data(Order, Profits)
:order_to_charges(Order, Charges),
Order = order(article(_, _, prices(Base, Market)), _, _),
Charges = charges(Shipping, Netto, Fees).</p>
          <p>Gross_Profit is Netto - Base,
C_Margin is Gross_Profit - Fees - Shipping,
Profit_Ratio is C_Margin / Market,</p>
          <p>Profits = profits(Gross_Profit, C_Margin, Profit_Ratio).
order_to_charges(Order, Charges)
:</p>
          <p>Order = order(Article, Country, Logistician),
Article = article(_, Category, prices(_, Market)),
call(Order),
tax(Country, Tax_Rate),
shipping_charges(Country, Logistician, Charges),
Shipping is Charges / (1 + Tax_Rate),
Netto is Market / (1 + Tax_Rate),
platform_charges(Category, Commission, Discount),
Fees is Market * Commission * (1 - Discount),
Charges = charges(Shipping, Netto, Fees).</p>
          <p>The predicate order_to_charges/4 first computes the charges for the
shipment, then an article’s netto price using the tax rate of the country of dispatch, and
finally the fees for selling an article on the online platform in a given category. We use
the PROLOG terms Order, Profits, and Charges to keep the argument lists of the
rule heads short. E.g., order_to_charges/4 extracts the components of Order in
line 2 and calls the term Order in line 4. Thus, we can avoid writing the term Order
repeatedly – in the head and in the call. In the code, we can see nicely, which
components of Order are used in which rule, since the other components are labeled by
underscore variables.
2.3</p>
        </sec>
      </sec>
      <sec id="sec-2-3">
        <title>Constraints in PROLOG</title>
        <p>In knowledge bases, facts often reference each other. E.g., in our business rules
application, we have the following foreign key constraints: for every order/3 fact, there must
exist corresponding facts for tax/2 and shipping_charges/4, whose attribute
values for Country match the attribute value for Country in order/3. The same
holds for category in platform_charges/3 and category in order/3.
Another frequently occuring type of constraints are restrictions on argument values; e.g.,
the values for Country could be limited to countries of the European Union.</p>
        <p>This meta information between facts in a knowledge base usually remains hidden;
the developer of the rule set knows these constraints, and only sometimes they are easy
to identify within the set of business rules. For validation purposes of knowledge bases,
however, this information is crucial, in particular when a knowledge base for a request
is arranged by a programmer other than the creator of the set of rules.</p>
        <p>Constraints, such as the foreign key constraints from above, can simply be
specified and tested in PROLOG. The execution of the PROLOG predicate constraint/1
is controlled using meta–predicates for exception handling from SWI PROLOG. With
print_message/2, a meaningsful error message can be generated, and exceptions
can be caught with catch/3. In Listing 1.4, the foreign key constraints on Country
and Category are checked.</p>
        <p>
          We can also represent standard relational constraints in XML. XML representations
for create table statements have been developed and used in [
          <xref ref-type="bibr" rid="ref16 ref3">3, 16</xref>
          ]. Thus the
knowledge base – including the constraints – can be represented in XML.
        </p>
        <p>Listing 1.4: Foreign Key Constraints
constraint(fk(shipping_charges))
:forall( shipping_charges(Country, _, _),</p>
        <p>tax(Country, _) ).
constraint(fk(article_charges))
:forall( article(_, Category, _),</p>
        <p>platform_charges(Category, _, _) ).
3</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>Integration of PROLOG Business Rules into JAVA</title>
      <p>The workflow of PBR4J follows three steps, cf. Figure 1. First, PBR4J extracts an XML
Schema description for the knowledge base and the result set of a given set of PROLOG
rules. Then, the user must extend the extracted XML Schema by names for atomic
arguments, numbers and strings from PROLOG and review the type description. Finally,
PBR4J uses the XML Schema to generate JAVA classes and packs the generated classes
into a JAVA Archieve (JAR). After embedding the JAR into the JAVA application, the set
of PROLOG rules can be called from JAVA. The facts derived in PROLOG are sent back
to JAVA, where they are parsed; then, they can be accessed by the generated classes.</p>
      <p>In the following, we describe the transformation of the knowledge base to an XML
representation, from which we subsequently extract the XML Schema. Then we show
that the JAVA classes generated from the XML Schema reflect the complex structured
knowledge base in an object–oriented way. The result set is handled in a similar
manner; thus, we describe only the transformation of the knowledge base and omit further
processing details for the result set.</p>
      <sec id="sec-3-1">
        <title>3.1 An XML Schema for the Knowledge Base</title>
        <p>XML is a well–known standard for representing and exchanging complex structured
data. It allows for representing PROLOG terms and improves the interoperability
between PROLOG and JAVA programs, since XML is easy to read. We extract an XML
Schema from the XML representation of the knowledge base, and we generate JAVA
classes from the extracted XML Schema.</p>
        <p>We use the predicate prolog_term_to_xml(+Term, -Xml) for the
transformation of a PROLOG term to XML. Listing 1.5 shows the XML representation for the
PROLOG term with the predicate symbol order/3. Notice the XML attribute type
and the names of elements representing arguments of complex terms on the PROLOG
side.</p>
        <p>Listing 1.5: An Order in XML Format
&lt;order type="class"&gt;
&lt;country type="string"&gt;Germany&lt;/country&gt;
&lt;logistician type="string"&gt;Fast Logistics&lt;/logistician&gt;
&lt;article type="class"&gt;
&lt;ean type="integer"&gt;98765&lt;/ean&gt;
&lt;category type="string"&gt;Books&lt;/category&gt;
&lt;prices type="class"&gt;
&lt;base type="decimal"&gt;29.00&lt;/base&gt;
&lt;market type="decimal"&gt;59.99&lt;/market&gt;
&lt;/prices&gt;
&lt;/article&gt;
&lt;/order&gt;</p>
        <p>These are necessary, because JAVA is a typed language, whereas PROLOG builds
data structures from a few basic data types. The representation for class attributes in
JAVA is a typed Name="Value" pair. In order to map the knowledge base from
PROLOG to JAVA, we must give names to arguments of PROLOG facts, if they are atomic,
numbers, or strings, and we must add a type information. The functor of a complex
PROLOG term is mapped to the tag of an element with type="class". The structure
of the XML representation easily can be generated from the PROLOG term structure,
and some of the type information can be inferred automatically from the basic PROLOG
data types. But, type preferences and meaningful names for atoms, numbers, and strings
must be inserted manually.</p>
        <p>From the XML representation of the knowledge base and the result set, we can
extract a describing XML Schema using PROLOG. The XML Schema is a natural way to
describe and to define the complex data structure. Known techniques are available for
validating the XML representation of the knowledge base w.r.t. the XML Schema.
Listing 1.6 shows the description of an order/3 term in XML Schema. The XML Schema
of the knowledge base can contain further information in attributes like minOccurs
and maxOccurs.</p>
        <p>Listing 1.6: Fragment of the XML Schema describing order/3
&lt;xsd:element name="order" type="order_Type"</p>
        <p>minOccurs="1" maxOccurs="unbounded" /&gt;
&lt;xsd:complexType name="order_Type"&gt;
&lt;xsd:sequence&gt;
&lt;xsd:element name="article" type="article_Type" /&gt;
&lt;xsd:element name="country" type="xsd:string" /&gt;
&lt;xsd:element name="logistician" type="xsd:string" /&gt;
&lt;/xsd:sequence&gt;
&lt;/xsd:complexType&gt;
&lt;xsd:complexType name="article_Type"&gt;
&lt;xsd:sequence&gt;
&lt;xsd:element name="ean" type="xsd:integer" /&gt;
&lt;xsd:element name="category" type="xsd:string" /&gt;
&lt;xsd:element name="prices" type="prices_Type" /&gt;
&lt;/xsd:sequence&gt;
&lt;/xsd:complexType&gt;
&lt;xsd:complexType name="prices_Type"&gt;
&lt;xsd:sequence&gt;
&lt;xsd:element name="base" type="xsd:decimal" /&gt;
&lt;xsd:element name="market" type="xsd:decimal" /&gt;
&lt;/xsd:sequence&gt;
&lt;/xsd:complexType&gt;
3.2</p>
      </sec>
      <sec id="sec-3-2">
        <title>Scaffolding of JAVA Code</title>
        <p>
          From the XML Schema, we generate JAVA classes using the PROLOG–based XML
transformation language FNTRANSFORM [
          <xref ref-type="bibr" rid="ref13">13</xref>
          ]. FNTRANSFORM offers recursive
transformations of XML elements using a rule formalism similar to – but more powerful than –
XSLT. Every xsd:element in the schema with a complex type will be mapped to
a JAVA class. Child elements with simple content are mapped to attributes. Figure 2
shows a fragment of the UML diagram for the generated classes.
        </p>
        <p>All classes associated with the class KnowledgeBase implement the methods
check and toPrologString. An example of the method toPrologString of
the generated class Order is shown in Listing 1.7. A recursive call of check controls
that all necessary input data are set before the method toPrologString is called
to build a knowledge base in a string format, which can be parsed easily by PROLOG
using the predicate string_to_atom/2. The transformation to a PROLOG term can
be achieved by atom_to_term/3.</p>
        <p>Parts of the generated class RuleSet are shown in Listing 1.8. The method query
sends a PROLOG goal together with a knowledge base in string format from JAVA to
PROLOG. As a default interface between JAVA and PROLOG, we have implemented
a simple connection with a communication layer based on standard TCP/IP sockets.
Other interfaces can be implemented and set as the value for the attribute
prologInterface of the class RuleSet. The default interface is represented by the class
PrologInterface, which is fix and not generated every time a set of PROLOG rules
is integrated into a given JAVA application via PBR4J. The class PrologInterface
must be integrated into the JAVA application once, and it must be accessible for all
generated classes of the type RuleSet.</p>
        <p>Listing 1.7: toPrologString in Order
public String toPrologString() {
this.check();
StringBuilder sb = new StringBuilder();
sb.append( "order" + "(" +
this.article.toPrologString() + ", "
"’" + this.getCountry() + "’" + ", "
"’" + this.getLogistician() + "’" + ")" );
return sb.toString();
}</p>
        <p>The result set that is sent back from PROLOG to JAVA is parsed by the method
parseResult of the class RuleSet. As for the class PrologInterface, the
class PrologParser is not generated and must be integrated into the JAVA
application once and be accessible for all generated classes of the type RuleSet. The
method parseProlog of PrologParser saves the content of the string returned
from PROLOG in a structured way to a hashmap. The hashmap than can be further
processed efficiently by the method readData that all classes associated with the class
ResultSet must implement. The method readData analyses the hashmap and fills
the data list of the class ResultSet.</p>
        <p>Listing 1.8: The Class RuleSet
package pbr4j.financial_key_data;
public class RuleSet {
private PrologInterface prologInterface = null;
private String name = "financial_key_data";
private KnowledgeBase knowledgeBase = null;
private ResultSet resultSet = null;
// ... code that we omit...
private void parseResponse(String prologString) {</p>
        <p>DataList data = PrologParser.parseProlog(prologString);
this.resultSet = new ResultSet();
this.resultSet.readData(data); }
// ... code that we omit...
private void query(KnowledgeBase kb) {
if (prologInterface == null) {</p>
        <p>this.setDefaultInterface(); }
String response = prologInterface.callProlog(</p>
        <p>this.name, kb.toPrologString());
this.parseResponse(response); }
// ... code that we omit...
}</p>
        <p>
          All generated classes are organised in a namespace via a JAVA package. The package
access protection ensures that the class RuleSet can only contain a
KnowledgeBase from the same package. The package can be stored in a JAVA Archive (JAR) – a
compressed file that can not be changed manually. This creates an intentional generation
gap, cf. Fowler [
          <xref ref-type="bibr" rid="ref8">8</xref>
          ]. The JAR file can be embedded into any JAVA application easily, and
all classes in the JAR become fully available to the JAVA developers.
        </p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>4 A JAVA Call to the Business Rules</title>
      <p>In the following, we will give a short example of a request to a set of PROLOG rules
using the classes generated with PBR4J. Listing 1.9 shows a test call from JAVA to the
set of business rules described in Section 2. We omit object initialisation details, but we
assume that the necessary objects for a successful call are provided. For improving the
readability of the result of the call, we assume that all classes associated with the class
ResultSet implement the method toPrologString.</p>
      <sec id="sec-4-1">
        <title>Listing 1.9: A JAVA Call to the Business Rules</title>
        <p>import pbr4j.financial_key_data.*;
public class TestCall {
public static void main(String[] args) {</p>
        <p>RuleSet rules = new RuleSet();
KnowledgeBase kb = new KnowledgeBase();
// ... filling the knowledge base with data ...
rules.query(kb);
ListIterator&lt;Object&gt; it =</p>
        <p>rules.getResultSet().listIterator();
while (it.hasNext()) {</p>
        <p>System.out.println(it.next().toPrologString() + ".");
} } }</p>
        <p>It is not visible in JAVA that a request is made to a rule set written in PROLOG.
Running the JAVA code from above creates the system output shown in Listing 1.10;
we have added some newlines to improve readability. The first fact is derived from the
data described in Subsection 2.1. The second fact is derived from another order of the
same article, that is shipped to France. Charges for the shipment to a foreign country are
higher, and the tax rate of France is 0.196, which explains the slightly lower argument
values of profits/3.</p>
        <p>Listing 1.10: order Result Set
financial_key_data(
order( article(’98765’, ’Books’, prices(29.00, 59.99)),
’Germany’, ’Fast Logistics’ ),
profits(21.41, 11.70, 0.195) ).
financial_key_data(
order( article(’98765’, ’Books’, prices(29.00, 59.99)),
’France’, ’Fast Logistics’ ),
profits(21.16, 7.70, 0.128) ).
5</p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>Conclusions</title>
      <p>We have presented a largely automatic approach for integrating a set of PROLOG rules
seamlessly into JAVA applications. XML Schema is used for specifying the XML format
for exchanging a knowledge base and a result set, respectively, between PROLOG and
JAVA.</p>
      <p>On the PROLOG side, we use a generic mapping from the PROLOG representation
of the knowledge base and the result set to an XML representation enriched by data type
information and names for atoms or numbers, and we extract a describing XML Schema
from the XML representation. On the JAVA side, we scaffold JAVA classes from the XML
Schema, that reflect the complex structured PROLOG terms in an object–oriented way.
Accessing a set of rules from JAVA is simply done by invoking the JAVA methods of the
generated classes without programming PROLOG or creating complex query strings.</p>
      <p>We have illustrated our approach using a set of business rules that we have already
integrated with our framework into a commercial E–Commerce system written in JAVA.
Acknowledgement. We acknowledge the support of the Trinodis GmbH.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>S.</given-names>
            <surname>Abiteboul</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Bunemann</surname>
          </string-name>
          ,
          <string-name>
            <surname>D.</surname>
          </string-name>
          <article-title>Suciu: Data on the Web - From Relations to Semi-Structured Data</article-title>
          and
          <string-name>
            <surname>XML</surname>
          </string-name>
          , Morgan Kaufmann,
          <year>2000</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>M.</given-names>
            <surname>Banbara</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Tamura</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Inoue</surname>
          </string-name>
          .:
          <article-title>Prolog Cafe: A Prolog to Java Translator</article-title>
          ,
          <source>Proc. Intl. Conf. on Applications of Declarative Programming and Knowledge Management (INAP)</source>
          <year>2005</year>
          , Springer, LNAI
          <volume>4369</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>A.</given-names>
            <surname>Böhm</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Seipel</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Sickmann</surname>
          </string-name>
          ,
          <string-name>
            <surname>M.</surname>
          </string-name>
          <article-title>Wetzka: Squash: A Tool for Designing, Analyzing and Refactoring Relational Database Applications</article-title>
          .
          <source>Proc. Intl. Conf. on Applications of Declarative Programming and Knowledge Management (INAP)</source>
          <year>2007</year>
          , Springer, LNAI
          <volume>5437</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4. H.
          <article-title>Boley: The Rule Markup Language: RDF-XML Data Model, XML Schema Hierarchy, and XSL Transformations</article-title>
          .
          <source>Proc. Intl. Conf. on Applications of Declarative Programming and Knowledge Management (INAP)</source>
          <year>2001</year>
          , Springer, LNAI
          <volume>2543</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>M.</surname>
          </string-name>
          <article-title>Calejo: InterProlog: Towards a Declarative Embedding of Logic Programming in Java</article-title>
          ,
          <source>Proc. 9th European Conference on Logics in Artificial Intelligence, JELIA</source>
          ,
          <year>2004</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Drools - The Business</surname>
          </string-name>
          Logic Integration Platform. http://www.jboss.org/drools/.
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <given-names>Ebay</given-names>
            <surname>Seller</surname>
          </string-name>
          <article-title>Fees</article-title>
          . http://pages.ebay.de/help/sell/seller-fees.html.
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <given-names>M.</given-names>
            <surname>Fowler</surname>
          </string-name>
          .
          <source>Domain-Specific Languages. Addison-Wesley</source>
          ,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <given-names>E.</given-names>
            <surname>Gamma</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Helm</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Johnson</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. Vlissides. Design</given-names>
            <surname>Patterns</surname>
          </string-name>
          .
          <article-title>Elements of Reusable Object-Oriented Software</article-title>
          .
          <string-name>
            <surname>Addison-Wesley Longman</surname>
          </string-name>
          ,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <given-names>B. v.</given-names>
            <surname>Halle</surname>
          </string-name>
          . Business Rules Applied. Wiley,
          <year>2002</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11. L.
          <string-name>
            <surname>Ostermayer</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          <string-name>
            <surname>Seipel</surname>
          </string-name>
          .
          <article-title>Knowledge Engineering for Business Rules in PROLOG</article-title>
          .
          <source>Proc. Workshop on Logic Programming (WLP)</source>
          ,
          <year>2012</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12. L.
          <string-name>
            <surname>Ostermayer</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          <string-name>
            <surname>Seipel</surname>
          </string-name>
          .
          <article-title>Simplifying the Development of Rules Using Domain Specific Languages in DROOLS</article-title>
          .
          <source>Proc. Intl. Conf. on Applications of Declarative Programming and Knowledge Management (INAP</source>
          )
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13.
          <string-name>
            <given-names>D.</given-names>
            <surname>Seipel</surname>
          </string-name>
          .
          <article-title>Processing XML-Documents in Prolog</article-title>
          .
          <source>Proc. 17th Workshop on Logic Programming (WLP)</source>
          ,
          <year>2002</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          14.
          <string-name>
            <given-names>D.</given-names>
            <surname>Seipel</surname>
          </string-name>
          .
          <article-title>Practical Applications of Extended Deductive Databases in DATALOG</article-title>
          .
          <source>Proc. Workshop on Logic Programming (WLP)</source>
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          15.
          <string-name>
            <given-names>D.</given-names>
            <surname>Seipel</surname>
          </string-name>
          .
          <article-title>The DISLOG Developers' Kit (DDK)</article-title>
          . http://www1.informatik.uni-wuerzburg.de/database/DisLog/
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          16.
          <string-name>
            <given-names>D.</given-names>
            <surname>Seipel</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Boehm</surname>
          </string-name>
          ,
          <string-name>
            <surname>M.</surname>
          </string-name>
          <article-title>Fröhlich: Jsquash: Source Code Analysis of Embedded Database Applications for Determining SQL Statements</article-title>
          .
          <source>Proc. Intl. Conf. on Applications of Declarative Programming and Knowledge Management (INAP)</source>
          <year>2009</year>
          , Springer, LNAI
          <volume>6547</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          17.
          <string-name>
            <given-names>P.</given-names>
            <surname>Singleton</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Dushin</surname>
          </string-name>
          , J. Wielemaker: JPL: A Bidirectional Prolog/Java Interface http://www.swi-prolog.org/packages/jpl/,
          <year>2004</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          18.
          <string-name>
            <given-names>J.</given-names>
            <surname>Wielemaker</surname>
          </string-name>
          . SWI PROLOG Reference Manual http://www.swi-prolog.org/pldoc/refman/
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>