diff options
Diffstat (limited to 'test/uk/ac/ox/cs/jrdfox/Tester.java')
| -rw-r--r-- | test/uk/ac/ox/cs/jrdfox/Tester.java | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/test/uk/ac/ox/cs/jrdfox/Tester.java b/test/uk/ac/ox/cs/jrdfox/Tester.java new file mode 100644 index 0000000..00476d6 --- /dev/null +++ b/test/uk/ac/ox/cs/jrdfox/Tester.java | |||
| @@ -0,0 +1,102 @@ | |||
| 1 | package uk.ac.ox.cs.jrdfox; | ||
| 2 | |||
| 3 | import java.io.File; | ||
| 4 | |||
| 5 | import uk.ac.ox.cs.JRDFox.JRDFStoreException; | ||
| 6 | import uk.ac.ox.cs.JRDFox.Prefixes; | ||
| 7 | import uk.ac.ox.cs.JRDFox.store.DataStore; | ||
| 8 | import uk.ac.ox.cs.JRDFox.store.Parameters; | ||
| 9 | import uk.ac.ox.cs.JRDFox.store.TupleIterator; | ||
| 10 | import uk.ac.ox.cs.pagoda.util.Timer; | ||
| 11 | |||
| 12 | public class Tester { | ||
| 13 | |||
| 14 | public static void main(String[] args) { | ||
| 15 | try { | ||
| 16 | (new Tester()).test();; | ||
| 17 | } catch (JRDFStoreException e) { | ||
| 18 | // TODO Auto-generated catch block | ||
| 19 | e.printStackTrace(); | ||
| 20 | } | ||
| 21 | } | ||
| 22 | |||
| 23 | DataStore store; | ||
| 24 | Prefixes prefixes = new Prefixes(); | ||
| 25 | Parameters parameters; | ||
| 26 | |||
| 27 | public Tester() { | ||
| 28 | try { | ||
| 29 | store = new DataStore(new File("lazy-upper-bound")); | ||
| 30 | } catch (JRDFStoreException e) { | ||
| 31 | e.printStackTrace(); | ||
| 32 | } | ||
| 33 | parameters = new Parameters(); | ||
| 34 | parameters.m_allAnswersInRoot = true; | ||
| 35 | parameters.m_useBushy = true; | ||
| 36 | |||
| 37 | } | ||
| 38 | |||
| 39 | public void dispose() { | ||
| 40 | store.dispose(); | ||
| 41 | } | ||
| 42 | |||
| 43 | public void test() throws JRDFStoreException { | ||
| 44 | evaluate("PREFIX benchmark: <http://semantics.crl.ibm.com/univ-bench-dl.owl#> " | ||
| 45 | + "SELECT distinct ?x WHERE { " | ||
| 46 | + "?x a benchmark:Person . " | ||
| 47 | + "?x benchmark:like ?y . " | ||
| 48 | + "?z a benchmark:Chair . " | ||
| 49 | + "?z benchmark:isHeadOf <http://www.Department0.University0.edu> . " | ||
| 50 | + "?z benchmark:like ?y . " | ||
| 51 | + "?x a <http://www.cs.ox.ac.uk/PAGOdA/auxiliary#Original> . " | ||
| 52 | + "?z a <http://www.cs.ox.ac.uk/PAGOdA/auxiliary#Original> . " | ||
| 53 | + "?y a <http://www.cs.ox.ac.uk/PAGOdA/auxiliary#Original> }"); | ||
| 54 | |||
| 55 | evaluate("PREFIX benchmark: <http://semantics.crl.ibm.com/univ-bench-dl.owl#> " | ||
| 56 | + "SELECT distinct ?x WHERE { " | ||
| 57 | + "?x a benchmark:Person . " | ||
| 58 | + "?x benchmark:like ?y . " | ||
| 59 | + "?z a benchmark:Chair . " | ||
| 60 | + "?z benchmark:isHeadOf <http://www.Department0.University0.edu> . " | ||
| 61 | + "?z benchmark:like ?y . " | ||
| 62 | + "?z a <http://www.cs.ox.ac.uk/PAGOdA/auxiliary#Original> . " | ||
| 63 | + "?y a <http://www.cs.ox.ac.uk/PAGOdA/auxiliary#Original> ." | ||
| 64 | + "?x a <http://www.cs.ox.ac.uk/PAGOdA/auxiliary#Original> }"); | ||
| 65 | |||
| 66 | evaluate("PREFIX benchmark: <http://semantics.crl.ibm.com/univ-bench-dl.owl#> " | ||
| 67 | + "SELECT distinct ?x WHERE { " | ||
| 68 | + "?x a benchmark:Person . " | ||
| 69 | + "?x benchmark:like ?y . " | ||
| 70 | + "?z a benchmark:Chair . " | ||
| 71 | + "?z benchmark:isHeadOf <http://www.Department0.University0.edu> . " | ||
| 72 | + "?z benchmark:like ?y . " | ||
| 73 | + "?y a <http://www.cs.ox.ac.uk/PAGOdA/auxiliary#Original> . " | ||
| 74 | + "?x a <http://www.cs.ox.ac.uk/PAGOdA/auxiliary#Original> . " | ||
| 75 | + "?z a <http://www.cs.ox.ac.uk/PAGOdA/auxiliary#Original> }"); | ||
| 76 | |||
| 77 | evaluate("PREFIX benchmark: <http://semantics.crl.ibm.com/univ-bench-dl.owl#> " | ||
| 78 | + "SELECT distinct ?x WHERE { " | ||
| 79 | + "?x a benchmark:Person . " | ||
| 80 | + "?x benchmark:like ?y . " | ||
| 81 | + "?z a benchmark:Chair . " | ||
| 82 | + "?z benchmark:isHeadOf <http://www.Department0.University0.edu> . " | ||
| 83 | + "?z benchmark:like ?y . " | ||
| 84 | + "?y a <http://www.cs.ox.ac.uk/PAGOdA/auxiliary#Original> }"); | ||
| 85 | } | ||
| 86 | |||
| 87 | public void evaluate(String query) throws JRDFStoreException { | ||
| 88 | TupleIterator iter = store.compileQuery(query, prefixes, parameters); | ||
| 89 | |||
| 90 | int number = 0; | ||
| 91 | Timer t = new Timer(); | ||
| 92 | try { | ||
| 93 | for (long multi = iter.open(); multi != 0; multi = iter.getNext()) | ||
| 94 | ++number; | ||
| 95 | } finally { | ||
| 96 | iter.dispose(); | ||
| 97 | } | ||
| 98 | System.out.println(number); | ||
| 99 | System.out.println(t.duration()); | ||
| 100 | } | ||
| 101 | |||
| 102 | } | ||
