From fbbbfbeb79097e5ce8f9ff2682d2c21368971654 Mon Sep 17 00:00:00 2001 From: Ronca Date: Wed, 6 May 2015 18:11:08 +0100 Subject: Switch from JUnit to TestNG. Plus minor fixes. --- .../ac/ox/cs/pagoda/test_units/ClauseTester.java | 164 +++++++++++++++++++ .../ac/ox/cs/pagoda/test_units/CostEvaluation.java | 109 +++++++++++++ .../uk/ac/ox/cs/pagoda/test_units/JAIR_PAGOdA.java | 180 +++++++++++++++++++++ .../ox/cs/pagoda/test_units/JAIR_Scalability.java | 88 ++++++++++ .../ox/cs/pagoda/test_units/LightEvaluation.java | 62 +++++++ .../ac/ox/cs/pagoda/test_units/PagodaDBPedia.java | 30 ++++ test/uk/ac/ox/cs/pagoda/test_units/PagodaELU.java | 18 +++ test/uk/ac/ox/cs/pagoda/test_units/PagodaFLY.java | 24 +++ test/uk/ac/ox/cs/pagoda/test_units/PagodaLUBM.java | 68 ++++++++ test/uk/ac/ox/cs/pagoda/test_units/PagodaNPD.java | 45 ++++++ .../ox/cs/pagoda/test_units/PagodaNPD_bench.java | 30 ++++ test/uk/ac/ox/cs/pagoda/test_units/PagodaRLU.java | 18 +++ test/uk/ac/ox/cs/pagoda/test_units/PagodaUOBM.java | 79 +++++++++ 13 files changed, 915 insertions(+) create mode 100644 test/uk/ac/ox/cs/pagoda/test_units/ClauseTester.java create mode 100644 test/uk/ac/ox/cs/pagoda/test_units/CostEvaluation.java create mode 100644 test/uk/ac/ox/cs/pagoda/test_units/JAIR_PAGOdA.java create mode 100644 test/uk/ac/ox/cs/pagoda/test_units/JAIR_Scalability.java create mode 100644 test/uk/ac/ox/cs/pagoda/test_units/LightEvaluation.java create mode 100644 test/uk/ac/ox/cs/pagoda/test_units/PagodaDBPedia.java create mode 100644 test/uk/ac/ox/cs/pagoda/test_units/PagodaELU.java create mode 100644 test/uk/ac/ox/cs/pagoda/test_units/PagodaFLY.java create mode 100644 test/uk/ac/ox/cs/pagoda/test_units/PagodaLUBM.java create mode 100644 test/uk/ac/ox/cs/pagoda/test_units/PagodaNPD.java create mode 100644 test/uk/ac/ox/cs/pagoda/test_units/PagodaNPD_bench.java create mode 100644 test/uk/ac/ox/cs/pagoda/test_units/PagodaRLU.java create mode 100644 test/uk/ac/ox/cs/pagoda/test_units/PagodaUOBM.java (limited to 'test/uk/ac/ox/cs/pagoda/test_units') diff --git a/test/uk/ac/ox/cs/pagoda/test_units/ClauseTester.java b/test/uk/ac/ox/cs/pagoda/test_units/ClauseTester.java new file mode 100644 index 0000000..a0f16d4 --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/test_units/ClauseTester.java @@ -0,0 +1,164 @@ +package uk.ac.ox.cs.pagoda.test_units; + +import org.semanticweb.HermiT.model.Atom; +import org.semanticweb.HermiT.model.AtomicConcept; +import org.semanticweb.HermiT.model.AtomicRole; +import org.semanticweb.HermiT.model.DLClause; +import org.semanticweb.HermiT.model.Equality; +import org.semanticweb.HermiT.model.Variable; +import org.semanticweb.owlapi.apibinding.OWLManager; +import org.semanticweb.owlapi.model.OWLOntology; +import org.semanticweb.owlapi.model.OWLOntologyManager; + +import org.testng.Assert; +import org.testng.annotations.Test; +import uk.ac.ox.cs.pagoda.approx.Clause; +import uk.ac.ox.cs.pagoda.approx.Clausifier; + +public class ClauseTester { + + @Test + public void test_simple() { + Variable x = Variable.create("X"), y1 = Variable.create("y1"), y2 = Variable.create("y2"); + AtomicConcept A = AtomicConcept.create("A"); + AtomicRole r = AtomicRole.create("r"); + Atom[] bodyAtoms = new Atom[] { + Atom.create(A, x), + Atom.create(r, x, y1), + Atom.create(r, x, y2) + }; + + Atom[] headAtoms = new Atom[] { + Atom.create(Equality.INSTANCE, y1, y2) + }; + + OWLOntologyManager m = OWLManager.createOWLOntologyManager(); + OWLOntology emptyOntology = null; + try { + emptyOntology = m.createOntology(); + } catch (Exception e) { + e.printStackTrace(); + Assert.fail("failed to create a new ontology"); + } + Clause c = new Clause(Clausifier.getInstance(emptyOntology), DLClause.create(headAtoms, bodyAtoms)); + System.out.println(c.toString()); + } + + @Test + public void test_more() { + Variable x = Variable.create("X"), y1 = Variable.create("y1"), y2 = Variable.create("y2"), y3 = Variable.create("y3"); + AtomicConcept A = AtomicConcept.create("A"); + AtomicRole r = AtomicRole.create("r"); + Atom[] bodyAtoms = new Atom[] { + Atom.create(A, x), + Atom.create(r, x, y1), + Atom.create(r, x, y2), + Atom.create(r, x, y3), + }; + + Atom[] headAtoms = new Atom[] { + Atom.create(Equality.INSTANCE, y1, y2), + Atom.create(Equality.INSTANCE, y1, y3), + Atom.create(Equality.INSTANCE, y2, y3) + }; + + OWLOntologyManager m = OWLManager.createOWLOntologyManager(); + OWLOntology emptyOntology = null; + try { + emptyOntology = m.createOntology(); + } catch (Exception e) { + e.printStackTrace(); + Assert.fail("failed to create a new ontology"); + } + Clause c = new Clause(Clausifier.getInstance(emptyOntology), DLClause.create(headAtoms, bodyAtoms)); + System.out.println(c.toString()); + } + + @Test + public void test_inverse() { + Variable x = Variable.create("X"), y1 = Variable.create("y1"), y2 = Variable.create("y2"); + AtomicConcept A = AtomicConcept.create("A"); + AtomicRole r = AtomicRole.create("r"); + Atom[] bodyAtoms = new Atom[] { + Atom.create(A, x), + Atom.create(r, y1, x), + Atom.create(r, y2, x) + }; + + Atom[] headAtoms = new Atom[] { + Atom.create(Equality.INSTANCE, y1, y2) + }; + + OWLOntologyManager m = OWLManager.createOWLOntologyManager(); + OWLOntology emptyOntology = null; + try { + emptyOntology = m.createOntology(); + } catch (Exception e) { + e.printStackTrace(); + Assert.fail("failed to create a new ontology"); + } + Clause c = new Clause(Clausifier.getInstance(emptyOntology), DLClause.create(headAtoms, bodyAtoms)); + System.out.println(c.toString()); + } + + @Test + public void test_fillter() { + Variable x = Variable.create("X"), y1 = Variable.create("y1"), y2 = Variable.create("y2"); + AtomicConcept A = AtomicConcept.create("A"); + AtomicConcept B = AtomicConcept.create("B"); + AtomicRole r = AtomicRole.create("r"); + Atom[] bodyAtoms = new Atom[] { + Atom.create(A, x), + Atom.create(r, y1, x), + Atom.create(r, y2, x), + Atom.create(B, y1), + Atom.create(B, y2) + }; + + Atom[] headAtoms = new Atom[] { + Atom.create(Equality.INSTANCE, y1, y2) + }; + + OWLOntologyManager m = OWLManager.createOWLOntologyManager(); + OWLOntology emptyOntology = null; + try { + emptyOntology = m.createOntology(); + } catch (Exception e) { + e.printStackTrace(); + Assert.fail("failed to create a new ontology"); + } + Clause c = new Clause(Clausifier.getInstance(emptyOntology), DLClause.create(headAtoms, bodyAtoms)); + System.out.println(c.toString()); + } + + @Test + public void test_negFillter() { + Variable x = Variable.create("X"), y1 = Variable.create("y1"), y2 = Variable.create("y2"); + AtomicConcept A = AtomicConcept.create("A"); + AtomicConcept B = AtomicConcept.create("B"); + AtomicRole r = AtomicRole.create("r"); + Atom[] bodyAtoms = new Atom[] { + Atom.create(A, x), + Atom.create(r, y1, x), + Atom.create(r, y2, x) + }; + + Atom[] headAtoms = new Atom[] { + Atom.create(Equality.INSTANCE, y1, y2), + Atom.create(B, y1), + Atom.create(B, y2) + }; + + OWLOntologyManager m = OWLManager.createOWLOntologyManager(); + OWLOntology emptyOntology = null; + try { + emptyOntology = m.createOntology(); + } catch (Exception e) { + e.printStackTrace(); + Assert.fail("failed to create a new ontology"); + } + Clause c = new Clause(Clausifier.getInstance(emptyOntology), DLClause.create(headAtoms, bodyAtoms)); + System.out.println(c.toString()); + } + +} diff --git a/test/uk/ac/ox/cs/pagoda/test_units/CostEvaluation.java b/test/uk/ac/ox/cs/pagoda/test_units/CostEvaluation.java new file mode 100644 index 0000000..4e32297 --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/test_units/CostEvaluation.java @@ -0,0 +1,109 @@ +package uk.ac.ox.cs.pagoda.test_units; + +import org.semanticweb.owlapi.model.OWLOntology; + +import org.testng.annotations.Test; +import uk.ac.ox.cs.pagoda.owl.OWLHelper; +import uk.ac.ox.cs.pagoda.reasoner.QueryReasoner; +import uk.ac.ox.cs.pagoda.reasoner.QueryReasoner.Type; +import uk.ac.ox.cs.pagoda.tester.PagodaTester; +import uk.ac.ox.cs.pagoda.util.Timer; +import uk.ac.ox.cs.pagoda.util.Utility; + +public class CostEvaluation { + + @Test + public void lubm100() { + int number = 1; + PagodaTester.main( + PagodaTester.onto_dir + "lubm/univ-bench.owl", + PagodaTester.onto_dir + "lubm/data/lubm" + number + ".ttl", + PagodaTester.onto_dir + "lubm/queries/test_all_pagoda.sparql" + ); +// AllTests.copy("output/log4j.log", "results-backup/jair/lubm" + number + ".out"); + } + + public void lubm1000() { + int number = 1000; + String[] args = new String[] { + PagodaTester.onto_dir + "lubm/univ-bench.owl", + PagodaTester.onto_dir + "lubm/data/lubm" + number + ".ttl", + PagodaTester.onto_dir + "lubm/queries/test_all_pagoda.sparql" + }; + OWLOntology ontology = OWLHelper.loadOntology(args[0]); + QueryReasoner reasoner = QueryReasoner.getInstance(Type.ELHOU, ontology, true, true); + Timer t = new Timer(); + reasoner.loadOntology(ontology); + reasoner.importData(args[1]); + if (!reasoner.preprocess()) + return ; + Utility.logInfo("Preprocessing Done in " + t.duration() + " seconds."); + + reasoner.evaluate(reasoner.getQueryManager().collectQueryRecords(args[2])); +// AllTests.copy("output/log4j.log", "results-backup/jair/lubm" + number + ".out"); + } + + @Test + public void uobm5() { + int number = 1; + String[] args = new String[] { + PagodaTester.onto_dir + "uobm/univ-bench-dl.owl", + PagodaTester.onto_dir + "uobm/data/uobm" + number + ".ttl", + PagodaTester.onto_dir + "uobm/queries/standard_all_pagoda.sparql" + }; + PagodaTester.main(args); +// AllTests.copy("output/log4j.log", "results-backup/jair/uobm" + number + ".out"); + } + + public void uobm100() { + int number = 200; + String[] args = new String[] { + PagodaTester.onto_dir + "uobm/univ-bench-dl.owl", + PagodaTester.onto_dir + "uobm/data/uobm" + number + ".ttl", + PagodaTester.onto_dir + "uobm/queries/standard_group3_all.sparql" + }; + PagodaTester.main(args); +// AllTests.copy("output/log4j.log", "results-backup/jair/uobm" + number + ".out"); + } + + public void uobm500() { + int number = 500; + String[] args = new String[] { + PagodaTester.onto_dir + "uobm/univ-bench-dl.owl", + PagodaTester.onto_dir + "uobm/data/uobm" + number + ".ttl", + PagodaTester.onto_dir + "uobm/queries/standard_all_pagoda.sparql" + }; + + OWLOntology ontology = OWLHelper.loadOntology(args[0]); + QueryReasoner reasoner = QueryReasoner.getInstance(Type.ELHOU, ontology, true, true); + Timer t = new Timer(); + reasoner.loadOntology(ontology); + reasoner.importData(args[1]); + if (!reasoner.preprocess()) + return ; + Utility.logInfo("Preprocessing Done in " + t.duration() + " seconds."); + + reasoner.evaluate(reasoner.getQueryManager().collectQueryRecords(args[2])); +// AllTests.copy("output/log4j.log", "results-backup/jair/uobm" + number + ".out"); + } + + + public static void main(String... args) { + args = new String[] { + PagodaTester.onto_dir + "dbpedia/integratedOntology-all-in-one-minus-datatype.owl", + PagodaTester.onto_dir + "dbpedia/data/dbpedia-minus-datatype-new.ttl", + PagodaTester.onto_dir + "dbpedia/queries/atomic_ground.sparql" + }; + + OWLOntology ontology = OWLHelper.loadOntology(args[0]); + QueryReasoner reasoner = QueryReasoner.getInstance(Type.ELHOU, ontology, true, true); + Timer t = new Timer(); + reasoner.loadOntology(ontology); + reasoner.importData(args[1]); + if (!reasoner.preprocess()) + return ; + Utility.logInfo("Preprocessing Done in " + t.duration() + " seconds."); + + reasoner.evaluate(reasoner.getQueryManager().collectQueryRecords(args[2])); + } +} diff --git a/test/uk/ac/ox/cs/pagoda/test_units/JAIR_PAGOdA.java b/test/uk/ac/ox/cs/pagoda/test_units/JAIR_PAGOdA.java new file mode 100644 index 0000000..ff616f7 --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/test_units/JAIR_PAGOdA.java @@ -0,0 +1,180 @@ +package uk.ac.ox.cs.pagoda.test_units; + +import org.testng.annotations.Test; +import uk.ac.ox.cs.pagoda.tester.PagodaTester; +import uk.ac.ox.cs.pagoda.util.Utility; + +import java.io.IOException; + +public class JAIR_PAGOdA { + + @Test + public void lubm1() throws IOException { + String[] args = new String[] { + PagodaTester.onto_dir + "lubm/univ-bench.owl", + PagodaTester.onto_dir + "lubm/data/lubm1.ttl", + PagodaTester.onto_dir + "lubm/queries/test.sparql" + }; + PagodaTester.main(args); + Utility.copyFile("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/lubm1/pagoda"); + } + + @Test + public void lubm1_conj() throws IOException { + String[] args = new String[] { + PagodaTester.onto_dir + "lubm/univ-bench.owl", + PagodaTester.onto_dir + "lubm/data/lubm1.ttl", + PagodaTester.onto_dir + "lubm/queries/test_pellet.sparql" + }; + PagodaTester.main(args); + Utility.copyFile("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/lubm1/pagoda_conj"); + } + + @Test + public void lubm1_rolledUp() throws IOException { + String[] args = new String[] { + "/home/yzhou/backup/20141212/univ-bench-queries.owl", + PagodaTester.onto_dir + "lubm/data/lubm1.ttl", + PagodaTester.onto_dir + "lubm/queries/atomic_lubm.sparql" + }; + PagodaTester.main(args); + Utility.copyFile("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/lubm1/pagoda_rolledUp"); + } + + @Test + public void uobm1() throws IOException { + String[] args = new String[] { + PagodaTester.onto_dir + "uobm/univ-bench-dl.owl", + PagodaTester.onto_dir + "uobm/data/uobm1.ttl", + PagodaTester.onto_dir + "uobm/queries/standard.sparql" + }; + PagodaTester.main(args); + Utility.copyFile("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/uobm1/pagoda"); + } + + @Test + public void uobm1_conj() throws IOException { + String[] args = new String[] { + PagodaTester.onto_dir + "uobm/univ-bench-dl.owl", + PagodaTester.onto_dir + "uobm/data/uobm1.ttl", + PagodaTester.onto_dir + "uobm/queries/standard_pellet.sparql" + }; + PagodaTester.main(args); + Utility.copyFile("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/uobm1/pagoda_conj"); + } + + @Test + public void uobm1_rolledUp() { + String[] args = new String[] { + "/home/yzhou/backup/20141212/univ-bench-dl-queries.owl", + PagodaTester.onto_dir + "uobm/data/uobm1.ttl", + PagodaTester.onto_dir + "uobm/queries/atomic_uobm.sparql" + }; + PagodaTester.main(args); +// AllTests.copy("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/uobm1/pagoda_rolledUp"); + } + + @Test + public void fly() { + String[] args = new String[] { + PagodaTester.onto_dir + "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl", + null, + PagodaTester.onto_dir + "fly/queries/fly_pellet.sparql" + }; + PagodaTester.main(args); +// AllTests.copy("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/fly/pagoda"); + } + + @Test + public void fly_conj() throws IOException { + String[] args = new String[] { + PagodaTester.onto_dir + "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl", + null, + PagodaTester.onto_dir + "fly/queries/fly_pellet.sparql" + }; + PagodaTester.main(args); + Utility.copyFile("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/fly/pagoda_conj"); + } + + + public void fly_rolledUp() { + PagodaTester.main(new String[] { +// PagodaTester.onto_dir + "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl", + PagodaTester.onto_dir + "fly/fly-all-in-one_rolledUp.owl", + null, + PagodaTester.onto_dir + "fly/queries/fly_atomic.sparql" + }); +// Utility.copyFile("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/fly/pagoda_rolledUp"); + } + + public void dbpedia() { + PagodaTester.main( + PagodaTester.onto_dir + "dbpedia/integratedOntology-all-in-one-minus-datatype.owl", + PagodaTester.onto_dir + "dbpedia/data/dbpedia-minus-datatype-new.ttl", + PagodaTester.onto_dir + "dbpedia/queries/atomic_ground.sparql" + , "dbpedia.ans" + ); + +// Utility.copyFile("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/dbpedia/pagoda"); + } + + public void npd() { + PagodaTester.main( + PagodaTester.onto_dir + "npd/npd-all-minus-datatype.owl", + PagodaTester.onto_dir + "npd/data/npd-data-dump-minus-datatype-new.ttl", + PagodaTester.onto_dir + "npd/queries/atomic_ground.sparql" + , "npd.ans" + ); + +// Utility.copyFile("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/npd/pagoda"); + } + + public void reactome() throws IOException { + PagodaTester.main( + PagodaTester.onto_dir + "bio2rdf/reactome/biopax-level3-processed.owl", + PagodaTester.onto_dir + "bio2rdf/reactome/graph sampling/reactome_sample_10.ttl", +// null, +// PagodaTester.onto_dir + "bio2rdf/reactome/queries/atomic_ground.sparql" + PagodaTester.onto_dir + "bio2rdf/reactome/queries/example.sparql" + , "pagoda_reactome.ans" + ); + Utility.copyFile("log4j.log", "output/jair/pagoda_reactome.example"); + +// AllTests.copy("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/reactome/pagoda_10p"); + } + + public void chembl() throws IOException { + PagodaTester.main( + PagodaTester.onto_dir + "bio2rdf/chembl/cco-noDPR.ttl", + PagodaTester.onto_dir + "bio2rdf/chembl/graph sampling/sample_1.nt", +// PagodaTester.onto_dir + "bio2rdf/chembl/queries/atomic_ground.sparql" + PagodaTester.onto_dir + "bio2rdf/chembl/queries/example.sparql" + , "pagoda_chembl.ans" + ); + Utility.copyFile("log4j.log", "output/jair/pagoda_chembl.example"); +// Utility.copyFile("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/chembl/pagoda_1p"); + } + + public void uniprot() throws IOException { + PagodaTester.main( + PagodaTester.onto_dir + "bio2rdf/uniprot/core-sat-processed.owl", + PagodaTester.onto_dir + "bio2rdf/uniprot/graph sampling/sample_1.nt", +// null, +// PagodaTester.onto_dir + "bio2rdf/uniprot/queries/atomic_ground.sparql" + PagodaTester.onto_dir + "bio2rdf/uniprot/queries/example.sparql" + , "pagoda_uniprot.ans" + ); + Utility.copyFile("log4j.log", "output/jair/pagoda_uniprot.example"); +// AllTests.copy("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/uniprot/pagoda_1p"); + } + + + public static void main(String... args) { + try { + new JAIR_PAGOdA().lubm1(); + } catch (IOException e) { + e.printStackTrace(); + } + } + +} diff --git a/test/uk/ac/ox/cs/pagoda/test_units/JAIR_Scalability.java b/test/uk/ac/ox/cs/pagoda/test_units/JAIR_Scalability.java new file mode 100644 index 0000000..43cb810 --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/test_units/JAIR_Scalability.java @@ -0,0 +1,88 @@ +package uk.ac.ox.cs.pagoda.test_units; + +import org.testng.annotations.Test; +import uk.ac.ox.cs.pagoda.tester.PagodaTester; +import uk.ac.ox.cs.pagoda.util.Properties; +import uk.ac.ox.cs.pagoda.util.Utility; + +import java.io.IOException; + +public class JAIR_Scalability { + + private static final String date = "_0123"; + + @Test + public void reactome() throws IOException { + testReactome(10, false); + } + + @Test + public void chembl() throws IOException { + testChEMBL(1, false); + } + + @Test + public void uniprot() throws IOException { + testUniProt(1, false); + } + + public void testReactome(int percentage, boolean save) throws IOException { + String[] args = new String[] { + PagodaTester.onto_dir + "bio2rdf/reactome/biopax-level3-processed.owl", + PagodaTester.onto_dir + "bio2rdf/reactome/graph sampling/simplifed_sample_" + percentage + ".ttl", + PagodaTester.onto_dir + "bio2rdf/reactome/queries/test.sparql" + , "reactome.ans" + }; + if (percentage == 10) + args[1] = args[1].replace("simplifed", "reactome"); + + PagodaTester.main(args); + if (save) + Utility.copyFile("log4j.log", "/home/yzhou/java-workspace/test-share/results_new/reactome/pagoda_" + percentage + "p" + date); + } + + public void testChEMBL(int percentage, boolean save) throws IOException { + String[] args = new String[] { + PagodaTester.onto_dir + "bio2rdf/chembl/cco-noDPR.ttl", + PagodaTester.onto_dir + "bio2rdf/chembl/sample_" + percentage + ".nt", +// PagodaTester.onto_dir + "bio2rdf/chembl/queries/atomic_ground.sparql" + PagodaTester.onto_dir + "bio2rdf/chembl/queries/test.sparql" + , "chembl.ans" + }; + if (percentage == 1 || percentage == 10 || percentage == 50) + args[1] = args[1].replace("chembl", "chembl/graph sampling"); + else + if (percentage == 100) + args[1] = "/home/yzhou/RDFData/ChEMBL/facts/ChEMBL.ttl"; + + PagodaTester.main(args); + if (save) + Utility.copyFile("log4j.log", "/home/yzhou/java-workspace/test-share/results_new/chembl/pagoda_" + percentage + "p" + date); + } + + public void testUniProt(int percentage, boolean save) throws IOException { + String[] args = new String[] { + PagodaTester.onto_dir + "bio2rdf/uniprot/core-sat-processed.owl", + PagodaTester.onto_dir + "bio2rdf/uniprot/sample_" + percentage + ".nt", +// PagodaTester.onto_dir + "bio2rdf/uniprot/queries/atomic_ground.sparql" + PagodaTester.onto_dir + "bio2rdf/uniprot/queries/test.sparql" + , "uniprot.ans" + }; + + if (percentage == 1 || percentage == 10 || percentage == 50) + args[1] = args[1].replace("uniprot", "uniprot/graph sampling"); + else + if (percentage == 100) + args[1] = "/home/yzhou/krr-nas-share/Yujiao/ontologies/bio2rdf/uniprot/data/uniprot_cleaned.nt"; + + PagodaTester.main(args); + if (save) + Utility.copyFile("log4j.log", "/home/yzhou/java-workspace/test-share/results_new/uniprot/pagoda_" + percentage + "p" + date); + } + + public static void main(String... args) throws IOException { + Properties.ShellModeDefault = true; + new JAIR_Scalability().testUniProt(50, false); + } + +} diff --git a/test/uk/ac/ox/cs/pagoda/test_units/LightEvaluation.java b/test/uk/ac/ox/cs/pagoda/test_units/LightEvaluation.java new file mode 100644 index 0000000..29006de --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/test_units/LightEvaluation.java @@ -0,0 +1,62 @@ +package uk.ac.ox.cs.pagoda.test_units; + +import org.junit.Test; +import uk.ac.ox.cs.pagoda.tester.PagodaTester; +import uk.ac.ox.cs.pagoda.util.Utility; + +import java.io.IOException; + +public class LightEvaluation { + + @Test + public void uobm1() throws IOException { + int number = 1; + PagodaTester.main( + PagodaTester.onto_dir + "uobm/univ-bench-dl.owl", + PagodaTester.onto_dir + "uobm/data/uobm" + number + ".ttl", + PagodaTester.onto_dir + "uobm/queries/standard.sparql" + ); + Utility.copyFile("log4j.log", "output/jair/uobm1.out"); + } + + @Test + public void lubm100() throws IOException { + int number = 100; + PagodaTester.main( + PagodaTester.onto_dir + "lubm/univ-bench.owl", + PagodaTester.onto_dir + "lubm/data/lubm" + number + ".ttl", + PagodaTester.onto_dir + "lubm/queries/test.sparql" + ); + Utility.copyFile("log4j.log", "results-backup/current/lubm100.out"); + } + + @Test + public void fly() throws IOException { + PagodaTester.main( + PagodaTester.onto_dir + "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl", + PagodaTester.onto_dir + "fly/queries/fly.sparql" + ); + Utility.copyFile("log4j.log", "results-backup/current/fly.out"); + } + + @Test + public void dbpedia() throws IOException { + PagodaTester.main( + PagodaTester.onto_dir + "dbpedia/integratedOntology-all-in-one-minus-datatype.owl", + PagodaTester.onto_dir + "dbpedia/data/dbpedia-minus-datatype-new.ttl", + PagodaTester.onto_dir + "dbpedia/atomic.sparql" + ); + Utility.copyFile("log4j.log", "results-backup/current/dbpedia.out"); + } + + @Test + public void npdWithoutDataType() throws IOException { + PagodaTester.main( + PagodaTester.onto_dir + "npd/npd-all-minus-datatype.owl", + PagodaTester.onto_dir + "npd/data/npd-data-dump-minus-datatype-new.ttl", + PagodaTester.onto_dir + "npd/queries/atomic.sparql" + ); + Utility.copyFile("log4j.log", "results-backup/current/npd_minus.out"); + } + +} diff --git a/test/uk/ac/ox/cs/pagoda/test_units/PagodaDBPedia.java b/test/uk/ac/ox/cs/pagoda/test_units/PagodaDBPedia.java new file mode 100644 index 0000000..aaf542e --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/test_units/PagodaDBPedia.java @@ -0,0 +1,30 @@ +package uk.ac.ox.cs.pagoda.test_units; + +import static org.junit.Assert.fail; + +import org.junit.Test; + +import uk.ac.ox.cs.pagoda.tester.PagodaTester; +import uk.ac.ox.cs.pagoda.tester.Statistics; +import uk.ac.ox.cs.pagoda.util.Utility; + +import java.io.IOException; + +public class PagodaDBPedia { + + @Test + public void test() throws IOException { + PagodaTester.main( + PagodaTester.onto_dir + "dbpedia/integratedOntology-all-in-one-minus-datatype.owl", + PagodaTester.onto_dir + "dbpedia/data/dbpedia-minus-datatype-new.ttl", + PagodaTester.onto_dir + "dbpedia/atomic.sparql" + ); + + Statistics stat = new Statistics("output/log4j.log"); + String diff = stat.diff("results-backup/benchmark/dbpedia.out"); + Utility.copyFile("output/log4j.log", "results-backup/current/dbpedia.out"); + if (!diff.isEmpty()) + fail(diff); + } + +} diff --git a/test/uk/ac/ox/cs/pagoda/test_units/PagodaELU.java b/test/uk/ac/ox/cs/pagoda/test_units/PagodaELU.java new file mode 100644 index 0000000..c2fa838 --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/test_units/PagodaELU.java @@ -0,0 +1,18 @@ +package uk.ac.ox.cs.pagoda.test_units; + +import org.junit.Test; +import uk.ac.ox.cs.pagoda.tester.PagodaTester; + +public class PagodaELU { + + @Test void test() { + int number = 1; + PagodaTester.main( + PagodaTester.onto_dir + "uobm/univ-bench-dl.owl", + PagodaTester.onto_dir + "uobm/data/uobm" + number + ".ttl", + PagodaTester.onto_dir + "uobm/queries/standard.sparql" + ); + } + + +} diff --git a/test/uk/ac/ox/cs/pagoda/test_units/PagodaFLY.java b/test/uk/ac/ox/cs/pagoda/test_units/PagodaFLY.java new file mode 100644 index 0000000..2fe07f0 --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/test_units/PagodaFLY.java @@ -0,0 +1,24 @@ +package uk.ac.ox.cs.pagoda.test_units; + +import org.junit.Test; + +import uk.ac.ox.cs.pagoda.tester.PagodaTester; + +public class PagodaFLY { + + @Test + public void test() { + PagodaTester.main( + PagodaTester.onto_dir + "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl", + PagodaTester.onto_dir + "fly/queries/fly_pellet.sparql" + ); + +// Statistics stat = new Statistics("output/log4j.log"); +// String diff = stat.diff("results-backup/benchmark/fly.out"); +// AllTests.copy("output/log4j.log", "results-backup/current/fly.out"); +// if (!diff.isEmpty()) +// fail(diff); + } + + +} diff --git a/test/uk/ac/ox/cs/pagoda/test_units/PagodaLUBM.java b/test/uk/ac/ox/cs/pagoda/test_units/PagodaLUBM.java new file mode 100644 index 0000000..f40e41b --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/test_units/PagodaLUBM.java @@ -0,0 +1,68 @@ +package uk.ac.ox.cs.pagoda.test_units; + +import org.testng.Assert; +import org.testng.annotations.Test; +import uk.ac.ox.cs.pagoda.tester.PagodaTester; +import uk.ac.ox.cs.pagoda.tester.Statistics; +import uk.ac.ox.cs.pagoda.util.Utility; + +import java.io.FileInputStream; +import java.io.IOException; +import java.util.Properties; + +public class PagodaLUBM { + + public static final String CONFIG_FILE = "config/test.properties"; + + private static boolean isInit = false; + private static String ontoDir; + + private static void init() { + if(isInit) return; + isInit = true; + + Properties config = new Properties(); + + try(FileInputStream in = new FileInputStream(CONFIG_FILE)) { + config.load(in); + in.close(); + } catch (IOException e) { + e.printStackTrace(); + } + + ontoDir = config.getProperty("ontoDir"); + } + + private void test_all(int number) { + init(); + PagodaTester.main( + Utility.combinePaths(ontoDir, "lubm/univ-bench.owl"), + Utility.combinePaths(ontoDir, "lubm/data/lubm" + number + ".ttl"), + Utility.combinePaths(ontoDir, "lubm/queries/test.sparql") + ); + +// assertTrue(false); +// AllTests.copy("log4j.log", "output/jair/lubm" + number + ".out"); + } + + @Test + public void test1() { + test_all(1); + } + +// @Test +// public void test() { +// int number = 100; +// test_all(number); +// } + + private void check(int number) throws IOException { + Statistics stat = new Statistics("output/log4j.log"); + // TODO insert proper file + String diff = stat.diff("results-backup/benchmark/lubm" + number + ".out"); + Utility.copyFile("output/log4j.log", "results-backup/current/lubm" + number + ".out"); + if (!diff.isEmpty()) + Assert.fail(diff); + } + +} diff --git a/test/uk/ac/ox/cs/pagoda/test_units/PagodaNPD.java b/test/uk/ac/ox/cs/pagoda/test_units/PagodaNPD.java new file mode 100644 index 0000000..8fbe793 --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/test_units/PagodaNPD.java @@ -0,0 +1,45 @@ +package uk.ac.ox.cs.pagoda.test_units; + +import static org.junit.Assert.fail; + +import org.junit.Test; + +import uk.ac.ox.cs.pagoda.tester.PagodaTester; +import uk.ac.ox.cs.pagoda.tester.Statistics; +import uk.ac.ox.cs.pagoda.util.Utility; + +import java.io.IOException; + +public class PagodaNPD { + + @Test + public void testNPDwithoutDataType() throws IOException { + PagodaTester.main( + PagodaTester.onto_dir + "npd/npd-all-minus-datatype.owl", + PagodaTester.onto_dir + "npd/data/npd-data-dump-minus-datatype-new.ttl", + PagodaTester.onto_dir + "npd/queries/atomic.sparql" + ); + + Statistics stat = new Statistics("output/log4j.log"); + String diff = stat.diff("results-backup/benchmark/npd_minus.out"); + Utility.copyFile("output/log4j.log", "results-backup/current/npd_minus.out"); + if (!diff.isEmpty()) + fail(diff); + } + + @Test + public void testNPD() throws IOException { + PagodaTester.main( + PagodaTester.onto_dir + "npd/npd-all.owl", + PagodaTester.onto_dir + "npd/data/npd-data-dump-processed.ttl", + PagodaTester.onto_dir + "npd/queries/atomic.sparql" + ); + + Statistics stat = new Statistics("output/log4j.log"); + String diff = stat.diff("results-backup/benchmark/npd.out"); + Utility.copyFile("output/log4j.log", "results-backup/current/npd.out"); + if (!diff.isEmpty()) + fail(diff); + } + +} diff --git a/test/uk/ac/ox/cs/pagoda/test_units/PagodaNPD_bench.java b/test/uk/ac/ox/cs/pagoda/test_units/PagodaNPD_bench.java new file mode 100644 index 0000000..1243180 --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/test_units/PagodaNPD_bench.java @@ -0,0 +1,30 @@ +package uk.ac.ox.cs.pagoda.test_units; + +import static org.junit.Assert.fail; + +import org.junit.Test; + +import uk.ac.ox.cs.pagoda.tester.PagodaTester; +import uk.ac.ox.cs.pagoda.tester.Statistics; +import uk.ac.ox.cs.pagoda.util.Utility; + +import java.io.IOException; + +public class PagodaNPD_bench { + + @Test + public void test() throws IOException { + PagodaTester.main( + PagodaTester.onto_dir + "npd-benchmark/npd-v2-ql_a.owl", + PagodaTester.onto_dir + "npd-benchmark/npd-v2-ql_a.ttl", + PagodaTester.onto_dir + "npd-benchmark/queries/all.sparql" + ); + + Statistics stat = new Statistics("output/log4j.log"); + String diff = stat.diff("results-backup/benchmark/npd-bench.out"); + Utility.copyFile("output/log4j.log", "results-backup/current/npd-bench.out"); + if (!diff.isEmpty()) + fail(diff); + } + +} diff --git a/test/uk/ac/ox/cs/pagoda/test_units/PagodaRLU.java b/test/uk/ac/ox/cs/pagoda/test_units/PagodaRLU.java new file mode 100644 index 0000000..8b31c99 --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/test_units/PagodaRLU.java @@ -0,0 +1,18 @@ +package uk.ac.ox.cs.pagoda.test_units; + +import org.junit.Test; +import uk.ac.ox.cs.pagoda.tester.PagodaTester; + +public class PagodaRLU { + + @Test + public void testRL() { + int number = 1; + PagodaTester.main( + PagodaTester.onto_dir + "uobm/univ-bench-dl.owl", + PagodaTester.onto_dir + "uobm/data/uobm" + number + ".ttl", + PagodaTester.onto_dir + "uobm/queries/standard.sparql" + ); + } + +} diff --git a/test/uk/ac/ox/cs/pagoda/test_units/PagodaUOBM.java b/test/uk/ac/ox/cs/pagoda/test_units/PagodaUOBM.java new file mode 100644 index 0000000..29a9056 --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/test_units/PagodaUOBM.java @@ -0,0 +1,79 @@ +package uk.ac.ox.cs.pagoda.test_units; + +import org.testng.annotations.Test; +import uk.ac.ox.cs.pagoda.tester.PagodaTester; +import uk.ac.ox.cs.pagoda.tester.Statistics; +import uk.ac.ox.cs.pagoda.util.Utility; + +import java.io.FileInputStream; +import java.io.IOException; +import java.util.Properties; + +public class PagodaUOBM { + + public static final String CONFIG_FILE = "config/test.properties"; + + private static boolean isInit = false; + private static String ontoDir; + + private static void init() { + if(isInit) return; + isInit = true; + + Properties config = new Properties(); + + try(FileInputStream in = new FileInputStream(CONFIG_FILE)) { + config.load(in); + in.close(); + } catch (IOException e) { + e.printStackTrace(); + } + + ontoDir = config.getProperty("ontoDir"); + } + + private void test_all(int number ) { + init(); + + PagodaTester.main( + Utility.combinePaths(ontoDir, "uobm/univ-bench-dl.owl"), + Utility.combinePaths(ontoDir, "uobm/data/uobm" + number + ".ttl"), + Utility.combinePaths(ontoDir, "uobm/queries/test.sparql") +// + ";" + +// Utility.combinePaths(ontoDir, "uobm/queries/standard_group3_all_less.sparql") + ";" + +// Utility.combinePaths(ontoDir, "uobm/queries/G3.sparql") + ";" + +// Utility.combinePaths(ontoDir, "uobm/queries/last.sparql") + ); + +// AllTests.copy("log4j.log", "output/jair/newuobm/uobm" + number + ".out"); + } + + private void test_upToSum(int number) { + init(); + + PagodaTester.main( + PagodaTester.onto_dir + "uobm/univ-bench-dl.owl", + PagodaTester.onto_dir + "uobm/data/uobm" + number + ".ttl", + PagodaTester.onto_dir + "uobm/queries/standard_group3_all.sparql" + ); + +// AllTests.copy("log4j.log", "output/jair/uobm" + number + ".out"); + } + + @Test + public void test1() { test_all(1); } + +// @Test + public void test500() { test_upToSum(500); } + +// public static void main(String... args) { +// new PagodaUOBM().test_all(1); +// } + + private void check() { + Statistics stat = new Statistics("results-backup/current/uobm1.out"); + String diff = stat.diff("results-backup/benchmark/uobm1.out"); + System.out.println(diff); + } + +} -- cgit v1.2.3