Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this user
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
gadelrab
/
ExFaKT
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
0
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security
Insights
Files
aea978c
Api
Client
Demo
Extras
FactSpotting
QueryRewriting
Utils
WebService
WebService2
app
controllers
AsyncController.java
Evaluation.java
Explanations.java
views
Module.java
conf
gradle
project
public
sbt-dist
test
.gitignore
build.gradle
build.sbt
gradlew
gradlew.bat
pom.xml
sbt
sbt.bat
data
scripts
src
.gitignore
.gitmodules
README.md
install_external_jars.sh
pom.xml
rules_splitq_heursitic.out.json
Breadcrumbs
ExFaKT
/
WebService2
/
app
/
controllers
/
Explanations.java
Blame
Blame
Latest commit
History
History
executable file
·
102 lines (67 loc) · 2.97 KB
Breadcrumbs
ExFaKT
/
WebService2
/
app
/
controllers
/
Explanations.java
Top
File metadata and controls
Code
Blame
executable file
·
102 lines (67 loc) · 2.97 KB
Raw
package controllers; import checker.ExplanationsExtractor; import com.google.gson.Gson; import com.google.inject.Inject; import de.mpii.datastructures.BinaryFact; import extendedsldnf.datastructure.InputQuery; import org.deri.iris.api.basics.IRule; import org.deri.iris.compiler.Parser; import org.deri.iris.compiler.ParserException; import web.data.Query; import extendedsldnf.datastructure.IQueryExplanations; import play.data.Form; import play.data.FormFactory; import play.mvc.Controller; import play.mvc.Result; import utils.json.CustomGson; import views.html.*; import java.util.List; /** * This controller contains an action to handle HTTP requests * to the application's home page. */ public class Explanations extends Controller { private final ExplanationsExtractor explanationsExtractor; private final FormFactory formFactory; @Inject public Explanations(final FormFactory formFactory,ExplanationsExtractor explanationsExtractor ) { this.formFactory = formFactory; this.explanationsExtractor=explanationsExtractor; } /** * An action that renders an HTML page with a welcome message. * The configuration in the <code>routes</code> file means that * this method will be called when the application receives a * <code>GET</code> request with a path of <code>/</code>. */ public Result index() { // System.out.println(Configuration.getInstance().getSpottingConfFile()); // // IQueryExplanations res = explanationsExtractor.check(new BinaryFact("Albert Einstein", "was_born_in", "ulm")); Query exampleQ = new Query("<Albert_Einstein>", "<wasBornIn>", "<Germany>", "wasBornIn(?x,?y):- birthPlace(?x,?z), in(?z,?y).\nwasBornIn(?x,?y):- birthPlace(?x,?z), city_in(?z,?y)."); return ok(index.render(exampleQ,null)); } public Result explain(){ Form<Query> qf=formFactory.form(Query.class).bindFromRequest(); Query q=qf.get(); System.out.println("explain "+q); // System.out.println(new Query(qf.field("subject").getValue().get().toString(),qf.field("predicate").getValue().get().toString(),qf.field("object").getValue().get().toString(),qf.field("rules").getValue().get().toString())); // parseRulesAs Parser parser=new Parser(); List<IRule> ruleList=null; try { parser.parse(q.getRules()); ruleList=parser.getRules(); } catch (ParserException e) { e.printStackTrace(); } InputQuery inputQuery=new InputQuery(new BinaryFact(q.getSubject(),q.getPredicate(),q.getObject()),0,0); inputQuery.setTextualSources(q.getTextualSources()); inputQuery.setKg(q.getKg()); IQueryExplanations explanations = explanationsExtractor.check( inputQuery,ruleList); System.out.println(explanations); Gson gson=CustomGson.getInstance().getGson(); return ok(gson.toJson(explanations)); // return ok(index.render(q,explanations)); } }
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
You can’t perform that action at this time.