Skip to content

Commit a8875df

Browse files
committed
added aba classes
1 parent f7e5159 commit a8875df

9 files changed

Lines changed: 455 additions & 17 deletions

File tree

org-tweetyproject-web/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@
104104
<groupId>org.tweetyproject.arg</groupId>
105105
<artifactId>delp</artifactId>
106106
<version>1.24-SNAPSHOT</version>
107+
</dependency>
108+
<dependency>
109+
<groupId>org.tweetyproject.arg</groupId>
110+
<artifactId>aba</artifactId>
111+
<version>1.24-SNAPSHOT</version>
107112
</dependency>
108113
<dependency>
109114
<groupId>org.json</groupId>

org-tweetyproject-web/src/main/java/org/tweetyproject/web/pyargservices/RequestController.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ public DungServicesInfoResponse getInfo(@RequestBody DungReasonerPost pyArgPost)
156156
@ResponseBody
157157
public Response handleRequest(
158158
@RequestBody DelpPost delpPost) {
159+
160+
System.out.println(delpPost.toString());
159161

160162
DelpResponse delpResponse = new DelpResponse("query", delpPost.getEmail(), delpPost.getCompcriterion(), delpPost.getKb(), delpPost.getQuery(), delpPost.getTimeout(),null, 0.0, delpPost.getUnit_timeout(),null);
161163
TimeUnit unit = Utils.getTimoutUnit(delpPost.getUnit_timeout());

org-tweetyproject-web/src/main/java/org/tweetyproject/web/pyargservices/Utils.java

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,12 @@ public static DungTheory getDungTheory(int nr_of_arguments, List<List<Integer>>
3030
}
3131
for (List<Integer> list : atttacks) {
3232
af_graph.add(new DirectedEdge<Argument>(arguments.get(list.get(0) - 1),arguments.get(list.get(1) - 1)));
33-
34-
// for (String item : list) {
35-
// System.out.print(" "
36-
// + item
37-
// + ", ");
38-
// }
39-
// System.out.println("], ");
40-
// }
41-
// System.out.println("]");
42-
// return "";
4333
}
4434

4535
DungTheory dungTheory = new DungTheory(af_graph);
4636
return dungTheory;
4737
}
4838

49-
// Gson gson = new Gson();
50-
// List<List<String>> firstList = gson.fromJson(atttacks, new TypeToken<List<List<Float>>>() {}.getType());
51-
// System.out.println(firstList.toString());
52-
53-
5439
public static String returnLowerCase(String stringInput) {
5540
return stringInput.toLowerCase();
5641
}
@@ -99,4 +84,6 @@ public static int checkUserTimeout(int user_timeout, int server_timeout, TimeUni
9984
return user_timeout;
10085
}
10186

87+
88+
10289
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package org.tweetyproject.web.pyargservices.aba;
2+
3+
import org.tweetyproject.arg.dung.reasoner.AbstractExtensionReasoner;
4+
import org.tweetyproject.arg.dung.syntax.DungTheory;
5+
import org.tweetyproject.web.pyargservices.Callee;
6+
7+
8+
9+
10+
public class AbaReasonerCalleeFactory {
11+
public enum Command{
12+
GET_MODELS ("get_models", "Get all models"),
13+
GET_MODEL ("get_model", "Get some model");
14+
/**id*/
15+
public String id;
16+
/**label*/
17+
public String label;
18+
19+
Command(String id, String label){
20+
this.id = id;
21+
this.label = label;
22+
}
23+
/**
24+
*
25+
* @param id ID
26+
* @return the measure
27+
*/
28+
public static Command getCommand(String id){
29+
for(Command m: Command.values())
30+
if(m.id.equals(id))
31+
return m;
32+
return null;
33+
}
34+
}
35+
36+
public static Command [] getCommands(){
37+
return Command.values();
38+
}
39+
/**
40+
* Creates a new inconsistency measure of the given type with default
41+
* settings.
42+
* @param im some identifier of an inconsistency measure.
43+
* @return the requested inconsistency measure.
44+
*/
45+
public static Callee getCallee(Command cmd, AbstractExtensionReasoner reasoner, DungTheory bbase){
46+
switch(cmd){
47+
case GET_MODELS:
48+
return new AbaReasonerGetModelsCallee(reasoner, bbase);
49+
default:
50+
throw new RuntimeException("Command not found: " + cmd.toString());
51+
}
52+
}
53+
54+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package org.tweetyproject.web.pyargservices.aba;
2+
3+
import java.util.Collection;
4+
5+
import org.tweetyproject.arg.aba.reasoner.GeneralAbaReasoner;
6+
import org.tweetyproject.arg.aba.semantics.AbaExtension;
7+
import org.tweetyproject.arg.aba.syntax.AbaTheory;
8+
import org.tweetyproject.arg.dung.reasoner.AbstractExtensionReasoner;
9+
import org.tweetyproject.arg.dung.semantics.Extension;
10+
import org.tweetyproject.arg.dung.syntax.DungTheory;
11+
import org.tweetyproject.web.pyargservices.Callee;
12+
13+
// public class AbaReasonerGetModelsCallee extends Callee {
14+
// GeneralAbaReasoner<T> reasoner;
15+
// AbaTheory<T> bbase;
16+
// public T AbaReasonerGetModelsCallee(GeneralAbaReasoner<T> reasoner, AbaTheory<T> bbase){
17+
// this.reasoner = reasoner;
18+
// this.bbase = bbase;
19+
// }
20+
// @Override
21+
// public T Collection<AbaExtension<T>> call() throws Exception {
22+
// return this.reasoner.getModels(this.bbase);
23+
// }
24+
25+
// }
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
package org.tweetyproject.web.pyargservices.aba;
2+
3+
import java.util.List;
4+
5+
public class AbaReasonerPost
6+
{
7+
8+
private String cmd;
9+
private String email;
10+
private int nr_of_arguments;
11+
private List<List<Integer>> attacks;
12+
private String semantics;
13+
private String solver;
14+
private int timeout; // Timeout in seconds
15+
private String unit_timeout;
16+
17+
public String getUnit_timeout() {
18+
return unit_timeout;
19+
}
20+
21+
public void setUnit_timeout(String unit_timeout) {
22+
this.unit_timeout = unit_timeout;
23+
}
24+
25+
public String getCmd() {
26+
return this.cmd;
27+
}
28+
29+
public void setCmd(String cmd) {
30+
this.cmd = cmd;
31+
}
32+
33+
public String getEmail() {
34+
return this.email;
35+
}
36+
37+
public void setEmail(String email) {
38+
this.email = email;
39+
}
40+
41+
public int getNr_of_arguments() {
42+
return this.nr_of_arguments;
43+
}
44+
45+
public void setNr_of_arguments(int nr_of_arguments) {
46+
this.nr_of_arguments = nr_of_arguments;
47+
}
48+
49+
public List<List<Integer>> getAttacks() {
50+
return this.attacks;
51+
}
52+
53+
public void setAttacks(List<List<Integer>> attacks) {
54+
this.attacks = attacks;
55+
}
56+
57+
public String getSemantics() {
58+
return this.semantics;
59+
}
60+
61+
public void setSemantics(String semantics) {
62+
this.semantics = semantics;
63+
}
64+
65+
public String getSolver() {
66+
return this.solver;
67+
}
68+
69+
public void setSolver(String solver) {
70+
this.solver = solver;
71+
}
72+
73+
public int getTimeout() {
74+
return this.timeout;
75+
}
76+
77+
public void setTimeout(int timeout) {
78+
this.timeout = timeout;
79+
}
80+
81+
}

0 commit comments

Comments
 (0)