-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshort_paper.html
More file actions
596 lines (413 loc) · 28.7 KB
/
short_paper.html
File metadata and controls
596 lines (413 loc) · 28.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Automatic Integration of Hybrid Java-Prolog Entities with LogicObjects</title>
<link rel="stylesheet" href="/styles/publication/sc.tutorial.css" />
<link rel="stylesheet" href="/styles/publication/sc.tooglejs.css" />
<script type="text/javascript" src="/js/jquery.min.js" charset="utf-8"></script>
<script type="text/javascript" src="/js/ace-builds/src-noconflict/ace.js" charset="utf-8"></script>
<script type="text/javascript" src="/js/publication/jquery.tableofcontents.min.js" charset="utf-8"></script>
<script type="text/javascript" src="/js/publication/jquery.sc.publication.js" charset="utf-8"></script>
<script type="text/javascript">//<![CDATA[
(function ($) {
$(document).ready(function(){
$('.JSOnlyContent').show();
$('#table_of_content_entries').tableOfContents('#content', {startLevel:2, depth: 3});
$.prettifyCodeSnippets("eclipse");
//$.prettifyCodeSnippets("solarized_light");
$.configureFootnotes();
})
})(jQuery);
//]]></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-47515052-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body>
<div>
<div style="text-align: center">
<div><h1 style="margin: 0.4em 0 0.2em 0;">Automatic Integration of Hybrid Java-Prolog Entities with LogicObjects</h1></div>
<!--
<div><h1 style="margin: 0.4em 0 0.2em 0;">LogicObjects: Enabling the Automatic Integration of Hybrid Java-Prolog Entities</h1></div>
-->
<!--
<div><h1 style="margin: 0.4em 0 0.2em 0;">An Automatic Integration Approach for Java and Prolog <br/> based on Inter-Language Conversions</h1></div>
-->
<div>
Sergio Castro <sup> <a rel="footnote" href="#fn:ucl">1</a> </sup>,
Kim Mens <sup> <a rel="footnote" href="#fn:ucl">1</a> </sup> and
Paulo Moura <sup> <a rel="footnote" href="#fn:inescporto">2</a> </sup>
</div>
<div id="affiliations">
<div id="fn:ucl">
(1)
<a title="Université catholique de Louvain" href="http://www.uclouvain.be/">Université catholique de Louvain</a>,
<a title="Institute of Information and Communication Technologies, Electronics and Applied Mathematics" href="http://www.uclouvain.be/icteam/">ICTEAM</a>,
<a title="Computing Science Engineering Department" href="http://www.uclouvain.be/ingi/">INGI</a>.
</div>
<div id="fn:inescporto">
(2)
<a title="Center for Research in Advanced Computing Systems" href="http://cracs.fc.up.pt/">Center for Research in Advanced Computing Systems</a>,
<a title="INESC-TEC" href="http://www.inescporto.pt/">INESC-TEC</a>.
</div>
</div> <!-- end of affiliations -->
</div>
</div>
<div id="table_of_content" class="JSOnlyContent" style="display: none;">
<strong>Contents</strong>
<ol id="table_of_content_entries"></ol>
</div>
<div id="content">
<h2>Introduction</h2>
<p>
Logic languages excel for problems that can be defined declaratively, e.g. applications that require symbolic computation such as expert and planning systems
<sup><a rel="footnote" href="#fn:rus95">1</a></sup> <sup><a rel="footnote" href="#fn:Sterling:1994:APA:175753">2</a></sup>.
However, it is often difficult to develop complete applications that require e.g. GUIs, heavy numerical computations, or low-level operating system and network access
<!--However, it is often difficult to develop real-life applications with only a logic language-->
<sup><a rel="footnote" href="#fn:2014-jelia-calejo">3</a></sup> <sup><a rel="footnote" href="#fn:conf/lpe/WielemakerA02">4</a></sup>.
On the other hand, object-oriented languages have demonstrated their usefulness for modelling a wide range of concepts (e.g., GUIs) found in many business scenarios
<sup><a rel="footnote" href="#fn:Meyer:1988ys">5</a></sup>.
The availability of continuously growing software ecosystems around widely used modern object-oriented languages, including advanced IDEs and rich sets of libraries, has significantly contributed to their success.
</p>
<p>
Non-trivial applications can profit from implementing their components, or even distinct routines of the same entity, in the language that is most appropriate for expressing them
<sup><a rel="footnote" href="#fn:2014-jelia-calejo">3</a></sup>
<sup><a rel="footnote" href="#fn:Mernik:2005:DDL:1118890.1118892">6</a></sup>
<sup><a rel="footnote" href="#fn:DHondt2004">7</a></sup>.
However, the integration of programs or routines written in different languages is not trivial when such languages belong to different paradigms
<sup><a rel="footnote" href="#fn:Omicini:1994fk">8</a></sup>
<sup><a rel="footnote" href="#fn:Brichau02towardslinguistic">9</a></sup>
<sup><a rel="footnote" href="#fn:Gybels2003">10</a></sup>.
</p>
<p>
Although numerous approaches allow to integrate Java and Prolog programs, few of them put an emphasis on the transparency and automation of the integration concern at the entity level.
In this article, we describe an approach based on the notion of automatic inter-language conversions that does tackle this problem.
</p>
<!--
<p>
In the first part of this article we introduce JPC, a Java library for accomplishing bi-directional conversions between Java objects and Prolog terms.
In the second part we introduce the LogicObjects framework, which facilitates the automatic integration of hybrid Java-Prolog entities.
</p>
-->
<h2>Preparing the Ground: Inter-Language Conversions with JPC</h2>
<p>
The core of our approach is built on top of an extensible and fine-grained mechanism for mapping artefacts between the Prolog and Java worlds:
the <a href="http://java-prolog-connectivity.github.com/" title="The JPC library">JPC</a> (Java-Prolog Connectivity) library.
<!--
A concrete implementation of this mechanism is provided by means of the <a href="http://java-prolog-connectivity.github.com/" title="The JPC library">JPC</a> (Java-Prolog Connectivity) library.
-->
Conversely to other Java-Prolog integration libraries, JPC leaves open the mapping between concrete Prolog terms and Java objects.
</p>
<p>
JPC's design has been inspired by a well-known library for accomplishing context-dependent conversions between Java and <a href="http://json.org/" title="JSON">JSON</a> artefacts: <a href="https://code.google.com/p/google-gson/" title="Google's Gson">Google's Gson</a> library.
The goal of Gson is to provide an intuitive, minimalistic interface for facilitating the specification and execution of Java-JSON bidirectional conversions.
As part of our design philosophy we extrapolate several design goals of Gson to our domain (i.e., Java-Prolog conversions), amongst others:
</p>
<div class="divList">
<ul>
<li>Allowing arbitrary objects to be converted to and from Prolog terms. </li>
<li>Working with pre-existing objects that cannot or should not be modified (e.g., no sources available). </li>
<li>Including a considerable catalog of pre-defined bi-directional converters.</li>
<li>Allowing to extend the default conversion strategy by means of custom converters.</li>
<li>Encapsulating conversion strategies as reified conversion contexts.</li>
<li>Supporting objects with deep hierarchies that may contain generic classes.</li>
<li>Enabling type-guided conversions. For example, a Prolog list may be converted to a Java Array, List or Map, according to the expected conversion type, if any.</li>
</ul>
</div>
<p>In the rest of this section we overview how JPC accomplishes some of these goals.</p>
<h3>Conversion Contexts</h3>
<p>
A conversion context is a scoped bidirectional conversion strategy reified by means of the <a href="/javadocs/org/jpc/Jpc.html" title="Jpc class"><code>Jpc</code></a> class.
Being encapsulated into an entity, multiple conversion contexts can be employed in the same program, facilitating the co-existence of different mappings when required.
New conversion contexts can be easily created by means of a <a href="/javadocs/org/jpc/JpcBuilder.html" title="JpcBuilder class"><code>context builder</code></a>.
The instantiation of a default conversion context (i.e., a context including only pre-defined conversions) is shown in the code snippet below:
</p>
<div class="codeEditor"><pre data-editor="java" data-show-gutter="true">
JpcBuilder builder = JpcBuilder.create(); // a default conversion context builder
Jpc jpc = builder.build(); // a default conversion context</pre></div>
<h3>Pre-Defined Conversions</h3>
<p>
Once a conversion context has been instantiated, it can be employed to convert between Java and Prolog artefacts.
By default, a conversion context can accomplish common conversions (e.g., conversions between primitives) without further configuration.
Some of these pre-defined conversions are shown below:
</p>
<div class="codeEditor"><pre data-editor="java" data-show-gutter="true">
Jpc jpc = JpcBuilder.create().build(); // a default conversion context
//Java to Prolog
jpc.toTerm(true); // ==> new Atom("true")
jpc.toTerm("1"); // ==> new Atom("1")
jpc.toTerm(1); // ==> new IntegerTerm(1)
jpc.toTerm(1D); // ==> new FloatTerm(1)
//Prolog to Java
jpc.fromTerm(new Atom("true")); // ==> true
jpc.fromTerm(new Atom("1")); // ==> "1"
jpc.fromTerm(new IntegerTerm(1)); // ==> 1L
jpc.fromTerm(new FloatTerm(1)); // ==> 1D</pre></div>
<h3>Type-Guided Conversions</h3>
<p>
A conversion operation can also be parameterised with the expected result type of a conversion.
Some examples of type-guided conversions are shown in the following code snippet:
</p>
<div class="codeEditor"><pre data-editor="java" data-show-gutter="true">
Term listTerm = listTerm(new Atom("1"), new Atom("2")); //Prolog list -> ['1', '2']
String[] array = jpc.fromTerm(listTerm, String[].class); //array of strings
List<?> list = jpc.fromTerm(listTerm, List.class); //list of strings
Type type = new TypeToken<List<Integer>>(){}.getType(); //reification of the List<Integer> type
list = jpc.fromTerm(listTerm, type); //list of integers</pre></div>
<p>
Depending on the target conversion type, the Prolog atoms list <code>['1', '2']</code> (line 1) is converted into a a string array (line 2), a list of strings (line 3) or a list of integers (line 5).
</p>
<h3>Custom Conversions</h3>
<p>
A conversion context can be extended with custom converters.
Such a converter is just a class implementing the <code>FromTermConverter</code> and/or <code>ToTermConverter</code> interfaces.
When registered into a conversion context, a converter adds to the pre-defined conversions a new mapping of artefacts.
As an example, consider a converter that knows how to convert a Prolog compound term to an instance of the <code>Person</code> class:
</p>
<div class="codeEditor"><pre data-editor="java" data-show-gutter="true">
public class PersonConverter implements FromTermConverter<Compound, Person> {
@Override public Person fromTerm(Compound term, Type type, Jpc context) {
String personName = ((Atom)term.arg(1)).getName();
return new Person(personName);
}
}</pre></div>
<p>
The following code snippet illustrates how a custom conversion context extended with the <code>PersonConverter</code> can be employed to facilitate the interpretation of a query result as a Java object with a minimum amount of code:
</p>
<div class="codeEditor"><pre data-editor="java" data-show-gutter="true">
JpcBuilder builder = JpcBuilder.create().register(new PersonConverter(),
new Functor("person"), 1).asTerm()); //person(_)
Jpc jpc = builder.build(); //custom conversion context
//the term bound to P is automatically converted to an instance of the Person class
Person person = engine.query("cool_person(P)", jpc).<Person>selectObject("P").oneSolutionOrThrow(); </pre></div>
<p>
Note that at the moment of registering the converter, it is associated with the compound term <code>person(_)</code> (line 2).
Therefore, the converter is applicable only to terms subsumed by such a compound.
</p>
<h2>Automatic Integration of Hybrid Entities with LogicObjects</h2>
<p>
The low-level inter-language conversion framework provided by JPC is a convenient building block for facilitating the implementation of more advanced integration libraries.
LogicObjects is a high-level integration framework for Java and Prolog built on top of JPC.
It allows to define hybrid entities with partial implementations in Java and Prolog.
Although to a certain extent LogicObjects is compatible with plain Prolog, to get the best out of it, it is recommended to install on the Prolog side <a href="http://logtalk.org/" title="Logtalk: An open source object-oriented logic programming language">Logtalk</a>, an object-oriented layer for Prolog.
</p>
<p>
Figure 1 shows the definition of a <code>Person</code> entity.
This entity has a dual nature. In the Java world, it takes the form of an instance of the <code>Person</code> class. In the Prolog world, it is reified as the Logtalk <a href="http://logtalk.org/manuals/userman/features.html#features_parametric" title="Logtalk parametric objects"> parametric object</a> <code>person/1</code>.
In this example, the implementation is scattered over the two worlds (the method <code>experience()</code> is defined in Java and the predicate <code>salary/1</code> in Prolog).
However, it is also possible to create entities that are completely defined either in Java or Prolog, but still transparently accessible from the foreign language.
</p>
<div class="divImg">
<img src="img/examples/interaction_person.svg" alt="The Person entity." style="padding-bottom:0.5em;" height="250" />
<div id="imglabel:interaction_person" >Fig 1. - A dual representation of the Person entity.</div>
</div>
<p>
In the rest of this section we review the automatic integration mechanisms provided by LogicObjects from both language perspectives.
</p>
<h3>Integration from the Java Perspective</h3>
<p>
The following code snippet shows the Java side of the implementation of the <code>Person</code> entity.
Abstract methods correspond to routines implemented in Prolog/Logtalk.
</p>
<div class="codeEditor"><pre data-editor="java" data-show-gutter="true">
@LObject(name="person", args={"name"})
abstract class Person {
private final String name;
public Person(String name) {this.name = name;}
@LMethod(args = {"LSolution"})
public abstract int salary();
public int experience() {
...
}
}</pre></div>
<p>
The <code>@LObject</code> annotation on line 1 provides mapping information to LogicObjects.
The <code>name</code> attribute indicates that an instance of the <code>Person</code> class is reified as a compound with name <code>person</code>.
The <code>args</code> attribute signals that the argument of such a compound is the term representation of the instance variable <code>name</code>.
</p>
<p>
The <code>@LMethod</code> annotation on line 7 provides mapping information regarding a specific routine.
In this case, the <code>salary()</code> Java method is mapped to a predicate having the same name.
As arguments, it will have the unbound logic variable <code>LSolution</code>.
Therefore, an invocation of the <code>salary()</code> method on a person with name <code>"mary"</code> will be interpreted as querying the Prolog goal:
<div class="codeEditor"><pre data-editor="prolog" data-show-gutter="false">
person(mary)::salary(LSolution)</pre></div>
where <code>person(mary)</code> corresponds to the conversion to a term of the receiver of the message (an instance of <code>Person</code>); <code>salary(LSolution)</code> is the conversion to a predicate of the method <code>salary()</code> and <code><a href="http://logtalk.org/manuals/userman/messages.html" title="Logtalk message sending operator">::</a></code> is the Logtalk message sending operator.
</p>
<p>
LogicObjects provides several heuristics for determining the return value in Java of a routine implemented on the Prolog side.
One of them consists in inspecting the names of the unbound logic variables. In case it encounters an occurrence of a variable named <code>LSolution</code> (line 7), it will consider as the return value of the method the conversion to a Java object of the term bound to that variable.
Also note that by default a query is interpreted as deterministic. Hence, only its first solution is considered. However, this can be customised by means of another Java annotation (e.g., to compose all the solutions in a container object such as an instance of <code>java.util.List</code>).
</p>
<p>
In addition to the <code>@LObject</code> and <code>@LMethod</code> annotations illustrated in the <code>Person</code> class, other useful annotations are:
</p>
<div class="divList">
<ul>
<li><code>@LComposition</code>: If present in a method, all solutions will be composed into one single object.</li>
<li><code>@LSolution</code>: Allows to specify the term representation of an object corresponding to a single solution.</li>
<li><code>@LQuery</code>: Allows to map a Java method to an arbitrary Prolog query.</li>
</ul>
</div>
We have left, however, a detailed explanation of these annotations outside the scope of this short article.
<p>
An instance of a class with a partial implementation in Prolog can be obtained by means of the static method <code>newLogicObject</code>, as shown in the following code snippet:
</p>
<div class="codeEditor"><pre data-editor="java" data-show-gutter="true">
import static org.logicobjects.newLogicObject;
...
Person person = newLogicObject(Person.class, "mary");
System.out.println("Salary: " + person.salary()); //automatic delegation to Prolog</pre></div>
<p>
The first argument is the class to instantiate. Remaining arguments correspond to the class constructor arguments.
</p>
<h3>Integration from the Prolog Perspective</h3>
<p>
The logic counterpart of the <code>Person</code> class is the Logtalk parametric object <code>person/1</code> defined as in the following code snippet:
</p>
<div class="codeEditor"><pre data-editor="prolog" data-show-gutter="true">
:- object(person(_Name) imports jobject).
:- public(salary/1).
salary(S) :- ...
:- end_object.</pre></div>
<p>
Any Logtalk object importing the <code>jobject</code> <a href="http://logtalk.org/manuals/userman/categories.html" title="Logtalk categories"> category</a> will delegate automatically to the Java side any message that it does not understand.
For example, a Logtalk method call <code>person(mary)::experience</code> will be interpreted in Java as:
<div class="codeEditor"><pre data-editor="java" data-show-gutter="false">
new Person("mary").experience()</pre></div>
where <code>new Person("mary")</code> corresponds to the conversion to a Java object of the term <code>person(mary)</code> and the method <code>experience()</code> the looked-up method when receiving a message with the same name on the logic side.
</p>
<p>
Java methods returning values impose a defiance to the transparency of our approach.
While returning values is a natural concept in Java, it does not exist in Prolog.
Therefore, an important problem to solve is how a programmer can specify that a Java method return value is required on the Prolog side.
We provide three different alternative mechanisms for this.
They are illustrated by means of the following equivalent message calls on the <code>person(mary)</code> Logtalk object:
</p>
<div class="codeEditor"><pre data-editor="prolog" data-show-gutter="true">
person(mary)::experience(return(ReturnSpecifier)). %return value specified as an argument of the method.
jobject(person(mary), ReturnSpecifier)::experience. %return value specified as an argument of the jobject/2 Logtalk object.
person(mary)::experience return ReturnSpecifier. %return value specified by means of the return operator.</pre></div>
<p>
On line 1, the return value is part of the message term. Arguments matching <code>return(_)</code> are ignored since they correspond not to a Java method parameter, but to the Java method return value.
On line 2, the return value is an argument of the auxiliary Logtalk object <code>jobject/2</code>, which has as first argument the receiver of the message, and the second argument corresponds to the return value.
This alternative has the advantage that the message term does not require to be polluted with a return value.
As the last alternative on line 3, the return value is captured by means of the <code>return</code> operator. This has the advantage that the return value is not present as an argument neither of the receiver nor the message.
None of these approaches is perfect, since they make explicit the foreign concept of a returned value on the Prolog side.
We believe, however, that providing several alternatives alleviate this problem to a certain extent.
</p>
<p>
Finally, note that the object returned from a Java method can be reified as a term in many different ways (e.g., a term containing the object serialisation data, or a simple numeric identifier pointing to a Java reference, etc).
Therefore, an integration approach should not impose a single reification strategy.
We provide a solution to this problem by means of introducing the notion of <em>return specifiers</em>.
</p>
<p>
By employing return specifiers, a programmer can provide a term describing the meaning of an object returned from the Java world.
For example, if we invoke the Java method <code>experience()</code> from the Prolog side, we should write <code>term(R)</code> as the return specifier, which means that the object returned from the Java method should be converted into a term according to the default JPC conversion context. This is illustrated by the following example:
<div class="codeEditor"><pre data-editor="prolog" data-show-gutter="false">
person(mary)::experience(return(term(R))).</pre></div>
Several possible ways of interpreting a return value are possible by means of choosing distinct return specifiers.
The following list describes some of them:
</p>
<div class="divList">
<ul>
<li><code>term(R)</code>: <code>R</code> is the default conversion to a term of the returned object.</li>
<li><code>jserialized(R)</code>: <code>R</code> is a term representation of the serialisation of the returned object.</li>
<li><code>jref(R)</code>: <code>R</code> is an opaque term representation of a Java reference. The reference remains valid as long as the term exists somewhere in the Prolog database.</li>
<li><code>weak(jref(R))</code>: <code>R</code> is an opaque term representation of a Java reference. The reference remains valid as long as the reference is not garbage-collected in the Java world.</li>
<li><code>strong(jref(R))</code>: <code>R</code> is an opaque term representation of a Java reference. The reference remains valid as long as the reference symbol is not explicitly forgotten.</li>
</ul>
</div>
<p>
We have left outside the scope of this article a complete description of all the possible return specifiers.
</p>
<!--
<h2>Compatibility</h2>
<p>
JPC and LogicObjects are currently compatible with
<a href="http://www.swi-prolog.org/" title="SWI Prolog">SWI</a>,
<a href="http://www.dcc.fc.up.pt/~vsc/Yap/" title="YAP Prolog">YAP</a> and
<a href="http://xsb.sourceforge.net/" title="XSB Prolog">XSB</a>
Prolog by means of drivers developed on top of the
<a href="http://www.swi-prolog.org/packages/jpl/" title="JPL: A bidirectional Prolog/Java interface">JPL</a>,
<a href="http://sewiki.iai.uni-bonn.de/research/pdt/developers/cookbook/standalone_prolog_connector" title="Standalone PDT connector">PDT Connector</a> and
<a href="http://www.declarativa.com/interprolog/" title="InterProlog: a Java front-end and enhancement for Prolog">InterProlog</a>
libraries.
</p>
-->
<h2>Conclusions</h2>
<p>
LogicObjects enables a fine-grained, (semi-)automatic integration (i.e., at the entity level) of routines written in Java and Prolog.
It is an example of the advanced integration frameworks that can be built on top of the notion of inter-language conversions implemented by the JPC library.
</p>
<p>
There are other powerful JPC and LogicObjects features in addition to the ones described here.
Those include a comprehensive set of heuristics for interpreting the solution to a Prolog query as a Java object, autoloading of Prolog artefacts, and the automatic propagation and handling of inter-language exceptions.
A description of these and other advanced features can be found in the JPC and LogicObjects <a href="http://java-prolog-connectivity.github.com/" title="JPC and LogicObjects online documentation">documentation</a>.
</p>
<p>
JPC and LogicObjects are currently compatible with
<a href="http://www.swi-prolog.org/" title="SWI Prolog">SWI</a>,
<a href="http://www.dcc.fc.up.pt/~vsc/Yap/" title="YAP Prolog">YAP</a> and
<a href="http://xsb.sourceforge.net/" title="XSB Prolog">XSB</a>
Prolog by means of drivers developed on top of the
<a href="http://www.swi-prolog.org/packages/jpl/" title="JPL: A bidirectional Prolog/Java interface">JPL</a>,
<a href="http://sewiki.iai.uni-bonn.de/research/pdt/developers/cookbook/standalone_prolog_connector" title="Standalone PDT connector">PDT Connector</a> and
<a href="http://www.declarativa.com/interprolog/" title="InterProlog: a Java front-end and enhancement for Prolog">InterProlog</a>
libraries. We envision the development of native drivers and support for other Prolog engines in the short term.
</p>
<p>
We hope that both JPC and LogicObjects will be useful to the Prolog and Java community. In this spirit, we are releasing our work as <a href="https://github.com/java-prolog-connectivity/" title="JPC at GitHub">open-source software</a>.
</p>
</div> <!-- end of content -->
<div id="footnotes">
<hr />
<h3>Bibliography</h3>
<ol>
<li id="fn:rus95">
Artificial Intelligence, A Modern Approach. Russel, S. and Norvig, P. Prentice Hall. 1995.
</li>
<li id="fn:Sterling:1994:APA:175753">
The Art of Prolog (2nd ed.): Advanced Programming Techniques. Sterling, L. and Shapiro, E. MIT Press. Cambridge, MA, USA. 1994.
</li>
<!--
<li id="fn:Cale01">
Interprolog: A Declarative Java-Prolog Interface. Calejo, M. EPIA. Springer. 2001.
</li>
-->
<li id="fn:2014-jelia-calejo">
InterProlog: Towards a Declarative Embedding of Logic Programming in Java. Calejo, M. In proceedings of Logics in Artificial Intelligence, 9th European Conference, JELIA. V. 3229. P. 714-717. Lisbon, Portugal. September 27-30, 2004.
</li>
<li id="fn:conf/lpe/WielemakerA02">
An Architecture for Making Object-Oriented Systems Available from Prolog. Wielemaker, J. and Anjewierden, A. Workshop on Logic-based methods in Programming Environments (WLPE). 2002.
</li>
<li id="fn:Meyer:1988ys">
Object-Oriented Software Construction. Meyer, B. Prentice-Hall, Inc. 1988.
</li>
<li id="fn:Mernik:2005:DDL:1118890.1118892">
When and How to Develop Domain-specific Languages. Mernik, M, Heering, J. and Sloane, A. ACM Comput. Surv. V. 37, N. 4, P. 316-344. New York, USA. December 2005.
</li>
<li id="fn:DHondt2004">
Seamless integration of rule-based knowledge and object-oriented functionality with linguistic symbiosis. D'Hondt, M., Gybels, K. and Jonckers, V. Proceedings of the 2004 ACM symposium on Applied computing. New York, USA. 2004.
</li>
<li id="fn:Omicini:1994fk">
Object-oriented computations in logic programming. Omicini, A. and Natali, A. Object-Oriented Programming. Lecture Notes in Computer Science. V. 821, P. 194-212. 1994.
</li>
<li id="fn:Brichau02towardslinguistic">
Towards Linguistic Symbiosis of an Object-Oriented and a Logic Programming Language. Brichau, J. Gybels, K and Wuyts, R. In Jörg Striegnitz, Kei Davis, and Yannis Smaragdakis, editors, Proceedings of the Workshop on Multiparadigm Programming with Object-Oriented Languages. 2002.
</li>
<li id="fn:Gybels2003">
SOUL and Smalltalk - Just Married: Evolution of the Interaction Between a Logic and an Object-Oriented Language Towards Symbiosis. Gybels, K. Proceedings of the Workshop on Declarative Programming in the Context of Object-Oriented Languages. 2003.
</li>
</ol>
</div> <!-- end of footnotes -->
</body>
</html>