aboutsummaryrefslogtreecommitdiff
path: root/example/simpleExample.java
diff options
context:
space:
mode:
authoryzhou <yujiao.zhou@gmail.com>2015-04-21 10:34:27 +0100
committeryzhou <yujiao.zhou@gmail.com>2015-04-21 10:34:27 +0100
commit9ce65c5a963b03ee97fe9cb6c5aa65a3c04a80a8 (patch)
tree47511c0fb89dccff0db4b5990522e04f294d795b /example/simpleExample.java
parentb1ac207612ee8b045244253fb94b866104bc34f2 (diff)
downloadACQuA-9ce65c5a963b03ee97fe9cb6c5aa65a3c04a80a8.tar.gz
ACQuA-9ce65c5a963b03ee97fe9cb6c5aa65a3c04a80a8.zip
initial version
Diffstat (limited to 'example/simpleExample.java')
-rw-r--r--example/simpleExample.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/example/simpleExample.java b/example/simpleExample.java
new file mode 100644
index 0000000..9a6f0a7
--- /dev/null
+++ b/example/simpleExample.java
@@ -0,0 +1,38 @@
1import org.semanticweb.owlapi.model.OWLOntology;
2
3import uk.ac.ox.cs.pagoda.query.AnswerTuple;
4import uk.ac.ox.cs.pagoda.query.AnswerTuples;
5import uk.ac.ox.cs.pagoda.reasoner.QueryReasoner;
6
7
8public class simpleExample {
9
10 OWLOntology ontology;
11 String dataPath; // splited by ; (i.e. path1;path2)
12 String[] queryTexts;
13
14 public boolean test() {
15 QueryReasoner r = QueryReasoner.getInstance(ontology);
16 try {
17 r.loadOntology(ontology);
18 r.importData(dataPath);
19 if (!r.preprocess()) return false;
20 AnswerTuples answers;
21 AnswerTuple answer;
22 for (String queryText: queryTexts) {
23 answers = r.evaluate(queryText);
24 for (int arity = answers.getArity(); answers.isValid(); answers.moveNext()) {
25 answer = answers.getTuple();
26 for (int i = 0; i < arity; ++i)
27 System.out.println(answer.getGroundTerm(i) + " ");
28 System.out.println();
29 answers.dispose();
30 }
31 }
32 } finally {
33 r.dispose();
34 }
35 return true;
36 }
37
38}