diff options
Diffstat (limited to 'test/uk/ac/ox/cs/pagoda')
| -rw-r--r-- | test/uk/ac/ox/cs/pagoda/junit/JAIR_Scalability.java | 3 | ||||
| -rw-r--r-- | test/uk/ac/ox/cs/pagoda/tester/ORETester.java | 18 | ||||
| -rw-r--r-- | test/uk/ac/ox/cs/pagoda/tester/PagodaTester.java | 75 |
3 files changed, 30 insertions, 66 deletions
diff --git a/test/uk/ac/ox/cs/pagoda/junit/JAIR_Scalability.java b/test/uk/ac/ox/cs/pagoda/junit/JAIR_Scalability.java index 5bd3134..5e2b1d7 100644 --- a/test/uk/ac/ox/cs/pagoda/junit/JAIR_Scalability.java +++ b/test/uk/ac/ox/cs/pagoda/junit/JAIR_Scalability.java | |||
| @@ -3,6 +3,7 @@ package uk.ac.ox.cs.pagoda.junit; | |||
| 3 | import org.junit.Test; | 3 | import org.junit.Test; |
| 4 | 4 | ||
| 5 | import uk.ac.ox.cs.pagoda.tester.PagodaTester; | 5 | import uk.ac.ox.cs.pagoda.tester.PagodaTester; |
| 6 | import uk.ac.ox.cs.pagoda.util.Properties; | ||
| 6 | 7 | ||
| 7 | public class JAIR_Scalability { | 8 | public class JAIR_Scalability { |
| 8 | 9 | ||
| @@ -78,7 +79,7 @@ public class JAIR_Scalability { | |||
| 78 | } | 79 | } |
| 79 | 80 | ||
| 80 | public static void main(String... args) { | 81 | public static void main(String... args) { |
| 81 | PagodaTester.ShellMode = true; | 82 | Properties.ShellModeDefault = true; |
| 82 | new JAIR_Scalability().testUniProt(50, false); | 83 | new JAIR_Scalability().testUniProt(50, false); |
| 83 | } | 84 | } |
| 84 | 85 | ||
diff --git a/test/uk/ac/ox/cs/pagoda/tester/ORETester.java b/test/uk/ac/ox/cs/pagoda/tester/ORETester.java index 1092d6f..ae58ba9 100644 --- a/test/uk/ac/ox/cs/pagoda/tester/ORETester.java +++ b/test/uk/ac/ox/cs/pagoda/tester/ORETester.java | |||
| @@ -1,9 +1,7 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.tester; | 1 | package uk.ac.ox.cs.pagoda.tester; |
| 2 | 2 | ||
| 3 | import org.semanticweb.owlapi.model.OWLOntology; | ||
| 4 | |||
| 5 | import uk.ac.ox.cs.pagoda.owl.OWLHelper; | ||
| 6 | import uk.ac.ox.cs.pagoda.reasoner.QueryReasoner; | 3 | import uk.ac.ox.cs.pagoda.reasoner.QueryReasoner; |
| 4 | import uk.ac.ox.cs.pagoda.util.Properties; | ||
| 7 | 5 | ||
| 8 | public class ORETester { | 6 | public class ORETester { |
| 9 | 7 | ||
| @@ -13,17 +11,11 @@ public class ORETester { | |||
| 13 | // args = new String[] { "/home/yzhou/krr-nas-share/Yujiao/ontologies/ORE2014/DL/wine_nodatatype.owl" }; | 11 | // args = new String[] { "/home/yzhou/krr-nas-share/Yujiao/ontologies/ORE2014/DL/wine_nodatatype.owl" }; |
| 14 | 12 | ||
| 15 | // args = new String[] { "/home/yzhou/krr-nas-share/Yujiao/ontologies/ORE2014/EL/b7700fe1-103b-4b32-a21c-f6604a763ba5_t-cell.owl" }; | 13 | // args = new String[] { "/home/yzhou/krr-nas-share/Yujiao/ontologies/ORE2014/EL/b7700fe1-103b-4b32-a21c-f6604a763ba5_t-cell.owl" }; |
| 16 | args = new String[] { "/home/yzhou/krr-nas-share/Yujiao/ontologies/ORE2014/EL/baa29363-f93c-4285-827e-0e2380c82efc_cations.n3" }; | 14 | // args = new String[] { "/home/yzhou/krr-nas-share/Yujiao/ontologies/ORE2014/EL/baa29363-f93c-4285-827e-0e2380c82efc_cations.n3" }; |
| 17 | |||
| 18 | 15 | ||
| 19 | OWLOntology ontology = OWLHelper.loadOntology(args[0]); | 16 | Properties properties = new Properties("config/sys.conf"); |
| 20 | QueryReasoner pagoda = QueryReasoner.getInstance(ontology); | 17 | QueryReasoner pagoda = QueryReasoner.getInstance(properties); |
| 21 | System.out.println(pagoda); | 18 | pagoda.dispose(); |
| 22 | pagoda.loadOntology(ontology); | ||
| 23 | if (pagoda.preprocess()) | ||
| 24 | System.out.println("The ontology is consistent!"); | ||
| 25 | else | ||
| 26 | System.out.println("The ontology is inconsistent!"); | ||
| 27 | } | 19 | } |
| 28 | 20 | ||
| 29 | } | 21 | } |
diff --git a/test/uk/ac/ox/cs/pagoda/tester/PagodaTester.java b/test/uk/ac/ox/cs/pagoda/tester/PagodaTester.java index d754a70..48a2a51 100644 --- a/test/uk/ac/ox/cs/pagoda/tester/PagodaTester.java +++ b/test/uk/ac/ox/cs/pagoda/tester/PagodaTester.java | |||
| @@ -5,13 +5,10 @@ import java.io.FileNotFoundException; | |||
| 5 | import java.io.IOException; | 5 | import java.io.IOException; |
| 6 | import java.util.Scanner; | 6 | import java.util.Scanner; |
| 7 | 7 | ||
| 8 | import org.semanticweb.owlapi.model.OWLOntology; | ||
| 9 | |||
| 10 | import uk.ac.ox.cs.pagoda.owl.OWLHelper; | ||
| 11 | import uk.ac.ox.cs.pagoda.query.AnswerTuple; | 8 | import uk.ac.ox.cs.pagoda.query.AnswerTuple; |
| 12 | import uk.ac.ox.cs.pagoda.query.AnswerTuples; | 9 | import uk.ac.ox.cs.pagoda.query.AnswerTuples; |
| 13 | import uk.ac.ox.cs.pagoda.reasoner.*; | 10 | import uk.ac.ox.cs.pagoda.reasoner.*; |
| 14 | import uk.ac.ox.cs.pagoda.reasoner.QueryReasoner.Type; | 11 | import uk.ac.ox.cs.pagoda.util.Properties; |
| 15 | import uk.ac.ox.cs.pagoda.util.Timer; | 12 | import uk.ac.ox.cs.pagoda.util.Timer; |
| 16 | import uk.ac.ox.cs.pagoda.util.Utility; | 13 | import uk.ac.ox.cs.pagoda.util.Utility; |
| 17 | 14 | ||
| @@ -93,8 +90,6 @@ public class PagodaTester { | |||
| 93 | public static final String atlas_abox = onto_dir + "bio2rdf/atlas/graph sampling/sample_1.nt"; | 90 | public static final String atlas_abox = onto_dir + "bio2rdf/atlas/graph sampling/sample_1.nt"; |
| 94 | public static final String atlas_queries = onto_dir + "bio2rdf/atlas/queries/atomic_one.sparql"; | 91 | public static final String atlas_queries = onto_dir + "bio2rdf/atlas/queries/atomic_one.sparql"; |
| 95 | 92 | ||
| 96 | public static boolean ShellMode = false; | ||
| 97 | |||
| 98 | public static void main(String... args) { | 93 | public static void main(String... args) { |
| 99 | if (args.length == 0) { | 94 | if (args.length == 0) { |
| 100 | // args = new String[] {test_tbox, test_abox, test_query}; | 95 | // args = new String[] {test_tbox, test_abox, test_query}; |
| @@ -109,7 +104,7 @@ public class PagodaTester { | |||
| 109 | // args = new String[] {"../SemFacet/WebContent/WEB-INF/data/dbpedia.owl", "../SemFacet/WebContent/WEB-INF/data/dbpediaA.nt", null}; | 104 | // args = new String[] {"../SemFacet/WebContent/WEB-INF/data/dbpedia.owl", "../SemFacet/WebContent/WEB-INF/data/dbpediaA.nt", null}; |
| 110 | // args = new String[] {"../core/WebContent/WEB-INF/data/fly.owl", "../core/WebContent/WEB-INF/data/fly-data.nt", null}; | 105 | // args = new String[] {"../core/WebContent/WEB-INF/data/fly.owl", "../core/WebContent/WEB-INF/data/fly-data.nt", null}; |
| 111 | // args = new String[] {"data/lubm/univ-bench.owl", "data/lubm/lubm1.ttl", "data/lubm/lubm.sparql", "lubm.ans"}; | 106 | // args = new String[] {"data/lubm/univ-bench.owl", "data/lubm/lubm1.ttl", "data/lubm/lubm.sparql", "lubm.ans"}; |
| 112 | args = new String[] {"data/uobm/univ-bench-dl.owl", "data/uobm/uobm1.ttl", "data/uobm/uobm.sparql", "uobm.ans"}; | 107 | // args = new String[] {"data/uobm/univ-bench-dl.owl", "data/uobm/uobm1.ttl", "data/uobm/uobm.sparql", "uobm.ans"}; |
| 113 | // args = new String[] {"data/fly/fly_anatomy_XP_with_GJ_FC_individuals.owl", "data/fly/fly.sparql", "fly.ans"}; | 108 | // args = new String[] {"data/fly/fly_anatomy_XP_with_GJ_FC_individuals.owl", "data/fly/fly.sparql", "fly.ans"}; |
| 114 | // args = new String[] {bioModels_tbox, bioModels_abox, bioModels_queries}; | 109 | // args = new String[] {bioModels_tbox, bioModels_abox, bioModels_queries}; |
| 115 | // args = new String[] {chembl_tbox, chembl_abox, chembl_queries}; | 110 | // args = new String[] {chembl_tbox, chembl_abox, chembl_queries}; |
| @@ -124,66 +119,42 @@ public class PagodaTester { | |||
| 124 | // args[2] = args[2].replace(".sparql", "_pellet.sparql"); | 119 | // args[2] = args[2].replace(".sparql", "_pellet.sparql"); |
| 125 | } | 120 | } |
| 126 | 121 | ||
| 127 | int ontoIndex = 0, dataIndex = 1, queryIndex = 2; | 122 | Properties properties = new Properties("config/uobm.conf"); |
| 128 | |||
| 129 | if (args.length > dataIndex && args[dataIndex] != null && args[dataIndex].endsWith(".sparql")) { | ||
| 130 | String[] inputArgs = args; | ||
| 131 | args = new String[inputArgs.length + 1]; | ||
| 132 | for (int i = 0; i < dataIndex; ++i) | ||
| 133 | args[i] = inputArgs[i]; | ||
| 134 | args[dataIndex] = null; | ||
| 135 | args[queryIndex] = inputArgs[dataIndex]; | ||
| 136 | for (int i = dataIndex + 1; i < inputArgs.length; ++i) | ||
| 137 | args[i + 1] = inputArgs[i]; | ||
| 138 | } | ||
| 139 | |||
| 140 | StringBuilder info = new StringBuilder(); | ||
| 141 | info.append("System started with \n"); | ||
| 142 | for (int i = 0; i < args.length; ++i) | ||
| 143 | info.append("Arg " + (i + 1) + ": " + args[i] + "\n"); | ||
| 144 | Utility.logInfo(info); | ||
| 145 | |||
| 146 | // Utility.redirectCurrentOut("temp.out"); | ||
| 147 | |||
| 148 | OWLOntology ontology = OWLHelper.loadOntology(args[ontoIndex]); | ||
| 149 | |||
| 150 | QueryReasoner pagoda = QueryReasoner.getInstance(Type.Full, ontology, true, true); | ||
| 151 | // QueryReasoner pagoda = QueryReasoner.getInstance(Type.ELHOU, ontology, true, true); | ||
| 152 | 123 | ||
| 153 | // QueryReasoner pagoda = QueryReasoner.getInstanceForSemFacet(ontology); | 124 | int index = 0; |
| 154 | // QueryReasoner pagoda = QueryReasoner.getHermiTReasoner(false); | 125 | if (args.length > index) properties.setOntologyPath(args[index++]); |
| 126 | if (args.length > index && (args[index].endsWith(".ttl") || args[index].endsWith(".nt"))) properties.setDataPath(args[index++]); | ||
| 127 | if (args.length > index && args[index].endsWith(".sparql")) properties.setQueryPath(args[index++]); | ||
| 128 | if (args.length > index && !args[index].startsWith("-")) properties.setAnswerPath(args[index++]); | ||
| 129 | if (args.length > index) properties.setToClassify(Boolean.parseBoolean(args[index++].substring(1))); | ||
| 130 | if (args.length > index) properties.setToCallHermiT(Boolean.parseBoolean(args[index++].substring(1))); | ||
| 131 | |||
| 132 | QueryReasoner pagoda = null; | ||
| 155 | 133 | ||
| 156 | // PagodaTester tester = new PagodaTester(pagoda); | ||
| 157 | String ansFile = args.length > 3 ? args[3] : null; | ||
| 158 | try { | 134 | try { |
| 159 | Timer t = new Timer(); | 135 | Timer t = new Timer(); |
| 160 | pagoda.loadOntology(ontology); | 136 | pagoda = QueryReasoner.getInstance(properties); |
| 161 | pagoda.importData(args[dataIndex]); | 137 | if (pagoda == null) return; |
| 162 | if (!pagoda.preprocess()) | 138 | |
| 163 | return; | ||
| 164 | Utility.logInfo("Preprocessing Done in " + t.duration() + " seconds."); | 139 | Utility.logInfo("Preprocessing Done in " + t.duration() + " seconds."); |
| 165 | // tester.printPredicatesWithGap(); | 140 | |
| 166 | // tester.testSemFacetQueries(); | 141 | if (properties.getQueryPath() != null) |
| 167 | // tester.testSomeFlyQueries(); | 142 | for (String queryFile: properties.getQueryPath().split(";")) |
| 168 | // tester.testISGQueries(); | 143 | pagoda.evaluate(pagoda.getQueryManager().collectQueryRecords(queryFile), properties.getAnswerPath()); |
| 169 | // tester.testReactomeQueries(); | 144 | |
| 170 | if (args[queryIndex] != null) | 145 | if (properties.getShellMode()) |
| 171 | for (String queryFile: args[queryIndex].split(";")) | ||
| 172 | pagoda.evaluate(pagoda.getQueryManager().collectQueryRecords(queryFile), ansFile); | ||
| 173 | |||
| 174 | if (ShellMode) | ||
| 175 | try { | 146 | try { |
| 176 | evaluateConsoleQuery(pagoda); | 147 | evaluateConsoleQuery(pagoda); |
| 177 | } catch (IOException e) { | 148 | } catch (IOException e) { |
| 178 | e.printStackTrace(); | 149 | e.printStackTrace(); |
| 179 | } | 150 | } |
| 180 | } finally { | 151 | } finally { |
| 181 | pagoda.dispose(); | 152 | if (pagoda != null) pagoda.dispose(); |
| 182 | } | 153 | } |
| 183 | 154 | ||
| 184 | Utility.closeCurrentOut(); | 155 | Utility.closeCurrentOut(); |
| 185 | 156 | ||
| 186 | if (ShellMode) System.exit(0); | 157 | if (properties.getShellMode()) System.exit(0); |
| 187 | } | 158 | } |
| 188 | 159 | ||
| 189 | // private void printPredicatesWithGap() { | 160 | // private void printPredicatesWithGap() { |
