From: <tho...@us...> - 2010-11-12 21:02:59
|
Revision: 3946 http://bigdata.svn.sourceforge.net/bigdata/?rev=3946&view=rev Author: thompsonbry Date: 2010-11-12 21:02:48 +0000 (Fri, 12 Nov 2010) Log Message: ----------- Added LUBM Q8 to the test class. Modified Paths: -------------- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/test/com/bigdata/bop/rdf/joinGraph/TestJoinGraphOnLubm.java Modified: branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/test/com/bigdata/bop/rdf/joinGraph/TestJoinGraphOnLubm.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/test/com/bigdata/bop/rdf/joinGraph/TestJoinGraphOnLubm.java 2010-11-12 20:47:51 UTC (rev 3945) +++ branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/test/com/bigdata/bop/rdf/joinGraph/TestJoinGraphOnLubm.java 2010-11-12 21:02:48 UTC (rev 3946) @@ -616,4 +616,144 @@ } // test_Q9 + /** + * LUBM Query 8 + * + * <pre> + * PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> + * PREFIX ub: <http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#> + * SELECT ?x ?y ?z + * WHERE{ + * ?y a ub:Department . + * ?x a ub:Student; + * ub:memberOf ?y . + * ?y ub:subOrganizationOf <http://www.University0.edu> . + * ?x ub:emailAddress ?z . + * } + * </pre> + * @throws Exception + */ + public void test_query8() throws Exception { + final AbstractTripleStore database = (AbstractTripleStore) jnl + .getResourceLocator() + .locate(namespace, jnl.getLastCommitTime()); + + if (database == null) + throw new RuntimeException("Not found: " + namespace); + + /* + * Resolve terms against the lexicon. + */ + final BigdataValueFactory f = database.getLexiconRelation() + .getValueFactory(); + + final BigdataURI rdfType = f + .createURI("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"); + + final BigdataURI department = f + .createURI("http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#Department"); + + final BigdataURI student = f + .createURI("http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#Student"); + + final BigdataURI memberOf = f + .createURI("http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#memberOf"); + + final BigdataURI subOrganizationOf = f + .createURI("http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#subOrganizationOf"); + + final BigdataURI emailAddress = f + .createURI("http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#emailAddress"); + + final BigdataURI university0 = f + .createURI("http://www.University0.edu"); + + final BigdataValue[] terms = new BigdataValue[] { rdfType, department, + student, memberOf, subOrganizationOf, emailAddress, university0 }; + + // resolve terms. + database.getLexiconRelation() + .addTerms(terms, terms.length, true/* readOnly */); + + { + for (BigdataValue tmp : terms) { + System.out.println(tmp + " : " + tmp.getIV()); + if (tmp.getIV() == null) + throw new RuntimeException("Not defined: " + tmp); + } + } + + final IPredicate[] preds; + { + final IVariable<?> x = Var.var("x"); + final IVariable<?> y = Var.var("y"); + final IVariable<?> z = Var.var("z"); + + // The name space for the SPO relation. + final String[] relation = new String[] { namespace + ".spo" }; + + final long timestamp = jnl.getLastCommitTime(); + + int nextId = 0; + + // ?y a ub:Department . + final IPredicate p0 = new SPOPredicate(new BOp[] { y, + new Constant(rdfType.getIV()), + new Constant(department.getIV()) },// + new NV(BOp.Annotations.BOP_ID, nextId++),// + new NV(IPredicate.Annotations.TIMESTAMP, timestamp),// + new NV(IPredicate.Annotations.RELATION_NAME, relation)// + ); + + // ?x a ub:Student; + final IPredicate p1 = new SPOPredicate(new BOp[] { x, + new Constant(rdfType.getIV()), + new Constant(student.getIV()) },// + new NV(BOp.Annotations.BOP_ID, nextId++),// + new NV(IPredicate.Annotations.TIMESTAMP, timestamp),// + new NV(IPredicate.Annotations.RELATION_NAME, relation)// + ); + + // (?x) ub:memberOf ?y . + final IPredicate p2 = new SPOPredicate(new BOp[] { x, + new Constant(memberOf.getIV()), y },// + new NV(BOp.Annotations.BOP_ID, nextId++),// + new NV(IPredicate.Annotations.TIMESTAMP, timestamp),// + new NV(IPredicate.Annotations.RELATION_NAME, relation)// + ); + + // ?y ub:subOrganizationOf <http://www.University0.edu> . + final IPredicate p3 = new SPOPredicate(new BOp[] { y, + new Constant(subOrganizationOf.getIV()), + new Constant(university0.getIV()) },// + new NV(BOp.Annotations.BOP_ID, nextId++),// + new NV(IPredicate.Annotations.TIMESTAMP, timestamp),// + new NV(IPredicate.Annotations.RELATION_NAME, relation)// + ); + + // ?x ub:emailAddress ?z . + final IPredicate p4 = new SPOPredicate(new BOp[] { x, + new Constant(emailAddress.getIV()), z },// + new NV(BOp.Annotations.BOP_ID, nextId++),// + new NV(IPredicate.Annotations.TIMESTAMP, timestamp),// + new NV(IPredicate.Annotations.RELATION_NAME, relation)// + ); + + // the vertices of the join graph (the predicates). + preds = new IPredicate[] { p0, p1, p2, p3, p4 }; + } + + { + final int limit = 100; + + final QueryEngine queryEngine = QueryEngineFactory + .getQueryController(jnl/* indexManager */); + + final JGraph g = new JGraph(preds); + + g.runtimeOptimizer(queryEngine, limit); + + } + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tho...@us...> - 2011-01-05 13:45:29
|
Revision: 4052 http://bigdata.svn.sourceforge.net/bigdata/?rev=4052&view=rev Author: thompsonbry Date: 2011-01-05 13:45:21 +0000 (Wed, 05 Jan 2011) Log Message: ----------- Restored run against local U50 instance. Modified Paths: -------------- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/test/com/bigdata/bop/rdf/joinGraph/TestJoinGraphOnLubm.java Modified: branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/test/com/bigdata/bop/rdf/joinGraph/TestJoinGraphOnLubm.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/test/com/bigdata/bop/rdf/joinGraph/TestJoinGraphOnLubm.java 2011-01-05 13:44:51 UTC (rev 4051) +++ branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/test/com/bigdata/bop/rdf/joinGraph/TestJoinGraphOnLubm.java 2011-01-05 13:45:21 UTC (rev 4052) @@ -230,7 +230,7 @@ final Properties properties = getProperties(); final File file; - if (true) { + if (false) { /* * Use a persistent file that is generated once and then reused by * each test run. @@ -244,7 +244,7 @@ /* * Use a specific file generated by some external process. */ - final int nuniv = 1000; + final int nuniv = 50; file = new File("/data/lubm/U" + nuniv + "/bigdata-lubm.WORM.jnl"); namespace = "LUBM_U" + nuniv; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tho...@us...> - 2011-02-27 21:14:18
|
Revision: 4257 http://bigdata.svn.sourceforge.net/bigdata/?rev=4257&view=rev Author: thompsonbry Date: 2011-02-27 21:14:12 +0000 (Sun, 27 Feb 2011) Log Message: ----------- Missed on the last commit. Modified Paths: -------------- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/test/com/bigdata/bop/rdf/joinGraph/TestJoinGraphOnLubm.java Modified: branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/test/com/bigdata/bop/rdf/joinGraph/TestJoinGraphOnLubm.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/test/com/bigdata/bop/rdf/joinGraph/TestJoinGraphOnLubm.java 2011-02-27 21:14:03 UTC (rev 4256) +++ branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/test/com/bigdata/bop/rdf/joinGraph/TestJoinGraphOnLubm.java 2011-02-27 21:14:12 UTC (rev 4257) @@ -141,7 +141,7 @@ * large data set to assess the relative performance of the static and * runtime query optimizers). */ - static private final boolean useExistingJournal = false; + static private final boolean useExistingJournal = true; protected Journal getJournal(final Properties properties) throws Exception { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |