From: <tho...@us...> - 2010-10-13 14:18:54
|
Revision: 3786 http://bigdata.svn.sourceforge.net/bigdata/?rev=3786&view=rev Author: thompsonbry Date: 2010-10-13 14:18:44 +0000 (Wed, 13 Oct 2010) Log Message: ----------- Modified four tests which were relying on cnx.flush() before issuing a high level query. They now use cxn.commit(). Modified Paths: -------------- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestOptionals.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestPruneBindingSets.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestQuadsAPI.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestUnions.java Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestOptionals.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestOptionals.java 2010-10-13 14:11:24 UTC (rev 3785) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestOptionals.java 2010-10-13 14:18:44 UTC (rev 3786) @@ -161,7 +161,8 @@ * statement buffers to the database before executing any operations * that go around the sail. */ - cxn.flush();//commit(); +// cxn.flush();//commit(); + cxn.commit(); /**/ if (log.isInfoEnabled()) { @@ -221,6 +222,8 @@ cxn.add(vf.createURI("u:1"), vf.createURI("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"), vf.createURI("u:2")); + + cxn.commit(); String query = "SELECT REDUCED ?subj ?subj_class ?subj_label " + Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestPruneBindingSets.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestPruneBindingSets.java 2010-10-13 14:11:24 UTC (rev 3785) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestPruneBindingSets.java 2010-10-13 14:18:44 UTC (rev 3786) @@ -108,7 +108,8 @@ * statement buffers to the database before executing any operations * that go around the sail. */ - cxn.flush();//commit(); +// cxn.flush();//commit(); + cxn.commit(); /**/ if (log.isInfoEnabled()) { Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestQuadsAPI.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestQuadsAPI.java 2010-10-13 14:11:24 UTC (rev 3785) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestQuadsAPI.java 2010-10-13 14:18:44 UTC (rev 3786) @@ -242,7 +242,8 @@ * statement buffers to the database before executing any operations * that go around the sail. */ - cxn.flush();//commit(); +// cxn.flush();//commit(); + cxn.commit(); assertEquals(2, sail.database.getNamedGraphCount()); Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestUnions.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestUnions.java 2010-10-13 14:11:24 UTC (rev 3785) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestUnions.java 2010-10-13 14:18:44 UTC (rev 3786) @@ -154,7 +154,8 @@ * statement buffers to the database before executing any operations * that go around the sail. */ - cxn.flush();//commit(); +// cxn.flush();//commit(); + cxn.commit(); /**/ if (log.isInfoEnabled()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tho...@us...> - 2011-01-21 13:17:07
|
Revision: 4155 http://bigdata.svn.sourceforge.net/bigdata/?rev=4155&view=rev Author: thompsonbry Date: 2011-01-21 13:17:01 +0000 (Fri, 21 Jan 2011) Log Message: ----------- Bracketed the sail and connection setup with try/finally clauses and used the tear down method for the sail to ensure that the backing file is deleted by the unit test. Modified Paths: -------------- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestNamedGraphs.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestNestedOptionals.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestNestedUnions.java Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestNamedGraphs.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestNamedGraphs.java 2011-01-21 09:56:28 UTC (rev 4154) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestNamedGraphs.java 2011-01-21 13:17:01 UTC (rev 4155) @@ -151,13 +151,14 @@ log.info("testing: 8.2.1 Specifying the Default Graph"); final BigdataSail sail = getSail(); - sail.initialize(); - final BigdataSailRepository repo = new BigdataSailRepository(sail); - final BigdataSailRepositoryConnection cxn = - (BigdataSailRepositoryConnection) repo.getConnection(); - cxn.setAutoCommit(false); try { + sail.initialize(); + final BigdataSailRepository repo = new BigdataSailRepository(sail); + final BigdataSailRepositoryConnection cxn = + (BigdataSailRepositoryConnection) repo.getConnection(); + try { + cxn.setAutoCommit(false); final BNode a = new BNodeImpl("_:a"); final URI graph = new URIImpl("http://example.org/foaf/aliceFoaf"); @@ -197,8 +198,10 @@ compare(result, answer); + } finally { + cxn.close(); + } } finally { - cxn.close(); sail.__tearDownUnitTest(); } @@ -260,13 +263,14 @@ log.info("testing: 8.2.3 Combining FROM and FROM NAMED"); final BigdataSail sail = getSail(); + try { sail.initialize(); final BigdataSailRepository repo = new BigdataSailRepository(sail); final BigdataSailRepositoryConnection cxn = (BigdataSailRepositoryConnection) repo.getConnection(); - cxn.setAutoCommit(false); try { + cxn.setAutoCommit(false); final BNode a = new BNodeImpl("_:a"); final BNode b = new BNodeImpl("_:b"); @@ -350,6 +354,8 @@ } finally { cxn.close(); + } + } finally { sail.__tearDownUnitTest(); } @@ -418,14 +424,16 @@ log.info("testing: 8.3.1 Accessing Graph Names"); final BigdataSail sail = getSail(); + try { sail.initialize(); final BigdataSailRepository repo = new BigdataSailRepository(sail); final BigdataSailRepositoryConnection cxn = (BigdataSailRepositoryConnection) repo.getConnection(); - cxn.setAutoCommit(false); try { - + + cxn.setAutoCommit(false); + final BNode a = new BNodeImpl("_:a"); final BNode b = new BNodeImpl("_:b"); final BNode z = new BNodeImpl("_:b"); @@ -536,9 +544,11 @@ new BindingImpl("bobNick", new LiteralImpl("Robert")))); compare(result, answer); - + } finally { cxn.close(); + } + } finally { sail.__tearDownUnitTest(); } @@ -605,14 +615,15 @@ log.info("testing: 8.3.2 Restricting by Graph IRI"); final BigdataSail sail = getSail(); + try { sail.initialize(); final BigdataSailRepository repo = new BigdataSailRepository(sail); final BigdataSailRepositoryConnection cxn = (BigdataSailRepositoryConnection) repo.getConnection(); + try { + cxn.setAutoCommit(false); - try { - final BNode a = new BNodeImpl("_:a"); final BNode b = new BNodeImpl("_:b"); final BNode z = new BNodeImpl("_:b"); @@ -719,9 +730,10 @@ new BindingImpl("nick", new LiteralImpl("Robert")))); compare(result, answer); - } finally { cxn.close(); + } + } finally { sail.__tearDownUnitTest(); } @@ -810,14 +822,15 @@ log.info("testing: 8.3.3 Restricting Possible Graph IRIs"); final BigdataSail sail = getSail(); + try { sail.initialize(); final BigdataSailRepository repo = new BigdataSailRepository(sail); final BigdataSailRepositoryConnection cxn = (BigdataSailRepositoryConnection) repo.getConnection(); + try { + cxn.setAutoCommit(false); - try { - final BNode a = new BNodeImpl("_:a"); final BNode b = new BNodeImpl("_:b"); final BNode z = new BNodeImpl("_:b"); @@ -940,6 +953,9 @@ } finally { cxn.close(); + + } + } finally { sail.__tearDownUnitTest(); } @@ -959,14 +975,15 @@ SailException, QueryEvaluationException, MalformedQueryException { final BigdataSail sail = getSail(); + try { sail.initialize(); final BigdataSailRepository repo = new BigdataSailRepository(sail); final BigdataSailRepositoryConnection cxn = (BigdataSailRepositoryConnection) repo.getConnection(); + try { + cxn.setAutoCommit(false); - try { - if(!sail.getDatabase().isQuads()) { log.warn("test requires quads."); @@ -1192,6 +1209,10 @@ } finally { cxn.close(); + + } + } finally { + sail.__tearDownUnitTest(); } @@ -1212,14 +1233,15 @@ SailException, QueryEvaluationException, MalformedQueryException { final BigdataSail sail = getSail(); + try { sail.initialize(); final BigdataSailRepository repo = new BigdataSailRepository(sail); final BigdataSailRepositoryConnection cxn = (BigdataSailRepositoryConnection) repo .getConnection(); + try { + cxn.setAutoCommit(false); - try { - if (!sail.getDatabase().isQuads()) { log.warn("test requires quads."); @@ -1559,8 +1581,10 @@ } } finally { + cxn.close(); + } + } finally { - cxn.close(); sail.__tearDownUnitTest(); } @@ -1570,14 +1594,15 @@ public void testSearchQuery() throws Exception { final BigdataSail sail = getSail(); + try { sail.initialize(); final BigdataSailRepository repo = new BigdataSailRepository(sail); final BigdataSailRepositoryConnection cxn = (BigdataSailRepositoryConnection) repo .getConnection(); + try { + cxn.setAutoCommit(false); - try { - if (!sail.getDatabase().isQuads()) { log.warn("test requires quads."); @@ -1669,8 +1694,12 @@ } } finally { + + cxn.close(); - cxn.close(); + } + } finally { + sail.__tearDownUnitTest(); } Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestNestedOptionals.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestNestedOptionals.java 2011-01-21 09:56:28 UTC (rev 4154) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestNestedOptionals.java 2011-01-21 13:17:01 UTC (rev 4155) @@ -130,14 +130,16 @@ // final Repository repo = new SailRepository(sail); final BigdataSail sail = getSail(); + try { sail.initialize(); final BigdataSailRepository repo = new BigdataSailRepository(sail); final RepositoryConnection cxn = repo.getConnection(); - cxn.setAutoCommit(false); try { - + + cxn.setAutoCommit(false); + final ValueFactory vf = sail.getValueFactory(); /* @@ -261,7 +263,8 @@ } finally { cxn.close(); - sail.shutDown(); + }} finally { + sail.__tearDownUnitTest(); } } @@ -273,13 +276,14 @@ // final Repository repo = new SailRepository(sail); final BigdataSail sail = getSail(); + try { sail.initialize(); final BigdataSailRepository repo = new BigdataSailRepository(sail); final RepositoryConnection cxn = repo.getConnection(); - cxn.setAutoCommit(false); try { + cxn.setAutoCommit(false); final ValueFactory vf = sail.getValueFactory(); @@ -391,9 +395,11 @@ } - } finally { - cxn.close(); - sail.shutDown(); + } finally { + cxn.close(); + } + } finally { + sail.__tearDownUnitTest(); } } @@ -405,13 +411,14 @@ // final Repository repo = new SailRepository(sail); final BigdataSail sail = getSail(); + try { sail.initialize(); final BigdataSailRepository repo = new BigdataSailRepository(sail); final RepositoryConnection cxn = repo.getConnection(); - cxn.setAutoCommit(false); try { + cxn.setAutoCommit(false); final ValueFactory vf = sail.getValueFactory(); @@ -528,22 +535,25 @@ } } finally { - cxn.close(); - sail.shutDown(); + cxn.close(); } + } finally { + sail.__tearDownUnitTest(); + } } private void __testNestedOptionals1() throws Exception { final BigdataSail sail = getSail(); + try { sail.initialize(); final BigdataSailRepository repo = new BigdataSailRepository(sail); final BigdataSailRepositoryConnection cxn = (BigdataSailRepositoryConnection) repo.getConnection(); - cxn.setAutoCommit(false); try { + cxn.setAutoCommit(false); final ValueFactory vf = sail.getValueFactory(); @@ -634,6 +644,8 @@ } finally { cxn.close(); + } + } finally { sail.__tearDownUnitTest(); } @@ -642,13 +654,14 @@ private void _testNestedOptionals2() throws Exception { final BigdataSail sail = getSail(); + try { sail.initialize(); final BigdataSailRepository repo = new BigdataSailRepository(sail); final BigdataSailRepositoryConnection cxn = (BigdataSailRepositoryConnection) repo.getConnection(); - cxn.setAutoCommit(false); try { + cxn.setAutoCommit(false); final ValueFactory vf = sail.getValueFactory(); @@ -811,9 +824,11 @@ // final TupleQueryResult result = tupleQuery.evaluate(); // compare(result, answer); - + } finally { cxn.close(); + } + } finally { sail.__tearDownUnitTest(); } Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestNestedUnions.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestNestedUnions.java 2011-01-21 09:56:28 UTC (rev 4154) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestNestedUnions.java 2011-01-21 13:17:01 UTC (rev 4155) @@ -130,13 +130,14 @@ // final Repository repo = new SailRepository(sail); final BigdataSail sail = getSail(); + try { sail.initialize(); final BigdataSailRepository repo = new BigdataSailRepository(sail); final RepositoryConnection cxn = repo.getConnection(); - cxn.setAutoCommit(false); try { + cxn.setAutoCommit(false); final ValueFactory vf = sail.getValueFactory(); @@ -221,8 +222,10 @@ } finally { cxn.close(); - sail.shutDown(); } + } finally { + sail.__tearDownUnitTest();//shutDown(); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mrp...@us...> - 2011-02-08 17:42:25
|
Revision: 4183 http://bigdata.svn.sourceforge.net/bigdata/?rev=4183&view=rev Author: mrpersonick Date: 2011-02-08 17:42:19 +0000 (Tue, 08 Feb 2011) Log Message: ----------- fixed some free text search tests Modified Paths: -------------- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailEvaluationStrategyImpl.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestNamedGraphs.java Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailEvaluationStrategyImpl.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailEvaluationStrategyImpl.java 2011-02-08 14:57:32 UTC (rev 4182) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailEvaluationStrategyImpl.java 2011-02-08 17:42:19 UTC (rev 4183) @@ -711,7 +711,7 @@ "where { " + " ?s <"+RDF.TYPE+"> <"+person+"> . " + // [160, 8, 164], [156, 8, 164] " ?s <"+RDFS.LABEL+"> ?label . " + // [160, 148, 174], [156, 148, 170] - " ?label <"+search+"> \"Mi\" . " + // [174, 0, 0] + " ?label <"+search+"> \"Mi*\" . " + // [174, 0, 0] "}"; { // evalute it once so i can see it Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestNamedGraphs.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestNamedGraphs.java 2011-02-08 14:57:32 UTC (rev 4182) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestNamedGraphs.java 2011-02-08 17:42:19 UTC (rev 4183) @@ -1636,7 +1636,7 @@ final String query = "select ?x ?y " + "where { " + - " ?y <"+ BD.SEARCH+"> \"Chris\" . " + + " ?y <"+ BD.SEARCH+"> \"Chris*\" . " + " ?x <"+ RDFS.LABEL.stringValue() + "> ?y . " + "}"; @@ -1669,7 +1669,7 @@ "select ?x ?y " + "where { " + " graph <http://example.org> { " + - " ?y <"+ BD.SEARCH+"> \"Chris\" . " + + " ?y <"+ BD.SEARCH+"> \"Chris*\" . " + " ?x <"+ RDFS.LABEL.stringValue() + "> ?y ." + " } . " + "}"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mrp...@us...> - 2011-02-21 17:48:56
|
Revision: 4216 http://bigdata.svn.sourceforge.net/bigdata/?rev=4216&view=rev Author: mrpersonick Date: 2011-02-21 17:48:49 +0000 (Mon, 21 Feb 2011) Log Message: ----------- created a test case template for user-submitted bugs Added Paths: ----------- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestTemplate.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/data.ttl Added: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestTemplate.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestTemplate.java (rev 0) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestTemplate.java 2011-02-21 17:48:49 UTC (rev 4216) @@ -0,0 +1,258 @@ +/** +Copyright (C) SYSTAP, LLC 2011. All rights reserved. + +Contact: + SYSTAP, LLC + 4501 Tower Road + Greensboro, NC 27410 + lic...@bi... + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package com.bigdata.rdf.sail; + +import java.util.Collection; +import java.util.LinkedList; +import java.util.Properties; + +import org.apache.log4j.Logger; +import org.openrdf.model.vocabulary.RDF; +import org.openrdf.model.vocabulary.RDFS; +import org.openrdf.query.BindingSet; +import org.openrdf.query.QueryLanguage; +import org.openrdf.query.TupleQueryResult; +import org.openrdf.repository.Repository; +import org.openrdf.repository.RepositoryConnection; +import org.openrdf.repository.sail.SailRepository; +import org.openrdf.repository.sail.SailTupleQuery; +import org.openrdf.rio.RDFFormat; +import org.openrdf.sail.Sail; +import org.openrdf.sail.memory.MemoryStore; + +import com.bigdata.rdf.axioms.NoAxioms; +import com.bigdata.rdf.store.BD; +import com.bigdata.rdf.vocab.NoVocabulary; + +/** + * Unit test template for use in submission of bugs. + * <p> + * This test case will delegate to an underlying backing store. You can + * specify this store via a JVM property as follows: + * <code>-DtestClass=com.bigdata.rdf.sail.TestBigdataSailWithQuads</code> + * <p> + * There are three possible configurations for the testClass: + * <ul> + * <li>com.bigdata.rdf.sail.TestBigdataSailWithQuads (quads mode)</li> + * <li>com.bigdata.rdf.sail.TestBigdataSailWithoutSids (triples mode)</li> + * <li>com.bigdata.rdf.sail.TestBigdataSailWithSids (SIDs mode)</li> + * </ul> + * <p> + * The default for triples and SIDs mode is for inference with truth maintenance + * to be on. If you would like to turn off inference, make sure to do so in + * {@link #getProperties()}. + * + * @author <a href="mailto:mrp...@us...">Mike Personick</a> + * @version $Id$ + */ +public class TestTemplate extends QuadsTestCase { + + protected static final Logger log = Logger.getLogger(TestTemplate.class); + + /** + * Please set your database properties here, except for your journal file, + * please DO NOT SPECIFY A JOURNAL FILE. + */ + @Override + public Properties getProperties() { + + Properties props = super.getProperties(); + + /* + * For example, here is a set of five properties that turns off + * inference, truth maintenance, and the free text index. + */ + props.setProperty(BigdataSail.Options.AXIOMS_CLASS, NoAxioms.class.getName()); + props.setProperty(BigdataSail.Options.VOCABULARY_CLASS, NoVocabulary.class.getName()); + props.setProperty(BigdataSail.Options.TRUTH_MAINTENANCE, "false"); + props.setProperty(BigdataSail.Options.JUSTIFY, "false"); + props.setProperty(BigdataSail.Options.TEXT_INDEX, "false"); + + return props; + + } + + public TestTemplate() { + } + + public TestTemplate(String arg0) { + super(arg0); + } + + public void testBug() throws Exception { + + /* + * We use an in-memory Sesame store as our point of reference. This + * will supply the "correct" answer to the query (below). + */ + final Sail sesameSail = new MemoryStore(); + + /* + * The bigdata store, backed by a temporary journal file. + */ + final BigdataSail bigdataSail = getSail(); + + /* + * Data file containing the data demonstrating your bug. + */ + final String data = "data.ttl"; + final String baseURI = ""; + final RDFFormat format = RDFFormat.TURTLE; + + /* + * Query(ies) demonstrating your bug. + */ + final String query = + "prefix bd: <"+BD.NAMESPACE+"> " + + "prefix rdf: <"+RDF.NAMESPACE+"> " + + "prefix rdfs: <"+RDFS.NAMESPACE+"> " + + + "SELECT DISTINCT ?neType ?majorType ?minorType " + + "WHERE { " + + " { " + + " ?neType <http://www.w3.org/2000/01/rdf-schema#subClassOf> <http://example/class/NamedEntity> . " + + " FILTER(?neType != <http://example/class/NamedEntity>) " + + " } " + + " UNION " + + " { ?lookup <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example/class/Lookup> . " + + " ?lookup <http://example/prop/lookup/majorType> ?majorType . " + + " OPTIONAL { ?lookup <http://example/prop/lookup/minorType> ?minorType } " + + " } " + + "}"; + + try { + + sesameSail.initialize(); + bigdataSail.initialize(); + + final Repository sesameRepo = new SailRepository(sesameSail); + final BigdataSailRepository bigdataRepo = new BigdataSailRepository(bigdataSail); + + { // load the data into the Sesame store + + final RepositoryConnection cxn = sesameRepo.getConnection(); + try { + cxn.setAutoCommit(false); + cxn.add(getClass().getResourceAsStream(data), baseURI, format); + cxn.commit(); + } finally { + cxn.close(); + } + + } + + { // load the data into the bigdata store + + final RepositoryConnection cxn = bigdataRepo.getConnection(); + try { + cxn.setAutoCommit(false); + cxn.add(getClass().getResourceAsStream(data), baseURI, format); + cxn.commit(); + } finally { + cxn.close(); + } + + } + + final Collection<BindingSet> answer = new LinkedList<BindingSet>(); + + /* + * Here is how you manually build the answer set, but please make + * sure you answer truly is correct if you choose to do it this way. + +// answer.add(createBindingSet( +// new BindingImpl("neType", vf.createURI("http://example/class/Location")) +// )); +// answer.add(createBindingSet( +// new BindingImpl("neType", vf.createURI("http://example/class/Person")) +// )); + + */ + + /* + * Run the problem query using the Sesame store to gather the + * correct results. + */ + { + final RepositoryConnection cxn = sesameRepo.getConnection(); + try { + final SailTupleQuery tupleQuery = (SailTupleQuery) + cxn.prepareTupleQuery(QueryLanguage.SPARQL, query); + tupleQuery.setIncludeInferred(false /* includeInferred */); + final TupleQueryResult result = tupleQuery.evaluate(); + + if (log.isInfoEnabled()) { + log.info("sesame results:"); + if (!result.hasNext()) { + log.info("no results."); + } + } + + while (result.hasNext()) { + final BindingSet bs = result.next(); + answer.add(bs); + if (log.isInfoEnabled()) + log.info(bs); + } + } finally { + cxn.close(); + } + } + + /* + * Run the problem query using the bigdata store and then compare + * the answer. + */ + final RepositoryConnection cxn = bigdataRepo.getReadOnlyConnection(); + try { + final SailTupleQuery tupleQuery = (SailTupleQuery) + cxn.prepareTupleQuery(QueryLanguage.SPARQL, query); + tupleQuery.setIncludeInferred(false /* includeInferred */); + + if (log.isInfoEnabled()) { + final TupleQueryResult result = tupleQuery.evaluate(); + log.info("bigdata results:"); + if (!result.hasNext()) { + log.info("no results."); + } + while (result.hasNext()) { + log.info(result.next()); + } + } + + final TupleQueryResult result = tupleQuery.evaluate(); + compare(result, answer); + + } finally { + cxn.close(); + } + + } finally { + bigdataSail.__tearDownUnitTest(); + sesameSail.shutDown(); + } + + } + +} Added: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/data.ttl =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/data.ttl (rev 0) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/data.ttl 2011-02-21 17:48:49 UTC (rev 4216) @@ -0,0 +1,21 @@ +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . + +<http://example/class/Location> rdfs:subClassOf <http://example/class/NamedEntity> . +<http://example/class/Location> rdfs:label "Location" . +<http://example/class/NamedEntity> rdfs:label "NamedEntity" . +<http://example/elem/loc/loc1> rdfs:label "label: Amsterdam" . +<http://example/elem/loc/loc1> rdf:type <http://example/class/Location> . +<http://example/elem/loc/loc1> <http://example/prop/lookupName> "amsterdam" . +<http://example/elem/loc/loc2> rdfs:label "label: Den Haag" . +<http://example/elem/loc/loc2> rdf:type <http://example/class/Location> . +<http://example/elem/loc/loc2> <http://example/prop/lookupName> "den haag" . +<http://example/elem/loc/loc3> rdfs:label "label: IJmuiden" . +<http://example/elem/loc/loc3> rdf:type <http://example/class/Location> . +<http://example/elem/loc/loc3> <http://example/prop/lookupName> "ijmuiden" . +<http://example/elem/loc/loc3> <http://example/prop/disabled> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> . +<http://example/class/Person> rdfs:subClassOf <http://example/class/NamedEntity> . +<http://example/class/Person> rdfs:label "Person" . +<http://example/elem/person/puk> rdfs:label "label: Puk van de Petteflet" . +<http://example/elem/person/puk> rdf:type <http://example/class/Person> . +<http://example/elem/person/puk> <http://example/prop/lookupName> "puk van de petteflet" . This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mrp...@us...> - 2011-02-22 21:13:21
|
Revision: 4226 http://bigdata.svn.sourceforge.net/bigdata/?rev=4226&view=rev Author: mrpersonick Date: 2011-02-22 21:13:14 +0000 (Tue, 22 Feb 2011) Log Message: ----------- added the inlining values test to the suite, and got rid of the no-inline tests entirely Modified Paths: -------------- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestAll.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithQuads.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithSids.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithoutSids.java Removed Paths: ------------- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithQuadsWithoutInlining.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithSidsWithoutInlining.java Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestAll.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestAll.java 2011-02-22 20:57:55 UTC (rev 4225) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestAll.java 2011-02-22 21:13:14 UTC (rev 4226) @@ -86,18 +86,12 @@ // run the test suite with statement identifiers enabled. suite.addTest(TestBigdataSailWithSids.suite()); - suite.addTest(TestBigdataSailWithSidsWithoutInlining.suite()); // run the test suite without statement identifiers enabled. suite.addTest(TestBigdataSailWithoutSids.suite()); - // nestedSubquery is deprecated. -// // quad store test suite w/ nested subquery joins. -// suite.addTest(TestBigdataSailWithQuads.suite()); - // quad store test suite w/ pipeline joins. suite.addTest(TestBigdataSailWithQuads.suite()); - suite.addTest(TestBigdataSailWithQuadsWithoutInlining.suite()); // quad store in scale-out. suite.addTest(TestBigdataSailEmbeddedFederationWithQuads.suite()); Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithQuads.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithQuads.java 2011-02-22 20:57:55 UTC (rev 4225) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithQuads.java 2011-02-22 21:13:14 UTC (rev 4226) @@ -103,6 +103,8 @@ suite.addTestSuite(TestMultiGraphs.class); + suite.addTestSuite(TestInlineValues.class); + // The Sesame TCK, including the SPARQL test suite. { Deleted: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithQuadsWithoutInlining.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithQuadsWithoutInlining.java 2011-02-22 20:57:55 UTC (rev 4225) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithQuadsWithoutInlining.java 2011-02-22 21:13:14 UTC (rev 4226) @@ -1,188 +0,0 @@ -/** -Copyright (C) SYSTAP, LLC 2006-2007. All rights reserved. - -Contact: - SYSTAP, LLC - 4501 Tower Road - Greensboro, NC 27410 - lic...@bi... - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -/* - * Created on Sep 4, 2008 - */ - -package com.bigdata.rdf.sail; - -import java.util.Properties; - -import junit.extensions.proxy.ProxyTestSuite; -import junit.framework.Test; -import junit.framework.TestSuite; - -import com.bigdata.rdf.axioms.NoAxioms; -import com.bigdata.rdf.sail.BigdataSail.Options; -import com.bigdata.rdf.sail.tck.BigdataConnectionTest; -import com.bigdata.rdf.sail.tck.BigdataSparqlTest; -import com.bigdata.rdf.sail.tck.BigdataStoreTest; -import com.bigdata.relation.AbstractResource; - -/** - * Test suite for the {@link BigdataSail} with quads enabled. The provenance - * mode is disabled. Inference is disabled. This version of the test suite uses - * the pipeline join algorithm. - * - * @author <a href="mailto:tho...@us...">Bryan Thompson</a> - * @version $Id$ - */ -public class TestBigdataSailWithQuadsWithoutInlining extends AbstractBigdataSailTestCase { - - /** - * - */ - public TestBigdataSailWithQuadsWithoutInlining() { - } - - public TestBigdataSailWithQuadsWithoutInlining(String name) { - super(name); - } - - public static Test suite() { - - final TestBigdataSailWithQuadsWithoutInlining delegate = new TestBigdataSailWithQuadsWithoutInlining(); // !!!! THIS CLASS !!!! - - /* - * Use a proxy test suite and specify the delegate. - */ - - final ProxyTestSuite suite = new ProxyTestSuite(delegate, "SAIL with Quads (pipeline joins, no inlining)"); - - // test pruning of variables not required for downstream processing. - suite.addTestSuite(TestPruneBindingSets.class); - - // misc named graph API stuff. - suite.addTestSuite(TestQuadsAPI.class); - - // SPARQL named graphs tests. - suite.addTestSuite(TestNamedGraphs.class); - - // test suite for optionals handling (left joins). - suite.addTestSuite(TestOptionals.class); - - suite.addTestSuite(TestNestedOptionals.class); - - suite.addTestSuite(TestNestedUnions.class); - - // test of the search magic predicate - suite.addTestSuite(TestSearchQuery.class); - - // high-level query tests. - suite.addTestSuite(TestQuery.class); - - // test of high-level query on a graph with statements about statements. - suite.addTestSuite(TestProvenanceQuery.class); - - // unit tests for custom evaluation of high-level query - suite.addTestSuite(TestBigdataSailEvaluationStrategyImpl.class); - - suite.addTestSuite(TestUnions.class); - - suite.addTestSuite(TestDescribe.class); - - // The Sesame TCK, including the SPARQL test suite. - { - - final TestSuite tckSuite = new TestSuite("Sesame 2.x TCK"); - - tckSuite.addTestSuite(BigdataStoreTest.LTSWithPipelineJoins.class); - - tckSuite.addTestSuite(BigdataConnectionTest.LTSWithPipelineJoins.class); - - try { - - /* - * suite() will call suiteLTSWithPipelineJoins() and then - * filter out the dataset tests, which we don't need right now - */ -// tckSuite.addTest(BigdataSparqlTest.suiteLTSWithPipelineJoins()); - tckSuite.addTest(BigdataSparqlTest.suite()); - - } catch (Exception ex) { - - throw new RuntimeException(ex); - - } - - suite.addTest(tckSuite); - - } - - return suite; - - } - - @Override - protected BigdataSail getSail(final Properties properties) { - - return new BigdataSail(properties); - - } - - public Properties getProperties() { - - final Properties properties = new Properties(super.getProperties()); -/* - properties.setProperty(Options.STATEMENT_IDENTIFIERS, "false"); - - properties.setProperty(Options.QUADS, "true"); - - properties.setProperty(Options.AXIOMS_CLASS, NoAxioms.class.getName()); -*/ - properties.setProperty(Options.QUADS_MODE, "true"); - - properties.setProperty(Options.TRUTH_MAINTENANCE, "false"); - -// properties.setProperty(AbstractResource.Options.NESTED_SUBQUERY, "false"); - - properties.setProperty(Options.INLINE_LITERALS, "false"); - - return properties; - - } - - @Override - protected BigdataSail reopenSail(BigdataSail sail) { - - final Properties properties = sail.database.getProperties(); - - if (sail.isOpen()) { - - try { - - sail.shutDown(); - - } catch (Exception ex) { - - throw new RuntimeException(ex); - - } - - } - - return getSail(properties); - - } - -} Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithSids.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithSids.java 2011-02-22 20:57:55 UTC (rev 4225) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithSids.java 2011-02-22 21:13:14 UTC (rev 4226) @@ -83,6 +83,8 @@ suite.addTestSuite(TestDescribe.class); + suite.addTestSuite(TestInlineValues.class); + return suite; } Deleted: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithSidsWithoutInlining.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithSidsWithoutInlining.java 2011-02-22 20:57:55 UTC (rev 4225) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithSidsWithoutInlining.java 2011-02-22 21:13:14 UTC (rev 4226) @@ -1,136 +0,0 @@ -/** -Copyright (C) SYSTAP, LLC 2006-2007. All rights reserved. - -Contact: - SYSTAP, LLC - 4501 Tower Road - Greensboro, NC 27410 - lic...@bi... - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -/* - * Created on Sep 4, 2008 - */ - -package com.bigdata.rdf.sail; - -import java.util.Properties; - -import junit.extensions.proxy.ProxyTestSuite; -import junit.framework.Test; - -import com.bigdata.rdf.sail.BigdataSail.Options; - -/** - * Test suite for the {@link BigdataSail} with statement identifiers enabled. - * - * @author <a href="mailto:tho...@us...">Bryan Thompson</a> - * @version $Id$ - */ -public class TestBigdataSailWithSidsWithoutInlining extends AbstractBigdataSailTestCase { - - /** - * - */ - public TestBigdataSailWithSidsWithoutInlining() { - } - - public TestBigdataSailWithSidsWithoutInlining(String name) { - super(name); - } - - public static Test suite() { - - final TestBigdataSailWithSidsWithoutInlining delegate = new TestBigdataSailWithSidsWithoutInlining(); // !!!! THIS CLASS !!!! - - /* - * Use a proxy test suite and specify the delegate. - */ - - final ProxyTestSuite suite = new ProxyTestSuite(delegate, "SAIL with Triples (with SIDs, no inlining)"); - - // test pruning of variables not required for downstream processing. - suite.addTestSuite(TestPruneBindingSets.class); - - // test of the search magic predicate - suite.addTestSuite(TestSearchQuery.class); - - // high-level query tests. - suite.addTestSuite(TestQuery.class); - - // test of high-level query on a graph with statements about statements. - suite.addTestSuite(TestProvenanceQuery.class); - - suite.addTestSuite(TestBigdataSailEvaluationStrategyImpl.class); - - suite.addTestSuite(TestReadWriteTransactions.class); - - suite.addTestSuite(TestOrderBy.class); - - suite.addTestSuite(TestUnions.class); - - suite.addTestSuite(TestDescribe.class); - - return suite; - - } - - @Override - protected BigdataSail getSail(Properties properties) { - - return new BigdataSail(properties); - - } - - public Properties getProperties() { - - final Properties properties = new Properties(super.getProperties()); -/* - properties.setProperty(Options.STATEMENT_IDENTIFIERS, "true"); - - properties.setProperty(Options.QUADS, "false"); -*/ - properties.setProperty(Options.TRIPLES_MODE_WITH_PROVENANCE, "true"); - - properties.setProperty(Options.INLINE_LITERALS, "false"); - - return properties; - - } - - @Override - protected BigdataSail reopenSail(BigdataSail sail) { - - final Properties properties = sail.database.getProperties(); - - if (sail.isOpen()) { - - try { - - sail.shutDown(); - - } catch (Exception ex) { - - throw new RuntimeException(ex); - - } - - } - - return getSail(properties); - - } - -} Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithoutSids.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithoutSids.java 2011-02-22 20:57:55 UTC (rev 4225) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithoutSids.java 2011-02-22 21:13:14 UTC (rev 4226) @@ -79,6 +79,8 @@ suite.addTestSuite(TestDescribe.class); + suite.addTestSuite(TestInlineValues.class); + return suite; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2011-03-30 18:57:10
|
Revision: 4353 http://bigdata.svn.sourceforge.net/bigdata/?rev=4353&view=rev Author: martyncutcher Date: 2011-03-30 18:57:03 +0000 (Wed, 30 Mar 2011) Log Message: ----------- JettySparqlServer unit tests Added Paths: ----------- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/TestJettySparqlServer_StartStop.java Added: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/TestJettySparqlServer_StartStop.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/TestJettySparqlServer_StartStop.java (rev 0) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/TestJettySparqlServer_StartStop.java 2011-03-30 18:57:03 UTC (rev 4353) @@ -0,0 +1,869 @@ +package com.bigdata.rdf.sail.webapp; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.Reader; +import java.io.Writer; +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.URLEncoder; +import java.util.List; +import java.util.Properties; +import java.util.concurrent.atomic.AtomicLong; + +import junit.framework.TestCase2; + +import org.openrdf.model.Graph; +import org.openrdf.model.Literal; +import org.openrdf.model.Statement; +import org.openrdf.model.URI; +import org.openrdf.model.impl.GraphImpl; +import org.openrdf.model.impl.LiteralImpl; +import org.openrdf.model.impl.StatementImpl; +import org.openrdf.model.impl.URIImpl; +import org.openrdf.model.impl.ValueFactoryImpl; +import org.openrdf.model.vocabulary.RDF; +import org.openrdf.model.vocabulary.RDFS; +import org.openrdf.query.BindingSet; +import org.openrdf.query.TupleQueryResultHandlerBase; +import org.openrdf.query.resultio.TupleQueryResultParser; +import org.openrdf.query.resultio.sparqlxml.SPARQLResultsXMLParserFactory; +import org.openrdf.rio.RDFFormat; +import org.openrdf.rio.RDFParser; +import org.openrdf.rio.helpers.StatementCollector; +import org.openrdf.rio.rdfxml.RDFXMLParser; + +import com.bigdata.journal.BufferMode; +import com.bigdata.journal.ITx; +import com.bigdata.journal.Journal; +import com.bigdata.rawstore.Bytes; +import com.bigdata.rdf.axioms.NoAxioms; +import com.bigdata.rdf.sail.BigdataSail; +import com.bigdata.rdf.sail.BigdataSailRepository; +import com.bigdata.rdf.sail.BigdataSailRepositoryConnection; +import com.bigdata.rdf.sail.webapp.BigdataContext.Config; +import com.bigdata.rdf.store.AbstractTripleStore; +import com.bigdata.rdf.store.BD; +import com.bigdata.rdf.store.LocalTripleStore; +import com.bigdata.rdf.vocab.NoVocabulary; +import com.bigdata.util.config.NicUtil; + +public class TestJettySparqlServer_StartStop extends TestCase2 { + + private Journal m_jnl; + private JettySparqlServer m_fixture; + private String m_serviceURL; + + protected void setUp() throws Exception { + + final Properties properties = getProperties(); + + final String namespace = getName(); + + // log.info("Creating journal"); + + m_jnl = new Journal(properties); + + // log.info("Creating kb"); + + // Create the kb instance. + new LocalTripleStore(m_jnl, namespace, ITx.UNISOLATED, properties).create(); + + final Config config = new Config(); + + config.namespace = namespace; + config.port = 0; // any open port. + /* + * Service will not hold a read lock. + * + * Queries will read from the last commit point by default and will use + * a read-only tx to have snapshot isolation for that query. + */ + config.timestamp = ITx.READ_COMMITTED; + + // log.info("Starting server"); + + // Start server for that kb instance. + m_fixture = new JettySparqlServer(config.port); + m_fixture.startup(config, m_jnl); + + // log.info("Server running"); + + assertTrue("open", m_fixture.isOpen()); + + final int port = m_fixture.getPort(); + + // log.info("Getting host address"); + + final String hostAddr = NicUtil.getIpAddress("default.nic", "default", true/* loopbackOk */); + + if (hostAddr == null) { + + fail("Could not identify network address for this host."); + + } + + m_serviceURL = new URL("http", hostAddr, port, ""/* file */).toExternalForm(); + + // log.info("Setup done: "+serviceURL); + + } + + /** + * Returns a view of the triple store using the sail interface. + */ + protected BigdataSail getSail() { + + final String namespace = getName(); + + final AbstractTripleStore tripleStore = (AbstractTripleStore) m_jnl.getResourceLocator().locate(namespace, + ITx.UNISOLATED); + + return new BigdataSail(tripleStore); + + } + + @Override + protected void tearDown() throws Exception { + + if (m_fixture != null) { + + m_fixture.shutdownNow(); + + m_fixture = null; + + } + + if (m_jnl != null) { + + m_jnl.destroy(); + + m_jnl = null; + + } + + m_serviceURL = null; + + // log.info("tear down done"); + + } + + public Properties getProperties() { + final Properties properties = new Properties(); + + properties.setProperty(com.bigdata.journal.Options.BUFFER_MODE, BufferMode.Transient.toString()); + + properties.setProperty(com.bigdata.journal.Options.INITIAL_EXTENT, "" + (Bytes.megabyte32 * 1)); + + // if(false/*quads*/) { + // properties.setProperty(AbstractTripleStore.Options.QUADS_MODE, + // "true"); + // properties.setProperty(BigdataSail.Options.TRUTH_MAINTENANCE,"false"); + // properties.setProperty(AbstractTripleStore.Options.AXIOMS_CLASS, + // NoAxioms.class.getName()); + // properties.setProperty(AbstractTripleStore.Options.VOCABULARY_CLASS, + // NoVocabulary.class.getName()); + // properties.setProperty(AbstractTripleStore.Options.STATEMENT_IDENTIFIERS, + // "false"); + // } + // if (true/* told triples */) { + properties.setProperty(BigdataSail.Options.TRUTH_MAINTENANCE, "false"); + properties.setProperty(AbstractTripleStore.Options.AXIOMS_CLASS, NoAxioms.class.getName()); + properties.setProperty(AbstractTripleStore.Options.VOCABULARY_CLASS, NoVocabulary.class.getName()); + properties.setProperty(AbstractTripleStore.Options.STATEMENT_IDENTIFIERS, "false"); + // } + // if (false/* triples w/ truth maintenance */) { + // properties.setProperty(AbstractTripleStore.Options.STATEMENT_IDENTIFIERS, + // "false"); + // } + // if (false/* sids w/ truth maintenance */) { + // properties.setProperty(AbstractTripleStore.Options.STATEMENT_IDENTIFIERS, + // "true"); + // } + + return properties; + } + + public void test_startup() throws Exception { + assertTrue("open", m_fixture.isOpen()); + } + + public void testXMLBuilder() throws IOException { + XMLBuilder xml = new XMLBuilder(); + + XMLBuilder.Node close = xml.root("data") + .attr("id", "TheRoot") + .attr("name", "Test") + .node("child", "My Child") + .node("child") + .attr("name", "My Child") + .close() + .node("child") + .attr("name", "My Child") + .text("Content") + .close() + .close(); + + assertTrue(close == null); + + System.out.println(xml.toString()); + } + + /** + * Options for the query. + */ + private static class QueryOptions { + + /** The default timeout (ms). */ + private static final int DEFAULT_TIMEOUT = 2000; + + /** The URL of the SPARQL endpoint. */ + public String serviceURL = null; + // public String username = null; + // public String password = null; + /** The HTTP method (GET, POST, etc). */ + public String method = "GET"; + /** The SPARQL query. */ + public String queryStr = null; + /** The default graph URI (optional). */ + public String defaultGraphUri = null; + + /** The connection timeout (ms) -or- ZERO (0) for an infinate timeout. */ + // public int timeout = DEFAULT_TIMEOUT; + public int timeout = 0; + // public boolean showQuery = false; + + } + + protected HttpURLConnection doConnect(final String urlString, final String method) throws Exception { + final URL url = new URL(urlString); + HttpURLConnection conn = (HttpURLConnection) url.openConnection(); + + conn.setRequestMethod(method); + conn.setDoOutput(true); + conn.setUseCaches(false); + + return conn; + } + + /** + * Connect to a SPARQL end point (GET or POST query only). + * + * @param opts + * The query request. + * + * @return The connection. + */ + protected HttpURLConnection doSparqlQuery(final QueryOptions opts, final String servlet) throws Exception { + + // Fully formed and encoded URL @todo use */* for ASK. + final String urlString = opts.serviceURL + + "/" + servlet + "?query=" + + URLEncoder.encode(opts.queryStr, "UTF-8") + + (opts.defaultGraphUri == null ? "" : ("&default-graph-uri=" + URLEncoder.encode(opts.defaultGraphUri, + "UTF-8"))); + + HttpURLConnection conn = null; + try { + conn = doConnect(urlString, opts.method); + + conn.setReadTimeout(opts.timeout); + + /* + * Set an appropriate Accept header for the query. + * + * @todo ASK queries have boolean data, JSON format is also + * available. + */ + conn.setRequestProperty("Accept",// + BigdataServlet.MIME_SPARQL_RESULTS_XML + ";q=1" + // + "," + // + BigdataServlet.MIME_RDF_XML + ";q=1"// + ); + + // write out the request headers + if (log.isDebugEnabled()) { + log.debug("*** Request ***"); + log.debug(opts.serviceURL); + log.debug(opts.queryStr); + } + + // connect. + conn.connect(); + + final int rc = conn.getResponseCode(); + if (rc < 200 || rc >= 300) { + throw new IOException(conn.getResponseMessage()); + } + + if (log.isDebugEnabled()) { + /* + * write out the status list, headers, etc. + */ + log.debug("*** Response ***"); + log.debug("Status Line: " + conn.getResponseMessage()); + } + return conn; + + } catch (Throwable t) { + /* + * If something goes wrong, then close the http connection. + * Otherwise, the connection will be closed by the caller. + */ + try { + // clean up the connection resources + if (conn != null) + conn.disconnect(); + } catch (Throwable t2) { + // ignored. + } + throw new RuntimeException(t); + } + + } + + /** + * Builds a graph from an RDF result set (statements, not binding sets). + * + * @param conn + * The connection from which to read the results. + * + * @return The graph + * + * @throws Exception + * If anything goes wrong. + */ + protected Graph buildGraph(final HttpURLConnection conn) throws Exception { + + final Graph g = new GraphImpl(); + + try { + + final String baseURI = ""; + + final RDFXMLParser rdfParser = new RDFXMLParser(new ValueFactoryImpl()); + + rdfParser.setVerifyData(true); + + rdfParser.setStopAtFirstError(true); + + rdfParser.setDatatypeHandling(RDFParser.DatatypeHandling.IGNORE); + + rdfParser.setRDFHandler(new StatementCollector(g)); + + rdfParser.parse(conn.getInputStream(), baseURI); + + return g; + + } finally { + + // terminate the http connection. + conn.disconnect(); + + } + + } + + /** + * Counts the #of results in a SPARQL result set. + * + * @param conn + * The connection from which to read the results. + * + * @return The #of results. + * + * @throws Exception + * If anything goes wrong. + */ + protected long countResults(final HttpURLConnection conn) throws Exception { + + final AtomicLong nsolutions = new AtomicLong(); + + try { + + final TupleQueryResultParser parser = new SPARQLResultsXMLParserFactory().getParser(); + + parser.setTupleQueryResultHandler(new TupleQueryResultHandlerBase() { + // Indicates the end of a sequence of solutions. + public void endQueryResult() { + // connection close is handled in finally{} + } + + // Handles a solution. + public void handleSolution(final BindingSet bset) { + if (log.isDebugEnabled()) + log.debug(bset.toString()); + nsolutions.incrementAndGet(); + } + + // Indicates the start of a sequence of Solutions. + public void startQueryResult(List<String> bindingNames) { + } + }); + + parser.parse(conn.getInputStream()); + + if (log.isInfoEnabled()) + log.info("nsolutions=" + nsolutions); + + // done. + return nsolutions.longValue(); + + } finally { + + // terminate the http connection. + conn.disconnect(); + + } + + } + + /** + * Select everything in the kb using a GET. + */ + public void test_STATUS() throws Exception { + + HttpURLConnection conn = doConnect(m_serviceURL + "/status", "GET"); + + // No solutions (assuming a told triple kb or quads kb w/o axioms). + + // connect. + conn.connect(); + + final int rc = conn.getResponseCode(); + if (rc < 200 || rc >= 300) { + throw new IOException(conn.getResponseMessage()); + } + + Reader rdr = new InputStreamReader(conn.getInputStream()); + + + String txt = getStreamContents(conn.getInputStream()); + + System.out.println(txt); + + } + + private String getStreamContents(InputStream inputStream) throws IOException { + Reader rdr = new InputStreamReader(inputStream); + + StringBuffer sb = new StringBuffer(); + char[] buf = new char[512]; + while (true) { + int rdlen = rdr.read(buf); + if (rdlen == -1) + break; + sb.append(buf, 0, rdlen); + } + + return sb.toString(); + } + + /** + * Select everything in the kb using a GET. + */ + public void test_GET_SELECT_ALL() throws Exception { + + final String queryStr = "select * where {?s ?p ?o}"; + + final QueryOptions opts = new QueryOptions(); + opts.serviceURL = m_serviceURL; + opts.queryStr = queryStr; + opts.method = "GET"; + + // No solutions (assuming a told triple kb or quads kb w/o axioms). + assertEquals(0, countResults(doSparqlQuery(opts, "query"))); + assertEquals(0, countResults(doSparqlQuery(opts, "REST"))); + + } + + /** + * Select everything in the kb using a POST. + */ + public void test_POST_SELECT_ALL() throws Exception { + + final String queryStr = "select * where {?s ?p ?o}"; + + final QueryOptions opts = new QueryOptions(); + opts.serviceURL = m_serviceURL; + opts.queryStr = queryStr; + opts.method = "POST"; + + // No solutions (assuming a told triple kb or quads kb w/o axioms). + assertEquals(0, countResults(doSparqlQuery(opts, "REST"))); + + } + + public void test_POSTUPDATE_withBody_NTRIPLES() throws Exception { + do_UPDATE_withBody_NTRIPLES("POST", 23, "REST"); + } + + public void test_PUTUPDATE_withBody_NTRIPLES() throws Exception { + do_UPDATE_withBody_NTRIPLES("PUT", 23, "REST"); + } + + /** + * Select everything in the kb using a POST. + */ + public void test_DELETE_withqueryandnamespace() throws Exception { + + final String queryStr = "select * where {?s ?p ?o}"; + + final QueryOptions opts = new QueryOptions(); + opts.serviceURL = m_serviceURL; + opts.queryStr = queryStr; + opts.method = "POST"; + + do_UPDATE_withBody_NTRIPLES("POST", 23, "REST"); + + assertEquals(23, countResults(doSparqlQuery(opts, "REST"))); + + do_DELETE_with_Query("REST", "construct {?s ?p ?o} where {?s ?p ?o}"); + + // No solutions (assuming a told triple kb or quads kb w/o axioms). + assertEquals(0, countResults(doSparqlQuery(opts, "REST"))); + + } + + + /** + * Select everything in the kb using a DELETE. + */ + public void test_REST_DELETE_withquery() throws Exception { + + final String queryStr = "select * where {?s ?p ?o}"; + + final QueryOptions opts = new QueryOptions(); + opts.serviceURL = m_serviceURL; + opts.queryStr = queryStr; + opts.method = "POST"; + + do_UPDATE_withBody_NTRIPLES("POST", 23, "update"); + + assertEquals(23, countResults(doSparqlQuery(opts, "REST"))); + + do_DELETE_with_Query("REST", "construct {?s ?p ?o} where {?s ?p ?o}"); + + // No solutions (assuming a told triple kb or quads kb w/o axioms). + assertEquals(0, countResults(doSparqlQuery(opts, "REST"))); + } + + /** + * Select everything in the kb using a POST. + */ + public void test_DELETE_withPOST() throws Exception { + + final String queryStr = "select * where {?s ?p ?o}"; + + final QueryOptions opts = new QueryOptions(); + opts.serviceURL = m_serviceURL; + opts.queryStr = queryStr; + opts.method = "POST"; + + do_UPDATE_withBody_NTRIPLES("POST", 23, "update"); + + assertEquals(23, countResults(doSparqlQuery(opts, "REST"))); + + do_DELETE_withBody_NTRIPLES("delete", 23); + + // No solutions (assuming a told triple kb or quads kb w/o axioms). + assertEquals(0, countResults(doSparqlQuery(opts, "REST"))); + + } + + + + private void do_DELETE_with_Query(final String servlet, final String query) { + HttpURLConnection conn = null; + try { + + final URL url = new URL(m_serviceURL + "/" + servlet + "?query=" + + URLEncoder.encode(query, "UTF-8")); + conn = (HttpURLConnection) url.openConnection(); + conn.setRequestMethod("DELETE"); + conn.setDoOutput(true); + conn.setDoInput(true); + conn.setUseCaches(false); + conn.setReadTimeout(0);// TODO timeout (ms) + + conn.connect(); + + if (log.isInfoEnabled()) + log.info(conn.getResponseMessage()); + + final int rc = conn.getResponseCode(); + + if (rc < 200 || rc >= 300) { + throw new IOException(conn.getResponseMessage()); + } + + } catch (Throwable t) { + // clean up the connection resources + if (conn != null) + conn.disconnect(); + throw new RuntimeException(t); + } + } + + private void do_DELETE_withBody_NTRIPLES(final String servlet, final int ntriples) { + HttpURLConnection conn = null; + try { + + final URL url = new URL(m_serviceURL + "/" + servlet); + conn = (HttpURLConnection) url.openConnection(); + conn.setRequestMethod("POST"); + conn.setDoOutput(true); + conn.setDoInput(true); + conn.setUseCaches(false); + conn.setReadTimeout(0);// TODO timeout (ms) + + String defmimetype = RDFFormat.NTRIPLES.getDefaultMIMEType(); + conn.setRequestProperty("Content-Type", defmimetype); + + final String data = genNTRIPLES(ntriples); + + conn.setRequestProperty("Content-Length", "" + Integer.toString(data.length())); + + final OutputStream os = conn.getOutputStream(); + try { + final Writer w = new OutputStreamWriter(os); + w.write(data); + w.flush(); + w.close(); + os.flush(); + os.close(); + } finally { + os.close(); + } + + if (log.isInfoEnabled()) + log.info(conn.getResponseMessage()); + + final int rc = conn.getResponseCode(); + + if (rc < 200 || rc >= 300) { + throw new IOException(conn.getResponseMessage()); + } + + } catch (Throwable t) { + // clean up the connection resources + if (conn != null) + conn.disconnect(); + throw new RuntimeException(t); + } + } + + /** + * UPDATE should not be allowed with a GET request + */ + public void test_GETUPDATE_withBody_NTRIPLES() throws Exception { + HttpURLConnection conn = null; + final URL url = new URL(m_serviceURL + "/update?data=stuff"); + conn = (HttpURLConnection) url.openConnection(); + conn.setRequestMethod("GET"); + conn.setDoOutput(true); + conn.setDoInput(true); + conn.setUseCaches(false); + conn.setReadTimeout(0);// TODO timeout (ms) + + conn.connect(); + + final int rc = conn.getResponseCode(); + + assertTrue(rc == 400); + } + + String genNTRIPLES(final int ntriples) { + StringBuffer databuf = new StringBuffer(); + databuf.append("#@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n"); + databuf.append("#@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n"); + databuf.append("#@prefix owl: <http://www.w3.org/2002/07/owl#> .\n"); + databuf.append("#@prefix : <#> .\n"); + for (int i = 0; i < ntriples; i++) { + databuf.append("<http://www.bigdata.org/b> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.bigdata.org/c#" + i + ">.\n"); + } + + return databuf.toString(); + } + /** + * @todo Test of POST w/ BODY having data to be loaded. + */ + public void do_UPDATE_withBody_NTRIPLES(final String method, final int ntriples, final String servlet) throws Exception { + + HttpURLConnection conn = null; + try { + + final URL url = new URL(m_serviceURL + "/" + servlet); + conn = (HttpURLConnection) url.openConnection(); + conn.setRequestMethod(method); + conn.setDoOutput(true); + conn.setDoInput(true); + conn.setUseCaches(false); + conn.setReadTimeout(0);// TODO timeout (ms) + String defmimetype = RDFFormat.NTRIPLES.getDefaultMIMEType(); + conn.setRequestProperty("Content-Type", defmimetype); + + final String data = genNTRIPLES(ntriples); + + conn.setRequestProperty("Content-Length", "" + Integer.toString(data.length())); + + final OutputStream os = conn.getOutputStream(); + try { + final Writer w = new OutputStreamWriter(os); + w.write(data); + w.flush(); + w.close(); + os.flush(); + os.close(); + } finally { + os.close(); + } + // conn.connect(); + + if (log.isInfoEnabled()) + log.info(conn.getResponseMessage()); + + final int rc = conn.getResponseCode(); + + System.out.println("Response: " + rc + " for " + method); + + if (rc < 200 || rc >= 300) { + throw new IOException(conn.getResponseMessage()); + } + + } catch (Throwable t) { + // clean up the connection resources + if (conn != null) + conn.disconnect(); + throw new RuntimeException(t); + } + + { + final String queryStr = "select * where {?s ?p ?o}"; + + final QueryOptions opts = new QueryOptions(); + opts.serviceURL = m_serviceURL; + opts.queryStr = queryStr; + opts.method = "GET"; + + assertEquals(ntriples, countResults(doSparqlQuery(opts, "REST"))); + } + + } + + public void test_GET_DESCRIBE() throws Exception { + do_construct_describe("describe"); + } + + public void test_GET_CONSTRUCT() throws Exception { + fail("Fix construct test"); + + do_construct_describe("construct"); + } + /** + * Test GET with DESCRIBE query. + */ + public void do_construct_describe(final String type) throws Exception { + + final URI mike = new URIImpl(BD.NAMESPACE + "Mike"); + final URI bryan = new URIImpl(BD.NAMESPACE + "Bryan"); + final URI person = new URIImpl(BD.NAMESPACE + "Person"); + final URI likes = new URIImpl(BD.NAMESPACE + "likes"); + final URI rdf = new URIImpl(BD.NAMESPACE + "RDF"); + final URI rdfs = new URIImpl(BD.NAMESPACE + "RDFS"); + final Literal label1 = new LiteralImpl("Mike"); + final Literal label2 = new LiteralImpl("Bryan"); + + final BigdataSail sail = getSail(); + sail.initialize(); + final BigdataSailRepository repo = new BigdataSailRepository(sail); + + try { + + final BigdataSailRepositoryConnection cxn = (BigdataSailRepositoryConnection) repo + .getConnection(); + try { + cxn.setAutoCommit(false); + + cxn.add(mike, RDF.TYPE, person); + cxn.add(mike, likes, rdf); + cxn.add(mike, RDFS.LABEL, label1); + cxn.add(bryan, RDF.TYPE, person); + cxn.add(bryan, likes, rdfs); + cxn.add(bryan, RDFS.LABEL, label2); + + /* + * Note: The either flush() or commit() is required to flush the + * statement buffers to the database before executing any + * operations that go around the sail. + */ + cxn.commit(); + } finally { + cxn.close(); + } + + } finally { + sail.shutDown(); + } + + // The expected results. + final Graph expected = new GraphImpl(); + { + expected.add(new StatementImpl(mike, likes, rdf)); + expected.add(new StatementImpl(mike, RDF.TYPE, person)); + expected.add(new StatementImpl(mike, RDFS.LABEL, label1)); + } + + // Run the query and verify the results. + { + + final QueryOptions opts = new QueryOptions(); + opts.serviceURL = m_serviceURL; + opts.queryStr =// + "prefix bd: <"+BD.NAMESPACE+"> " +// + "prefix rdf: <"+RDF.NAMESPACE+"> " +// + "prefix rdfs: <"+RDFS.NAMESPACE+"> " +// + type + " ?x " +// + "WHERE { " +// + " ?x rdf:type bd:Person . " +// + " ?x bd:likes bd:RDF " +// + "}"; + + final Graph actual = buildGraph(doSparqlQuery(opts, "REST")); + + assertSameGraph(expected, actual); + + } + + } + + /** + * Compare two graphs for equality. + * <p> + * Note: This is not very efficient if the {@link Graph} implementations are + * not indexed. + * <p> + * Note: This does not handle equality testing with blank nodes (it does not + * test for isomorphic graphs). + * + * @param expected + * @param actual + */ + protected void assertSameGraph(final Graph expected, final Graph actual) { + + for (Statement s : expected) { + + if (!actual.contains(s)) + fail("Expecting: " + s); + + } + + assertEquals("size", expected.size(), actual.size()); + + } + + +} Property changes on: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/TestJettySparqlServer_StartStop.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Id Date Revision Author HeadURL This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tho...@us...> - 2011-05-06 15:54:45
|
Revision: 4460 http://bigdata.svn.sourceforge.net/bigdata/?rev=4460&view=rev Author: thompsonbry Date: 2011-05-06 15:54:39 +0000 (Fri, 06 May 2011) Log Message: ----------- The trunk was deadlocking when running the SPARQL test suite using the UNISOLATED index. MikeP has suggested a work around, which I have implemented. There are now two variations of the SPARQL test suite. The base version runs with the unisolated connection and overrides getQueryConnection() to avoid a deadlock. The 2nd version runs with full read-write transactions and overrides getQueryConnection() to issue the query against a full tx. Both versions are now run in CI. This change was applied to the trunk and the quads branch. This also required back porting some changes to SPARQLQueryTest to request the "query" connection and to avoid a double acquisition of the unisolated connection when loading the test data sets. Modified Paths: -------------- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithQuads.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/tck/BigdataSparqlTest.java Added Paths: ----------- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/tck/BigdataSparqlFullRWTxTest.java Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithQuads.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithQuads.java 2011-05-06 13:47:16 UTC (rev 4459) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithQuads.java 2011-05-06 15:54:39 UTC (rev 4460) @@ -35,6 +35,7 @@ import com.bigdata.rdf.sail.BigdataSail.Options; import com.bigdata.rdf.sail.tck.BigdataConnectionTest; import com.bigdata.rdf.sail.tck.BigdataSparqlTest; +import com.bigdata.rdf.sail.tck.BigdataSparqlFullRWTxTest; import com.bigdata.rdf.sail.tck.BigdataStoreTest; /** @@ -128,7 +129,8 @@ * filter out the dataset tests, which we don't need right now */ // tckSuite.addTest(BigdataSparqlTest.suiteLTSWithPipelineJoins()); - tckSuite.addTest(BigdataSparqlTest.suite()); + tckSuite.addTest(BigdataSparqlTest.suite()); // w/ unisolated connection. + tckSuite.addTest(BigdataSparqlFullRWTxTest.suite()); // w/ full read/write tx. } catch (Exception ex) { Added: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/tck/BigdataSparqlFullRWTxTest.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/tck/BigdataSparqlFullRWTxTest.java (rev 0) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/tck/BigdataSparqlFullRWTxTest.java 2011-05-06 15:54:39 UTC (rev 4460) @@ -0,0 +1,85 @@ +/* + +Copyright (C) SYSTAP, LLC 2006-2008. All rights reserved. + +Contact: + SYSTAP, LLC + 4501 Tower Road + Greensboro, NC 27410 + lic...@bi... + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + */ +/* + * Created on May 6, 2011 + */ +package com.bigdata.rdf.sail.tck; + +import java.util.Properties; + +import org.openrdf.query.Dataset; +import org.openrdf.repository.Repository; +import org.openrdf.repository.RepositoryConnection; +import org.openrdf.repository.dataset.DatasetRepository; + +import com.bigdata.journal.Journal; +import com.bigdata.rdf.sail.BigdataSail; +import com.bigdata.rdf.sail.BigdataSailRepository; +import com.bigdata.rdf.sail.BigdataSail.Options; + +/** + * Test harness for running the SPARQL test suites against a {@link Journal} + * using full read/write transaction support. + * + * @author <a href="mailto:tho...@us...">Bryan Thompson</a> + * @version $Id: BigdataEmbeddedFederationSparqlTest.java 4455 2011-05-05 + * 19:24:03Z thompsonbry $ + */ +public class BigdataSparqlFullRWTxTest extends BigdataSparqlTest { + + public BigdataSparqlFullRWTxTest(String testURI, String name, String queryFileURL, + String resultFileURL, Dataset dataSet, boolean laxCardinality) { + + super(testURI, name, queryFileURL, resultFileURL, dataSet, laxCardinality); + + } + + @Override + protected Properties getProperties() { + + final Properties properties = super.getProperties(); + + // enable read/write transactions. + properties.setProperty(Options.ISOLATABLE_INDICES, "true"); + + return properties; + + } + + /** + * Overridden to use {@link BigdataSail#getConnection()} since we do not + * have to workaround a deadlock in concurrent access to the unisolated + * connection by the test harness when using full read-write transactions. + */ + @Override + protected RepositoryConnection getQueryConnection(Repository dataRep) + throws Exception { + + return ((BigdataSailRepository) ((DatasetRepository) dataRep) + .getDelegate()).getConnection(); + + } + +} Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/tck/BigdataSparqlTest.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/tck/BigdataSparqlTest.java 2011-05-06 13:47:16 UTC (rev 4459) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/tck/BigdataSparqlTest.java 2011-05-06 15:54:39 UTC (rev 4460) @@ -59,12 +59,14 @@ import com.bigdata.btree.keys.StrengthEnum; import com.bigdata.journal.BufferMode; import com.bigdata.journal.IIndexManager; +import com.bigdata.journal.Journal; import com.bigdata.rdf.sail.BigdataSail; import com.bigdata.rdf.sail.BigdataSailRepository; import com.bigdata.rdf.sail.BigdataSail.Options; /** - * Test harness for running the SPARQL test suites. + * Test harness for running the SPARQL test suites. This version runs against + * a {@link Journal} without full read/write transaction support. * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> * @version $Id$ @@ -411,8 +413,11 @@ // Force identical unicode comparisons (assuming default COLLATOR setting). // props.setProperty(Options.STRENGTH, StrengthEnum.Identical.toString()); - // enable/disable read/write transactions - props.setProperty(Options.ISOLATABLE_INDICES, "true"); + /* + * disable read/write transactions since this class runs against the + * unisolated connection. + */ + props.setProperty(Options.ISOLATABLE_INDICES, "false"); // disable truth maintenance in the SAIL props.setProperty(Options.TRUTH_MAINTENANCE, "false"); @@ -486,6 +491,13 @@ protected void runTest() throws Exception { + if(true) { + /* + * Dump out some interesting things about the query, the parse tree, + * and the state of the database *before* we run the unit test. This + * uses the same logic that is used when the test is run by the base + * class. + */ RepositoryConnection con = getQueryConnection(dataRep); try { @@ -515,10 +527,30 @@ finally { con.close(); } + } super.runTest(); } - - + /** + * Overridden to use {@link BigdataSail#getReadOnlyConnection()} as a + * workaround to the test harness which invokes + * {@link BigdataSail#getConnection()} multiple times from within the same + * thread. When full transactions are not enabled, that will delegate to + * {@link BigdataSail#getUnisolatedConnection()}. Only one unisolated + * connection is permitted at a time. While different threads will block to + * await the unisolated connection, that method will throw an exception if + * there is an attempt by a single thread to obtain more than one instance + * of the unisolated connection (since that operation would otherwise + * deadlock). + */ + @Override + protected RepositoryConnection getQueryConnection(Repository dataRep) + throws Exception { + + return ((BigdataSailRepository) ((DatasetRepository) dataRep) + .getDelegate()).getReadOnlyConnection(); + + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tho...@us...> - 2011-06-02 13:20:05
|
Revision: 4602 http://bigdata.svn.sourceforge.net/bigdata/?rev=4602&view=rev Author: thompsonbry Date: 2011-06-02 13:19:58 +0000 (Thu, 02 Jun 2011) Log Message: ----------- Commit of unit test and data contributed by gerdev. The test currently fails against SIDs, triples, and quads. Modified Paths: -------------- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithQuads.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithSids.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithoutSids.java Added Paths: ----------- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestMillisecondPrecisionForInlineDateTimes.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestMillisecondPrecisionForInlineDateTimes.ttl Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithQuads.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithQuads.java 2011-06-02 13:10:20 UTC (rev 4601) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithQuads.java 2011-06-02 13:19:58 UTC (rev 4602) @@ -113,6 +113,8 @@ suite.addTestSuite(com.bigdata.rdf.sail.contrib.TestRollbacks.class); suite.addTestSuite(com.bigdata.rdf.sail.contrib.TestRollbacksTx.class); + + suite.addTestSuite(com.bigdata.rdf.sail.TestMillisecondPrecisionForInlineDateTimes.class); // The Sesame TCK, including the SPARQL test suite. { Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithSids.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithSids.java 2011-06-02 13:10:20 UTC (rev 4601) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithSids.java 2011-06-02 13:19:58 UTC (rev 4602) @@ -96,6 +96,8 @@ suite.addTestSuite(com.bigdata.rdf.sail.contrib.TestRollbacksTx.class); suite.addTestSuite(com.bigdata.rdf.sail.contrib.TestRollbacksTM.class); + suite.addTestSuite(com.bigdata.rdf.sail.TestMillisecondPrecisionForInlineDateTimes.class); + return suite; } Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithoutSids.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithoutSids.java 2011-06-02 13:10:20 UTC (rev 4601) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithoutSids.java 2011-06-02 13:19:58 UTC (rev 4602) @@ -90,6 +90,8 @@ suite.addTestSuite(com.bigdata.rdf.sail.contrib.TestRollbacksTx.class); suite.addTestSuite(com.bigdata.rdf.sail.contrib.TestRollbacksTM.class); + suite.addTestSuite(com.bigdata.rdf.sail.TestMillisecondPrecisionForInlineDateTimes.class); + return suite; } Added: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestMillisecondPrecisionForInlineDateTimes.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestMillisecondPrecisionForInlineDateTimes.java (rev 0) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestMillisecondPrecisionForInlineDateTimes.java 2011-06-02 13:19:58 UTC (rev 4602) @@ -0,0 +1,268 @@ +/** +Copyright (C) SYSTAP, LLC 2011. All rights reserved. + +Contact: + SYSTAP, LLC + 4501 Tower Road + Greensboro, NC 27410 + lic...@bi... + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package com.bigdata.rdf.sail; + +import java.util.Collection; +import java.util.LinkedList; +import java.util.Properties; + +import org.apache.log4j.Logger; +import org.openrdf.model.vocabulary.RDF; +import org.openrdf.model.vocabulary.RDFS; +import org.openrdf.query.BindingSet; +import org.openrdf.query.QueryLanguage; +import org.openrdf.query.TupleQueryResult; +import org.openrdf.repository.Repository; +import org.openrdf.repository.RepositoryConnection; +import org.openrdf.repository.sail.SailRepository; +import org.openrdf.repository.sail.SailTupleQuery; +import org.openrdf.rio.RDFFormat; +import org.openrdf.sail.Sail; +import org.openrdf.sail.memory.MemoryStore; + +import com.bigdata.journal.BufferMode; +import com.bigdata.rdf.axioms.NoAxioms; +import com.bigdata.rdf.sail.BigdataSail; +import com.bigdata.rdf.sail.BigdataSailRepository; +import com.bigdata.rdf.vocab.NoVocabulary; + +/** + * Unit test template for use in submission of bugs. + * <p> + * This test case will delegate to an underlying backing store. You can + * specify this store via a JVM property as follows: + * <code>-DtestClass=com.bigdata.rdf.sail.TestBigdataSailWithQuads</code> + * <p> + * There are three possible configurations for the testClass: + * <ul> + * <li>com.bigdata.rdf.sail.TestBigdataSailWithQuads (quads mode)</li> + * <li>com.bigdata.rdf.sail.TestBigdataSailWithoutSids (triples mode)</li> + * <li>com.bigdata.rdf.sail.TestBigdataSailWithSids (SIDs mode)</li> + * </ul> + * <p> + * The default for triples and SIDs mode is for inference with truth maintenance + * to be on. If you would like to turn off inference, make sure to do so in + * {@link #getProperties()}. + * + * @author <a href="mailto:mrp...@us...">Mike Personick</a> + * @version $Id$ + */ +public class TestMillisecondPrecisionForInlineDateTimes extends QuadsTestCase { + + private static final Logger log = Logger + .getLogger(TestMillisecondPrecisionForInlineDateTimes.class); + + /** + * Please set your database properties here, except for your journal file, + * please DO NOT SPECIFY A JOURNAL FILE. + */ + @Override + public Properties getProperties() { + + final Properties props = super.getProperties(); + + /* + * For example, here is a set of five properties that turns off + * inference, truth maintenance, and the free text index. + */ + props.setProperty(BigdataSail.Options.AXIOMS_CLASS, NoAxioms.class.getName()); + props.setProperty(BigdataSail.Options.VOCABULARY_CLASS, NoVocabulary.class.getName()); + props.setProperty(BigdataSail.Options.TRUTH_MAINTENANCE, "false"); + props.setProperty(BigdataSail.Options.JUSTIFY, "false"); + props.setProperty(BigdataSail.Options.TEXT_INDEX, "false"); + props.setProperty(BigdataSail.Options.INLINE_DATE_TIMES, "true"); + props.setProperty(BigdataSail.Options.INLINE_DATE_TIMES_TIMEZONE, "GMT"); + + // No disk file. + props.setProperty(com.bigdata.journal.Options.BUFFER_MODE, + BufferMode.Transient.toString()); + + return props; + + } + + public TestMillisecondPrecisionForInlineDateTimes() { + } + + public TestMillisecondPrecisionForInlineDateTimes(String arg0) { + super(arg0); + } + + public void testBug() throws Exception { + + /* + * We use an in-memory Sesame store as our point of reference. This + * will supply the "correct" answer to the query (below). + */ + Sail sesameSail = null; + + /* + * The bigdata store, backed by a temporary journal file. + */ + BigdataSail bigdataSail = null; + + try { + + sesameSail = new MemoryStore(); + + bigdataSail = getSail(); + + /* + * Data file containing the data demonstrating your bug. + */ + final String data = "TestMillisecondPrecisionForInlineDateTimes.ttl"; + final String baseURI = ""; + final RDFFormat format = RDFFormat.TURTLE; + + /* + * Query(ies) demonstrating your bug. + */ + final String query = +// "prefix bd: <"+BD.NAMESPACE+"> " + + "prefix rdf: <"+RDF.NAMESPACE+"> " + + "prefix rdfs: <"+RDFS.NAMESPACE+"> " + + + "SELECT DISTINCT ?ar WHERE {\n" + + " FILTER(?datePub>=\"2011-03-08T08:48:27.003\"^^<http://www.w3.org/2001/XMLSchema#dateTime>).\n" + + " ?ar <os:prop/analysis/datePublished> ?datePub\n" + + "} ORDER BY DESC(?datePub)"; + + sesameSail.initialize(); + bigdataSail.initialize(); + + final Repository sesameRepo = new SailRepository(sesameSail); + final BigdataSailRepository bigdataRepo = new BigdataSailRepository(bigdataSail); + + { // load the data into the Sesame store + + final RepositoryConnection cxn = sesameRepo.getConnection(); + try { + cxn.setAutoCommit(false); + cxn.add(getClass().getResourceAsStream(data), baseURI, format); + cxn.commit(); + } finally { + cxn.close(); + } + + } + + { // load the data into the bigdata store + + final RepositoryConnection cxn = bigdataRepo.getConnection(); + try { + cxn.setAutoCommit(false); + cxn.add(getClass().getResourceAsStream(data), baseURI, format); + cxn.commit(); + } finally { + cxn.close(); + } + + } + + final Collection<BindingSet> answer = new LinkedList<BindingSet>(); + + /* + * Here is how you manually build the answer set, but please make + * sure you answer truly is correct if you choose to do it this way. + +// answer.add(createBindingSet( +// new BindingImpl("neType", vf.createURI("http://example/class/Location")) +// )); +// answer.add(createBindingSet( +// new BindingImpl("neType", vf.createURI("http://example/class/Person")) +// )); + + */ + + /* + * Run the problem query using the Sesame store to gather the + * correct results. + */ + { + final RepositoryConnection cxn = sesameRepo.getConnection(); + try { + final SailTupleQuery tupleQuery = (SailTupleQuery) + cxn.prepareTupleQuery(QueryLanguage.SPARQL, query); + tupleQuery.setIncludeInferred(false /* includeInferred */); + final TupleQueryResult result = tupleQuery.evaluate(); + + if (log.isInfoEnabled()) { + log.info("sesame results:"); + if (!result.hasNext()) { + log.info("no results."); + } + } + + while (result.hasNext()) { + final BindingSet bs = result.next(); + answer.add(bs); + if (log.isInfoEnabled()) + log.info(bs); + } + } finally { + cxn.close(); + } + } + + /* + * Run the problem query using the bigdata store and then compare + * the answer. + */ + final RepositoryConnection cxn = bigdataRepo.getReadOnlyConnection(); + try { + final SailTupleQuery tupleQuery = (SailTupleQuery) + cxn.prepareTupleQuery(QueryLanguage.SPARQL, query); + tupleQuery.setIncludeInferred(false /* includeInferred */); + + if (log.isInfoEnabled()) { + final TupleQueryResult result = tupleQuery.evaluate(); + log.info("bigdata results:"); + if (!result.hasNext()) { + log.info("no results."); + } + while (result.hasNext()) { + log.info(result.next()); + } + } + + final TupleQueryResult result = tupleQuery.evaluate(); + compare(result, answer); + + } finally { + cxn.close(); + } + + } finally { + + if (sesameSail != null) + sesameSail.shutDown(); + + if (bigdataSail != null) + bigdataSail.__tearDownUnitTest(); + + } + + } + +} Property changes on: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestMillisecondPrecisionForInlineDateTimes.java ___________________________________________________________________ Added: svn:keywords + Id Date Revision Author HeadURL Added: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestMillisecondPrecisionForInlineDateTimes.ttl =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestMillisecondPrecisionForInlineDateTimes.ttl (rev 0) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestMillisecondPrecisionForInlineDateTimes.ttl 2011-06-02 13:19:58 UTC (rev 4602) @@ -0,0 +1,17 @@ +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . + +<os:r1> a <os:class/AnalysisResults> ; + <os:prop/analysis/datePublished> "2011-03-08T08:48:23"^^<http://www.w3.org/2001/XMLSchema#dateTime>. + +<os:r2> a <os:class/AnalysisResults> ; + <os:prop/analysis/datePublished> "2011-03-08T08:48:27.002"^^<http://www.w3.org/2001/XMLSchema#dateTime>. + +<os:r3> a <os:class/AnalysisResults> ; + <os:prop/analysis/datePublished> "2011-03-08T08:48:27.003"^^<http://www.w3.org/2001/XMLSchema#dateTime>. + +<os:r4> a <os:class/AnalysisResults> ; + <os:prop/analysis/datePublished> "2011-03-08T08:48:27.004"^^<http://www.w3.org/2001/XMLSchema#dateTime>. + +<os:r5> a <os:class/AnalysisResults> ; + <os:prop/analysis/datePublished> "2011-03-08T08:48:28"^^<http://www.w3.org/2001/XMLSchema#dateTime>. \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tho...@us...> - 2011-06-02 14:19:25
|
Revision: 4605 http://bigdata.svn.sourceforge.net/bigdata/?rev=4605&view=rev Author: thompsonbry Date: 2011-06-02 14:19:18 +0000 (Thu, 02 Jun 2011) Log Message: ----------- Moved the contributed TestRollbacks test suites into the core sail package. Modified Paths: -------------- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithQuads.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithSids.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithoutSids.java Added Paths: ----------- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestRollbacks.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestRollbacksTM.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestRollbacksTx.java Removed Paths: ------------- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/contrib/TestRollbacks.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/contrib/TestRollbacksTM.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/contrib/TestRollbacksTx.java Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithQuads.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithQuads.java 2011-06-02 14:16:13 UTC (rev 4604) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithQuads.java 2011-06-02 14:19:18 UTC (rev 4605) @@ -111,8 +111,8 @@ suite.addTestSuite(TestTxCreate.class); - suite.addTestSuite(com.bigdata.rdf.sail.contrib.TestRollbacks.class); - suite.addTestSuite(com.bigdata.rdf.sail.contrib.TestRollbacksTx.class); + suite.addTestSuite(com.bigdata.rdf.sail.TestRollbacks.class); + suite.addTestSuite(com.bigdata.rdf.sail.TestRollbacksTx.class); suite.addTestSuite(com.bigdata.rdf.sail.TestMillisecondPrecisionForInlineDateTimes.class); Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithSids.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithSids.java 2011-06-02 14:16:13 UTC (rev 4604) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithSids.java 2011-06-02 14:19:18 UTC (rev 4605) @@ -92,9 +92,9 @@ suite.addTestSuite(TestSids.class); - suite.addTestSuite(com.bigdata.rdf.sail.contrib.TestRollbacks.class); - suite.addTestSuite(com.bigdata.rdf.sail.contrib.TestRollbacksTx.class); - suite.addTestSuite(com.bigdata.rdf.sail.contrib.TestRollbacksTM.class); + suite.addTestSuite(com.bigdata.rdf.sail.TestRollbacks.class); + suite.addTestSuite(com.bigdata.rdf.sail.TestRollbacksTx.class); + suite.addTestSuite(com.bigdata.rdf.sail.TestRollbacksTM.class); suite.addTestSuite(com.bigdata.rdf.sail.TestMillisecondPrecisionForInlineDateTimes.class); Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithoutSids.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithoutSids.java 2011-06-02 14:16:13 UTC (rev 4604) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithoutSids.java 2011-06-02 14:19:18 UTC (rev 4605) @@ -86,9 +86,9 @@ suite.addTestSuite(TestTxCreate.class); - suite.addTestSuite(com.bigdata.rdf.sail.contrib.TestRollbacks.class); - suite.addTestSuite(com.bigdata.rdf.sail.contrib.TestRollbacksTx.class); - suite.addTestSuite(com.bigdata.rdf.sail.contrib.TestRollbacksTM.class); + suite.addTestSuite(com.bigdata.rdf.sail.TestRollbacks.class); + suite.addTestSuite(com.bigdata.rdf.sail.TestRollbacksTx.class); + suite.addTestSuite(com.bigdata.rdf.sail.TestRollbacksTM.class); suite.addTestSuite(com.bigdata.rdf.sail.TestMillisecondPrecisionForInlineDateTimes.class); Copied: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestRollbacks.java (from rev 4600, branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/contrib/TestRollbacks.java) =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestRollbacks.java (rev 0) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestRollbacks.java 2011-06-02 14:19:18 UTC (rev 4605) @@ -0,0 +1,359 @@ +/** +Copyright (C) SYSTAP, LLC 2011. All rights reserved. + +Contact: + SYSTAP, LLC + 4501 Tower Road + Greensboro, NC 27410 + lic...@bi... + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +package com.bigdata.rdf.sail; + +import java.util.LinkedList; +import java.util.List; +import java.util.Properties; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.atomic.AtomicReference; + +import org.apache.log4j.Logger; +import org.openrdf.OpenRDFException; +import org.openrdf.model.URI; +import org.openrdf.model.Value; +import org.openrdf.query.MalformedQueryException; +import org.openrdf.query.QueryEvaluationException; +import org.openrdf.query.QueryLanguage; +import org.openrdf.query.TupleQuery; +import org.openrdf.query.TupleQueryResult; +import org.openrdf.repository.RepositoryConnection; +import org.openrdf.repository.RepositoryException; +import org.openrdf.repository.sail.SailRepository; + +import com.bigdata.journal.IIndexManager; +import com.bigdata.rdf.axioms.NoAxioms; +import com.bigdata.rdf.sail.BigdataSail; +import com.bigdata.rdf.sail.BigdataSailRepository; +import com.bigdata.rdf.vocab.NoVocabulary; + +/** + * This is a stress test for abort/rollback semantics. + * <p> + * This test case will delegate to an underlying backing store. You can specify + * this store via a JVM property as follows: + * <code>-DtestClass=com.bigdata.rdf.sail.TestBigdataSailWithQuads</code> + * <p> + * There are three possible configurations for the testClass: + * <ul> + * <li>com.bigdata.rdf.sail.TestBigdataSailWithQuads (quads mode)</li> + * <li>com.bigdata.rdf.sail.TestBigdataSailWithoutSids (triples mode)</li> + * <li>com.bigdata.rdf.sail.TestBigdataSailWithSids (SIDs mode)</li> + * </ul> + * <p> + * The default for triples and SIDs mode is for inference with truth maintenance + * to be on. If you would like to turn off inference, make sure to do so in + * {@link #getProperties()}. + * + * @see https://sourceforge.net/apps/trac/bigdata/ticket/278 + * + * @author <a href="mailto:mrp...@us...">Mike Personick</a> + * @author <a href="mailto:tho...@us...">Bryan Thompson</a> + * @author <a href="mailto:ge...@us...">Gerjon</a> + * @version $Id$ + */ +public class TestRollbacks extends QuadsTestCase { + + private static final Logger log = Logger.getLogger(TestRollbacks.class); + + public TestRollbacks() { + } + + public TestRollbacks(String arg0) { + super(arg0); + } + + @Override + public Properties getProperties() { + + final Properties props = super.getProperties(); + + /* + * For example, here is a set of five properties that turns off + * inference, truth maintenance, and the free text index. + */ + props.setProperty(BigdataSail.Options.AXIOMS_CLASS, + NoAxioms.class.getName()); + props.setProperty(BigdataSail.Options.VOCABULARY_CLASS, + NoVocabulary.class.getName()); + props.setProperty(BigdataSail.Options.TRUTH_MAINTENANCE, "false"); + props.setProperty(BigdataSail.Options.JUSTIFY, "false"); + + // transactions are off in the base version of this class. + props.setProperty(BigdataSail.Options.ISOLATABLE_INDICES, "false"); + +// props.setProperty(BigdataSail.Options.CREATE_TEMP_FILE, "true"); +// props.setProperty(BigdataSail.Options.BUFFER_MODE, BufferMode.DiskRW +// .toString()); + +// props.setProperty(BigdataSail.Options.EXACT_SIZE, "true"); + + return props; + } + + + /** The thrown exception which is the first cause of failure. */ + private AtomicReference<Throwable> firstCause; + + /** + * Service used to run the individual tasks. This makes it possible to + * interrupt them as soon as one of the tasks fails. + */ + private ExecutorService executorService = null; + + @Override + protected void setUp() throws Exception { + super.setUp(); + firstCause = new AtomicReference<Throwable>(null); + executorService = Executors.newFixedThreadPool(3/*nthreads*/); + } + + @Override + protected void tearDown() throws Exception { + if (executorService != null) { + // interrupt any running tasks. + executorService.shutdownNow(); + } + // clear references so that junit does not hold onto them. + executorService = null; + firstCause = null; + super.tearDown(); + } + + /** + * Stress test for abort/rollback semantics consisting of many short + * runs of the basic test. + * + * @throws Exception + */ + public void testManyShortRuns() throws Exception { + + for (int i = 0; i < 20; i++) { + + doTest(10); + + } + + } + + /** + * Stress test for abort/rollback semantics consisting of one moderate + * duration run of the basic test. + * + * @throws Exception + */ + public void testModerateDuration() throws Exception { + + doTest(100); + + } + + private void doTest(final int maxCounter) throws InterruptedException, Exception { + final BigdataSail sail = getSail(); + try { + // Note: Modified to use the BigdataSailRepository rather than the base SailRepository class. + final BigdataSailRepository repo = new BigdataSailRepository(sail); + repo.initialize(); + runConcurrentStuff(repo,maxCounter); + } finally { + final IIndexManager db = sail.getDatabase().getIndexManager(); + if (sail.isOpen()) + sail.shutDown(); + db.destroy(); + } + } + + private void runConcurrentStuff(final SailRepository repo,final int maxCounter) + throws Exception, + InterruptedException { + try { + final List<Callable<Void>> tasks = new LinkedList<Callable<Void>>(); + tasks.add(new DoStuff(repo, true/*writer*/, maxCounter)); + tasks.add(new DoStuff(repo, false/*reader*/, maxCounter)); + tasks.add(new DoStuff(repo, false/*reader*/, maxCounter)); + final List<Future<Void>> futures = executorService.invokeAll(tasks); + // Look for the first cause. + final Throwable t = firstCause.get(); + if (t != null) { + // Found it. + throw new RuntimeException(t); + } + // test each future. + for (Future<Void> f : futures) { + f.get(); + } + } finally { + repo.shutDown(); + } + } + + private class DoStuff implements Callable<Void> { + + private SailRepository repo; + private boolean writer; + private final int maxCounter; + int counter = 0; + + /** + * @param repo + * The repository. + * @param writer + * <code>true</code> iff this is a writer. + * @param maxCounter + * Sets a limit on the length of the stress test. A value of + * 1000 results in a 26 second run. A value of 100-200 is + * more reasonable and is sufficient to readily identify any + * problems during CI. + */ + private DoStuff(final SailRepository repo, final boolean writer, + final int maxCounter) throws OpenRDFException { + this.repo = repo; + this.writer = writer; + this.maxCounter = maxCounter; + } + + public Void call() throws Exception { +// if (writer) { +// // Initial sleep on the writer. +// Thread.sleep(500); +// } + RepositoryConnection conn = null; + try { + int counter2 = 0; + conn = repo.getConnection(); + conn.setAutoCommit(false); + while (firstCause.get() == null && counter < maxCounter) { + if (writer) + writer(conn); + else + reader(conn); + /* + * Note: If connection obtained/closed within the loop then + * the query is more likely to have some data to visit + * within its tx view. + */ + if (++counter2 % 4 == 0) { + conn.close(); + conn = repo.getConnection(); + conn.setAutoCommit(false); + } +// conn = repo.getConnection(); +// conn.setAutoCommit(false); +// conn.close(); + } + return (Void) null; + } catch (Throwable t) { + firstCause.compareAndSet(null/* expect */, t); + throw new RuntimeException(t); + } finally { + if (conn != null) + conn.close(); + } + } + + private void reader(final RepositoryConnection conn) + throws RepositoryException, MalformedQueryException, + QueryEvaluationException, InterruptedException { + query(conn); +// Thread.sleep(100); + query(conn); + ++counter; + + if (counter % 3 == 0) + conn.commit(); + else + conn.rollback(); + + // if (counter % 7 == 0) { + // conn.close(); + // conn = repo.getConnection(); + // conn.setAutoCommit(false); + // } + } + + private void writer(final RepositoryConnection conn) throws RepositoryException, + MalformedQueryException, QueryEvaluationException, + InterruptedException { + + final URI subj = conn.getValueFactory().createURI( + "u:s" + (counter++)); + final Value value = conn.getValueFactory().createLiteral( + "literal" + counter); + query(conn); +// Thread.sleep(200); + conn.add(subj, conn.getValueFactory().createURI("u:p"), subj); + conn.add(subj, conn.getValueFactory().createURI("u:p"), value); + conn.commit(); + + if(log.isInfoEnabled()) + log.info("Added statements: size="+conn.size()); + + // if (counter % 12 == 0) { + // conn.close(); + // conn = repo.getConnection(); + // conn.setAutoCommit(false); + // } + } + + private void query(final RepositoryConnection conn) throws RepositoryException, + MalformedQueryException, QueryEvaluationException { + final long begin = System.currentTimeMillis(); + /* + * Note: This query will do an access path scan rather than a join. + * There are different code paths involved with a join, so there + * might be problems on those code paths as well. + */ + final boolean useJoin = counter % 2 == 0; + final String query = !useJoin// + // access path scan + ? "SELECT ?b { ?a ?b ?c } LIMIT 20"// + // join + : "SELECT ?b { ?a ?b ?c . ?d ?b ?e} LIMIT 20"// + ; + final TupleQuery q = conn.prepareTupleQuery(QueryLanguage.SPARQL, query); + q.setBinding("b", conn.getValueFactory().createURI("u:p")); + if (useJoin) + q.setBinding("d", conn.getValueFactory().createLiteral( + "literal1")); + final TupleQueryResult tqr = q.evaluate(); + int n = 0; + try { + while (tqr.hasNext()) { + tqr.next(); + n++; + } + } finally { + tqr.close(); + } + if (log.isInfoEnabled()) + log.info("Query: writer=" + writer + ", counter=" + counter + + ", nresults=" + n + ", elapsed=" + + (System.currentTimeMillis() - begin)); + } + } + +} Copied: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestRollbacksTM.java (from rev 4600, branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/contrib/TestRollbacksTM.java) =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestRollbacksTM.java (rev 0) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestRollbacksTM.java 2011-06-02 14:19:18 UTC (rev 4605) @@ -0,0 +1,66 @@ +/** +Copyright (C) SYSTAP, LLC 2011. All rights reserved. + +Contact: + SYSTAP, LLC + 4501 Tower Road + Greensboro, NC 27410 + lic...@bi... + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +package com.bigdata.rdf.sail; + +import java.util.Properties; + +import com.bigdata.rdf.axioms.NoAxioms; +import com.bigdata.rdf.axioms.RdfsAxioms; +import com.bigdata.rdf.sail.BigdataSail; +import com.bigdata.rdf.vocab.NoVocabulary; +import com.bigdata.rdf.vocab.RDFSVocabulary; + +/** + * Concrete instance of {@link TestRollbacks} which overrides the properties to + * enable truth maintenance support in the SAIL. + * + * @author <a href="mailto:tho...@us...">Bryan Thompson</a> + * @version $Id$ + */ +public class TestRollbacksTM extends TestRollbacks { + + public TestRollbacksTM() { + super(); + } + + public TestRollbacksTM(String name) { + super(name); + } + + @Override + public Properties getProperties() { + + final Properties props = super.getProperties(); + + props.setProperty(BigdataSail.Options.AXIOMS_CLASS, + RdfsAxioms.class.getName()); + props.setProperty(BigdataSail.Options.VOCABULARY_CLASS, + RDFSVocabulary.class.getName()); + props.setProperty(BigdataSail.Options.TRUTH_MAINTENANCE, "true"); + props.setProperty(BigdataSail.Options.JUSTIFY, "true"); + + return props; + + } + +} Copied: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestRollbacksTx.java (from rev 4600, branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/contrib/TestRollbacksTx.java) =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestRollbacksTx.java (rev 0) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestRollbacksTx.java 2011-06-02 14:19:18 UTC (rev 4605) @@ -0,0 +1,58 @@ +/** +Copyright (C) SYSTAP, LLC 2011. All rights reserved. + +Contact: + SYSTAP, LLC + 4501 Tower Road + Greensboro, NC 27410 + lic...@bi... + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +package com.bigdata.rdf.sail; + +import java.util.Properties; + +import com.bigdata.rdf.sail.BigdataSail; + +/** + * Concrete instance of {@link TestRollbacks} which overrides the properties to + * enable full transaction support in the SAIL. + * + * @author <a href="mailto:tho...@us...">Bryan Thompson</a> + * @version $Id$ + */ +public class TestRollbacksTx extends TestRollbacks { + + public TestRollbacksTx() { + super(); + } + + public TestRollbacksTx(String name) { + super(name); + } + + @Override + public Properties getProperties() { + + final Properties props = super.getProperties(); + + // transactions are ON in this version of this class. + props.setProperty(BigdataSail.Options.ISOLATABLE_INDICES, "true"); + + return props; + + } + +} Deleted: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/contrib/TestRollbacks.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/contrib/TestRollbacks.java 2011-06-02 14:16:13 UTC (rev 4604) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/contrib/TestRollbacks.java 2011-06-02 14:19:18 UTC (rev 4605) @@ -1,360 +0,0 @@ -/** -Copyright (C) SYSTAP, LLC 2011. All rights reserved. - -Contact: - SYSTAP, LLC - 4501 Tower Road - Greensboro, NC 27410 - lic...@bi... - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -package com.bigdata.rdf.sail.contrib; - -import java.util.LinkedList; -import java.util.List; -import java.util.Properties; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import java.util.concurrent.atomic.AtomicReference; - -import org.apache.log4j.Logger; -import org.openrdf.OpenRDFException; -import org.openrdf.model.URI; -import org.openrdf.model.Value; -import org.openrdf.query.MalformedQueryException; -import org.openrdf.query.QueryEvaluationException; -import org.openrdf.query.QueryLanguage; -import org.openrdf.query.TupleQuery; -import org.openrdf.query.TupleQueryResult; -import org.openrdf.repository.RepositoryConnection; -import org.openrdf.repository.RepositoryException; -import org.openrdf.repository.sail.SailRepository; - -import com.bigdata.journal.IIndexManager; -import com.bigdata.rdf.axioms.NoAxioms; -import com.bigdata.rdf.sail.BigdataSail; -import com.bigdata.rdf.sail.BigdataSailRepository; -import com.bigdata.rdf.sail.QuadsTestCase; -import com.bigdata.rdf.vocab.NoVocabulary; - -/** - * This is a stress test for abort/rollback semantics. - * <p> - * This test case will delegate to an underlying backing store. You can specify - * this store via a JVM property as follows: - * <code>-DtestClass=com.bigdata.rdf.sail.TestBigdataSailWithQuads</code> - * <p> - * There are three possible configurations for the testClass: - * <ul> - * <li>com.bigdata.rdf.sail.TestBigdataSailWithQuads (quads mode)</li> - * <li>com.bigdata.rdf.sail.TestBigdataSailWithoutSids (triples mode)</li> - * <li>com.bigdata.rdf.sail.TestBigdataSailWithSids (SIDs mode)</li> - * </ul> - * <p> - * The default for triples and SIDs mode is for inference with truth maintenance - * to be on. If you would like to turn off inference, make sure to do so in - * {@link #getProperties()}. - * - * @see https://sourceforge.net/apps/trac/bigdata/ticket/278 - * - * @author <a href="mailto:mrp...@us...">Mike Personick</a> - * @author <a href="mailto:tho...@us...">Bryan Thompson</a> - * @author <a href="mailto:ge...@us...">Gerjon</a> - * @version $Id$ - */ -public class TestRollbacks extends QuadsTestCase { - - private static final Logger log = Logger.getLogger(TestRollbacks.class); - - public TestRollbacks() { - } - - public TestRollbacks(String arg0) { - super(arg0); - } - - @Override - public Properties getProperties() { - - final Properties props = super.getProperties(); - - /* - * For example, here is a set of five properties that turns off - * inference, truth maintenance, and the free text index. - */ - props.setProperty(BigdataSail.Options.AXIOMS_CLASS, - NoAxioms.class.getName()); - props.setProperty(BigdataSail.Options.VOCABULARY_CLASS, - NoVocabulary.class.getName()); - props.setProperty(BigdataSail.Options.TRUTH_MAINTENANCE, "false"); - props.setProperty(BigdataSail.Options.JUSTIFY, "false"); - - // transactions are off in the base version of this class. - props.setProperty(BigdataSail.Options.ISOLATABLE_INDICES, "false"); - -// props.setProperty(BigdataSail.Options.CREATE_TEMP_FILE, "true"); -// props.setProperty(BigdataSail.Options.BUFFER_MODE, BufferMode.DiskRW -// .toString()); - -// props.setProperty(BigdataSail.Options.EXACT_SIZE, "true"); - - return props; - } - - - /** The thrown exception which is the first cause of failure. */ - private AtomicReference<Throwable> firstCause; - - /** - * Service used to run the individual tasks. This makes it possible to - * interrupt them as soon as one of the tasks fails. - */ - private ExecutorService executorService = null; - - @Override - protected void setUp() throws Exception { - super.setUp(); - firstCause = new AtomicReference<Throwable>(null); - executorService = Executors.newFixedThreadPool(3/*nthreads*/); - } - - @Override - protected void tearDown() throws Exception { - if (executorService != null) { - // interrupt any running tasks. - executorService.shutdownNow(); - } - // clear references so that junit does not hold onto them. - executorService = null; - firstCause = null; - super.tearDown(); - } - - /** - * Stress test for abort/rollback semantics consisting of many short - * runs of the basic test. - * - * @throws Exception - */ - public void testManyShortRuns() throws Exception { - - for (int i = 0; i < 20; i++) { - - doTest(10); - - } - - } - - /** - * Stress test for abort/rollback semantics consisting of one moderate - * duration run of the basic test. - * - * @throws Exception - */ - public void testModerateDuration() throws Exception { - - doTest(100); - - } - - private void doTest(final int maxCounter) throws InterruptedException, Exception { - final BigdataSail sail = getSail(); - try { - // Note: Modified to use the BigdataSailRepository rather than the base SailRepository class. - final BigdataSailRepository repo = new BigdataSailRepository(sail); - repo.initialize(); - runConcurrentStuff(repo,maxCounter); - } finally { - final IIndexManager db = sail.getDatabase().getIndexManager(); - if (sail.isOpen()) - sail.shutDown(); - db.destroy(); - } - } - - private void runConcurrentStuff(final SailRepository repo,final int maxCounter) - throws Exception, - InterruptedException { - try { - final List<Callable<Void>> tasks = new LinkedList<Callable<Void>>(); - tasks.add(new DoStuff(repo, true/*writer*/, maxCounter)); - tasks.add(new DoStuff(repo, false/*reader*/, maxCounter)); - tasks.add(new DoStuff(repo, false/*reader*/, maxCounter)); - final List<Future<Void>> futures = executorService.invokeAll(tasks); - // Look for the first cause. - final Throwable t = firstCause.get(); - if (t != null) { - // Found it. - throw new RuntimeException(t); - } - // test each future. - for (Future<Void> f : futures) { - f.get(); - } - } finally { - repo.shutDown(); - } - } - - private class DoStuff implements Callable<Void> { - - private SailRepository repo; - private boolean writer; - private final int maxCounter; - int counter = 0; - - /** - * @param repo - * The repository. - * @param writer - * <code>true</code> iff this is a writer. - * @param maxCounter - * Sets a limit on the length of the stress test. A value of - * 1000 results in a 26 second run. A value of 100-200 is - * more reasonable and is sufficient to readily identify any - * problems during CI. - */ - private DoStuff(final SailRepository repo, final boolean writer, - final int maxCounter) throws OpenRDFException { - this.repo = repo; - this.writer = writer; - this.maxCounter = maxCounter; - } - - public Void call() throws Exception { -// if (writer) { -// // Initial sleep on the writer. -// Thread.sleep(500); -// } - RepositoryConnection conn = null; - try { - int counter2 = 0; - conn = repo.getConnection(); - conn.setAutoCommit(false); - while (firstCause.get() == null && counter < maxCounter) { - if (writer) - writer(conn); - else - reader(conn); - /* - * Note: If connection obtained/closed within the loop then - * the query is more likely to have some data to visit - * within its tx view. - */ - if (++counter2 % 4 == 0) { - conn.close(); - conn = repo.getConnection(); - conn.setAutoCommit(false); - } -// conn = repo.getConnection(); -// conn.setAutoCommit(false); -// conn.close(); - } - return (Void) null; - } catch (Throwable t) { - firstCause.compareAndSet(null/* expect */, t); - throw new RuntimeException(t); - } finally { - if (conn != null) - conn.close(); - } - } - - private void reader(final RepositoryConnection conn) - throws RepositoryException, MalformedQueryException, - QueryEvaluationException, InterruptedException { - query(conn); -// Thread.sleep(100); - query(conn); - ++counter; - - if (counter % 3 == 0) - conn.commit(); - else - conn.rollback(); - - // if (counter % 7 == 0) { - // conn.close(); - // conn = repo.getConnection(); - // conn.setAutoCommit(false); - // } - } - - private void writer(final RepositoryConnection conn) throws RepositoryException, - MalformedQueryException, QueryEvaluationException, - InterruptedException { - - final URI subj = conn.getValueFactory().createURI( - "u:s" + (counter++)); - final Value value = conn.getValueFactory().createLiteral( - "literal" + counter); - query(conn); -// Thread.sleep(200); - conn.add(subj, conn.getValueFactory().createURI("u:p"), subj); - conn.add(subj, conn.getValueFactory().createURI("u:p"), value); - conn.commit(); - - if(log.isInfoEnabled()) - log.info("Added statements: size="+conn.size()); - - // if (counter % 12 == 0) { - // conn.close(); - // conn = repo.getConnection(); - // conn.setAutoCommit(false); - // } - } - - private void query(final RepositoryConnection conn) throws RepositoryException, - MalformedQueryException, QueryEvaluationException { - final long begin = System.currentTimeMillis(); - /* - * Note: This query will do an access path scan rather than a join. - * There are different code paths involved with a join, so there - * might be problems on those code paths as well. - */ - final boolean useJoin = counter % 2 == 0; - final String query = !useJoin// - // access path scan - ? "SELECT ?b { ?a ?b ?c } LIMIT 20"// - // join - : "SELECT ?b { ?a ?b ?c . ?d ?b ?e} LIMIT 20"// - ; - final TupleQuery q = conn.prepareTupleQuery(QueryLanguage.SPARQL, query); - q.setBinding("b", conn.getValueFactory().createURI("u:p")); - if (useJoin) - q.setBinding("d", conn.getValueFactory().createLiteral( - "literal1")); - final TupleQueryResult tqr = q.evaluate(); - int n = 0; - try { - while (tqr.hasNext()) { - tqr.next(); - n++; - } - } finally { - tqr.close(); - } - if (log.isInfoEnabled()) - log.info("Query: writer=" + writer + ", counter=" + counter - + ", nresults=" + n + ", elapsed=" - + (System.currentTimeMillis() - begin)); - } - } - -} Deleted: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/contrib/TestRollbacksTM.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/contrib/TestRollbacksTM.java 2011-06-02 14:16:13 UTC (rev 4604) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/contrib/TestRollbacksTM.java 2011-06-02 14:19:18 UTC (rev 4605) @@ -1,66 +0,0 @@ -/** -Copyright (C) SYSTAP, LLC 2011. All rights reserved. - -Contact: - SYSTAP, LLC - 4501 Tower Road - Greensboro, NC 27410 - lic...@bi... - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -package com.bigdata.rdf.sail.contrib; - -import java.util.Properties; - -import com.bigdata.rdf.axioms.NoAxioms; -import com.bigdata.rdf.axioms.RdfsAxioms; -import com.bigdata.rdf.sail.BigdataSail; -import com.bigdata.rdf.vocab.NoVocabulary; -import com.bigdata.rdf.vocab.RDFSVocabulary; - -/** - * Concrete instance of {@link TestRollbacks} which overrides the properties to - * enable truth maintenance support in the SAIL. - * - * @author <a href="mailto:tho...@us...">Bryan Thompson</a> - * @version $Id$ - */ -public class TestRollbacksTM extends TestRollbacks { - - public TestRollbacksTM() { - super(); - } - - public TestRollbacksTM(String name) { - super(name); - } - - @Override - public Properties getProperties() { - - final Properties props = super.getProperties(); - - props.setProperty(BigdataSail.Options.AXIOMS_CLASS, - RdfsAxioms.class.getName()); - props.setProperty(BigdataSail.Options.VOCABULARY_CLASS, - RDFSVocabulary.class.getName()); - props.setProperty(BigdataSail.Options.TRUTH_MAINTENANCE, "true"); - props.setProperty(BigdataSail.Options.JUSTIFY, "true"); - - return props; - - } - -} Deleted: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/contrib/TestRollbacksTx.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/contrib/TestRollbacksTx.java 2011-06-02 14:16:13 UTC (rev 4604) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/contrib/TestRollbacksTx.java 2011-06-02 14:19:18 UTC (rev 4605) @@ -1,58 +0,0 @@ -/** -Copyright (C) SYSTAP, LLC 2011. All rights reserved. - -Contact: - SYSTAP, LLC - 4501 Tower Road - Greensboro, NC 27410 - lic...@bi... - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -package com.bigdata.rdf.sail.contrib; - -import java.util.Properties; - -import com.bigdata.rdf.sail.BigdataSail; - -/** - * Concrete instance of {@link TestRollbacks} which overrides the properties to - * enable full transaction support in the SAIL. - * - * @author <a href="mailto:tho...@us...">Bryan Thompson</a> - * @version $Id$ - */ -public class TestRollbacksTx extends TestRollbacks { - - public TestRollbacksTx() { - super(); - } - - public TestRollbacksTx(String name) { - super(name); - } - - @Override - public Properties getProperties() { - - final Properties props = super.getProperties(); - - // transactions are ON in this version of this class. - props.setProperty(BigdataSail.Options.ISOLATABLE_INDICES, "true"); - - return props; - - } - -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tho...@us...> - 2011-06-03 11:01:24
|
Revision: 4612 http://bigdata.svn.sourceforge.net/bigdata/?rev=4612&view=rev Author: thompsonbry Date: 2011-06-03 11:01:17 +0000 (Fri, 03 Jun 2011) Log Message: ----------- Added unit test and data for [1] to the CI test suite. [1] https://sourceforge.net/apps/trac/bigdata/ticket/276 (UnsupportedOperationException during query evaluation) Modified Paths: -------------- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithQuads.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithSids.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithoutSids.java Added Paths: ----------- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestTicket276.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestTicket276.n3 Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithQuads.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithQuads.java 2011-06-02 20:30:39 UTC (rev 4611) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithQuads.java 2011-06-03 11:01:17 UTC (rev 4612) @@ -116,8 +116,10 @@ suite.addTestSuite(com.bigdata.rdf.sail.TestMillisecondPrecisionForInlineDateTimes.class); - suite.addTestSuite(com.bigdata.rdf.sail.DavidsTestBOps.class); + suite.addTestSuite(com.bigdata.rdf.sail.TestTicket276.class); + suite.addTestSuite(com.bigdata.rdf.sail.DavidsTestBOps.class); + // The Sesame TCK, including the SPARQL test suite. { Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithSids.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithSids.java 2011-06-02 20:30:39 UTC (rev 4611) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithSids.java 2011-06-03 11:01:17 UTC (rev 4612) @@ -98,6 +98,8 @@ suite.addTestSuite(com.bigdata.rdf.sail.TestMillisecondPrecisionForInlineDateTimes.class); + suite.addTestSuite(com.bigdata.rdf.sail.TestTicket276.class); + return suite; } Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithoutSids.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithoutSids.java 2011-06-02 20:30:39 UTC (rev 4611) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithoutSids.java 2011-06-03 11:01:17 UTC (rev 4612) @@ -92,6 +92,8 @@ suite.addTestSuite(com.bigdata.rdf.sail.TestMillisecondPrecisionForInlineDateTimes.class); + suite.addTestSuite(com.bigdata.rdf.sail.TestTicket276.class); + return suite; } Added: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestTicket276.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestTicket276.java (rev 0) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestTicket276.java 2011-06-03 11:01:17 UTC (rev 4612) @@ -0,0 +1,183 @@ +/** +Copyright (C) SYSTAP, LLC 2011. All rights reserved. + +Contact: + SYSTAP, LLC + 4501 Tower Road + Greensboro, NC 27410 + lic...@bi... + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +package com.bigdata.rdf.sail; + +import java.io.IOException; +import java.util.Properties; + +import org.openrdf.OpenRDFException; +import org.openrdf.model.Statement; +import org.openrdf.model.ValueFactory; +import org.openrdf.query.MalformedQueryException; +import org.openrdf.query.QueryEvaluationException; +import org.openrdf.query.QueryLanguage; +import org.openrdf.query.TupleQuery; +import org.openrdf.query.TupleQueryResult; +import org.openrdf.repository.RepositoryConnection; +import org.openrdf.repository.RepositoryException; +import org.openrdf.repository.sail.SailRepository; +import org.openrdf.rio.RDFFormat; +import org.openrdf.rio.RDFHandlerException; +import org.openrdf.rio.RDFParseException; +import org.openrdf.rio.RDFParser; +import org.openrdf.rio.Rio; +import org.openrdf.rio.helpers.RDFHandlerBase; +import org.openrdf.sail.memory.MemoryStore; + +import com.bigdata.rdf.axioms.NoAxioms; +import com.bigdata.rdf.vocab.NoVocabulary; + +/** + * Unit test template for use in submission of bugs. + * <p> + * This test case will delegate to an underlying backing store. You can specify + * this store via a JVM property as follows: + * <code>-DtestClass=com.bigdata.rdf.sail.TestBigdataSailWithQuads</code> + * <p> + * There are three possible configurations for the testClass: + * <ul> + * <li>com.bigdata.rdf.sail.TestBigdataSailWithQuads (quads mode)</li> + * <li>com.bigdata.rdf.sail.TestBigdataSailWithoutSids (triples mode)</li> + * <li>com.bigdata.rdf.sail.TestBigdataSailWithSids (SIDs mode)</li> + * </ul> + * <p> + * The default for triples and SIDs mode is for inference with truth maintenance + * to be on. If you would like to turn off inference, make sure to do so in + * {@link #getProperties()}. + * + * @author <a href="mailto:mrp...@us...">Mike Personick</a> + * @version $Id$ + * + * @see https://sourceforge.net/apps/trac/bigdata/ticket/276 + */ +public class TestTicket276 extends QuadsTestCase { + + public TestTicket276() { + } + + public TestTicket276(String arg0) { + super(arg0); + } + + /** + * Please set your database properties here, except for your journal file, + * please DO NOT SPECIFY A JOURNAL FILE. + */ + @Override + public Properties getProperties() { + + final Properties props = super.getProperties(); + + /* + * For example, here is a set of five properties that turns off + * inference, truth maintenance, and the free text index. + */ + props.setProperty(BigdataSail.Options.AXIOMS_CLASS, + NoAxioms.class.getName()); + props.setProperty(BigdataSail.Options.VOCABULARY_CLASS, + NoVocabulary.class.getName()); + props.setProperty(BigdataSail.Options.TRUTH_MAINTENANCE, "false"); + props.setProperty(BigdataSail.Options.JUSTIFY, "false"); + props.setProperty(BigdataSail.Options.INLINE_DATE_TIMES, "true"); + props.setProperty(BigdataSail.Options.ISOLATABLE_INDICES, "true"); + props.setProperty(BigdataSail.Options.EXACT_SIZE, "true"); + props.setProperty(BigdataSail.Options.ALLOW_SESAME_QUERY_EVALUATION, + "false"); + props.setProperty( + com.bigdata.rdf.store.AbstractTripleStore.Options.STATEMENT_IDENTIFIERS, + "false"); + + return props; + + } + + public void testBug() throws Exception { + + // try with Sesame MemoryStore: + executeQuery(new SailRepository(new MemoryStore())); + + final BigdataSail sail = getSail(); + try { + // fails with UnsupportedOperationException + executeQuery(new SailRepository(sail)); + } finally { + sail.__tearDownUnitTest(); + } + + } + + private void executeQuery(final SailRepository repo) + throws RepositoryException, MalformedQueryException, + QueryEvaluationException, RDFParseException, IOException, + RDFHandlerException { + try { + repo.initialize(); + RepositoryConnection conn = repo.getConnection(); + try { + ValueFactory vf = conn.getValueFactory(); + addData(conn); + + final String query = "SELECT ?x { ?x ?a ?t . ?x ?lookup ?l }"; + TupleQuery q = conn.prepareTupleQuery(QueryLanguage.SPARQL, + query); + q.setBinding( + "a", + vf.createURI("http://www.w3.org/1999/02/22-rdf-syntax-ns#type")); + q.setBinding("t", vf.createURI("os:class/Location")); + q.setBinding("lookup", vf.createURI("os:prop/lookupName")); + q.setBinding("l", vf.createLiteral("amsterdam")); + TupleQueryResult tqr = q.evaluate(); + while (tqr.hasNext()) + System.out.println(tqr.next().getBindingNames()); + tqr.close(); + } finally { + conn.close(); + } + } finally { + repo.shutDown(); + } + } + + private void addData(final RepositoryConnection conn) throws IOException, + RDFParseException, RepositoryException, RDFHandlerException { + + final RDFParser rdfParser = Rio.createParser(RDFFormat.NTRIPLES, + conn.getValueFactory()); + rdfParser.setVerifyData(true); + rdfParser.setStopAtFirstError(true); + rdfParser.setDatatypeHandling(RDFParser.DatatypeHandling.IGNORE); + rdfParser.setRDFHandler(new RDFHandlerBase() { + @Override + public void handleStatement(Statement st) + throws RDFHandlerException { + try { + conn.add(st); + } catch (OpenRDFException e) { + throw new RDFHandlerException(e); + } + } + }); + rdfParser.parse(getClass().getResourceAsStream("TestTicket276.n3"), ""); + } +} Property changes on: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestTicket276.java ___________________________________________________________________ Added: svn:keywords + Id Date Revision Author HeadURL Added: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestTicket276.n3 =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestTicket276.n3 (rev 0) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestTicket276.n3 2011-06-03 11:01:17 UTC (rev 4612) @@ -0,0 +1,83 @@ +<os:class/NamedEntity> <http://www.w3.org/2000/01/rdf-schema#label> "NamedEntity" . +<os:class/Organization> <http://www.w3.org/2000/01/rdf-schema#subClassOf> <os:class/NamedEntity> . +<os:class/Organization> <http://www.w3.org/2000/01/rdf-schema#label> "Organization" . +<os:class/Location> <http://www.w3.org/2000/01/rdf-schema#subClassOf> <os:class/NamedEntity> . +<os:class/Location> <http://www.w3.org/2000/01/rdf-schema#label> "Location" . +<os:elem/loc/Nederland> <http://www.w3.org/2000/01/rdf-schema#label> "Nederland" . +<os:elem/loc/Nederland> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <os:class/Location> . +<os:elem/loc/Nederland> <os:prop/lookupName> "nederland" . +<os:elem/loc/Nederland> <os:prop/dateCreated> "2011-04-01T12:21:56.449Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> . +<os:elem/loc/Nederland> <os:prop/loc/locationType> "city" . +<os:elem/loc/Noord-Holland> <http://www.w3.org/2000/01/rdf-schema#label> "Noord-Holland" . +<os:elem/loc/Noord-Holland> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <os:class/Location> . +<os:elem/loc/Noord-Holland> <os:prop/lookupName> "noord-holland" . +<os:elem/loc/Noord-Holland> <os:prop/dateCreated> "2011-04-01T12:21:56.494Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> . +<os:elem/loc/Noord-Holland> <os:prop/loc/locationType> "city" . +<os:elem/loc/Noord-Brabant> <http://www.w3.org/2000/01/rdf-schema#label> "Noord-Brabant" . +<os:elem/loc/Noord-Brabant> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <os:class/Location> . +<os:elem/loc/Noord-Brabant> <os:prop/lookupName> "noord-brabant" . +<os:elem/loc/Noord-Brabant> <os:prop/dateCreated> "2011-04-01T12:21:56.544Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> . +<os:elem/loc/Noord-Brabant> <os:prop/loc/locationType> "city" . +<os:elem/loc/Eindhoven> <http://www.w3.org/2000/01/rdf-schema#label> "Eindhoven" . +<os:elem/loc/Eindhoven> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <os:class/Location> . +<os:elem/loc/Eindhoven> <os:prop/lookupName> "eindhoven" . +<os:elem/loc/Eindhoven> <os:prop/dateCreated> "2011-04-01T12:21:56.581Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> . +<os:elem/loc/Eindhoven> <os:prop/loc/locationType> "city" . +<os:elem/loc/Amsterdam> <http://www.w3.org/2000/01/rdf-schema#label> "Amsterdam" . +<os:elem/loc/Amsterdam> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <os:class/Location> . +<os:elem/loc/Amsterdam> <os:prop/lookupName> "amsterdam" . +<os:elem/loc/Amsterdam> <os:prop/dateCreated> "2011-04-01T12:21:56.608Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> . +<os:elem/loc/Amsterdam> <os:prop/loc/locationType> "city" . +<os:elem/loc/Eindhoven_2> <http://www.w3.org/2000/01/rdf-schema#label> "Eindhoven" . +<os:elem/loc/Eindhoven_2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <os:class/Location> . +<os:elem/loc/Eindhoven_2> <os:prop/lookupName> "eindhoven" . +<os:elem/loc/Eindhoven_2> <os:prop/dateCreated> "2011-04-01T12:21:56.649Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> . +<os:elem/loc/Eindhoven_2> <os:prop/loc/locationType> "municipality" . +<os:elem/loc/Amsterdam_2> <http://www.w3.org/2000/01/rdf-schema#label> "Amsterdam" . +<os:elem/loc/Amsterdam_2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <os:class/Location> . +<os:elem/loc/Amsterdam_2> <os:prop/lookupName> "amsterdam" . +<os:elem/loc/Amsterdam_2> <os:prop/dateCreated> "2011-04-01T12:21:56.679Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> . +<os:elem/loc/Amsterdam_2> <os:prop/loc/locationType> "municipality" . +<os:elem/loc/Amsterdam+Zuid-Oost> <http://www.w3.org/2000/01/rdf-schema#label> "Amsterdam Zuid-Oost" . +<os:elem/loc/Amsterdam+Zuid-Oost> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <os:class/Location> . +<os:elem/loc/Amsterdam+Zuid-Oost> <os:prop/lookupName> "amsterdam zuid-oost" . +<os:elem/loc/Amsterdam+Zuid-Oost> <os:prop/dateCreated> "2011-04-01T12:21:56.703Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> . +<os:elem/loc/Amsterdam+Zuid-Oost> <os:prop/loc/locationType> "district" . +<os:elem/loc/Waalstraat> <http://www.w3.org/2000/01/rdf-schema#label> "Waalstraat" . +<os:elem/loc/Waalstraat> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <os:class/Location> . +<os:elem/loc/Waalstraat> <os:prop/lookupName> "waalstraat" . +<os:elem/loc/Waalstraat> <os:prop/dateCreated> "2011-04-01T12:21:56.737Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> . +<os:elem/loc/Waalstraat> <os:prop/loc/locationType> "street" . +<os:elem/loc/Noord-Holland> <os:prop/loc/partOf> <os:elem/loc/Nederland> . +<os:elem/loc/Noord-Brabant> <os:prop/loc/partOf> <os:elem/loc/Nederland> . +<os:elem/loc/Waalstraat_2> <http://www.w3.org/2000/01/rdf-schema#label> "Waalstraat" . +<os:elem/loc/Waalstraat_2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <os:class/Location> . +<os:elem/loc/Waalstraat_2> <os:prop/lookupName> "waalstraat" . +<os:elem/loc/Waalstraat_2> <os:prop/dateCreated> "2011-04-01T12:21:56.761Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> . +<os:elem/loc/Waalstraat_2> <os:prop/loc/locationType> "street" . +<os:elem/loc/Eindhoven> <os:prop/loc/partOf> <os:elem/loc/Nederland> . +<os:elem/loc/Eindhoven> <os:prop/loc/partOf> <os:elem/loc/Noord-Brabant> . +<os:elem/loc/Amsterdam> <os:prop/loc/partOf> <os:elem/loc/Nederland> . +<os:elem/loc/Amsterdam> <os:prop/loc/partOf> <os:elem/loc/Noord-Holland> . +<os:elem/loc/Eindhoven_2> <os:prop/loc/partOf> <os:elem/loc/Nederland> . +<os:elem/loc/Eindhoven_2> <os:prop/loc/partOf> <os:elem/loc/Noord-Brabant> . +<os:elem/loc/Eindhoven_2> <os:prop/loc/partOf> <os:elem/loc/Eindhoven> . +<os:elem/loc/Amsterdam_2> <os:prop/loc/partOf> <os:elem/loc/Nederland> . +<os:elem/loc/Amsterdam_2> <os:prop/loc/partOf> <os:elem/loc/Noord-Holland> . +<os:elem/loc/Amsterdam_2> <os:prop/loc/partOf> <os:elem/loc/Amsterdam> . +<os:elem/loc/Amsterdam+Zuid-Oost> <os:prop/loc/partOf> <os:elem/loc/Nederland> . +<os:elem/loc/Amsterdam+Zuid-Oost> <os:prop/loc/partOf> <os:elem/loc/Noord-Holland> . +<os:elem/loc/Amsterdam+Zuid-Oost> <os:prop/loc/partOf> <os:elem/loc/Amsterdam> . +<os:elem/loc/Amsterdam+Zuid-Oost> <os:prop/loc/partOf> <os:elem/loc/Amsterdam_2> . +<os:elem/loc/Waalstraat> <os:prop/loc/partOf> <os:elem/loc/Nederland> . +<os:elem/loc/Waalstraat> <os:prop/loc/partOf> <os:elem/loc/Noord-Brabant> . +<os:elem/loc/Waalstraat> <os:prop/loc/partOf> <os:elem/loc/Eindhoven> . +<os:elem/loc/Waalstraat_2> <os:prop/loc/partOf> <os:elem/loc/Nederland> . +<os:elem/loc/Waalstraat_2> <os:prop/loc/partOf> <os:elem/loc/Noord-Holland> . +<os:elem/loc/Waalstraat_2> <os:prop/loc/partOf> <os:elem/loc/Amsterdam> . +<os:elem/loc/Waalstraat_2> <os:prop/loc/partOf> <os:elem/loc/Amsterdam_2> . +<os:elem/loc/Waalstraat_2> <os:prop/loc/partOf> <os:elem/loc/Amsterdam+Zuid-Oost> . +<os:elem/Organization/inbedrijf+naam> <http://www.w3.org/2000/01/rdf-schema#label> "inbedrijf naam" . +<os:elem/Organization/inbedrijf+naam> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <os:class/Organization> . +<os:elem/Organization/inbedrijf+naam> <os:prop/lookupName> "inbedrijf naam" . +<os:elem/Organization/inbedrijf+naam> <os:prop/dateCreated> "2011-04-01T12:21:57.916Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> . \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tho...@us...> - 2011-06-03 11:48:31
|
Revision: 4614 http://bigdata.svn.sourceforge.net/bigdata/?rev=4614&view=rev Author: thompsonbry Date: 2011-06-03 11:48:25 +0000 (Fri, 03 Jun 2011) Log Message: ----------- The test case for [1] now runs without error. I have incorporated the unit test into the test suite to protect against regressions. No code changes were required so this was already fixed as a side-effect of some earlier changes. [1] https://sourceforge.net/apps/trac/bigdata/ticket/275 (IllegalArgumentException in com.bigdata.bop.Constant) Modified Paths: -------------- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithQuads.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithSids.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithoutSids.java Added Paths: ----------- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestTicket275.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestTicket275.ttl Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithQuads.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithQuads.java 2011-06-03 11:35:18 UTC (rev 4613) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithQuads.java 2011-06-03 11:48:25 UTC (rev 4614) @@ -116,6 +116,7 @@ suite.addTestSuite(com.bigdata.rdf.sail.TestMillisecondPrecisionForInlineDateTimes.class); + suite.addTestSuite(com.bigdata.rdf.sail.TestTicket275.class); suite.addTestSuite(com.bigdata.rdf.sail.TestTicket276.class); suite.addTestSuite(com.bigdata.rdf.sail.DavidsTestBOps.class); Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithSids.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithSids.java 2011-06-03 11:35:18 UTC (rev 4613) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithSids.java 2011-06-03 11:48:25 UTC (rev 4614) @@ -98,6 +98,7 @@ suite.addTestSuite(com.bigdata.rdf.sail.TestMillisecondPrecisionForInlineDateTimes.class); + suite.addTestSuite(com.bigdata.rdf.sail.TestTicket275.class); suite.addTestSuite(com.bigdata.rdf.sail.TestTicket276.class); return suite; Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithoutSids.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithoutSids.java 2011-06-03 11:35:18 UTC (rev 4613) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithoutSids.java 2011-06-03 11:48:25 UTC (rev 4614) @@ -92,6 +92,7 @@ suite.addTestSuite(com.bigdata.rdf.sail.TestMillisecondPrecisionForInlineDateTimes.class); + suite.addTestSuite(com.bigdata.rdf.sail.TestTicket275.class); suite.addTestSuite(com.bigdata.rdf.sail.TestTicket276.class); return suite; Added: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestTicket275.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestTicket275.java (rev 0) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestTicket275.java 2011-06-03 11:48:25 UTC (rev 4614) @@ -0,0 +1,115 @@ +/** +Copyright (C) SYSTAP, LLC 2011. All rights reserved. + +Contact: + SYSTAP, LLC + 4501 Tower Road + Greensboro, NC 27410 + lic...@bi... + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +package com.bigdata.rdf.sail; + +import java.io.IOException; +import java.util.Set; + +import org.openrdf.query.MalformedQueryException; +import org.openrdf.query.QueryEvaluationException; +import org.openrdf.query.QueryLanguage; +import org.openrdf.query.TupleQuery; +import org.openrdf.query.TupleQueryResult; +import org.openrdf.repository.RepositoryConnection; +import org.openrdf.repository.RepositoryException; +import org.openrdf.repository.sail.SailRepository; +import org.openrdf.rio.RDFFormat; +import org.openrdf.rio.RDFParseException; +import org.openrdf.sail.memory.MemoryStore; + +/** + * Unit test template for use in submission of bugs. + * <p> + * This test case will delegate to an underlying backing store. You can specify + * this store via a JVM property as follows: + * <code>-DtestClass=com.bigdata.rdf.sail.TestBigdataSailWithQuads</code> + * <p> + * There are three possible configurations for the testClass: + * <ul> + * <li>com.bigdata.rdf.sail.TestBigdataSailWithQuads (quads mode)</li> + * <li>com.bigdata.rdf.sail.TestBigdataSailWithoutSids (triples mode)</li> + * <li>com.bigdata.rdf.sail.TestBigdataSailWithSids (SIDs mode)</li> + * </ul> + * <p> + * The default for triples and SIDs mode is for inference with truth maintenance + * to be on. If you would like to turn off inference, make sure to do so in + * {@link #getProperties()}. + * + * @author <a href="mailto:mrp...@us...">Mike Personick</a> + * @version $Id$ + * + * @see https://sourceforge.net/apps/trac/bigdata/ticket/275 + */ +public class TestTicket275 extends QuadsTestCase { + + public TestTicket275() { + } + + public TestTicket275(String arg0) { + super(arg0); + } + + public void testBug() throws Exception { + + // try with Sesame MemoryStore: + executeQuery(new SailRepository(new MemoryStore())); + + final BigdataSail sail = getSail(); + try { + executeQuery(new SailRepository(sail)); + } finally { + sail.__tearDownUnitTest(); + } + } + + private void executeQuery(final SailRepository repo) + throws RepositoryException, MalformedQueryException, + QueryEvaluationException, RDFParseException, IOException { + try { + repo.initialize(); + final RepositoryConnection conn = repo.getConnection(); + try { + conn.add(getClass().getResourceAsStream("TestTicket275.ttl"), "", + RDFFormat.TURTLE); + + final String query = "SELECT ?lookup WHERE { ?lookup <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <os:class/Lookup> . ?lookup <os:prop/lookup/majorType> ?majorType . OPTIONAL{?lookup <os:prop/lookup/minorType> ?minorType}. FILTER(STR(?majorType) = ?argMajorType). FILTER(!bound(?minorType))}"; + final TupleQuery q = conn.prepareTupleQuery(QueryLanguage.SPARQL, + query); + q.setBinding("argMajorType", conn.getValueFactory() + .createLiteral("majoor")); + final TupleQueryResult tqr = q.evaluate(); + while (tqr.hasNext()) { + final Set<String> bindingNames = tqr.next().getBindingNames(); + if(log.isInfoEnabled()) + log.info("bindingNames="+bindingNames); + } + tqr.close(); + } finally { + conn.close(); + } + } finally { + repo.shutDown(); + } + } +} Property changes on: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestTicket275.java ___________________________________________________________________ Added: svn:keywords + Id Date Revision Author HeadURL Added: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestTicket275.ttl =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestTicket275.ttl (rev 0) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestTicket275.ttl 2011-06-03 11:48:25 UTC (rev 4614) @@ -0,0 +1,8 @@ +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . + +<os:elem/lookup/major/Piet+%26+sint> a <os:class/Lookup> ; + <http://www.w3.org/2000/01/rdf-schema#label> "Piet & sint" ; + <os:prop/lookup/text> "Piet & sint" ; + <os:prop/lookup/majorType> "major" ; + <os:prop/lookup/minorType> "minor" . \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tho...@us...> - 2011-06-09 17:32:08
|
Revision: 4664 http://bigdata.svn.sourceforge.net/bigdata/?rev=4664&view=rev Author: thompsonbry Date: 2011-06-09 17:32:01 +0000 (Thu, 09 Jun 2011) Log Message: ----------- Clean out some uses of System.err in the sail test suites. Modified Paths: -------------- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestNestedOptionals.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestOptionals.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestSetBinding.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestUnions.java Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestNestedOptionals.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestNestedOptionals.java 2011-06-09 17:26:40 UTC (rev 4663) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestNestedOptionals.java 2011-06-09 17:32:01 UTC (rev 4664) @@ -30,7 +30,6 @@ import java.util.LinkedList; import java.util.Map; import java.util.Properties; -import java.util.concurrent.atomic.AtomicInteger; import org.apache.log4j.Logger; import org.openrdf.model.Literal; @@ -48,17 +47,12 @@ import org.openrdf.repository.RepositoryConnection; import org.openrdf.repository.sail.SailTupleQuery; -import com.bigdata.bop.BOpUtility; -import com.bigdata.bop.PipelineOp; -import com.bigdata.bop.engine.QueryEngine; import com.bigdata.rdf.axioms.NoAxioms; import com.bigdata.rdf.sail.sop.SOp; -import com.bigdata.rdf.sail.sop.SOp2BOpUtility; import com.bigdata.rdf.sail.sop.SOpTree; +import com.bigdata.rdf.sail.sop.SOpTreeBuilder; import com.bigdata.rdf.sail.sop.SOpTree.SOpGroup; import com.bigdata.rdf.sail.sop.SOpTree.SOpGroups; -import com.bigdata.rdf.sail.sop.SOpTreeBuilder; -import com.bigdata.rdf.store.AbstractTripleStore; import com.bigdata.rdf.store.BD; import com.bigdata.rdf.vocab.NoVocabulary; @@ -792,21 +786,21 @@ final SOpTreeBuilder stb = new SOpTreeBuilder(); final SOpTree tree = stb.collectSOps(tupleExpr); - if (INFO) { - System.err.println(query); + if (log.isInfoEnabled()) { + log.info(query); for (SOp bop : tree) { - System.err.println(bop); + log.info(bop); } for (Map.Entry<Integer, SOpGroup> e : tree.allGroups.entrySet()) { final SOpGroup g = e.getValue(); - System.err.println(e.getKey() + ": g=" + g.getGroup() + " pg=" + g.getParentGroup()); + log.info(e.getKey() + ": g=" + g.getGroup() + " pg=" + g.getParentGroup()); for (SOp sop : e.getValue()) { - System.err.println(" " + sop); + log.info(" " + sop); } } for (Map.Entry<Integer, SOpGroup> e : tree.parents.entrySet()) { - System.err.println(e.getKey() + ": " + e.getValue().getGroup()); + log.info(e.getKey() + ": " + e.getValue().getGroup()); } for (Map.Entry<Integer, SOpGroups> e : tree.children.entrySet()) { final SOpGroups groups = e.getValue(); @@ -815,7 +809,7 @@ sb.append(g.getGroup()).append(", "); } sb.setLength(sb.length()-2); - System.err.println(e.getKey() + ": {" + sb.toString() + "}"); + log.info(e.getKey() + ": {" + sb.toString() + "}"); } } Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestOptionals.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestOptionals.java 2011-06-09 17:26:40 UTC (rev 4663) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestOptionals.java 2011-06-09 17:32:01 UTC (rev 4664) @@ -236,7 +236,9 @@ q.setBinding("subj", vf.createURI("u:1")); TupleQueryResult tqr = q.evaluate(); assertTrue(tqr.hasNext()); - System.err.println(tqr.next()); + final BindingSet tmp = tqr.next(); + if (log.isInfoEnabled()) + log.info(tmp); tqr.close(); } finally { Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestSetBinding.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestSetBinding.java 2011-06-09 17:26:40 UTC (rev 4663) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestSetBinding.java 2011-06-09 17:32:01 UTC (rev 4664) @@ -23,31 +23,22 @@ package com.bigdata.rdf.sail; -import java.io.InputStream; import java.io.StringReader; -import java.util.Iterator; import java.util.Properties; + import org.openrdf.model.Literal; import org.openrdf.model.Resource; import org.openrdf.model.Statement; -import org.openrdf.model.URI; import org.openrdf.model.ValueFactory; -import org.openrdf.model.impl.LiteralImpl; -import org.openrdf.model.impl.URIImpl; -import org.openrdf.model.vocabulary.RDF; -import org.openrdf.model.vocabulary.RDFS; import org.openrdf.query.BindingSet; -import org.openrdf.query.GraphQueryResult; import org.openrdf.query.QueryLanguage; import org.openrdf.query.TupleQuery; import org.openrdf.query.TupleQueryResult; -import org.openrdf.query.algebra.TupleExpr; import org.openrdf.repository.RepositoryResult; import org.openrdf.rio.RDFFormat; -import com.bigdata.rdf.axioms.NoAxioms; + import com.bigdata.rdf.internal.IV; import com.bigdata.rdf.model.BigdataLiteral; -import com.bigdata.rdf.vocab.NoVocabulary; /** * @author <a href="mailto:mrp...@us...">Mike Personick</a> @@ -115,7 +106,7 @@ " ns:buffy rdfs:label \"Buffy\"; " + " ns:weight \"8\"."; - System.err.println("Loading data"); + if(log.isInfoEnabled())log.info("Loading data"); // final ClassLoader cl = getClass().getClassLoader(); // final InputStream is = cl.getResourceAsStream("data.ttl"); // cxn.add(is, "", RDFFormat.TURTLE, new Resource[0]); @@ -125,7 +116,9 @@ RepositoryResult<Statement> stmts = cxn.getStatements(null, null, null, false); while(stmts.hasNext()) { - System.err.println(stmts.next()); + final Statement tmp = stmts.next(); + if(log.isInfoEnabled()) + log.info(tmp); } // Second step, query data. Load query from resource and execute. @@ -133,8 +126,11 @@ + "\nPREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>" + "\nSELECT ?name ?weight WHERE {" + "\n?uri rdfs:label ?name." + "\n?uri ns:weight ?weight." - + "\n}"; System.err.println("Executing query: " + query); - + + "\n}"; + + if (log.isInfoEnabled()) + log.info("Executing query: " + query); + final TupleQuery q = cxn.prepareTupleQuery( QueryLanguage.SPARQL, query); Literal snowball = vf.createLiteral("Snowball"); @@ -151,11 +147,12 @@ final TupleQueryResult res = q.evaluate(); while (res.hasNext()) { final BindingSet set = (BindingSet) res.next(); - System.err.println("Found: " + set.getValue("name") - + " = " + set.getValue("weight")); + if (log.isInfoEnabled()) + log.info("Found: " + set.getValue("name") + " = " + + set.getValue("weight")); } - System.err.println("Done..."); +// System.err.println("Done..."); } finally { cxn.close(); Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestUnions.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestUnions.java 2011-06-09 17:26:40 UTC (rev 4663) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestUnions.java 2011-06-09 17:32:01 UTC (rev 4664) @@ -284,7 +284,7 @@ tupleQuery.setIncludeInferred(true /* includeInferred */); tupleQuery.evaluate(new SPARQLResultsXMLWriter(new XMLWriter(sw))); - System.err.println(sw.toString()); + if(log.isInfoEnabled())log.info(sw.toString()); } } finally { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tho...@us...> - 2011-06-16 16:13:11
|
Revision: 4716 http://bigdata.svn.sourceforge.net/bigdata/?rev=4716&view=rev Author: thompsonbry Date: 2011-06-16 16:13:05 +0000 (Thu, 16 Jun 2011) Log Message: ----------- Added the new TestMROWTransactions stress test into CI for the sids, triples only, and quads modes. Modified Paths: -------------- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithQuads.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithSids.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithoutSids.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestMROWTransactions.java Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithQuads.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithQuads.java 2011-06-16 15:58:37 UTC (rev 4715) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithQuads.java 2011-06-16 16:13:05 UTC (rev 4716) @@ -113,6 +113,7 @@ suite.addTestSuite(com.bigdata.rdf.sail.TestRollbacks.class); suite.addTestSuite(com.bigdata.rdf.sail.TestRollbacksTx.class); + suite.addTestSuite(com.bigdata.rdf.sail.TestMROWTransactions.class); suite.addTestSuite(com.bigdata.rdf.sail.TestMillisecondPrecisionForInlineDateTimes.class); Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithSids.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithSids.java 2011-06-16 15:58:37 UTC (rev 4715) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithSids.java 2011-06-16 16:13:05 UTC (rev 4716) @@ -95,7 +95,8 @@ suite.addTestSuite(com.bigdata.rdf.sail.TestRollbacks.class); suite.addTestSuite(com.bigdata.rdf.sail.TestRollbacksTx.class); suite.addTestSuite(com.bigdata.rdf.sail.TestRollbacksTM.class); - + suite.addTestSuite(com.bigdata.rdf.sail.TestMROWTransactions.class); + suite.addTestSuite(com.bigdata.rdf.sail.TestMillisecondPrecisionForInlineDateTimes.class); suite.addTestSuite(com.bigdata.rdf.sail.TestTicket275.class); Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithoutSids.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithoutSids.java 2011-06-16 15:58:37 UTC (rev 4715) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithoutSids.java 2011-06-16 16:13:05 UTC (rev 4716) @@ -89,7 +89,8 @@ suite.addTestSuite(com.bigdata.rdf.sail.TestRollbacks.class); suite.addTestSuite(com.bigdata.rdf.sail.TestRollbacksTx.class); suite.addTestSuite(com.bigdata.rdf.sail.TestRollbacksTM.class); - + suite.addTestSuite(com.bigdata.rdf.sail.TestMROWTransactions.class); + suite.addTestSuite(com.bigdata.rdf.sail.TestMillisecondPrecisionForInlineDateTimes.class); suite.addTestSuite(com.bigdata.rdf.sail.TestTicket275.class); Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestMROWTransactions.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestMROWTransactions.java 2011-06-16 15:58:37 UTC (rev 4715) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/test/com/bigdata/rdf/sail/TestMROWTransactions.java 2011-06-16 16:13:05 UTC (rev 4716) @@ -260,7 +260,7 @@ writes.increment(); // System.out.print('.'); } - System.out.println("\n"); +// System.out.println("\n"); } finally { origStore.commit(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |