diff options
| author | yzhou <yujiao.zhou@gmail.com> | 2015-04-21 22:45:35 +0100 |
|---|---|---|
| committer | yzhou <yujiao.zhou@gmail.com> | 2015-04-21 22:45:35 +0100 |
| commit | c0f5bdcdb29608532656c71c219680eccd4aad09 (patch) | |
| tree | 5f599adfe2e3f15a1d2b3f1cb8d0bf9ace59badd /test/uk/ac/ox | |
| parent | c8a9fc67a3f6ed201d7c917e36128268587eabe5 (diff) | |
| download | ACQuA-c0f5bdcdb29608532656c71c219680eccd4aad09.tar.gz ACQuA-c0f5bdcdb29608532656c71c219680eccd4aad09.zip | |
fixed some bugs in windows server
Diffstat (limited to 'test/uk/ac/ox')
| -rw-r--r-- | test/uk/ac/ox/cs/jrdfox/Tester.java | 121 | ||||
| -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 |
4 files changed, 137 insertions, 80 deletions
diff --git a/test/uk/ac/ox/cs/jrdfox/Tester.java b/test/uk/ac/ox/cs/jrdfox/Tester.java index 00476d6..94f5401 100644 --- a/test/uk/ac/ox/cs/jrdfox/Tester.java +++ b/test/uk/ac/ox/cs/jrdfox/Tester.java | |||
| @@ -2,44 +2,137 @@ package uk.ac.ox.cs.jrdfox; | |||
| 2 | 2 | ||
| 3 | import java.io.File; | 3 | import java.io.File; |
| 4 | 4 | ||
| 5 | import org.semanticweb.owlapi.model.OWLOntology; | ||
| 6 | |||
| 5 | import uk.ac.ox.cs.JRDFox.JRDFStoreException; | 7 | import uk.ac.ox.cs.JRDFox.JRDFStoreException; |
| 6 | import uk.ac.ox.cs.JRDFox.Prefixes; | 8 | import uk.ac.ox.cs.JRDFox.Prefixes; |
| 7 | import uk.ac.ox.cs.JRDFox.store.DataStore; | 9 | import uk.ac.ox.cs.JRDFox.store.DataStore; |
| 10 | import uk.ac.ox.cs.JRDFox.store.DataStore.UpdateType; | ||
| 8 | import uk.ac.ox.cs.JRDFox.store.Parameters; | 11 | import uk.ac.ox.cs.JRDFox.store.Parameters; |
| 12 | import uk.ac.ox.cs.JRDFox.store.TripleStatus; | ||
| 9 | import uk.ac.ox.cs.JRDFox.store.TupleIterator; | 13 | import uk.ac.ox.cs.JRDFox.store.TupleIterator; |
| 14 | import uk.ac.ox.cs.JRDFox.store.DataStore.StoreType; | ||
| 15 | import uk.ac.ox.cs.pagoda.owl.OWLHelper; | ||
| 16 | import uk.ac.ox.cs.pagoda.reasoner.light.RDFoxQueryEngine; | ||
| 17 | import uk.ac.ox.cs.pagoda.util.Namespace; | ||
| 10 | import uk.ac.ox.cs.pagoda.util.Timer; | 18 | import uk.ac.ox.cs.pagoda.util.Timer; |
| 11 | 19 | ||
| 12 | public class Tester { | 20 | public class Tester { |
| 13 | 21 | ||
| 14 | public static void main(String[] args) { | 22 | public static void main(String[] args) throws JRDFStoreException { |
| 23 | Tester tester = new Tester(); | ||
| 24 | tester.testCrash(); | ||
| 25 | } | ||
| 26 | |||
| 27 | private void evaluate_againstIDs(String queryText) throws JRDFStoreException { | ||
| 28 | int number = 0; | ||
| 29 | Timer t = new Timer(); | ||
| 30 | TupleIterator iter = null; | ||
| 15 | try { | 31 | try { |
| 16 | (new Tester()).test();; | 32 | iter = store.compileQuery(queryText, prefixes, parameters, TripleStatus.TUPLE_STATUS_IDB.union(TripleStatus.TUPLE_STATUS_EDB), TripleStatus.TUPLE_STATUS_IDB); |
| 17 | } catch (JRDFStoreException e) { | 33 | for (long multi = iter.open(); multi != 0; multi = iter.getNext()) |
| 18 | // TODO Auto-generated catch block | 34 | ++number; |
| 19 | e.printStackTrace(); | 35 | } finally { |
| 36 | if (iter != null) iter.dispose(); | ||
| 20 | } | 37 | } |
| 38 | System.out.println(number); | ||
| 39 | System.out.println(t.duration()); | ||
| 40 | |||
| 21 | } | 41 | } |
| 22 | 42 | ||
| 23 | DataStore store; | 43 | DataStore store; |
| 24 | Prefixes prefixes = new Prefixes(); | 44 | Prefixes prefixes = new Prefixes(); |
| 25 | Parameters parameters; | 45 | Parameters parameters; |
| 26 | 46 | ||
| 27 | public Tester() { | 47 | public Tester() { |
| 28 | try { | 48 | try { |
| 29 | store = new DataStore(new File("lazy-upper-bound")); | 49 | store = new DataStore(StoreType.NarrowParallelHead); |
| 50 | store.setNumberOfThreads(RDFoxQueryEngine.matNoOfThreads); | ||
| 51 | store.initialize(); | ||
| 52 | System.out.println("data store created."); | ||
| 30 | } catch (JRDFStoreException e) { | 53 | } catch (JRDFStoreException e) { |
| 31 | e.printStackTrace(); | 54 | e.printStackTrace(); |
| 32 | } | 55 | } |
| 33 | parameters = new Parameters(); | 56 | parameters = new Parameters(); |
| 34 | parameters.m_allAnswersInRoot = true; | 57 | parameters.m_allAnswersInRoot = true; |
| 35 | parameters.m_useBushy = true; | 58 | parameters.m_useBushy = true; |
| 36 | 59 | } | |
| 60 | |||
| 61 | public Tester(String path) { | ||
| 62 | try { | ||
| 63 | store = new DataStore(new File(path)); | ||
| 64 | } catch (JRDFStoreException e) { | ||
| 65 | e.printStackTrace(); | ||
| 66 | } | ||
| 67 | parameters = new Parameters(); | ||
| 68 | // parameters.m_allAnswersInRoot = true; | ||
| 69 | // parameters.m_useBushy = true; | ||
| 70 | } | ||
| 71 | |||
| 72 | public void applyReasoning(boolean incremental) { | ||
| 73 | Timer t = new Timer(); | ||
| 74 | try { | ||
| 75 | store.applyReasoning(incremental); | ||
| 76 | } catch (JRDFStoreException e) { | ||
| 77 | e.printStackTrace(); | ||
| 78 | } | ||
| 79 | System.out.println("reasoning done: " + t.duration()); | ||
| 37 | } | 80 | } |
| 38 | 81 | ||
| 39 | public void dispose() { | 82 | public void dispose() { |
| 40 | store.dispose(); | 83 | store.dispose(); |
| 41 | } | 84 | } |
| 42 | 85 | ||
| 86 | public void testCrash() throws JRDFStoreException { | ||
| 87 | // DataStore lowerStore = new DataStore(StoreType.NarrowParallelHead); | ||
| 88 | // lowerStore.setNumberOfThreads(RDFoxQueryEngine.matNoOfThreads); | ||
| 89 | // lowerStore.initialize(); | ||
| 90 | // System.out.println("lower data store created."); | ||
| 91 | OWLOntology ontology = OWLHelper.loadOntology("data/fly/fly_anatomy_XP_with_GJ_FC_individuals.owl"); | ||
| 92 | System.out.println("ontology loaded ... " + ontology.getAxiomCount()); | ||
| 93 | |||
| 94 | store.importTurtleFile(new File("testcase/fly.ttl")); | ||
| 95 | System.out.println("data loaded. " + store.getTriplesCount()); | ||
| 96 | |||
| 97 | store.importRules(new File[] {new File("testcase/lower.dlog")}); | ||
| 98 | System.out.println("rules loaded. " + store.getTriplesCount()); | ||
| 99 | |||
| 100 | store.applyReasoning(); | ||
| 101 | System.out.println("materialised. " + store.getTriplesCount()); | ||
| 102 | |||
| 103 | store.clearRulesAndMakeFactsExplicit(); | ||
| 104 | |||
| 105 | store.importRules(new File[] {new File("testcase/multi.dlog")}); | ||
| 106 | System.out.println("rules loaded. " + store.getTriplesCount()); | ||
| 107 | |||
| 108 | store.applyReasoning(); | ||
| 109 | System.out.println("materialised. " + store.getTriplesCount()); | ||
| 110 | |||
| 111 | store.makeFactsExplicit(); | ||
| 112 | |||
| 113 | store.importTurtleFiles(new File[] {new File("testcase/first.ttl")}, UpdateType.ScheduleForAddition); | ||
| 114 | System.out.println("first data loaded. " + store.getTriplesCount()); | ||
| 115 | |||
| 116 | store.applyReasoning(true); | ||
| 117 | System.out.println("incremental reasoning done. " + store.getTriplesCount()); | ||
| 118 | |||
| 119 | store.clearRulesAndMakeFactsExplicit(); | ||
| 120 | |||
| 121 | store.importTurtleFiles(new File[] {new File("testcase/second.ttl")}, UpdateType.ScheduleForAddition); | ||
| 122 | store.importRules(new File[] {new File("testcase/tracking.dlog")}, UpdateType.ScheduleForAddition); | ||
| 123 | store.applyReasoning(true); | ||
| 124 | System.out.println("incremental reasoning done. " + store.getTriplesCount()); | ||
| 125 | |||
| 126 | evaluate_againstIDs("select distinct ?z where { ?x <" + Namespace.RDF_TYPE + "> ?z . }"); | ||
| 127 | System.out.println("done."); | ||
| 128 | // tester.applyReasoning(true); | ||
| 129 | // tester.evaluate_againstIDs("select distinct ?z where { ?x <" + Namespace.RDF_TYPE + "> ?z . }"); | ||
| 130 | // System.out.println("done."); | ||
| 131 | |||
| 132 | store.dispose(); | ||
| 133 | // lowerStore.dispose(); | ||
| 134 | } | ||
| 135 | |||
| 43 | public void test() throws JRDFStoreException { | 136 | public void test() throws JRDFStoreException { |
| 44 | evaluate("PREFIX benchmark: <http://semantics.crl.ibm.com/univ-bench-dl.owl#> " | 137 | evaluate("PREFIX benchmark: <http://semantics.crl.ibm.com/univ-bench-dl.owl#> " |
| 45 | + "SELECT distinct ?x WHERE { " | 138 | + "SELECT distinct ?x WHERE { " |
| @@ -82,18 +175,18 @@ public class Tester { | |||
| 82 | + "?z benchmark:isHeadOf <http://www.Department0.University0.edu> . " | 175 | + "?z benchmark:isHeadOf <http://www.Department0.University0.edu> . " |
| 83 | + "?z benchmark:like ?y . " | 176 | + "?z benchmark:like ?y . " |
| 84 | + "?y a <http://www.cs.ox.ac.uk/PAGOdA/auxiliary#Original> }"); | 177 | + "?y a <http://www.cs.ox.ac.uk/PAGOdA/auxiliary#Original> }"); |
| 85 | } | 178 | } |
| 86 | 179 | ||
| 87 | public void evaluate(String query) throws JRDFStoreException { | 180 | public void evaluate(String query) throws JRDFStoreException { |
| 88 | TupleIterator iter = store.compileQuery(query, prefixes, parameters); | ||
| 89 | |||
| 90 | int number = 0; | 181 | int number = 0; |
| 91 | Timer t = new Timer(); | 182 | Timer t = new Timer(); |
| 183 | TupleIterator iter = null; | ||
| 92 | try { | 184 | try { |
| 185 | iter = store.compileQuery(query, prefixes, parameters); | ||
| 93 | for (long multi = iter.open(); multi != 0; multi = iter.getNext()) | 186 | for (long multi = iter.open(); multi != 0; multi = iter.getNext()) |
| 94 | ++number; | 187 | ++number; |
| 95 | } finally { | 188 | } finally { |
| 96 | iter.dispose(); | 189 | if (iter != null) iter.dispose(); |
| 97 | } | 190 | } |
| 98 | System.out.println(number); | 191 | System.out.println(number); |
| 99 | System.out.println(t.duration()); | 192 | System.out.println(t.duration()); |
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() { |
