-
Notifications
You must be signed in to change notification settings - Fork 1
/
version_2x.html
754 lines (688 loc) · 40.6 KB
/
version_2x.html
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
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>EmbASP - version 2</title>
<!-- Bootstrap -->
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.5/styles/default.min.css">
<style>
.layer {
text-transform: uppercase;
}
.footer {
padding-top: 40px;
padding-bottom: 40px;
margin-top: 40px;
border-top: 1px solid #eee;
}
</style>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="page-header">
<h2><img src="img/EmbASP_Logo.png" alt="embASP" height="150" style=" padding-bottom: 0.2cm;" /></h2>
<div class="alert alert-info" role="alert">NOTE: this is the official site of versions 2+ of the EmbASP Framework. If you are looking for an older version,
please <a href="version_1x.html">click here.</a></div>
<div> EmbASP is a framework for the integration (embedding) of Answer Set Programming (ASP) in external systems for
generic applications. It helps developers at designing and implementing complex reasoning tasks by means
of ASP solvers on different platforms. The framework can be implemented in a object-oriented programming
language of choice, easing and guiding the generation of suitable libraries for the use of specific solvers
on particular platforms. We currently provide ready-made libraries for the use of two state-of-the-art ASP
systems: DLV and clingo, on Android mobile context and on desktop platform, respectively; however, it has
been designed to be easily extensible and adaptable to different solvers and platforms.
</div>
</div>
<div class="row">
<div class="col-xs-12">
<h2>Core Team</h2>
<div>
<ul>
<li>
Francesco Calimeri <a href="https://www.mat.unical.it/calimeri"><span class="glyphicon glyphicon-globe" aria-hidden="true"></span></a>
</li>
<li>
Davide Fuscà
</li>
<li>
Stefano Germano
</li>
<li>
Simona Perri
</li>
<li>
Jessica Zangari
</li>
</ul>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<h2>Contacts</h2>
<div>
For further information, contact <a href="mailto:embasp@mat.unical.it">embasp@mat.unical.it</a>.
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<h2>License</h2>
<div>
<p>
The framework is released under <a href="http://opensource.org/licenses/MIT">The MIT License (MIT)</a>.
</p>
<p> The framework library for DLV on Android embeds the DLV system itself, which is free for academic and
non-commercial educational use, as well as for use by non-profit organizations. For further information
about DLV, please refer to the <a href="http://www.dlvsystem.com">DLVSystem Ltd. home page</a>.</p>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<h2>Download</h2>
<div>
<h3 id="release">Latest release version</h3>
<div>To use the specialized library for DLV on Android, an AAR file has been released.</div>
<div>To use the specialized library for clingo on desktop, a JAR file has been released. </div>
<div>You can download their last stable versions <a href="https://github.com/DeMaCS-UNICAL/EmbASP/releases">here</a>.</div>
</div>
<div>
<h3>Development Version <img src="img/GitHub-Mark-120px-plus.png" alt="GitHub" height="40" /></h3> You can
find the current development version <a href="https://github.com/DeMaCS-UNICAL/EmbASP">here</a>.
</div>
<div>
<h3>Application Showcase</h3>
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
<div class="panel panel-primary">
<div class="panel-heading" role="tab" id="headingOne">
<h4 class="panel-title">
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="false"
aria-controls="collapseOne">
<em>DLVfit</em>
</a>
</h4>
</div>
<div id="collapseOne" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingOne">
<div class="panel-body">
<p><a href="https://github.com/brainatwork/DLVfit"><em>DLVfit</em></a> is a health and fitness
app that monitors the user activity during the day and suggests some workout plans
that depend on her age, weight, gender and goals. The app periodically stores some
information about the user activities (running, walking, etc.) and infers the current
amount of calories burned so far. When the user asks for a workout plan, <em>DLVfit</em> proposes a set of exercises that would allow the user to reach her daily goal, taking
into account also to her preferences. The suggested workout plans are computed in
the background by DLV via EmbASP. </p>
<p>The ASP program used within <em>DLVfit</em> can be found in the repository. Basically,
the program guesses for possible fitness exercises to do in order to burn the remaing
calories. Each answer set represent a possible workout plan, in which is ensured
that the user's requirements about the calories to burn and the time to spend in
the workout are respected. Moreover, also user's preferences are taken into account
by means of weak constraints.</p>
<h5><b>Release</b></h5>
<p>You can download the latest version of <em>DLVfit</em> <a href="https://github.com/brainatwork/DLVfit">here</a>.</p>
<button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#collapseExample" aria-expanded="false"
aria-controls="collapseExample">
Supported versions of Android
</button>
<div class="collapse" id="collapseExample">
<div class="well">
<p>The app should work on most devices equipped with Android 4.x/5.x.<br /> The
list of compatible devices include (but it is not limited to):</p>
<ul>
<li>Samsung Galaxy S2 - Android 4.3, API 16</li>
<li>HTC One - Android 4.3, API 18</li>
<li>HTC One XL - Android 4.2.2, API 17</li>
<li>HTC One XL - Android 4.1.1, API 16</li>
<li>Samsung Galaxy Note 2 - Android 4.2.2, API 17</li>
<li>Google Nexus 7 - Android 4.4.4, API 19</li>
<li>Samsung S4 - Android 4.4.4, API 19</li>
<li>Samnsung S3 - Android 4.3, API 18</li>
<li>Sony Xperia S - Android 4.1.1, API 16</li>
<li>Google Nexus 7 - Android 4.3, API 18</li>
<li>Sony Xperia Go - Android 4.0</li>
<li>Sony Xperia Z3 - Android 5.0</li>
<li>Sony Xperia Z3 - Android 5.1</li>
<li>Galaxy S6 - Android 5.0</li>
<li>Nexus 6 - Android 5.0</li>
</ul>
</div>
</div>
<h5><b>Developers</b></h5>
<ul>
<li>Dario Campisano</li>
<li>The EmbASP Team</li>
</ul>
</div>
</div>
</div>
<div class="panel panel-primary">
<div class="panel-heading" role="tab" id="headingTwo">
<h4 class="panel-title">
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false"
aria-controls="collapseTwo">
<em>GuessAndCheckers</em>
</a>
</h4>
</div>
<div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
<div class="panel-body">
<p><a href="https://github.com/vincenzoarieta93/GuessAndCheckers"><em>GuessAndCheckers</em></a> is a native mobile application that works as an helper for users that play "live"
games of the (Italian) checkers (i.e., by means of physical board and pieces). The
app, that runs on Android, can help a player at any time: by means of the device
camera a picture of the board is taken, and the information about the current status
of the game is properly inferred thanks to <a href="http://opencv.org">OpenCV</a>,
an open source computer vision and machine learning software; an ASP-based artificial
intelligence module then suggests the move.
</p>
<p>Thanks to EmbASP and the use of ASP, <em>GuessAndCheckers</em> features a fully-declarative
approach that made easy to develop and improve several different strategies, also
experimenting with many combinations thereof.<br /> The source code of this application
along with the Android Application Package (APK) are available online.</p>
<h5><b>Release</b></h5>
<p>You can download the latest version of <em>GuessAndCheckers</em> <a href="https://github.com/vincenzoarieta93/GuessAndCheckers">here</a>.</p>
<h5><b>Developers</b></h5>
<ul>
<li>Vincenzo Arieta</li>
<li>The EmbASP Team</li>
</ul>
</div>
</div>
</div>
<div class="panel panel-primary">
<div class="panel-heading" role="tab" id="headingThree">
<h4 class="panel-title">
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="false"
aria-controls="collapseThree">
<em>DLVEdu</em>
</a>
</h4>
</div>
<div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree">
<div class="panel-body">
<p><em>DLVEdu</em> is an educational Android App for children, that integrates well-established
mobile technologies, such as voice or drawn text recognition, with the modeling capabilities
of ASP. In particular, it is able to guide the child throughout the learning tasks,
by proposing a series of educational games, and developing a personalized educational
path. The games are divided into four macro-areas: Logic, Numeric-Mathematical, Memory,
and Verbal Language. The usage of ASP allows the application to adapt to the game
experiences fulfilled by the user, her formative gap, and the obtained improvements.
</p>
<p>
The application continuously profiles the user by recording mistakes and successes, and dynamically builds and updates a
customized educational path along the different games. The application features a
"Parent Area", that allows parents to monitor child's achievements and to express
some preferences, such as explicit filters of some games or educational areas.
</p>
<h5><b>Developers</b></h5>
<ul>
<li>Mattia Lanzillotta</li>
<li>Mirko Pontoriero</li>
<li>The EmbASP Team</li>
</ul>
</div>
</div>
</div>
<div class="panel panel-primary">
<div class="panel-heading" role="tab" id="headingFour">
<h4 class="panel-title">
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseFour" aria-expanded="false"
aria-controls="collapseFour">
<em>Connect4</em>
</a>
</h4>
</div>
<div id="collapseFour" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingFour">
<div class="panel-body">
<p>Connect4 is an application that allows a user to play the popular Connect Four game (also
known as Four-in-a-Row) against an ASP-based artificial player.<br /> The Connect
Four game is played by two opponents on a vertical 7*6 rectangular board. At each
turn, the players fill the board by dropping 1 disk into one of the column so that
it falls from the top to the lowest unoccupied position in the column. The winner
is the first player who gets four of her disks in a line, connected either horizontally,
vertically, or diagonally.
</p>
<p>
Different AIs have been implemented, ranging from the most powerful one implementing advanced techniques for the perfect
play to the simplest one relying on some classical heuristic strategies. By using
EmbASP, two different versions of the same app have been built: one for Android,
making use of <a href="http://www.dlvsystem.com">DLV</a>,
and one for Java-enabled desktop platforms, making use of <a href="http://potassco.sourceforge.net">clingo</a>.
</p>
<h5><b>Developers</b></h5>
<ul>
<li>Marco Anastasio</li>
<li>The EmbASP Team</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<h2>Documentation</h2>
<p>
<div class="list-group">
<a class="list-group-item list-group-item-info" href="#javadoc">Javadoc </a>
<a class="list-group-item list-group-item-info" href="#class-diagram">Class Diagram </a>
<a class="list-group-item list-group-item-info" href="#getting-started">Getting Started </a> <a class="list-group-item list-group-item-info"
href="#setting-up">Using EmbASP</a>
<!--<a
class="list-group-item list-group-item-info" href="#arch-desc">Architecture
Description </a> <a class="list-group-item list-group-item-info"
href="#detailed-desc">Detailed Description </a>-->
</div>
</p>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="panel panel-primary" id="javadoc">
<div class="panel-heading">
<h3 class="panel-title">Javadoc</h3>
</div>
<div class="panel-body">
<div>The Javadoc documentation is available <a href="javadoc/index.html">here</a>. </div>
<div>For an offline usage, you can download it <a href="javadoc-embasp.zip">here</a>. </div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="panel panel-primary" id="class-diagram">
<div class="panel-heading">
<h3 class="panel-title">Class Diagram</h3>
</div>
<div class="panel-body">
<div>A complete UML Class Diagram is available <a href="img/complete_class_diagram_fixed.png">here</a>.
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="panel panel-primary" id="getting-started">
<div class="panel-heading">
<h3 class="panel-title">Getting Started</h3>
</div>
<div class="panel-body">
<h4>How to import the framework on Android Studio</h4>
<p>In order to use the framework in your applications you have to import it as module on Android Studio.</p>
<ol>
<li>Import the framework module:
<ol>
<li>Download the framework last released <a href="#release">module</a>.
</li>
<li>In the project view, right-click on your project <b>New
> Module</b>.
</li>
<li>Select <b>Import .JAR/.AAR Package</b>.
</li>
<li>Select the directory in which the module has been downloaded.
</li>
</ol>
</li>
<li>Set the dependency:
<ol>
<li>In the Android Studio menu: <b>File > Project
Structure</b>.
</li>
<li>Select your project module (by default called <b>app</b>).
</li>
<li>In the <b>Dependencies Tab</b> add as <b>Module
Dependency</b> the previously imported framework.
</li>
</ol>
</li>
</ol>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="panel panel-primary" id="setting-up">
<div class="panel-heading">
<h3 class="panel-title">Using EmbASP</h3>
</div>
<div class="panel-body">
<div>In the following, we describe an the actual usage of the framework by means of a running example;
as a use case, we will develop a simple Android application for solving Sudoku puzzles. Hereafter,
we explain the crucial stepts, while
<b>the complete code is freely available <a href="https://github.com/dave90/EmbASPSudokuExample">here</a></b>.
</div>
<div>
The framework features a annotation-guided mapping, offered by the <i>ASPMapper</i> component,
for two-way translations between strings recognizable by ASP solvers and objects in the programming
language at hand, directly employable within applications. By means of this feature, the ASP-based
aspects can be separated from the Java coding: the programmer doesn't even necessarily need to
be aware of ASP.
</div>
<div>
Let us think of a user that designed (or has been given) a proper logic program <i>P</i> to solve
a sudoku puzzle and has also an initial schema. We assume that the initial schema is well-formed
i.e. the complete schema solution exists and is unique. A possible program <i>P</i> is embedded
in the complete example (<a href="https://github.com/dave90/EmbASPSudokuExample">here</a>), that,
coupled with a set of facts <i>F</i> representing the given initial schema, allows to obtain
the only admissible solution.
</div>
<div>
By means of the annotation-guided mapping, the initial schema can be expressed in forms of Java objects. To this extent,
we define the class <i>Cell</i>, aimed at representing the single
cell of the sudoku schema, as follows:
</div>
<pre><code class="language-java">
@Predicate("cell")
public class Cell {
@Term(0)
private int row;
@Term(1)
private int column;
@Term(2)
private int value;
[...]
}
</code></pre>
<div>
It is worth noticing how the class has been annotated by two custom annotations, defined according to the following syntax:
<ul>
<li>
<i>@Predicate(string_name)</i>: the target must be a class, and defines the predicate
name the class is mapped to;
</li>
<li>
<i>@Term(integer_position)</i>: the target must be a field of a class annotated via @Predicate,
and defines the term (and its position) in the ASP atom the field is mapped to.
</li>
</ul>
Thanks to these annotations the <i>ASPMapper</i> class will be able to map <i>Cell</i> objects
into strings properly recognizable from the ASP solver as logic facts of the form <i>cell(Row,Column,Value)</i>.
At this point, we can create an <a href="https://developer.android.com/reference/android/app/Activity.html">Android Activity Component</a>,
and start deploying our sudoku application:
</div>
<pre><code class="language-java">
public class MainActivity extends AppCompatActivity {
[...]
private Handler handler;
@Override
protected void onCreate(Bundle bundle) {
handler = new AndroidHandler(getApplicationContext(), DLVAndroidService.class);
[...]
}
public void onClick(final View view){
startReasoning();
[...]
}
public void startReasoning() {
InputProgram inputProgram = new InputProgram();
for (int i = 0; i < 9; i++){
for (int j = 0; j < 9; j++)
try {
if(sudokuMatrix[i][j]!=0) {
inputProgram.addObjectInput(new Cell(i, j, sudokuMatrix[i][j]));
}
} catch (Exception e) {
// Handle Exception
}
}
handler.addProgram(inputProgram);
String sudokuEncoding = getEncodingFromResources();
handler.addProgram(new InputProgram(sudokuEncoding));
Callback callback = new MyCallback();
handler.startAsync(callback);
}
}
</code></pre>
<div>
The class contains an <i>Handler</i> instance as field, that is initialized when the <i>Activity</i> is created as an <i>AndroidHandler</i>. Required parameters include the <i>Android Context</i> (an Android utility, needed to start an Android Service Component) and the type of <i>AndroidService</i> to use, in our case a <i>DLVAndroidService</i>.
</div>
<div>
In addiction, in order to represent an initial sudoku schema, the class features a matrix of integers as another field where
position <i> (i,j) </i> contains the value of cell <i> (i,j) </i> in the initial schema; cells initially empty are represented by positions containing zero.
</div>
<div>
The method <i>startReasoning</i> is in charge of actually managing the reasoning: in our case,
it is invoked in response to a click event that is generated when the user asks for the solution.
It is firstly created an <i>InputProgram</i> object that is filled with <i>Cell</i> objects representing
the initial schema, which is then provided to the handler; then it is provided with the sudoku
encoding. It could be loaded, for instance, by means of an utility function that retrieves it
from the <a href="http://developer.android.com/guide/topics/resources">Android Resources folder</a>,
which, within Android applications, is typically meant for containing images, sounds, files and
resources in general.
</div>
<div>
At this point, the reasoning process can start; since for Android we provide only the asynchronous execution mode, a callback
object is in charge of fetching the output when the ASP system has done.
</div>
<div>
Finally, once the computation is over, from within the callback function the output can be retrieved directly in form of
Java objects. For instance, in our case an inner class <i>MyCallback</i> implements the interface <i>Callback</i>:</div>
<pre><code class="language-java">
private class MyCallback implements Callback {
@Override
public void callback(Output o) {
if(!(o instanceof AnswerSets))
return;
AnswerSets answerSets=(AnswerSets)o;
if(answerSets.getAnswersets().isEmpty())
return;
AnswerSet as = answerSets.getAnswersets().get(0);
try {
for(Object obj:as.getAtoms()) {
Cell cell = (Cell) obj;
sudokuMatrix[cell.getRow()][cell.getColumn()] = cell.getValue();
}
} catch (Exception e) {
// Handle Exception
}
displaySolution();
}
}
</code></pre>
</div>
</div>
</div>
</div>
<!--
<div class="row">
<div class="col-xs-12">
<div class="panel panel-primary" id="arch-desc">
<div class="panel-heading">
<h3 class="panel-title">Architecture Description</h3>
</div>
<div class="panel-body">
The framework is almost totally written in Java to ensure the
portability in both Desktop and Mobile systems, it is noteworthy
that the
<code class="class">DLV Solver</code>
is implemented in C++ , using <a
href="http://docs.oracle.com/javase/8/docs/technotes/guides/jni">JNI</a>
as communication layer between solver's code and framework's code.
The
<code class="class">Handler</code>
class is used to manage generic inputs ,like programs and options
represented respectively by
<code class="class">InputProgram</code>
and
<code class="class">OptionDescriptor</code>
classes, providing methods to start the solving process in a
synchronous or asynchronous way. These methods rely on
<code class="class">Service</code>
classes which invoking the native functions of the solver with the
needed parameters, and then collecting the reasoning results, via
the
<code class="class">Callback</code>
interface results are published back to the user.
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="panel panel-primary" id="detailed-desc">
<div class="panel-heading">
<h3 class="panel-title">Detailed Description</h3>
</div>
<div class="panel-body">
<p>
This simplified class diagram shows the hierarchical
structure of EmbASP. The complete Class Diagram is available <a href="class_diagram.html">here</a>.
</p>
<div class="row">
<figure class="col-xs-12 col-sm-offset-1 col-sm-10 text-center">
<img class="img-responsive"
src="img/simplified_class_diagram.png" alt="Class Diagram">
<figcaption>Class Diagram of the framework</figcaption>
</figure>
</div>
<div>
The
<code class="class">Handler</code>
class as described above acts like a facade for user to manage
inputs ,in fact it (and his two subclasses
<code class="class">DesktopHandler</code>
and
<code class="class">AndroidHandler</code>
) have a collection of methods used to add and remove data such
as programs , files and options giving the user the possibility
to select which set of rules , option or files use within the
solver for the selected platform.
</div>
<div>
The way she can manage programs is thought
<code class="class">InputProgram</code>
class and his subclass
<code class="class">ASPInputProgram</code>
while the first represents a generic program , the second
represents a generic ASP program with the capability of
extrapolate data from Java objects with the help of
<code class="class">ASPMapper</code>
both classes support files as input. Similar ,but not to ignore,
is the
<code class="class">OptionDescriptor</code>
class which represents a generic option , again we have a
subclass for ASP context the
<code class="class">ASPFilterOption</code>
. A subclass for this one is the
<code class="class">DLVFilterOption</code>
which is a "-filter" option for DLV solver.
</div>
<div>
Handlers ,in addition, provides two methods for starting a solver
:
<code class="class">startSync</code>
and
<code class="class">startAsync</code>
for a detailed description refer to <a href="#documentation">JavaDoc</a>.
</div>
How data is formatted and transmitted from handler to solver , in
order to start a reasoning process , is handled by classes that
implements
<code class="class"> Service</code>
interface. The framework provides two classes that provide
facilities to make easier the integration of ASP in complex
systems the
<code class="class">AndroidService</code>
and
<code class="class">DesktopService</code>
though many more classes can be easily generated.
<div>
Starting a reasoning process depends entirely from the
implementation of the subclasses a default reasoner for DLV in
Android systems is the
<code calass="class">DLVAndroidService</code>
that is written in C++ , has been built using the Android NDK and
the <a href="http://www.dlvsystem.com/" target="_blank">DLV</a> code has been optimized for this particular use case, and
is linked to the Java code using the JNI as required by the NDK.
</div>
<div>
In order to get back results obtainer by the solver ,that is
invoked asynchronously,it is needed a callback function wich is
automatically called when computation is terminated.This callback
function can be specified implementing the
<code class="class">Callback</code>
interface.
<code class="class">Output</code>
represent a simple output in a string format and is used as
anchor for
<code class="class">AnswerSets</code>
class. AnswerSets can be extended in order to parse specific
output of different ASP solvers, the framework provide two
AnswerSets one for DLV
<code class="class">DLVAnswerSets</code>
and one for Clingo
<code class="class">ClingoAnswerSets</code>
.
</div>
<div>
<code class="class">ASPMapper</code>
class is in charge of translating data from objects into ASP
programs (generally as strings) , when an object is given as
input, the mapper is able to convert only if specific annotations
are provided. Moreover, the mapping is done also in the other way around, from
objects to strings, so that the input can be also specified as
plain Java objects.
</div>
-->
<div class="row">
<div class="col-xs-12">
<h2>Publications</h2>
<div>
<ul>
<li>Francesco Calimeri, Davide Fuscà, Stefano Germano, Simona Perri and Jessica Zangari.<br />
<em>Boosting the Development of ASP-based Applications in Mobile and General Scenarios</em><br
/>
<strong>To appear</strong> at The 15th International Conference of the Italian Association for
Artificial Intelligence (AI*IA 2016).
</li>
<li>Davide Fuscà, Stefano Germano, Jessica Zangari, Marco Anastasio, Francesco Calimeri and Simona Perri.<br
/>
<em>A Framework for Easing the Development of Applications Embedding Answer Set Programming</em><br
/> In Proceedings of the 18th International Symposium on Principles and Practice of Declarative
Programming (PPDP 2016).<br /> [
<a href="http://dl.acm.org/citation.cfm?id=2968594">paper</a>] [<a href="files/PPDP-2016-slides.pdf">slides</a>]
</li>
<li>Francesco Calimeri, Davide Fuscà, Stefano Germano, Simona Perri and Jessica Zangari.<br />
<em>Embedding ASP in mobile systems: discussion and preliminary implementations</em><br /> In
(online) Procedings of the 8th Workshop on Answer Set Programming and Other Computing Paradigms
(ASPOCP 2015).<br /> [
<a href="https://sites.google.com/site/aspocp2015/ASPOCP2015paper12.pdf">paper</a>] [<a href="files/ASPOCP-2015-slides.pdf">slides</a>]
</li>
</ul>
</div>
</div>
</div>
</div>
<footer class="footer">
<p class="text-center">A project of the <a href="https://www.mat.unical.it">Department of Mathematics and Computer Science</a> of the
<a
href="http://unical.it">University of Calabria</a>
</p>
</footer>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.5/highlight.min.js"></script>
<script>
hljs.initHighlightingOnLoad();
</script>
</div>
</body>
</html>