This list is closed, nobody may subscribe to it.
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(139) |
Aug
(94) |
Sep
(232) |
Oct
(143) |
Nov
(138) |
Dec
(55) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2011 |
Jan
(127) |
Feb
(90) |
Mar
(101) |
Apr
(74) |
May
(148) |
Jun
(241) |
Jul
(169) |
Aug
(121) |
Sep
(157) |
Oct
(199) |
Nov
(281) |
Dec
(75) |
2012 |
Jan
(107) |
Feb
(122) |
Mar
(184) |
Apr
(73) |
May
(14) |
Jun
(49) |
Jul
(26) |
Aug
(103) |
Sep
(133) |
Oct
(61) |
Nov
(51) |
Dec
(55) |
2013 |
Jan
(59) |
Feb
(72) |
Mar
(99) |
Apr
(62) |
May
(92) |
Jun
(19) |
Jul
(31) |
Aug
(138) |
Sep
(47) |
Oct
(83) |
Nov
(95) |
Dec
(111) |
2014 |
Jan
(125) |
Feb
(60) |
Mar
(119) |
Apr
(136) |
May
(270) |
Jun
(83) |
Jul
(88) |
Aug
(30) |
Sep
(47) |
Oct
(27) |
Nov
(23) |
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(3) |
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
(4) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <jer...@us...> - 2014-01-24 23:39:46
|
Revision: 7828 http://bigdata.svn.sourceforge.net/bigdata/?rev=7828&view=rev Author: jeremy_carroll Date: 2014-01-24 23:39:36 +0000 (Fri, 24 Jan 2014) Log Message: ----------- Tests and preparation for fixing of trac 807 concerning native distinct filter of insert/delete quads Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/QueryBase.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/AST2BOpUpdate.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/ASTConstructIterator.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/optimizers/ASTConstructOptimizer.java branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/TestNanoSparqlServerWithProxyIndexManager.java Added Paths: ----------- branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/AbstractNamedGraphUpdateTest.java branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/HashDistinctNamedGraphUpdateTest.java branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/NativeDistinctNamedGraphUpdateTest.java Removed Paths: ------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/NamedGraphUpdateTest.java Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/QueryBase.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/QueryBase.java 2014-01-24 18:42:02 UTC (rev 7827) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/QueryBase.java 2014-01-24 23:39:36 UTC (rev 7828) @@ -178,6 +178,7 @@ public void setConstruct(final ConstructNode construct) { setProperty(Annotations.CONSTRUCT, construct); + setQueryType(QueryType.CONSTRUCT); } Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/AST2BOpUpdate.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/AST2BOpUpdate.java 2014-01-24 18:42:02 UTC (rev 7827) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/AST2BOpUpdate.java 2014-01-24 23:39:36 UTC (rev 7828) @@ -595,10 +595,18 @@ * associated with the SailConnection in case the view is * isolated by a transaction. */ + + // If the query contains a nativeDistinctSPO query hint then + // the line below unfortunately isolates the query so that the hint does + // not impact any other execution, this is hacked by putting a property on the query root. + final MutableTupleQueryResult result = new MutableTupleQueryResult( ASTEvalHelper.evaluateTupleQuery( context.conn.getTripleStore(), astContainer, null/* bindingSets */)); + + boolean nativeDistinct = astContainer.getOptimizedAST().getProperty(ConstructNode.Annotations.NATIVE_DISTINCT, + ConstructNode.Annotations.DEFAULT_NATIVE_DISTINCT); try { @@ -745,6 +753,10 @@ .getQuadData().flatten(new ConstructNode(context)); template.setDistinctQuads(true); + + if (nativeDistinct) { + template.setNativeDistinct(true); + } final ASTConstructIterator itr = new ASTConstructIterator( context.conn.getTripleStore(), template, @@ -816,6 +828,10 @@ .getQuadData().flatten(new ConstructNode(context)); template.setDistinctQuads(true); + + if (nativeDistinct) { + template.setNativeDistinct(true); + } final ASTConstructIterator itr = new ASTConstructIterator( context.conn.getTripleStore(), template, Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/ASTConstructIterator.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/ASTConstructIterator.java 2014-01-24 18:42:02 UTC (rev 7827) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/ASTConstructIterator.java 2014-01-24 23:39:36 UTC (rev 7828) @@ -188,13 +188,15 @@ private boolean open = true; /** - * <code>true</code> until we get the first solution for the WHERE clause. + * <code>false</code> until we get the first solution for the WHERE clause. * We do not output ground triples in the template until we see that first * solution. It is Ok if it is empty, but we need to know that the WHERE * clause succeeded before we can output the ground triples. */ - private boolean haveFirstSolution = false; + private boolean haveFirstSolution = false; + public static boolean flagToCheckNativeDistinctQuadsInvocationForJUnitTesting = false; + /** * * @param tripleStore @@ -283,7 +285,7 @@ } - IFilterTest createDistinctFilter(final AbstractTripleStore tripleStore, final ConstructNode construct, + private IFilterTest createDistinctFilter(final AbstractTripleStore tripleStore, final ConstructNode construct, final GraphPatternGroup<?> whereClause) { /* * Setup the DISTINCT SPO filter. @@ -296,6 +298,13 @@ * graph is large. */ + final boolean distinctQuads = construct.isDistinctQuads() && tripleStore.isQuads() && hasMixedQuadData(templates); + final boolean nativeDistinct = construct.isNativeDistinct(); + + if (nativeDistinct && construct.isDistinctQuads()) { + flagToCheckNativeDistinctQuadsInvocationForJUnitTesting = true; + } + final boolean isObviouslyDistinct = isObviouslyDistinct(tripleStore.isQuads(), templates, whereClause); if (isObviouslyDistinct) { @@ -307,20 +316,33 @@ } - - final boolean distinctQuads = construct.isDistinctQuads() && tripleStore.isQuads() && hasMixedQuadData(templates); - if (distinctQuads) { - return createDistinctQuadsFilter(construct); + if (nativeDistinct) { + return createNativeDistinctQuadsFilter(construct); + } else { + return createHashDistinctQuadsFilter(construct); + } + + } else { + + if (nativeDistinct) { + return createNativeDistinctTripleFilter(construct); + } else { + // JVM Based DISTINCT filter. + return new DistinctFilter.DistinctFilterImpl(construct); + } } - - return createDistinctTriplesFilter(construct); } + private IFilterTest createNativeDistinctQuadsFilter(ConstructNode construct) { + // TODO This method needs to be written. It should scale, whereas the current implementation does not. + return createHashDistinctQuadsFilter(construct); + } + @SuppressWarnings("serial") - private IFilterTest createDistinctQuadsFilter(final ConstructNode construct) { + private IFilterTest createHashDistinctQuadsFilter(final ConstructNode construct) { return new DistinctFilter.DistinctFilterImpl(construct){ @Override public boolean isValid(Object o){ @@ -352,67 +374,55 @@ return a == b || ( a != null && a.equals(b)); } - IFilterTest createDistinctTriplesFilter(final ConstructNode construct) { - - final boolean nativeDistinct = construct.isNativeDistinct(); + private IFilterTest createNativeDistinctTripleFilter(final ConstructNode construct) { + /* + * Construct a predicate for the first triple template. We will + * use that as the bias for the scalable DISTINCT SPO filter. + */ + @SuppressWarnings("rawtypes") + final IPredicate pred; + { - if (nativeDistinct) { + final StatementPatternNode sp = templates.get(0/* index */); - /* - * Construct a predicate for the first triple template. We will - * use that as the bias for the scalable DISTINCT SPO filter. - */ - @SuppressWarnings("rawtypes") - final IPredicate pred; - { + @SuppressWarnings("rawtypes") + final IVariableOrConstant<IV> s = sp.s() + .getValueExpression(); - final StatementPatternNode sp = templates.get(0/* index */); + @SuppressWarnings("rawtypes") + final IVariableOrConstant<IV> p = sp.p() + .getValueExpression(); + + @SuppressWarnings("rawtypes") + final IVariableOrConstant<IV> o = sp.o() + .getValueExpression(); - @SuppressWarnings("rawtypes") - final IVariableOrConstant<IV> s = sp.s() - .getValueExpression(); + // // The graph term/variable iff specified by the query. + // final TermNode cvar = sp.c(); + // final IVariableOrConstant<IV> c = cvar == null ? null : + // cvar + // .getValueExpression(); - @SuppressWarnings("rawtypes") - final IVariableOrConstant<IV> p = sp.p() - .getValueExpression(); - - @SuppressWarnings("rawtypes") - final IVariableOrConstant<IV> o = sp.o() - .getValueExpression(); + final BOp[] vars = new BOp[] { s, p, o /* , c */}; - // // The graph term/variable iff specified by the query. - // final TermNode cvar = sp.c(); - // final IVariableOrConstant<IV> c = cvar == null ? null : - // cvar - // .getValueExpression(); + pred = new SPOPredicate(vars, BOp.NOANNS); - final BOp[] vars = new BOp[] { s, p, o /* , c */}; + } - pred = new SPOPredicate(vars, BOp.NOANNS); + /* + * The index that will be used to read on the B+Tree access + * path. + */ + @SuppressWarnings({ "unchecked", "rawtypes" }) + final SPOKeyOrder indexKeyOrder = SPOKeyOrder.getKeyOrder( + (IPredicate) pred, 3/* keyArity */); - } + construct.setProperty( + NativeDistinctFilter.Annotations.KEY_ORDER, + indexKeyOrder); - /* - * The index that will be used to read on the B+Tree access - * path. - */ - @SuppressWarnings({ "unchecked", "rawtypes" }) - final SPOKeyOrder indexKeyOrder = SPOKeyOrder.getKeyOrder( - (IPredicate) pred, 3/* keyArity */); - - construct.setProperty( - NativeDistinctFilter.Annotations.KEY_ORDER, - indexKeyOrder); - - // Native memory based DISTINCT filter. - return new NativeDistinctFilter.DistinctFilterImpl(construct); - - } else { - - // JVM Based DISTINCT filter. - return new DistinctFilter.DistinctFilterImpl(construct); - - } + // Native memory based DISTINCT filter. + return new NativeDistinctFilter.DistinctFilterImpl(construct); } /** Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/optimizers/ASTConstructOptimizer.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/optimizers/ASTConstructOptimizer.java 2014-01-24 18:42:02 UTC (rev 7827) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/optimizers/ASTConstructOptimizer.java 2014-01-24 23:39:36 UTC (rev 7828) @@ -42,6 +42,7 @@ import com.bigdata.rdf.sparql.ast.SliceNode; import com.bigdata.rdf.sparql.ast.SubqueryRoot; import com.bigdata.rdf.sparql.ast.VarNode; +import com.bigdata.rdf.sparql.ast.ConstructNode.Annotations; import com.bigdata.rdf.sparql.ast.eval.AST2BOpContext; /** @@ -73,6 +74,9 @@ case CONSTRUCT: break; default: + if (context.nativeDistinctSPO) { + queryRoot.setProperty(Annotations.NATIVE_DISTINCT, true); + } return queryRoot; } Copied: branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/AbstractNamedGraphUpdateTest.java (from rev 7827, branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/NamedGraphUpdateTest.java) =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/AbstractNamedGraphUpdateTest.java (rev 0) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/AbstractNamedGraphUpdateTest.java 2014-01-24 23:39:36 UTC (rev 7828) @@ -0,0 +1,296 @@ +/** +Copyright (C) SYSTAP, LLC 2014. 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.webapp; + +import java.io.IOException; + +import com.bigdata.rdf.sparql.ast.eval.ASTConstructIterator; + + + +/** + * This class is concernign the issues raised in trac 804 + * https://sourceforge.net/apps/trac/bigdata/ticket/804 + * @author jeremycarroll + * + */ +public class AbstractNamedGraphUpdateTest extends AbstractProtocolTest { + + private static String distinctHintFalse = " hint:Query hint:nativeDistinctSPO false . \n"; + private static String distinctHintTrue = " hint:Query hint:nativeDistinctSPO true . \n"; + private final boolean nativeDistinct; + + + + public AbstractNamedGraphUpdateTest(boolean nativeDistinct, String name) { + super(name); + this.nativeDistinct = nativeDistinct; + } + + + private String atomicMoveNamedGraph() { + // Atomic update of uploaded graph - moving eg:tmp to eg:a (deleting old contents of eg:a) + return + "DELETE {\n" + + " GRAPH <eg:a> {\n" + + " ?olds ?oldp ?oldo\n" + + " }\n" + + " GRAPH <eg:tmp> {\n" + + " ?news ?newp ?newo\n" + + " }\n" + + "}\n" + + "INSERT {\n" + + " GRAPH <eg:a> {\n" + + " ?news ?newp ?newo\n" + + " }\n" + + "}\n" + + "WHERE {\n" + + distinctHintFalse + + " {\n" + + " GRAPH <eg:a> {\n" + + " ?olds ?oldp ?oldo\n" + + " }\n" + + " } UNION {\n" + + " GRAPH <eg:tmp> {\n" + + " ?news ?newp ?newo\n" + + " }\n" + + " }\n" + + "}"; + } + + private String insertData = + "prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" + + "INSERT DATA\n" + + "{ \n" + + " GRAPH <eg:a> {\n" + + " [ a \"Blank\" ] .\n" + + " <eg:b> rdf:type <eg:c> ; rdf:value [] .\n" + + " [ rdf:value [] ]\n" + + " }\n" + + " GRAPH <eg:tmp> {\n" + + " [ a \"Blankx\" ] .\n" + + " <eg:B> rdf:type <eg:C> ; rdf:value [] .\n" + + " [ rdf:value [] ]\n" + + " }\n" + + "}\n"; + + + private void makeUpdate(String update) throws IOException { + boolean hasHint = update.contains(distinctHintFalse); + if (hasHint) { + ASTConstructIterator.flagToCheckNativeDistinctQuadsInvocationForJUnitTesting = false; + if (nativeDistinct) { + update = update.replace(distinctHintFalse, distinctHintTrue); + } + } + setMethodisPostUrlEncodedData(); + serviceRequest("update", update); + if (hasHint) { + assertEquals(nativeDistinct, ASTConstructIterator.flagToCheckNativeDistinctQuadsInvocationForJUnitTesting ); + } + } + + private void assertQuad(String graph, String triple) throws IOException { + assertQuad("true", graph, triple); + } + + private void assertNotQuad(String graph, String triple) throws IOException { + assertQuad("false", graph, triple); + } + + void assertQuad(String expected, String graph, String triple) throws IOException { + String result = serviceRequest("query", "ASK { GRAPH " + graph + " { " + triple + "} }" ); + assertTrue(result.contains(expected)); + } + + private void updateAFewTimes(int numberOfUpdatesPerTime) throws IOException { + final int numberOfTimes = 5; + for (int i=0; i<numberOfTimes; i++) { + for (int j=0; j<numberOfUpdatesPerTime;j++) { + makeUpdate(insertData); + } + makeUpdate( atomicMoveNamedGraph() ); + assertNotQuad("<eg:tmp>", " ?s ?p ?o "); + } + } + + public void test_t_1() throws IOException { + updateAFewTimes(1); + } + public void test_t_2() throws IOException { + updateAFewTimes(2); + } + public void test_t_3() throws IOException { + updateAFewTimes(3); + } + public void test_t_5() throws IOException { + updateAFewTimes(5); + } + public void test_double_triple_delete() throws IOException { + setMethodisPostUrlEncodedData(); + makeUpdate("prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" + + "INSERT DATA\n" + + "{ \n" + + " GRAPH <eg:a> {\n" + + " <eg:b> rdf:type <eg:c> \n" + + " }\n" + + " GRAPH <eg:tmp> {\n" + + " <eg:b> rdf:type <eg:c> \n" + + " }\n" + + "}\n"); + makeUpdate( "DELETE {\n" + + " GRAPH <eg:a> {\n" + + " ?olds ?oldp ?oldo\n" + + " }\n" + + " GRAPH <eg:tmp> {\n" + + " ?olds ?oldp ?oldo\n" + + " }\n" + + "}\n" + + "WHERE {\n" + + distinctHintFalse + + " GRAPH <eg:a> {\n" + + " ?olds ?oldp ?oldo\n" + + " }\n" + + "}"); + assertNotQuad("?g","?s ?p ?o"); + + } + + public void test_double_triple_insert() throws IOException { + makeUpdate( "prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" + + "INSERT DATA\n" + + "{ \n" + + " GRAPH <eg:tmp> {\n" + + " <eg:b> rdf:type <eg:c> .\n" + + " <eg:x> rdf:type _:foo \n" + + " }\n" + + "}\n"); + makeUpdate( "INSERT {\n" + + " GRAPH <eg:A> {\n" + + " ?olds ?oldp ?oldo\n" + + " }\n" + + " GRAPH <eg:B> {\n" + + " ?olds ?oldp ?oldo\n" + + " }\n" + + "}\n" + + "WHERE {\n" + + distinctHintFalse + + " GRAPH <eg:tmp> {\n" + + " ?olds ?oldp ?oldo\n" + + " }\n" + + "}"); + assertQuad("<eg:A>","<eg:b> rdf:type <eg:c> "); + assertQuad("<eg:B>","<eg:b> rdf:type <eg:c> "); + assertQuad("<eg:A>","<eg:x> rdf:type ?x"); + assertQuad("<eg:B>","<eg:x> rdf:type ?x "); + } + public void test_double_triple_delete_insert() throws IOException { + makeUpdate( "prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" + + "INSERT DATA\n" + + "{ \n" + + " GRAPH <eg:tmp> {\n" + + " <eg:A> <eg:moveTo> <eg:AA> .\n" + + " <eg:B> <eg:moveTo> <eg:BB> \n" + + " }\n" + + "}\n"); + makeUpdate( "INSERT {\n" + + " GRAPH <eg:A> {\n" + + " ?olds ?oldp ?oldo\n" + + " }\n" + + "}\n" + + "WHERE {\n" + + " GRAPH <eg:tmp> {\n" + + " ?olds ?oldp ?oldo\n" + + " }\n" + + "}"); + makeUpdate( "INSERT {\n" + + " GRAPH <eg:B> {\n" + + " ?olds ?oldp ?oldo\n" + + " }\n" + + "}\n" + + "WHERE {\n" + + " GRAPH <eg:tmp> {\n" + + " ?olds ?oldp ?oldo\n" + + " }\n" + + "}"); + assertQuad("<eg:A>","<eg:A> <eg:moveTo> <eg:AA> "); + assertQuad("<eg:B>","<eg:A> <eg:moveTo> <eg:AA> "); + assertQuad("<eg:A>","<eg:B> <eg:moveTo> <eg:BB>"); + assertQuad("<eg:B>","<eg:B> <eg:moveTo> <eg:BB> "); + makeUpdate( + "DELETE {\n" + + " GRAPH ?oldg {\n" + + " ?olds ?oldp ?oldo\n" + + " }\n" + + "}\n" + + "INSERT {\n" + + " GRAPH ?newg {\n" + + " ?olds ?oldp ?oldo\n" + + " }\n" + + "}\n" + + "WHERE {\n" + + distinctHintFalse + + " GRAPH <eg:tmp> {\n" + + " ?oldg <eg:moveTo> ?newg\n" + + " }\n" + + " GRAPH ?oldg {\n" + + " ?olds ?oldp ?oldo\n" + + " }\n" + + "}"); + assertNotQuad("<eg:A>","<eg:A> <eg:moveTo> <eg:AA> "); + assertNotQuad("<eg:B>","<eg:A> <eg:moveTo> <eg:AA> "); + assertNotQuad("<eg:A>","<eg:B> <eg:moveTo> <eg:BB>"); + assertNotQuad("<eg:B>","<eg:B> <eg:moveTo> <eg:BB> "); + assertQuad("<eg:AA>","<eg:A> <eg:moveTo> <eg:AA> "); + assertQuad("<eg:BB>","<eg:A> <eg:moveTo> <eg:AA> "); + assertQuad("<eg:AA>","<eg:B> <eg:moveTo> <eg:BB>"); + assertQuad("<eg:BB>","<eg:B> <eg:moveTo> <eg:BB> "); + } + public void test_triple_template_and_fixed_insert() throws IOException { + makeUpdate( "prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" + + "INSERT DATA\n" + + "{ \n" + + " GRAPH <eg:tmp> {\n" + + " <eg:b> rdf:type <eg:c> .\n" + + " }\n" + + "}\n"); + makeUpdate( "INSERT {\n" + + " GRAPH <eg:A> {\n" + + " ?olds ?oldp ?oldo\n" + + " }\n" + + " GRAPH <eg:B> {\n" + + " <eg:b> rdf:type <eg:c> .\n" + + " }\n" + + "}\n" + + "WHERE {\n" + + distinctHintFalse + + " GRAPH <eg:tmp> {\n" + + " ?olds ?oldp ?oldo\n" + + " }\n" + + "}"); + assertQuad("<eg:A>","<eg:b> rdf:type <eg:c> "); + assertQuad("<eg:B>","<eg:b> rdf:type <eg:c> "); + } + +} Added: branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/HashDistinctNamedGraphUpdateTest.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/HashDistinctNamedGraphUpdateTest.java (rev 0) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/HashDistinctNamedGraphUpdateTest.java 2014-01-24 23:39:36 UTC (rev 7828) @@ -0,0 +1,36 @@ +/** +Copyright (C) SYSTAP, LLC 2014. 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.webapp; + +import junit.framework.Test; + +public class HashDistinctNamedGraphUpdateTest extends AbstractNamedGraphUpdateTest { + + static public Test suite() { + return ProxySuiteHelper.suiteWhenStandalone(HashDistinctNamedGraphUpdateTest.class,"test.*", TestMode.quads); + } + public HashDistinctNamedGraphUpdateTest(String name) { + super(false, name); + } + +} Deleted: branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/NamedGraphUpdateTest.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/NamedGraphUpdateTest.java 2014-01-24 18:42:02 UTC (rev 7827) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/NamedGraphUpdateTest.java 2014-01-24 23:39:36 UTC (rev 7828) @@ -1,289 +0,0 @@ -/** -Copyright (C) SYSTAP, LLC 2014. 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.webapp; - -import java.io.IOException; - -import junit.framework.Test; - - -/** - * This class is concernign the issues raised in trac 804 - * https://sourceforge.net/apps/trac/bigdata/ticket/804 - * @author jeremycarroll - * - */ -public class NamedGraphUpdateTest extends AbstractProtocolTest { - - - public NamedGraphUpdateTest(String name) { - super(name); - } - - - private String atomicMoveNamedGraph(boolean useHint) { - // Atomic update of uploaded graph - moving eg:tmp to eg:a (deleting old contents of eg:a) - return - "DELETE {\n" + - " GRAPH <eg:a> {\n" + - " ?olds ?oldp ?oldo\n" + - " }\n" + - " GRAPH <eg:tmp> {\n" + - " ?news ?newp ?newo\n" + - " }\n" + - "}\n" + - "INSERT {\n" + - " GRAPH <eg:a> {\n" + - " ?news ?newp ?newo\n" + - " }\n" + - "}\n" + - "WHERE {\n" + - (useHint?" hint:Query hint:chunkSize 2 .\n":"") + - " {\n" + - " GRAPH <eg:a> {\n" + - " ?olds ?oldp ?oldo\n" + - " }\n" + - " } UNION {\n" + - " GRAPH <eg:tmp> {\n" + - " ?news ?newp ?newo\n" + - " }\n" + - " }\n" + - "}"; - } - - private String insertData = - "prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" + - "INSERT DATA\n" + - "{ \n" + - " GRAPH <eg:a> {\n" + - " [ a \"Blank\" ] .\n" + - " <eg:b> rdf:type <eg:c> ; rdf:value [] .\n" + - " [ rdf:value [] ]\n" + - " }\n" + - " GRAPH <eg:tmp> {\n" + - " [ a \"Blankx\" ] .\n" + - " <eg:B> rdf:type <eg:C> ; rdf:value [] .\n" + - " [ rdf:value [] ]\n" + - " }\n" + - "}\n"; - - - private void makeUpdate(String update) throws IOException { - setMethodisPostUrlEncodedData(); - serviceRequest("update", update); - } - - private void assertQuad(String graph, String triple) throws IOException { - assertQuad("true", graph, triple); - } - - private void assertNotQuad(String graph, String triple) throws IOException { - assertQuad("false", graph, triple); - } - - void assertQuad(String expected, String graph, String triple) throws IOException { - String result = serviceRequest("query", "ASK { GRAPH " + graph + " { " + triple + "} }" ); - assertTrue(result.contains(expected)); - } - - private void updateAFewTimes(boolean useHint, int numberOfUpdatesPerTime) throws IOException { - final int numberOfTimes = 5; - for (int i=0; i<numberOfTimes; i++) { - for (int j=0; j<numberOfUpdatesPerTime;j++) { - makeUpdate(insertData); - } - makeUpdate( atomicMoveNamedGraph(useHint) ); - assertNotQuad("<eg:tmp>", " ?s ?p ?o "); - } - } - - public void test_t_1() throws IOException { - updateAFewTimes(true, 1); - } - public void test_t_2() throws IOException { - updateAFewTimes(true, 2); - } - public void test_t_3() throws IOException { - updateAFewTimes(true, 3); - } - public void test_t_5() throws IOException { - updateAFewTimes(true, 5); - } - public void test_f_1() throws IOException { - updateAFewTimes(false, 1); - } - public void test_f_2() throws IOException { - updateAFewTimes(false, 2); - } - public void test_f_3() throws IOException { - updateAFewTimes(false, 3); - } - public void test_f_5() throws IOException { - updateAFewTimes(false, 5); - } - public void test_double_triple_delete() throws IOException { - setMethodisPostUrlEncodedData(); - makeUpdate("prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" + - "INSERT DATA\n" + - "{ \n" + - " GRAPH <eg:a> {\n" + - " <eg:b> rdf:type <eg:c> \n" + - " }\n" + - " GRAPH <eg:tmp> {\n" + - " <eg:b> rdf:type <eg:c> \n" + - " }\n" + - "}\n"); - makeUpdate( "DELETE {\n" + - " GRAPH <eg:a> {\n" + - " ?olds ?oldp ?oldo\n" + - " }\n" + - " GRAPH <eg:tmp> {\n" + - " ?olds ?oldp ?oldo\n" + - " }\n" + - "}\n" + - "WHERE {\n" + - " GRAPH <eg:a> {\n" + - " ?olds ?oldp ?oldo\n" + - " }\n" + - "}"); - assertNotQuad("?g","?s ?p ?o"); - - } - - public void test_double_triple_insert() throws IOException { - makeUpdate( "prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" + - "INSERT DATA\n" + - "{ \n" + - " GRAPH <eg:tmp> {\n" + - " <eg:b> rdf:type <eg:c> .\n" + - " <eg:x> rdf:type _:foo \n" + - " }\n" + - "}\n"); - makeUpdate( "INSERT {\n" + - " GRAPH <eg:A> {\n" + - " ?olds ?oldp ?oldo\n" + - " }\n" + - " GRAPH <eg:B> {\n" + - " ?olds ?oldp ?oldo\n" + - " }\n" + - "}\n" + - "WHERE {\n" + - " GRAPH <eg:tmp> {\n" + - " ?olds ?oldp ?oldo\n" + - " }\n" + - "}"); - assertQuad("<eg:A>","<eg:b> rdf:type <eg:c> "); - assertQuad("<eg:B>","<eg:b> rdf:type <eg:c> "); - assertQuad("<eg:A>","<eg:x> rdf:type ?x"); - assertQuad("<eg:B>","<eg:x> rdf:type ?x "); - } - public void test_double_triple_delete_insert() throws IOException { - makeUpdate( "prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" + - "INSERT DATA\n" + - "{ \n" + - " GRAPH <eg:tmp> {\n" + - " <eg:A> <eg:moveTo> <eg:AA> .\n" + - " <eg:B> <eg:moveTo> <eg:BB> \n" + - " }\n" + - "}\n"); - makeUpdate( "INSERT {\n" + - " GRAPH <eg:A> {\n" + - " ?olds ?oldp ?oldo\n" + - " }\n" + - "}\n" + - "WHERE {\n" + - " GRAPH <eg:tmp> {\n" + - " ?olds ?oldp ?oldo\n" + - " }\n" + - "}"); - makeUpdate( "INSERT {\n" + - " GRAPH <eg:B> {\n" + - " ?olds ?oldp ?oldo\n" + - " }\n" + - "}\n" + - "WHERE {\n" + - " GRAPH <eg:tmp> {\n" + - " ?olds ?oldp ?oldo\n" + - " }\n" + - "}"); - assertQuad("<eg:A>","<eg:A> <eg:moveTo> <eg:AA> "); - assertQuad("<eg:B>","<eg:A> <eg:moveTo> <eg:AA> "); - assertQuad("<eg:A>","<eg:B> <eg:moveTo> <eg:BB>"); - assertQuad("<eg:B>","<eg:B> <eg:moveTo> <eg:BB> "); - makeUpdate( "DELETE {\n" + - " GRAPH ?oldg {\n" + - " ?olds ?oldp ?oldo\n" + - " }\n" + - "}\n" + - "INSERT {\n" + - " GRAPH ?newg {\n" + - " ?olds ?oldp ?oldo\n" + - " }\n" + - "}\n" + - "WHERE {\n" + - " GRAPH <eg:tmp> {\n" + - " ?oldg <eg:moveTo> ?newg\n" + - " }\n" + - " GRAPH ?oldg {\n" + - " ?olds ?oldp ?oldo\n" + - " }\n" + - "}"); - assertNotQuad("<eg:A>","<eg:A> <eg:moveTo> <eg:AA> "); - assertNotQuad("<eg:B>","<eg:A> <eg:moveTo> <eg:AA> "); - assertNotQuad("<eg:A>","<eg:B> <eg:moveTo> <eg:BB>"); - assertNotQuad("<eg:B>","<eg:B> <eg:moveTo> <eg:BB> "); - assertQuad("<eg:AA>","<eg:A> <eg:moveTo> <eg:AA> "); - assertQuad("<eg:BB>","<eg:A> <eg:moveTo> <eg:AA> "); - assertQuad("<eg:AA>","<eg:B> <eg:moveTo> <eg:BB>"); - assertQuad("<eg:BB>","<eg:B> <eg:moveTo> <eg:BB> "); - } - public void test_triple_template_and_fixed_insert() throws IOException { - makeUpdate( "prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" + - "INSERT DATA\n" + - "{ \n" + - " GRAPH <eg:tmp> {\n" + - " <eg:b> rdf:type <eg:c> .\n" + - " }\n" + - "}\n"); - makeUpdate( "INSERT {\n" + - " GRAPH <eg:A> {\n" + - " ?olds ?oldp ?oldo\n" + - " }\n" + - " GRAPH <eg:B> {\n" + - " <eg:b> rdf:type <eg:c> .\n" + - " }\n" + - "}\n" + - "WHERE {\n" + - " GRAPH <eg:tmp> {\n" + - " ?olds ?oldp ?oldo\n" + - " }\n" + - "}"); - assertQuad("<eg:A>","<eg:b> rdf:type <eg:c> "); - assertQuad("<eg:B>","<eg:b> rdf:type <eg:c> "); - } - static public Test suite() { - return ProxySuiteHelper.suiteWhenStandalone(NamedGraphUpdateTest.class,"test.*", TestMode.quads); - } - -} Added: branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/NativeDistinctNamedGraphUpdateTest.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/NativeDistinctNamedGraphUpdateTest.java (rev 0) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/NativeDistinctNamedGraphUpdateTest.java 2014-01-24 23:39:36 UTC (rev 7828) @@ -0,0 +1,36 @@ +/** +Copyright (C) SYSTAP, LLC 2014. 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.webapp; + +import junit.framework.Test; + +public class NativeDistinctNamedGraphUpdateTest extends AbstractNamedGraphUpdateTest { + + static public Test suite() { + return ProxySuiteHelper.suiteWhenStandalone(NativeDistinctNamedGraphUpdateTest.class,"test.*", TestMode.quads); + } + public NativeDistinctNamedGraphUpdateTest(String name) { + super(true, name); + } + +} Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/TestNanoSparqlServerWithProxyIndexManager.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/TestNanoSparqlServerWithProxyIndexManager.java 2014-01-24 18:42:02 UTC (rev 7827) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/TestNanoSparqlServerWithProxyIndexManager.java 2014-01-24 23:39:36 UTC (rev 7828) @@ -247,6 +247,8 @@ case quads: // QUADS mode UPDATE test suite. suite.addTestSuite(TestSparqlUpdate.class); + suite.addTestSuite( NativeDistinctNamedGraphUpdateTest.class ); + suite.addTestSuite( HashDistinctNamedGraphUpdateTest.class ); break; default: throw new UnsupportedOperationException(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tho...@us...> - 2014-01-24 18:42:11
|
Revision: 7827 http://bigdata.svn.sourceforge.net/bigdata/?rev=7827&view=rev Author: thompsonbry Date: 2014-01-24 18:42:02 +0000 (Fri, 24 Jan 2014) Log Message: ----------- Added test for #806. Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/TestTickets.java Added Paths: ----------- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/ticket-806.rq branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/ticket-806.srx branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/ticket-806.trig Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/TestTickets.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/TestTickets.java 2014-01-23 22:48:03 UTC (rev 7826) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/TestTickets.java 2014-01-24 18:42:02 UTC (rev 7827) @@ -318,4 +318,21 @@ ).runTest(); } + + /** + * @see <a href="https://sourceforge.net/apps/trac/bigdata/ticket/806" > + * Incorrect computation of shared variables when lifting out named + * subqueries </a> + */ + public void test_ticket_806() throws Exception { + + new TestHelper("ticket-806",// testURI, + "ticket-806.rq",// queryFileURL + "ticket-806.trig",// dataFileURL + "ticket-806.srx",// resultFileURL + false// checkOrder + ).runTest(); + + } + } Added: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/ticket-806.rq =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/ticket-806.rq (rev 0) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/ticket-806.rq 2014-01-24 18:42:02 UTC (rev 7827) @@ -0,0 +1,27 @@ +PREFIX g: <http://example.org/graphs#> +PREFIX d: <http://example.org/data#> +PREFIX p: <http://example.org/person#> + +# since all 3 predicates are used in the test data, all 3 variables should end up bound here +SELECT ?id ?fullName ?legalName { + {select ?entity ?id { + graph ?g { ?entity p:id ?id } + graph g:pointers { ?entity ?a ?g } + }} + + # ?a and ?g end up being projected into the next query + # changing ?a => ?a1; ?g => ?g1 fixes this + optional { + select ?entity ?fullName { + graph g:pointers { ?entity ?a ?g } + graph ?g { ?entity p:fullName ?fullName } + } + } + + optional { + select ?entity ?legalName { + graph ?g { ?entity p:legalName ?legalName } + graph g:pointers { ?entity ?a ?g } + } + } +} Added: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/ticket-806.srx =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/ticket-806.srx (rev 0) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/ticket-806.srx 2014-01-24 18:42:02 UTC (rev 7827) @@ -0,0 +1,21 @@ +<?xml version='1.0' encoding='UTF-8'?> +<sparql xmlns='http://www.w3.org/2005/sparql-results#'> + <head> + <variable name='id'/> + <variable name='fullName'/> + <variable name='legalName'/> + </head> + <results> + <result> + <binding name='id'> + <literal>123</literal> + </binding> + <binding name='fullName'> + <literal>Bryan Thompson</literal> + </binding> + <binding name='legalName'> + <literal>Bryan Thompson 123</literal> + </binding> + </result> + </results> +</sparql> Added: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/ticket-806.trig =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/ticket-806.trig (rev 0) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/ticket-806.trig 2014-01-24 18:42:02 UTC (rev 7827) @@ -0,0 +1,21 @@ +@prefix g: <http://example.org/graphs#> . +@prefix d: <http://example.org/data#> . +@prefix p: <http://example.org/person#> . + +g:graph1 { + d:foo p:id "123" +} + +g:graph2 { + d:foo p:fullName "Bryan Thompson" +} + +g:graph3 { + d:foo p:legalName "Bryan Thompson 123" +} + +g:pointers { + d:foo d:a g:graph1 . + d:foo d:b g:graph2 . + d:foo d:c g:graph3 +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jer...@us...> - 2014-01-23 22:48:09
|
Revision: 7826 http://bigdata.svn.sourceforge.net/bigdata/?rev=7826&view=rev Author: jeremy_carroll Date: 2014-01-23 22:48:03 +0000 (Thu, 23 Jan 2014) Log Message: ----------- One last test for trac804 - exercises different code path (which was not buggy, and still isn?\226?\128?\153t) Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/NamedGraphUpdateTest.java Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/NamedGraphUpdateTest.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/NamedGraphUpdateTest.java 2014-01-23 22:38:27 UTC (rev 7825) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/NamedGraphUpdateTest.java 2014-01-23 22:48:03 UTC (rev 7826) @@ -258,6 +258,30 @@ assertQuad("<eg:AA>","<eg:B> <eg:moveTo> <eg:BB>"); assertQuad("<eg:BB>","<eg:B> <eg:moveTo> <eg:BB> "); } + public void test_triple_template_and_fixed_insert() throws IOException { + makeUpdate( "prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" + + "INSERT DATA\n" + + "{ \n" + + " GRAPH <eg:tmp> {\n" + + " <eg:b> rdf:type <eg:c> .\n" + + " }\n" + + "}\n"); + makeUpdate( "INSERT {\n" + + " GRAPH <eg:A> {\n" + + " ?olds ?oldp ?oldo\n" + + " }\n" + + " GRAPH <eg:B> {\n" + + " <eg:b> rdf:type <eg:c> .\n" + + " }\n" + + "}\n" + + "WHERE {\n" + + " GRAPH <eg:tmp> {\n" + + " ?olds ?oldp ?oldo\n" + + " }\n" + + "}"); + assertQuad("<eg:A>","<eg:b> rdf:type <eg:c> "); + assertQuad("<eg:B>","<eg:b> rdf:type <eg:c> "); + } static public Test suite() { return ProxySuiteHelper.suiteWhenStandalone(NamedGraphUpdateTest.class,"test.*", TestMode.quads); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jer...@us...> - 2014-01-23 22:38:34
|
Revision: 7825 http://bigdata.svn.sourceforge.net/bigdata/?rev=7825&view=rev Author: jeremy_carroll Date: 2014-01-23 22:38:27 +0000 (Thu, 23 Jan 2014) Log Message: ----------- Fix for trac 804: Update: Insert/Delete now sets quads mode on construct, which may use quad based equality rather than triple based equality for filtering Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/ConstructNode.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/AST2BOpUpdate.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/ASTConstructIterator.java branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/NamedGraphUpdateTest.java Added Paths: ----------- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/model/BigdataQuadWrapper.java Added: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/model/BigdataQuadWrapper.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/model/BigdataQuadWrapper.java (rev 0) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/model/BigdataQuadWrapper.java 2014-01-23 22:38:27 UTC (rev 7825) @@ -0,0 +1,75 @@ +/** + +Copyright (C) SYSTAP, LLC 2014. 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 onJan 24, 2014 + */ + +package com.bigdata.rdf.model; + +import com.bigdata.rdf.internal.IV; + +/** + * This class wraps a {@link BigdataStatement} + * and provides {@link #hashCode()} and {@link #equals(Object)} + * respecting all four fields rather than SPO as per the {@link org.openrdf.model.Statement} contract + * @author jeremycarroll + * + */ +public class BigdataQuadWrapper { + + private final BigdataStatement delegate; + public BigdataQuadWrapper(BigdataStatement cspo) { + delegate = cspo; + } + @Override + public int hashCode() { + if (hash == 0) { + + if ( delegate.getContext() == null ) { + hash = delegate.hashCode(); + } else { + hash = delegate.getContext().hashCode() + 31 * delegate.hashCode(); + } + } + + return hash; + } + private int hash = 0; + @Override + public boolean equals(Object o) { + if (! (o instanceof BigdataQuadWrapper)) { + return false; + } + final BigdataStatement oo = ((BigdataQuadWrapper)o).delegate; + return delegate.equals(oo) && equals(delegate.getContext(),oo.getContext()); + } + + private boolean equals(BigdataResource a, BigdataResource b) { + return a == b || (a != null && a.equals(b)); + } + public BigdataStatement statement() { + return delegate; + } + +} Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/ConstructNode.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/ConstructNode.java 2014-01-23 15:06:01 UTC (rev 7824) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/ConstructNode.java 2014-01-23 22:38:27 UTC (rev 7825) @@ -52,7 +52,7 @@ public interface Annotations extends AbstractStatementContainer.Annotations { /** - * Boolean property (default {@value #DEFAULT_ALL_GRAPHS}) which is + * Boolean property (default {@value #DEFAULT_NATIVE_DISTINCT}) which is * <code>true</code> iff a native DISTINCT {@link ISPO} filter should be * applied (large cardinality is expected for the constructed graph). * When <code>false</code>, a JVM based DISTINCT {@link ISPO} filter @@ -66,7 +66,23 @@ */ String NATIVE_DISTINCT = "nativeDistinct"; + /** + * Internal boolean property (default {@value #DEFAULT_DISTINCT_QUDS}) which is + * <code>true</code> when used internally for constructing sets of quads rather + * than sets of triples. + * <p> + * Note: This can only be set programmatically using {@link ConstructNode#setDistinctQuads(boolean)} + * <p> + * Note: When this property is set and mixed quads are detected or suspected then the {@link #NATIVE_DISTINCT} property is ignored. + * + * @see <a href="https://sourceforge.net/apps/trac/bigdata/ticket/579"> + * CONSTRUCT should apply DISTINCT (s,p,o) filter </a> + */ + String DISTINCT_QUADS = "quadsDistinct"; + boolean DEFAULT_NATIVE_DISTINCT = false; + + boolean DEFAULT_DISTINCT_QUADS = false; } @@ -143,6 +159,17 @@ } + public boolean isDistinctQuads() { + + return getProperty(Annotations.DISTINCT_QUADS, + Annotations.DEFAULT_DISTINCT_QUADS); + + } + public void setDistinctQuads(final boolean quads) { + + setProperty(Annotations.DISTINCT_QUADS, quads); + } + @Override public String toString(final int indent) { @@ -167,4 +194,5 @@ } + } Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/AST2BOpUpdate.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/AST2BOpUpdate.java 2014-01-23 15:06:01 UTC (rev 7824) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/AST2BOpUpdate.java 2014-01-23 22:38:27 UTC (rev 7825) @@ -743,6 +743,8 @@ final ConstructNode template = op.getDeleteClause() .getQuadData().flatten(new ConstructNode(context)); + + template.setDistinctQuads(true); final ASTConstructIterator itr = new ASTConstructIterator( context.conn.getTripleStore(), template, @@ -813,6 +815,8 @@ final ConstructNode template = op.getInsertClause() .getQuadData().flatten(new ConstructNode(context)); + template.setDistinctQuads(true); + final ASTConstructIterator itr = new ASTConstructIterator( context.conn.getTripleStore(), template, op.getWhereClause(), null/* bnodesMap */, @@ -923,6 +927,8 @@ final ConstructNode template = quadData .flatten(new ConstructNode(context)); + template.setDistinctQuads(true); + // Set the CONSTRUCT template (quads patterns). queryRoot.setConstruct(template); Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/ASTConstructIterator.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/ASTConstructIterator.java 2014-01-23 15:06:01 UTC (rev 7824) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/ASTConstructIterator.java 2014-01-23 22:38:27 UTC (rev 7825) @@ -54,6 +54,7 @@ import com.bigdata.bop.rdf.filter.NativeDistinctFilter; import com.bigdata.rdf.internal.IV; import com.bigdata.rdf.model.BigdataBNode; +import com.bigdata.rdf.model.BigdataQuadWrapper; import com.bigdata.rdf.model.BigdataStatement; import com.bigdata.rdf.model.BigdataValue; import com.bigdata.rdf.model.BigdataValueFactory; @@ -278,7 +279,13 @@ this.src = src; - /* + filter = createDistinctFilter(tripleStore, construct, whereClause); + + } + + IFilterTest createDistinctFilter(final AbstractTripleStore tripleStore, final ConstructNode construct, + final GraphPatternGroup<?> whereClause) { + /* * Setup the DISTINCT SPO filter. * * Note: CONSTRUCT is sometimes used to materialize all triples for some @@ -289,79 +296,124 @@ * graph is large. */ - final boolean isObviouslyDistinct = isObviouslyDistinct( - tripleStore.isQuads(), templates, whereClause); - - if (isObviouslyDistinct) { + final boolean isObviouslyDistinct = isObviouslyDistinct(tripleStore.isQuads(), templates, whereClause); + if (isObviouslyDistinct) { + // Do not impose a DISTINCT filter. - filter = null; + return null; - } else { - - final boolean nativeDistinct = construct.isNativeDistinct(); - - if (nativeDistinct) { + } + - /* - * Construct a predicate for the first triple template. We will - * use that as the bias for the scalable DISTINCT SPO filter. - */ - @SuppressWarnings("rawtypes") - final IPredicate pred; - { + + final boolean distinctQuads = construct.isDistinctQuads() && tripleStore.isQuads() && hasMixedQuadData(templates); + + if (distinctQuads) { + + return createDistinctQuadsFilter(construct); + } + + return createDistinctTriplesFilter(construct); + + } - final StatementPatternNode sp = templates.get(0/* index */); + @SuppressWarnings("serial") + private IFilterTest createDistinctQuadsFilter(final ConstructNode construct) { + return new DistinctFilter.DistinctFilterImpl(construct){ + @Override + public boolean isValid(Object o){ + return super.isValid(new BigdataQuadWrapper((BigdataStatement)o)); + } + }; + } - @SuppressWarnings("rawtypes") - final IVariableOrConstant<IV> s = sp.s() - .getValueExpression(); + private boolean hasMixedQuadData(List<StatementPatternNode> templates) { + if (templates.size() == 0) { + return false; + } + TermNode singleValue = templates.get(0).c(); + if (singleValue instanceof VarNode) { + return true; + } + for (StatementPatternNode spn:templates) { + TermNode tn = spn.c(); + if (!equals(singleValue ,tn )) { + // this is a little too strong, but it is merely inefficient not incorrect + // to return true when false would be correct. + return true; + } + } + return false; + } - @SuppressWarnings("rawtypes") - final IVariableOrConstant<IV> p = sp.p() - .getValueExpression(); - - @SuppressWarnings("rawtypes") - final IVariableOrConstant<IV> o = sp.o() - .getValueExpression(); + private boolean equals(TermNode a, TermNode b) { + return a == b || ( a != null && a.equals(b)); + } - // // The graph term/variable iff specified by the query. - // final TermNode cvar = sp.c(); - // final IVariableOrConstant<IV> c = cvar == null ? null : - // cvar - // .getValueExpression(); + IFilterTest createDistinctTriplesFilter(final ConstructNode construct) { + + final boolean nativeDistinct = construct.isNativeDistinct(); - final BOp[] vars = new BOp[] { s, p, o /* , c */}; + if (nativeDistinct) { - pred = new SPOPredicate(vars, BOp.NOANNS); + /* + * Construct a predicate for the first triple template. We will + * use that as the bias for the scalable DISTINCT SPO filter. + */ + @SuppressWarnings("rawtypes") + final IPredicate pred; + { - } + final StatementPatternNode sp = templates.get(0/* index */); - /* - * The index that will be used to read on the B+Tree access - * path. - */ - @SuppressWarnings({ "unchecked", "rawtypes" }) - final SPOKeyOrder indexKeyOrder = SPOKeyOrder.getKeyOrder( - (IPredicate) pred, 3/* keyArity */); + @SuppressWarnings("rawtypes") + final IVariableOrConstant<IV> s = sp.s() + .getValueExpression(); - construct.setProperty( - NativeDistinctFilter.Annotations.KEY_ORDER, - indexKeyOrder); + @SuppressWarnings("rawtypes") + final IVariableOrConstant<IV> p = sp.p() + .getValueExpression(); + + @SuppressWarnings("rawtypes") + final IVariableOrConstant<IV> o = sp.o() + .getValueExpression(); - // Native memory based DISTINCT filter. - filter = new NativeDistinctFilter.DistinctFilterImpl(construct); + // // The graph term/variable iff specified by the query. + // final TermNode cvar = sp.c(); + // final IVariableOrConstant<IV> c = cvar == null ? null : + // cvar + // .getValueExpression(); - } else { + final BOp[] vars = new BOp[] { s, p, o /* , c */}; - // JVM Based DISTINCT filter. - filter = new DistinctFilter.DistinctFilterImpl(construct); + pred = new SPOPredicate(vars, BOp.NOANNS); } + + /* + * The index that will be used to read on the B+Tree access + * path. + */ + @SuppressWarnings({ "unchecked", "rawtypes" }) + final SPOKeyOrder indexKeyOrder = SPOKeyOrder.getKeyOrder( + (IPredicate) pred, 3/* keyArity */); + + construct.setProperty( + NativeDistinctFilter.Annotations.KEY_ORDER, + indexKeyOrder); + + // Native memory based DISTINCT filter. + return new NativeDistinctFilter.DistinctFilterImpl(construct); + + } else { + + // JVM Based DISTINCT filter. + return new DistinctFilter.DistinctFilterImpl(construct); + } - - } + } /** * Return <code>true</code> iff this CONSTRUCT template will obviously Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/NamedGraphUpdateTest.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/NamedGraphUpdateTest.java 2014-01-23 15:06:01 UTC (rev 7824) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/NamedGraphUpdateTest.java 2014-01-23 22:38:27 UTC (rev 7825) @@ -107,7 +107,8 @@ assertTrue(result.contains(expected)); } - private void updateAFewTimes(boolean useHint, int numberOfTimes, int numberOfUpdatesPerTime) throws IOException { + private void updateAFewTimes(boolean useHint, int numberOfUpdatesPerTime) throws IOException { + final int numberOfTimes = 5; for (int i=0; i<numberOfTimes; i++) { for (int j=0; j<numberOfUpdatesPerTime;j++) { makeUpdate(insertData); @@ -117,29 +118,29 @@ } } - public void test_t_20_1() throws IOException { - updateAFewTimes(true, 20, 1); + public void test_t_1() throws IOException { + updateAFewTimes(true, 1); } - public void test_t_20_2() throws IOException { - updateAFewTimes(true, 20, 2); + public void test_t_2() throws IOException { + updateAFewTimes(true, 2); } - public void test_t_20_3() throws IOException { - updateAFewTimes(true, 20, 3); + public void test_t_3() throws IOException { + updateAFewTimes(true, 3); } - public void test_t_20_5() throws IOException { - updateAFewTimes(true, 20, 5); + public void test_t_5() throws IOException { + updateAFewTimes(true, 5); } - public void test_f_20_1() throws IOException { - updateAFewTimes(false, 20, 1); + public void test_f_1() throws IOException { + updateAFewTimes(false, 1); } - public void test_f_20_2() throws IOException { - updateAFewTimes(false, 20, 2); + public void test_f_2() throws IOException { + updateAFewTimes(false, 2); } - public void test_f_20_3() throws IOException { - updateAFewTimes(false, 20, 3); + public void test_f_3() throws IOException { + updateAFewTimes(false, 3); } - public void test_f_20_5() throws IOException { - updateAFewTimes(false, 20, 5); + public void test_f_5() throws IOException { + updateAFewTimes(false, 5); } public void test_double_triple_delete() throws IOException { setMethodisPostUrlEncodedData(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jer...@us...> - 2014-01-23 15:06:12
|
Revision: 7824 http://bigdata.svn.sourceforge.net/bigdata/?rev=7824&view=rev Author: jeremy_carroll Date: 2014-01-23 15:06:01 +0000 (Thu, 23 Jan 2014) Log Message: ----------- Systematically exercise quad update problem (note the code paths for DELETE, DELETE/INSERT and INSERT are all different) Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/NamedGraphUpdateTest.java Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/NamedGraphUpdateTest.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/NamedGraphUpdateTest.java 2014-01-23 11:54:05 UTC (rev 7823) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/NamedGraphUpdateTest.java 2014-01-23 15:06:01 UTC (rev 7824) @@ -36,13 +36,14 @@ */ public class NamedGraphUpdateTest extends AbstractProtocolTest { + public NamedGraphUpdateTest(String name) { super(name); } private String atomicMoveNamedGraph(boolean useHint) { - // Atomic update of uploaded graph + // Atomic update of uploaded graph - moving eg:tmp to eg:a (deleting old contents of eg:a) return "DELETE {\n" + " GRAPH <eg:a> {\n" + @@ -87,19 +88,32 @@ " }\n" + "}\n"; - private String ask = "ASK { GRAPH <eg:tmp> { ?s ?p ?o } }"; + private void makeUpdate(String update) throws IOException { + setMethodisPostUrlEncodedData(); + serviceRequest("update", update); + } + + private void assertQuad(String graph, String triple) throws IOException { + assertQuad("true", graph, triple); + } + + private void assertNotQuad(String graph, String triple) throws IOException { + assertQuad("false", graph, triple); + } + + void assertQuad(String expected, String graph, String triple) throws IOException { + String result = serviceRequest("query", "ASK { GRAPH " + graph + " { " + triple + "} }" ); + assertTrue(result.contains(expected)); + } + private void updateAFewTimes(boolean useHint, int numberOfTimes, int numberOfUpdatesPerTime) throws IOException { for (int i=0; i<numberOfTimes; i++) { for (int j=0; j<numberOfUpdatesPerTime;j++) { - setMethodisPostUrlEncodedData(); - serviceRequest("update", insertData); + makeUpdate(insertData); } - setMethodisPostUrlEncodedData(); - serviceRequest("update", atomicMoveNamedGraph(useHint) ); - if (!serviceRequest("query", ask ).contains("false")) { - fail("On loop "+i+" (number of updates = "+numberOfUpdatesPerTime+")"); - } + makeUpdate( atomicMoveNamedGraph(useHint) ); + assertNotQuad("<eg:tmp>", " ?s ?p ?o "); } } @@ -127,6 +141,122 @@ public void test_f_20_5() throws IOException { updateAFewTimes(false, 20, 5); } + public void test_double_triple_delete() throws IOException { + setMethodisPostUrlEncodedData(); + makeUpdate("prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" + + "INSERT DATA\n" + + "{ \n" + + " GRAPH <eg:a> {\n" + + " <eg:b> rdf:type <eg:c> \n" + + " }\n" + + " GRAPH <eg:tmp> {\n" + + " <eg:b> rdf:type <eg:c> \n" + + " }\n" + + "}\n"); + makeUpdate( "DELETE {\n" + + " GRAPH <eg:a> {\n" + + " ?olds ?oldp ?oldo\n" + + " }\n" + + " GRAPH <eg:tmp> {\n" + + " ?olds ?oldp ?oldo\n" + + " }\n" + + "}\n" + + "WHERE {\n" + + " GRAPH <eg:a> {\n" + + " ?olds ?oldp ?oldo\n" + + " }\n" + + "}"); + assertNotQuad("?g","?s ?p ?o"); + + } + + public void test_double_triple_insert() throws IOException { + makeUpdate( "prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" + + "INSERT DATA\n" + + "{ \n" + + " GRAPH <eg:tmp> {\n" + + " <eg:b> rdf:type <eg:c> .\n" + + " <eg:x> rdf:type _:foo \n" + + " }\n" + + "}\n"); + makeUpdate( "INSERT {\n" + + " GRAPH <eg:A> {\n" + + " ?olds ?oldp ?oldo\n" + + " }\n" + + " GRAPH <eg:B> {\n" + + " ?olds ?oldp ?oldo\n" + + " }\n" + + "}\n" + + "WHERE {\n" + + " GRAPH <eg:tmp> {\n" + + " ?olds ?oldp ?oldo\n" + + " }\n" + + "}"); + assertQuad("<eg:A>","<eg:b> rdf:type <eg:c> "); + assertQuad("<eg:B>","<eg:b> rdf:type <eg:c> "); + assertQuad("<eg:A>","<eg:x> rdf:type ?x"); + assertQuad("<eg:B>","<eg:x> rdf:type ?x "); + } + public void test_double_triple_delete_insert() throws IOException { + makeUpdate( "prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" + + "INSERT DATA\n" + + "{ \n" + + " GRAPH <eg:tmp> {\n" + + " <eg:A> <eg:moveTo> <eg:AA> .\n" + + " <eg:B> <eg:moveTo> <eg:BB> \n" + + " }\n" + + "}\n"); + makeUpdate( "INSERT {\n" + + " GRAPH <eg:A> {\n" + + " ?olds ?oldp ?oldo\n" + + " }\n" + + "}\n" + + "WHERE {\n" + + " GRAPH <eg:tmp> {\n" + + " ?olds ?oldp ?oldo\n" + + " }\n" + + "}"); + makeUpdate( "INSERT {\n" + + " GRAPH <eg:B> {\n" + + " ?olds ?oldp ?oldo\n" + + " }\n" + + "}\n" + + "WHERE {\n" + + " GRAPH <eg:tmp> {\n" + + " ?olds ?oldp ?oldo\n" + + " }\n" + + "}"); + assertQuad("<eg:A>","<eg:A> <eg:moveTo> <eg:AA> "); + assertQuad("<eg:B>","<eg:A> <eg:moveTo> <eg:AA> "); + assertQuad("<eg:A>","<eg:B> <eg:moveTo> <eg:BB>"); + assertQuad("<eg:B>","<eg:B> <eg:moveTo> <eg:BB> "); + makeUpdate( "DELETE {\n" + + " GRAPH ?oldg {\n" + + " ?olds ?oldp ?oldo\n" + + " }\n" + + "}\n" + + "INSERT {\n" + + " GRAPH ?newg {\n" + + " ?olds ?oldp ?oldo\n" + + " }\n" + + "}\n" + + "WHERE {\n" + + " GRAPH <eg:tmp> {\n" + + " ?oldg <eg:moveTo> ?newg\n" + + " }\n" + + " GRAPH ?oldg {\n" + + " ?olds ?oldp ?oldo\n" + + " }\n" + + "}"); + assertNotQuad("<eg:A>","<eg:A> <eg:moveTo> <eg:AA> "); + assertNotQuad("<eg:B>","<eg:A> <eg:moveTo> <eg:AA> "); + assertNotQuad("<eg:A>","<eg:B> <eg:moveTo> <eg:BB>"); + assertNotQuad("<eg:B>","<eg:B> <eg:moveTo> <eg:BB> "); + assertQuad("<eg:AA>","<eg:A> <eg:moveTo> <eg:AA> "); + assertQuad("<eg:BB>","<eg:A> <eg:moveTo> <eg:AA> "); + assertQuad("<eg:AA>","<eg:B> <eg:moveTo> <eg:BB>"); + assertQuad("<eg:BB>","<eg:B> <eg:moveTo> <eg:BB> "); + } static public Test suite() { return ProxySuiteHelper.suiteWhenStandalone(NamedGraphUpdateTest.class,"test.*", TestMode.quads); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tho...@us...> - 2014-01-23 11:54:12
|
Revision: 7823 http://bigdata.svn.sourceforge.net/bigdata/?rev=7823&view=rev Author: thompsonbry Date: 2014-01-23 11:54:05 +0000 (Thu, 23 Jan 2014) Log Message: ----------- javadoc. Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/bop/rdf/joinGraph/GenerateBarData.java Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/bop/rdf/joinGraph/GenerateBarData.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/bop/rdf/joinGraph/GenerateBarData.java 2014-01-23 11:53:49 UTC (rev 7822) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/bop/rdf/joinGraph/GenerateBarData.java 2014-01-23 11:54:05 UTC (rev 7823) @@ -43,9 +43,12 @@ import org.openrdf.rio.Rio; import org.openrdf.sail.memory.model.MemValueFactory; +import com.bigdata.rdf.sparql.ast.eval.rto.TestRTO_BAR; + /** - * A data set generator. {@link TestJoinGraphOnBarData} uses data sets generated - * by this class. + * A data set generator. {@link TestRTO_BAR} uses data sets generated by this + * class. Each order is in its own named graph. So each a record for each + * employee. * * @author <a href="mailto:mr...@us...">Matt Roy</a> * @version $Id$ @@ -61,17 +64,6 @@ return 0; } - /* - * - * SELECT * WHERE { - ?a <http://test/bar#beverageType> ?d. - ?value <http://test/bar#orderItems> ?a. - ?value <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://test/bar#order> . - ?value <http://test/bar#employee> ?b. - ?b <http://test/bar#employeeNum> ?f. - ?a <http://test/bar#beverageType> """Beer"""^^<http://www.w3.org/2001/XMLSchema#string>. - } - */ /** * @param args * @throws RDFHandlerException This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tho...@us...> - 2014-01-23 11:53:55
|
Revision: 7822 http://bigdata.svn.sourceforge.net/bigdata/?rev=7822&view=rev Author: thompsonbry Date: 2014-01-23 11:53:49 +0000 (Thu, 23 Jan 2014) Log Message: ----------- javadoc, imports. Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/rto/TestRTO_BAR.java Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/rto/TestRTO_BAR.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/rto/TestRTO_BAR.java 2014-01-23 11:51:03 UTC (rev 7821) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/rto/TestRTO_BAR.java 2014-01-23 11:53:49 UTC (rev 7822) @@ -29,12 +29,15 @@ import java.util.Properties; +import com.bigdata.bop.rdf.joinGraph.GenerateBarData; import com.bigdata.rdf.sail.BigdataSail; /** - * Data driven test suite for the Runtime Query Optimizer (RTO) using LUBM data - * and queries based on LUBM. + * Data driven test suite for the Runtime Query Optimizer (RTO) using BAR data + * and queries. * + * @see GenerateBarData + * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> * @version $Id: TestBasicQuery.java 6440 2012-08-14 17:57:33Z thompsonbry $ */ @@ -51,7 +54,7 @@ /** * @param name */ - public TestRTO_BAR(String name) { + public TestRTO_BAR(final String name) { super(name); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tho...@us...> - 2014-01-23 11:51:10
|
Revision: 7821 http://bigdata.svn.sourceforge.net/bigdata/?rev=7821&view=rev Author: thompsonbry Date: 2014-01-23 11:51:03 +0000 (Thu, 23 Jan 2014) Log Message: ----------- missed in the last commit. Removed Paths: ------------- branches/BIGDATA_RELEASE_1_3_0/README-JINI Deleted: branches/BIGDATA_RELEASE_1_3_0/README-JINI =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/README-JINI 2014-01-23 11:50:35 UTC (rev 7820) +++ branches/BIGDATA_RELEASE_1_3_0/README-JINI 2014-01-23 11:51:03 UTC (rev 7821) @@ -1,160 +0,0 @@ -Some notes on installation and use follow: - -JINI - -- jini is used as a service fabric for bigdata. <start up jini and - then configure your data and metadata services; clients then - discover those services> - -- jini 2.1 may report errors locating the shared libraries from awk, - dirname, basename and grep when installing under un*x. The problem - is an assumption about the kernel version. This problem is resolved - by editing the installer and the launchall script. - See http://www.jini.org/wiki/Category:Getting_Started and - http://www.linuxquestions.org/questions/showthread.php?t=370056 for - a resolution. Here is is in case that link goes away: - - Open the bin installer file in an editor. Look for the line - - export LD_ASSUME_KERNEL=2.2.5 - - and replace it with - - #xport LD_ASSUME_KERNEL=2.2.5 - - Save the file and launch. - - Once jini is installed, you need to do exactly the same thing for the - Launch-All script in the installverify directory - this is the script - that you use the start jini. - -- Here are some notes on getting things working on a Fedora Core 6 platform. - The symptom was that ifconfig was reporting MULTICAST for the interface - but the jini install was complaining that multicase was not enabled for - that interface. - - Here's what I did: - - First, verify that multicast is enabled on eth0 by typing ifconfig and looking for multicast - - if it is not enabled type ifconfig eth0 multicast - - after that add a default route for multicast broadcasts and bind it to eth0 - - route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0 - - additionally, I disabled the firewall and I disabled SELinux (but I think the firewall was the big culprit here). - -- Downloadable code is NOT required for deployments, but MAY be useful - for the following purposes: - - (a) exposing services to the Jini service browser; - - (b) running procedures against services which were deployed before - the procedures were written; - - If you have a complete classpath when running the various services - then jini will not seek to transfer code from the client as the code - will be resolved locally by the service. - - In order to support downloadable code you need to have an HTTP - server that will serve class files to jini, including the interfaces - for all remote services. You can use any HTTP server for this - purpose, and the server can be located on any machine accessible - from the host(s) on which you are running jini. As a convenience, - jini bundles a simple HTTP server that you can start using a command - like the following: - - java -jar ${JINI_HOME}/lib/classserver.jar -port 8080 -dir classes -trees -verbose& - - The javadoc describes the logging and command line options for this - HTTP server. - - https://java.sun.com/products/jini/2.1/doc/api/com/sun/jini/tool/ClassServer.html - - The directory from which downloadable code will be served should - contain at least the bigdata jar(s) plus any remote application code - that you have defined (i.e., code that will run in the server - process). - - The recommended approach to downloadable code is to extract the - relevant classes into a directory that will be named to the HTTP - server as follows. Assuming that bigdata.jar is located in the - current directory: - - mkdir classes - cd classes - jar xfz ../bigdata.jar - - If you deploy a new version of any JAR, then you SHOULD delete the - classes directory and redeploy all relevant JARs to make sure that - old class files are not left lying around. - -- You can enable NIO support with JERI using TCP by specifying the - following property to the JVM. Note that JRMP does NOT allow for - the possibility of NIO. - - -Dcom.sun.jini.jeri.tcp.useNIO=true - - More information on JERI and NIO is available using the following links. - - http://archives.java.sun.com/cgi-bin/wa?A2=ind0504&L=jini-users&P=33490 - http://archives.java.sun.com/cgi-bin/wa?A2=ind0506&L=jini-users&P=9626 - http://archives.java.sun.com/cgi-bin/wa?A2=ind0504&L=jini-users&D=0&P=26542 - http://java.sun.com/products/jini/2.0.1/doc/api/net/jini/jeri/tcp/package-summary.html - - Note that one server thread will still be required per concurrent RPC request - owing to the semantics of RPC (call and wait for response) and the definition - of JERI. - -- Clients downloadable code that will be run on the bigdata services MUST set: - - -Djava.rmi.server.codebase=http://.../ - - where "..." is your host and path - - in order for the correct codebase property to be communicated to clients that - will then download code from that HTTP server. Note: the trailing '/' is - REQUIRED in your codebase or the generated URLs will NOT resolve correctly. - - There is an example of how to do this with the "ant lubm-install" target and - the "lubmMaster.sh" script. - -- Debugging with jini. - - See http://java.sun.com/j2se/1.4.2/docs/guide/rmi/javarmiproperties.html for - some guidance. Among other things, it suggests: - - -Djava.rmi.server.logCalls=true - - as an aid to debugging. Also try setting - - -Dcom.sun.jini.reggie.proxy.debug=1 - - for the client, e.g., the service browser. Also see: - - http://www.adtmag.com/java/articleold.aspx?id=1159 - - for some (very good) guidance in debugging jini services. - - Note: You may have to restart jini locally in order to force download of - updated classes from the codebase! - - See http://archives.java.sun.com/cgi-bin/wa?A2=ind0512&L=jini-users&P=R391&I=-3 - for instructions on setting up an "download jar" (dljar) ANT task that can make - life much simpler (one supposes). - - See http://archives.java.sun.com/cgi-bin/wa?A2=ind0311&L=jini-users&F=&S=&P=7182 - for a description of policy files and - http://www.dancres.org/cottage/jini-start-examples-2_1.zip for the - policy files described. - - See http://jan.newmarch.name/java/jini/tutorial/Ant.xml for a description of - one (simple) approach to using ant for jini projects (it does not use the - dljar ant task but explicitly enumerates what goes where). - - See http://jan.newmarch.name/java/jini/tutorial/TroubleShooting.xml#RMI%20Stubs - for common errors when using RMI stubs. - - See https://java.sun.com/products/jini/2.1/doc/api/com/sun/jini/example/browser/package-summary.html - for the dirty on the jini Service Browser. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tho...@us...> - 2014-01-23 11:50:46
|
Revision: 7820 http://bigdata.svn.sourceforge.net/bigdata/?rev=7820&view=rev Author: thompsonbry Date: 2014-01-23 11:50:35 +0000 (Thu, 23 Jan 2014) Log Message: ----------- Removed the stale overview.html. This has been replaced by a 25 page whitepaper linked from the blog [1]. Modified the README to point people to the release notes. The release notes have pointers for getting started with the platform. Moved the JINI README into bigdata-jini/src/resources. [1] http://www.bigdata.com/whitepapers/bigdata_architecture_whitepaper.pdf Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/README Added Paths: ----------- branches/BIGDATA_RELEASE_1_3_0/bigdata-jini/src/resources/README-JINI Removed Paths: ------------- branches/BIGDATA_RELEASE_1_3_0/overview.html Modified: branches/BIGDATA_RELEASE_1_3_0/README =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/README 2014-01-23 11:33:50 UTC (rev 7819) +++ branches/BIGDATA_RELEASE_1_3_0/README 2014-01-23 11:50:35 UTC (rev 7820) @@ -0,0 +1,4 @@ +Please see the release notes in bigdata/src/releases for getting started +links. This will point you to the installation instructions for the +different deployment modes, the online documentation, the wiki, etc. It +will also point you to resources for support, subscriptions, and licensing. Copied: branches/BIGDATA_RELEASE_1_3_0/bigdata-jini/src/resources/README-JINI (from rev 7775, branches/BIGDATA_RELEASE_1_3_0/README-JINI) =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-jini/src/resources/README-JINI (rev 0) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-jini/src/resources/README-JINI 2014-01-23 11:50:35 UTC (rev 7820) @@ -0,0 +1,160 @@ +Some notes on installation and use follow: + +JINI + +- jini is used as a service fabric for bigdata. <start up jini and + then configure your data and metadata services; clients then + discover those services> + +- jini 2.1 may report errors locating the shared libraries from awk, + dirname, basename and grep when installing under un*x. The problem + is an assumption about the kernel version. This problem is resolved + by editing the installer and the launchall script. + See http://www.jini.org/wiki/Category:Getting_Started and + http://www.linuxquestions.org/questions/showthread.php?t=370056 for + a resolution. Here is is in case that link goes away: + + Open the bin installer file in an editor. Look for the line + + export LD_ASSUME_KERNEL=2.2.5 + + and replace it with + + #xport LD_ASSUME_KERNEL=2.2.5 + + Save the file and launch. + + Once jini is installed, you need to do exactly the same thing for the + Launch-All script in the installverify directory - this is the script + that you use the start jini. + +- Here are some notes on getting things working on a Fedora Core 6 platform. + The symptom was that ifconfig was reporting MULTICAST for the interface + but the jini install was complaining that multicase was not enabled for + that interface. + + Here's what I did: + + First, verify that multicast is enabled on eth0 by typing ifconfig and looking for multicast + + if it is not enabled type ifconfig eth0 multicast + + after that add a default route for multicast broadcasts and bind it to eth0 + + route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0 + + additionally, I disabled the firewall and I disabled SELinux (but I think the firewall was the big culprit here). + +- Downloadable code is NOT required for deployments, but MAY be useful + for the following purposes: + + (a) exposing services to the Jini service browser; + + (b) running procedures against services which were deployed before + the procedures were written; + + If you have a complete classpath when running the various services + then jini will not seek to transfer code from the client as the code + will be resolved locally by the service. + + In order to support downloadable code you need to have an HTTP + server that will serve class files to jini, including the interfaces + for all remote services. You can use any HTTP server for this + purpose, and the server can be located on any machine accessible + from the host(s) on which you are running jini. As a convenience, + jini bundles a simple HTTP server that you can start using a command + like the following: + + java -jar ${JINI_HOME}/lib/classserver.jar -port 8080 -dir classes -trees -verbose& + + The javadoc describes the logging and command line options for this + HTTP server. + + https://java.sun.com/products/jini/2.1/doc/api/com/sun/jini/tool/ClassServer.html + + The directory from which downloadable code will be served should + contain at least the bigdata jar(s) plus any remote application code + that you have defined (i.e., code that will run in the server + process). + + The recommended approach to downloadable code is to extract the + relevant classes into a directory that will be named to the HTTP + server as follows. Assuming that bigdata.jar is located in the + current directory: + + mkdir classes + cd classes + jar xfz ../bigdata.jar + + If you deploy a new version of any JAR, then you SHOULD delete the + classes directory and redeploy all relevant JARs to make sure that + old class files are not left lying around. + +- You can enable NIO support with JERI using TCP by specifying the + following property to the JVM. Note that JRMP does NOT allow for + the possibility of NIO. + + -Dcom.sun.jini.jeri.tcp.useNIO=true + + More information on JERI and NIO is available using the following links. + + http://archives.java.sun.com/cgi-bin/wa?A2=ind0504&L=jini-users&P=33490 + http://archives.java.sun.com/cgi-bin/wa?A2=ind0506&L=jini-users&P=9626 + http://archives.java.sun.com/cgi-bin/wa?A2=ind0504&L=jini-users&D=0&P=26542 + http://java.sun.com/products/jini/2.0.1/doc/api/net/jini/jeri/tcp/package-summary.html + + Note that one server thread will still be required per concurrent RPC request + owing to the semantics of RPC (call and wait for response) and the definition + of JERI. + +- Clients downloadable code that will be run on the bigdata services MUST set: + + -Djava.rmi.server.codebase=http://.../ + + where "..." is your host and path + + in order for the correct codebase property to be communicated to clients that + will then download code from that HTTP server. Note: the trailing '/' is + REQUIRED in your codebase or the generated URLs will NOT resolve correctly. + + There is an example of how to do this with the "ant lubm-install" target and + the "lubmMaster.sh" script. + +- Debugging with jini. + + See http://java.sun.com/j2se/1.4.2/docs/guide/rmi/javarmiproperties.html for + some guidance. Among other things, it suggests: + + -Djava.rmi.server.logCalls=true + + as an aid to debugging. Also try setting + + -Dcom.sun.jini.reggie.proxy.debug=1 + + for the client, e.g., the service browser. Also see: + + http://www.adtmag.com/java/articleold.aspx?id=1159 + + for some (very good) guidance in debugging jini services. + + Note: You may have to restart jini locally in order to force download of + updated classes from the codebase! + + See http://archives.java.sun.com/cgi-bin/wa?A2=ind0512&L=jini-users&P=R391&I=-3 + for instructions on setting up an "download jar" (dljar) ANT task that can make + life much simpler (one supposes). + + See http://archives.java.sun.com/cgi-bin/wa?A2=ind0311&L=jini-users&F=&S=&P=7182 + for a description of policy files and + http://www.dancres.org/cottage/jini-start-examples-2_1.zip for the + policy files described. + + See http://jan.newmarch.name/java/jini/tutorial/Ant.xml for a description of + one (simple) approach to using ant for jini projects (it does not use the + dljar ant task but explicitly enumerates what goes where). + + See http://jan.newmarch.name/java/jini/tutorial/TroubleShooting.xml#RMI%20Stubs + for common errors when using RMI stubs. + + See https://java.sun.com/products/jini/2.1/doc/api/com/sun/jini/example/browser/package-summary.html + for the dirty on the jini Service Browser. Deleted: branches/BIGDATA_RELEASE_1_3_0/overview.html =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/overview.html 2014-01-23 11:33:50 UTC (rev 7819) +++ branches/BIGDATA_RELEASE_1_3_0/overview.html 2014-01-23 11:50:35 UTC (rev 7820) @@ -1,422 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" -"http://www.w3.org/TR/html4/loose.dtd"> -<html> -<head> -<meta http-equiv="Content-Type" content="text/html;charset=utf-8" > -<title>bigdata®</title> -<!-- $Id$ --> -</head> -<body> - - <p> - - <em>bigdata®</em> is a scale-out data and computing - fabric designed for commodity hardware. The bigdata - architecture provides named scale-out indices that are - transparently and dynamically key-range partitioned and - distributed across a cluster or grid of commodity server - platforms. The scale-out indices are B+Trees and remain - balanced under insert and removal operations. Keys and - values for btrees are variable length byte[]s (the keys are - interpreted as unsigned byte[]s). - - Atomic "row" operations are supported for very high - concurrency. However, full transactions are also available - for applications needing less concurrency but requiring - atomic operations that read or write on more than one row, - index partition, or index. - - Writes are absorbed on mutable btree instances in append - only "journals" of ~200M capacity. On overflow, data in a - journal is evicted onto read-optimized, immutable "index - segments". The metadata service manages the index - definitions, the index partitions, and the assignment of - index partitions to data services. A data service - encapsulates a journal and zero or more index partitions - assigned to that data service, including the logic to handle - overflow. - -</p><p> - - A deployment is made up of a transaction service, a load - balancer service, and a metadata service (with failover - redundancy) and many data service instances. bigdata can - provide data redundancy internally (by pipelining writes - bound for a partition across primary, secondary, ... data - service instances for that partition) or it can be deployed - over NAS/SAN. bigdata itself is 100% Java and requires a - JDK 1.6. There are additional dependencies for the - installer (un*x) and for collecting performance counters - from the OS (<a - href="http://pagesperso-orange.fr/sebastien.godard/">sysstat</a>). - - </p> - - <h2>Architecture</h2> - - <p> - - The bigdata SOA defines three essential services and some - additional services. The essential services are the - metadata service (provides a locator service for index - partitions on data services), the data service (provides - read, write, and concurrency control for index partitions), - and the transaction service (provides consistent timestamps - for commits, facilitates the release of data associated with - older commit points, read locks, and transactions). Full - transactions are NOT required, so you can use bigdata as a - scale-out row store. The load balancer service guides the - dynamic redistribution of data across a bigdata federation. - There are also client services, which are containers for - executing distributed jobs. - - </p> - - <p> - - While other service fabric architectures are contemplated, - bigdata services today use JINI 2. to advertise themselves - and do service discovery. This means that you must be - running a JINI registrar in order for services to be able to - register themselves or discover other services. The JINI - integration is bundled and installed automatically by - default. - - </p> - - <p> - - Zookeeper handles master election, configuration management - and global synchronous locks. Zookeeper was developed by - Yahoo! as a distributed lock and configuration management - service and is now an Apache subproject (part of - Hadoop). Among other things, it gets master election - protocols right. Zookeeper is bundled and installed - automatically by default. - - </p> - - <p> - - The main building blocks for the bigdata architecture are - the journal (both an append-only persistence store and a recently - introduced read/write store with the ability to recycle historical - commit points), the mutable - B+Tree (used to absorb writes), and the read-optimized - immutable B+Tree (aka the index segment). Highly efficient - bulk index builds are used to transfer data absorbed by a - mutable B+Tree on a journal into index segment files. Each - for index segment contains data for a single partition of a - scale-out index. In order to read from an index partition, - a consistent view is created by dynamically fusing data for - that index partition, including any recent writes on the - current journal, any historical writes that are in the - process of being transferred onto index segments, and any - historical index segments that also contain data for that - view. Periodically, index segments are merged together, at - which point deleted tuples are purged from the view. - -</p> - -<p> - - Bigdata periodically releases data associated with older - commit points, freeing up disk resources. The transaction - service is configured with a minimum release age in - milliseconds. This can be ZERO (0L) milliseconds, in which - case historical views may be released if there are no read - locks for that commit point. The minimum release age can - also be hours or days if you want to keep historical states - around for a while. When a data service overflows, it will - consult the transaction service to determine the effective - release time and release any old journals or index segments - no longer required to maintain views GT that release time. -</p><p> - An immortal or temporal database can be realized by - specifying Long#MAX_VALUE for the minimum release age. In - this case, the old journals and index segments will all be - retained and you can query any historical commit point of - the database at any time. - - </p><p> - - An detailed architecture whitepaper for bigdata is posted only and - linked from our <a href="http://www.bigdata.com/blog">blog</a>. - - </p> - - <h2>Sparse row store</h2> - - <p> - - The <em>SparseRowStore</em> provides a column flexible row - store similar to Google's bigtable or HBase, including very - high read/write concurrency and ACID operations on logical - "rows". Internally, a "global row store" instance is used - to maintain metadata on relations declared within a bigdata - federation. You can use this instance to store your own - data, or you can create your own named row store instances. - However, there is no REST api for the row store at this time - (trivial to be sure, but not something that we have gotten - around to yet). - -</p><p> - - In fact, it is trivial to realize bigtable semantics with - bigdata - all you need to do is exercise a specific protocol - when forming the keys for your scale-out indices and then - you simply choose to NOT use transactions. A bigtable style - key-value is formed as: - - </p> - - <pre> - - [columnFamily][primaryKey][columnName][timestamp} : [value] - - </pre> - - <p> - - By placing the column family identifier up front, all data - in the same column family will be clustered together by the - index. The next component is the "row" identifier, what you - would think of as the primary key in a relational table. - The column name comes next - only column names for non-null - columns are written into the index. Finally, there is a - timestamp column that is used either to record a timestamp - specified by the application or a datum write time. The - value associated with the key is simply the datum for that - column in that row. The use of nul byte separators makes it - possible to parse the key, which is required for various - operations including index partition splits and filtering - key scans based on column names or timestamps. See the - <em>KeyBuilder</em> class in - <code>com.bigdata.btree.keys</code> for utilities that may - be used to construct keys for variety of data types. - - </p> - - <h2>Map/reduce, Asynchronous Write API, and Query</h2> - - <p> - - Google's map/reduce architecture has received a lot of - attention, along with its bigtable architecture. Map/reduce - provides a means to transparently decompose processing - across a cluster. The "map" process examines a series of - key-value pairs, emitting a set of intermediate key-value - pairs for each input. Those intermediate key-values are - then hashed (module R) onto R reduce processes. The inputs - for the reduce processes are pre-sorted. The reduce process - then runs some arbitrary operation on the sorted data, such - as computing an inverted index file or loading the data into - a scale-out index. - - </p> - - <p> - - bigdata® supports an <em>asynchronous index write - API</em>, which delivers extremely high throughput for - scattered writes. While map/reduce is tremendously - effective when there is good locality in the data, it is not - the right tool for processing ordered data. Instead, you - execute a master job, which spawns client(s) running in - <em>client service</em>(s) associated with the bigdata - federation. Those clients process data, writing onto - blocking buffers. The writes are automatically split and - buffered for each key-range shard. This maximizes the chunk - size for ordered writes and provides a tremendous throughput - boost. Bigdata can work well in combination with - map/reduce. The basic paradigm is you use map/reduce jobs - to generate data, which is then bulk loaded into a bigdata - federation using bigdata jobs and the asynchronous write - API. - - </p><p> - - bigdata® has built in support for distributed rule - execution. This can be used for high-level query or for - materializing derived views, including maintaining the RDFS+ - closure of a semantic web database. The implementation is - highly efficient and propagates binding sets to the data - service for each key-range shard touched by the query, so - the JOINs happen right up against the data. Unlike using - map/reduce for join processing, bigdata query processing is - very low latency. Distributed query execution can be - substantially faster than local query execution, even for - low-latency queries. - - </p> - - <h2>Standalone Journals</h2> - - <p> - - While bigdata® is targeted at scale-out federations, - it can also be deployed as simple persistence store using - just the <code>com.bigdata.journal.Journal</code> API. - - </p><p> - - The read-write (RWStore) version of the journal can scale up to 50 billion - triples or quads and is - capable of reclaiming storage by releasing historical commit points, aging - them out of the backing file in a manner very similar to how the scale-out - database releases historical commit points. The read/write store is good - for standalone database instances, especially when the data have a lot of - skew and when the new data are arriving continually while older data should - be periodically released (for example, in a monitoring application where - historical events may be released after 30 days). - - </p><p> - - The read/write store is - also used in the scale-out architecture for the transaction manager and the - aggregated performance counters. However, the data services use a WORM - store to buffer writes, asynchronously migrate the buffered writes onto - read-optimized B+Tree files using index segments builds and compacting. - One an index partition (aka shard) reaches ~ 200MB on the disk (dynamic - sharding). Index partitions are moved from time to time to load balance - the cluster. - - </p> - - <h2>Status</h2> - - <p> - - bigdata® is a petabyte scale database architecture. It has been - tested on clusters of up to 16 nodes. We have loaded data sets of 10B+ - rows, at rates of over 300,000 rows per second. Overall, 100s of billions - of rows have been put down safely on disk. - - </p> - - <ul> - - <li>Hadoop integration points, including a REST API for the sparse row - store and scanners for HDFS files making easier to target bigdata - distributed jobs from Hadoop map/reduce jobs.</li> - - <li>Online backup and point in time recovery.</li> - - <li>Full distributed read/write transaction support (read-only transaction - support is done, but we still have some work to do on the commit protocol - for read-write transactions).</li> - - <li>OODBMS. We will be introducing an OODBM layer based on the - Generic Object Model shortly. This will be layered over the RDF - database and will have bindings and clients for Java, JSON, and - other client environments.</li> - - </ul> - - <h2>Getting Started</h2> - - <p> - - See the wiki for <a - href="http://bigdata.wiki.sourceforge.net/GettingStarted">Getting - Started</a> and our <a - href="http://www.bigdata.com/bigdata/blog/">blog</a> for - what's new. The javadoc is <a - href="http://www.bigdata.com/bigdata/docs/api/">online</a> - and you can also build it with the ant script. If you have a - question, please post it on the blog or the forum. - - </p> - -<h2>Getting Involved</h2> - -<p> - - bigdata® is an open source project. Contributors and - contributions are welcome. Like most open source project, - contributions must be submitted under a contributor - agreement, which must be signed by someone with the - appropriate authority. This is necessary to ensure that the - code base remains open. - - </p><p> - - If you want to help out, please check out what is going on - our <a href="http://www.bigdata.com/bigdata/blog/">blog</a> - and on the <a - href="https://sourceforge.net/projects/bigdata/">main project - site</a>. Post your questions and we will help you figure - out where you can contribute or how to create that new - feature that you need. - - </p> - - <h2>Licenses and Services</h2> - - <p> - - bigdata® is distributed under GPL(v2). SYSTAP, LLC - offers commercial licenses for customers who either want the - value add (warranty, technical support, additional - regression testing), who want to redistribute bigdata with - their own commercial products, or who are not "comfortable" - with the GPL license. For inquiries or further information, - please write <a - href="mailto:lic...@bi...">lic...@bi...</a>. - - </p><p> - - Please let us know if you need specific feature development - or help in applying bigdata® to your problem. We are - especially interested in working directly with people who - are trying to handle massive data, especially for the - semantic web. Please <a - href="http://www.systap.com/contact.htm">contact us</a> - directly. - - </p> - - <h2>Related links</h2> - - <dl> - - <dt>CouchDB</dt> - <dd>http://couchdb.org/CouchDB/CouchDBWeb.nsf/Home?OpenForm</dd> - - <dt>bigtable</dt> - <dd>http://labs.google.com/papers/bigtable.html, http://www.techcrunch.com/2008/04/04/source-google-to-launch-bigtable-as-web-service/</dd> - - <dt>map/reduce</dt> - <dd>http://labs.google.com/papers/mapreduce.html</dd> - - <dt>Hadoop</dt> - <dd>http://lucene.apache.org/hadoop/</dd> - - <dt>Zookeeper</dt> - <dd>http://hadoop.apache.org/zookeeper/</dd> - - <dt>Jini/River</dt> - <dd>http://www.jini.org/wiki/Main_Page, http://incubator.apache.org/river/RIVER/index.html</dd> - - <dt>Pig</dt> - <dd>http://research.yahoo.com/node/90</dd> - - <dt>Sawzall</dt> - <dd>http://labs.google.com/papers/sawzall.html</dd> - - <dt>Boxwood</dt> - <dd>http://research.microsoft.com/research/sv/Boxwood/</dd> - - <dt>Blue Cloud</dt> - <dd>http://www.techcrunch.com/2007/11/15/ibms-blue-cloud-is-web-computng-by-another-name/</dd> - - <dt>SimpleDB</dt> - <dd>http://www.techcrunch.com/2007/12/14/amazon-takes-on-oracle-and-ibm-with-simple-db-beta/</dd> - - <dt>mg4j</dt> - <dd>http://mg4j.dsi.unimi.it/</dd> - - </dl> - -</body> -</html> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tho...@us...> - 2014-01-23 11:34:06
|
Revision: 7819 http://bigdata.svn.sourceforge.net/bigdata/?rev=7819&view=rev Author: thompsonbry Date: 2014-01-23 11:33:50 +0000 (Thu, 23 Jan 2014) Log Message: ----------- Added unit tests for #801 (Adding optional removes solutions). Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/TestSubQuery.java Added Paths: ----------- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/test_ticket_801_complex_optionals.nt branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/test_ticket_801_complex_optionals.srx branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/test_ticket_801a_complex_optionals.rq branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/test_ticket_801b_complex_optionals.rq Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/TestSubQuery.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/TestSubQuery.java 2014-01-23 00:11:09 UTC (rev 7818) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/TestSubQuery.java 2014-01-23 11:33:50 UTC (rev 7819) @@ -29,9 +29,11 @@ import org.openrdf.model.Value; +import com.bigdata.BigdataStatics; import com.bigdata.bop.BOpUtility; import com.bigdata.rdf.sparql.ast.NamedSubqueryRoot; import com.bigdata.rdf.sparql.ast.QueryHints; +import com.bigdata.rdf.sparql.ast.optimizers.ASTComplexOptionalOptimizer; import com.bigdata.rdf.sparql.ast.optimizers.ASTSparql11SubqueryOptimizer; import com.bigdata.rdf.sparql.ast.optimizers.TestASTSparql11SubqueryOptimizer; @@ -298,4 +300,113 @@ } + /** + * This ticket is for a bug when the {@link ASTComplexOptionalOptimizer} + * runs. If that optimizer is disabled, then the query is fine. There are + * two versions for this method. One in which one of the OPTIONALs is turned + * into a required join. In this case, the problem is not demonstrated since + * the {@link ASTComplexOptionalOptimizer} does not run. In the other case, + * the join group is OPTIONAL rather than required and the problem is + * demonstrated. + * + * <pre> + * select ?name + * { + * { + * select ?p + * { + * ?p a <http://www.example.org/schema/Person> . + * optional{?p <http://www.example.org/schema/age> ?age.} + * } + * LIMIT 1 + * } + * + * {?p <http://www.example.org/schema/name> ?name.} + * + * #OPTIONAL + * { ?post a <http://www.example.org/schema/Post> . + * ?post <http://www.example.org/schema/postedBy> ?p. + * ?post <http://www.example.org/schema/content> ?postContent. + * } + * OPTIONAL{ + * ?comment a <http://www.example.org/schema/Comment> . + * ?comment <http://www.example.org/schema/parentPost> ?post. + * ?cperson a <http://www.example.org/schema/Person> . + * ?comment <http://www.example.org/schema/postedBy> ?cperson . + * } + * } + * </pre> + * + * @see <a href="https://sourceforge.net/apps/trac/bigdata/ticket/801" > + * Adding OPTIONAL removes solutions</a> + */ + public void test_ticket_801a_complex_optionals() throws Exception { + + final TestHelper h = new TestHelper( + "test_ticket_801a_complex_optionals", // testURI, + "test_ticket_801a_complex_optionals.rq",// queryFileURL + "test_ticket_801_complex_optionals.nt",// dataFileURL + "test_ticket_801_complex_optionals.srx"// resultFileURL + ); + + // Run test. + h.runTest(); + + } + + /** + * In this variant, one of the child join groups is OPTIONAL rather than + * required. This shows the problem reported in the ticket where adding an + * OPTIONAL join group reduces the number of solutions. + * + * <pre> + * select ?name + * { + * { + * select ?p + * { + * ?p a <http://www.example.org/schema/Person> . + * optional{?p <http://www.example.org/schema/age> ?age.} + * } + * LIMIT 1 + * } + * + * {?p <http://www.example.org/schema/name> ?name.} + * + * OPTIONAL + * { ?post a <http://www.example.org/schema/Post> . + * ?post <http://www.example.org/schema/postedBy> ?p. + * ?post <http://www.example.org/schema/content> ?postContent. + * } + * OPTIONAL{ + * ?comment a <http://www.example.org/schema/Comment> . + * ?comment <http://www.example.org/schema/parentPost> ?post. + * ?cperson a <http://www.example.org/schema/Person> . + * ?comment <http://www.example.org/schema/postedBy> ?cperson . + * } + * } + * </pre> + */ + public void test_ticket_801b_complex_optionals() throws Exception { + + if (!BigdataStatics.runKnownBadTests) { + /* + * FIXME Add this test to CI once we make some more progress + * against the underlying issue. + */ + return; + } + + final TestHelper h = new TestHelper( + "test_ticket_801b_complex_optionals", // testURI, + "test_ticket_801b_complex_optionals.rq",// queryFileURL + "test_ticket_801_complex_optionals.nt",// dataFileURL + "test_ticket_801_complex_optionals.srx"// resultFileURL + ); + + // Run test. + h.runTest(); + + } + } Added: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/test_ticket_801_complex_optionals.nt =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/test_ticket_801_complex_optionals.nt (rev 0) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/test_ticket_801_complex_optionals.nt 2014-01-23 11:33:50 UTC (rev 7819) @@ -0,0 +1,35 @@ +<http://www.example.com/person1> <http://www.example.org/schema/age> "39"^^<http://www.w3.org/2001/XMLSchema#integer> . +<http://www.example.com/person1> <http://www.example.org/schema/name> "Person #1"^^<http://www.w3.org/2001/XMLSchema#string> . +<http://www.example.com/person1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.example.org/schema/Person> . + +<http://www.example.com/person2> <http://www.example.org/schema/age> "29"^^<http://www.w3.org/2001/XMLSchema#integer> . +<http://www.example.com/person2> <http://www.example.org/schema/name> "Person #2"^^<http://www.w3.org/2001/XMLSchema#string> . +<http://www.example.com/person2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.example.org/schema/Person> . + +<http://www.example.com/person3> <http://www.example.org/schema/age> "19"^^<http://www.w3.org/2001/XMLSchema#integer> . +<http://www.example.com/person3> <http://www.example.org/schema/name> "Person #3"^^<http://www.w3.org/2001/XMLSchema#string> . +<http://www.example.com/person3> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.example.org/schema/Person> . + +<http://www.example.com/post1> <http://www.example.org/schema/content> "Post 1 content"^^<http://www.w3.org/2001/XMLSchema#string> . +<http://www.example.com/post1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.example.org/schema/Post> . +<http://www.example.com/post1> <http://www.example.org/schema/postedBy> <http://www.example.com/person1>. + +<http://www.example.com/post2> <http://www.example.org/schema/content> "Post 2 content"^^<http://www.w3.org/2001/XMLSchema#string> . +<http://www.example.com/post2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.example.org/schema/Post> . +<http://www.example.com/post2> <http://www.example.org/schema/postedBy> <http://www.example.com/person1>. + +<http://www.example.com/comment1> <http://www.example.org/schema/content> "Comment 1 content"^^<http://www.w3.org/2001/XMLSchema#string> . +<http://www.example.com/comment1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.example.org/schema/Comment> . +<http://www.example.com/comment1> <http://www.example.org/schema/parentPost> <http://www.example.com/post1> . +<http://www.example.com/comment1> <http://www.example.org/schema/postedBy> <http://www.example.com/person2>. + +<http://www.example.com/comment2> <http://www.example.org/schema/content> "Comment 2 content"^^<http://www.w3.org/2001/XMLSchema#string> . +<http://www.example.com/comment2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.example.org/schema/Comment> . +<http://www.example.com/comment2> <http://www.example.org/schema/parentPost> <http://www.example.com/post1> . +<http://www.example.com/comment2> <http://www.example.org/schema/postedBy> <http://www.example.com/person3>. + + + + + + Added: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/test_ticket_801_complex_optionals.srx =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/test_ticket_801_complex_optionals.srx (rev 0) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/test_ticket_801_complex_optionals.srx 2014-01-23 11:33:50 UTC (rev 7819) @@ -0,0 +1,26 @@ +<?xml version="1.0"?> +<sparql + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:xs="http://www.w3.org/2001/XMLSchema#" + xmlns="http://www.w3.org/2005/sparql-results#" > + <head> + <variable name="name"/> + </head> + <results> + <result> + <binding name="name"> + <literal datatype="http://www.w3.org/2001/XMLSchema#string">Person #1</literal> + </binding> + </result> + <result> + <binding name="name"> + <literal datatype="http://www.w3.org/2001/XMLSchema#string">Person #1</literal> + </binding> + </result> + <result> + <binding name="name"> + <literal datatype="http://www.w3.org/2001/XMLSchema#string">Person #1</literal> + </binding> + </result> + </results> +</sparql> Added: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/test_ticket_801a_complex_optionals.rq =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/test_ticket_801a_complex_optionals.rq (rev 0) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/test_ticket_801a_complex_optionals.rq 2014-01-23 11:33:50 UTC (rev 7819) @@ -0,0 +1,27 @@ +# See #801 (Adding OPTIONAL removes solutions) +# +select ?name +{ + { + select ?p + { + ?p a <http://www.example.org/schema/Person> . + optional{?p <http://www.example.org/schema/age> ?age.} + } + LIMIT 1 + } + + {?p <http://www.example.org/schema/name> ?name.} + + #OPTIONAL + { ?post a <http://www.example.org/schema/Post> . + ?post <http://www.example.org/schema/postedBy> ?p. + ?post <http://www.example.org/schema/content> ?postContent. + } + OPTIONAL{ + ?comment a <http://www.example.org/schema/Comment> . + ?comment <http://www.example.org/schema/parentPost> ?post. + ?cperson a <http://www.example.org/schema/Person> . + ?comment <http://www.example.org/schema/postedBy> ?cperson . + } +} \ No newline at end of file Added: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/test_ticket_801b_complex_optionals.rq =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/test_ticket_801b_complex_optionals.rq (rev 0) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/test_ticket_801b_complex_optionals.rq 2014-01-23 11:33:50 UTC (rev 7819) @@ -0,0 +1,27 @@ +# See #801 (Adding OPTIONAL removes solutions) +# +select ?name +{ + { + select ?p + { + ?p a <http://www.example.org/schema/Person> . + optional{?p <http://www.example.org/schema/age> ?age.} + } + LIMIT 1 + } + + {?p <http://www.example.org/schema/name> ?name.} + + OPTIONAL + { ?post a <http://www.example.org/schema/Post> . + ?post <http://www.example.org/schema/postedBy> ?p. + ?post <http://www.example.org/schema/content> ?postContent. + } + OPTIONAL{ + ?comment a <http://www.example.org/schema/Comment> . + ?comment <http://www.example.org/schema/parentPost> ?post. + ?cperson a <http://www.example.org/schema/Person> . + ?comment <http://www.example.org/schema/postedBy> ?cperson . + } +} \ 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: <jer...@us...> - 2014-01-23 00:11:19
|
Revision: 7818 http://bigdata.svn.sourceforge.net/bigdata/?rev=7818&view=rev Author: jeremy_carroll Date: 2014-01-23 00:11:09 +0000 (Thu, 23 Jan 2014) Log Message: ----------- New tests for Trac 804: heisenbug on update with union Added Paths: ----------- branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/NamedGraphUpdateTest.java Added: branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/NamedGraphUpdateTest.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/NamedGraphUpdateTest.java (rev 0) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/NamedGraphUpdateTest.java 2014-01-23 00:11:09 UTC (rev 7818) @@ -0,0 +1,134 @@ +/** +Copyright (C) SYSTAP, LLC 2014. 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.webapp; + +import java.io.IOException; + +import junit.framework.Test; + + +/** + * This class is concernign the issues raised in trac 804 + * https://sourceforge.net/apps/trac/bigdata/ticket/804 + * @author jeremycarroll + * + */ +public class NamedGraphUpdateTest extends AbstractProtocolTest { + + public NamedGraphUpdateTest(String name) { + super(name); + } + + + private String atomicMoveNamedGraph(boolean useHint) { + // Atomic update of uploaded graph + return + "DELETE {\n" + + " GRAPH <eg:a> {\n" + + " ?olds ?oldp ?oldo\n" + + " }\n" + + " GRAPH <eg:tmp> {\n" + + " ?news ?newp ?newo\n" + + " }\n" + + "}\n" + + "INSERT {\n" + + " GRAPH <eg:a> {\n" + + " ?news ?newp ?newo\n" + + " }\n" + + "}\n" + + "WHERE {\n" + + (useHint?" hint:Query hint:chunkSize 2 .\n":"") + + " {\n" + + " GRAPH <eg:a> {\n" + + " ?olds ?oldp ?oldo\n" + + " }\n" + + " } UNION {\n" + + " GRAPH <eg:tmp> {\n" + + " ?news ?newp ?newo\n" + + " }\n" + + " }\n" + + "}"; + } + + private String insertData = + "prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" + + "INSERT DATA\n" + + "{ \n" + + " GRAPH <eg:a> {\n" + + " [ a \"Blank\" ] .\n" + + " <eg:b> rdf:type <eg:c> ; rdf:value [] .\n" + + " [ rdf:value [] ]\n" + + " }\n" + + " GRAPH <eg:tmp> {\n" + + " [ a \"Blankx\" ] .\n" + + " <eg:B> rdf:type <eg:C> ; rdf:value [] .\n" + + " [ rdf:value [] ]\n" + + " }\n" + + "}\n"; + + private String ask = "ASK { GRAPH <eg:tmp> { ?s ?p ?o } }"; + + private void updateAFewTimes(boolean useHint, int numberOfTimes, int numberOfUpdatesPerTime) throws IOException { + for (int i=0; i<numberOfTimes; i++) { + for (int j=0; j<numberOfUpdatesPerTime;j++) { + setMethodisPostUrlEncodedData(); + serviceRequest("update", insertData); + } + setMethodisPostUrlEncodedData(); + serviceRequest("update", atomicMoveNamedGraph(useHint) ); + if (!serviceRequest("query", ask ).contains("false")) { + fail("On loop "+i+" (number of updates = "+numberOfUpdatesPerTime+")"); + } + } + } + + public void test_t_20_1() throws IOException { + updateAFewTimes(true, 20, 1); + } + public void test_t_20_2() throws IOException { + updateAFewTimes(true, 20, 2); + } + public void test_t_20_3() throws IOException { + updateAFewTimes(true, 20, 3); + } + public void test_t_20_5() throws IOException { + updateAFewTimes(true, 20, 5); + } + public void test_f_20_1() throws IOException { + updateAFewTimes(false, 20, 1); + } + public void test_f_20_2() throws IOException { + updateAFewTimes(false, 20, 2); + } + public void test_f_20_3() throws IOException { + updateAFewTimes(false, 20, 3); + } + public void test_f_20_5() throws IOException { + updateAFewTimes(false, 20, 5); + } + static public Test suite() { + return ProxySuiteHelper.suiteWhenStandalone(NamedGraphUpdateTest.class,"test.*", TestMode.quads); + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tho...@us...> - 2014-01-20 22:29:11
|
Revision: 7817 http://bigdata.svn.sourceforge.net/bigdata/?rev=7817&view=rev Author: thompsonbry Date: 2014-01-20 22:29:04 +0000 (Mon, 20 Jan 2014) Log Message: ----------- Also wrapped as assertCondition one test that was checking the HALog outcome status in TestHA3JournalServer. See #780 (Incremental or asynchronous purge of HALog files) Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-jini/src/test/com/bigdata/journal/jini/ha/TestHA3JournalServer.java Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-jini/src/test/com/bigdata/journal/jini/ha/TestHA3JournalServer.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-jini/src/test/com/bigdata/journal/jini/ha/TestHA3JournalServer.java 2014-01-20 22:27:50 UTC (rev 7816) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-jini/src/test/com/bigdata/journal/jini/ha/TestHA3JournalServer.java 2014-01-20 22:29:04 UTC (rev 7817) @@ -1829,10 +1829,24 @@ // Run through another transaction simpleTransaction(); - // all committed logs should be removed with only open log remaining - assertEquals(1L, recursiveCount(getHALogDirA(),IHALogReader.HALOG_FILTER)); - assertEquals(1L, recursiveCount(getHALogDirB(),IHALogReader.HALOG_FILTER)); - assertEquals(1L, recursiveCount(getHALogDirC(),IHALogReader.HALOG_FILTER)); + /** + * All committed logs should be removed with only open log remaining. + * + * Note: This condition is only eventually true now that we allow the + * asychronous release of the HALog files. + * + * @see <a href="http://sourceforge.net/apps/trac/bigdata/ticket/780" + * >Incremental or asynchronous purge of HALog files</a> + */ + assertCondition(new Runnable() { + + public void run() { + assertEquals(1L, recursiveCount(getHALogDirA(),IHALogReader.HALOG_FILTER)); + assertEquals(1L, recursiveCount(getHALogDirB(),IHALogReader.HALOG_FILTER)); + assertEquals(1L, recursiveCount(getHALogDirC(),IHALogReader.HALOG_FILTER)); + } + }); + } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tho...@us...> - 2014-01-20 22:27:57
|
Revision: 7816 http://bigdata.svn.sourceforge.net/bigdata/?rev=7816&view=rev Author: thompsonbry Date: 2014-01-20 22:27:50 +0000 (Mon, 20 Jan 2014) Log Message: ----------- I have modified HALogNexus to release the HALog files asynchronously. This causes some problems in the existing unit tests, so I have added a configuration parameter that may be used to specify a synchronous HALog release timeout - this defaults to ZERO, but may be increased as desired (in exchange for latency in 2-phase commits) or as necessary for the existing tests, some of which assume that HALog files are released synchronously at the 2-phase commit. The expected behavior should now be that HALog files are asynchronously release starting with the first 2-phase commit in which the corresponding commit point is reclaimable. The release of HALog files will continue until the specified first commit point that may not be released, or until an invariant is violated. Under sustained commits with concurrent releases, any commit in which the task to release HALog files is longer running will start a new such task with a new earliest commit point that may not be released. Changes are to: * HALogNexus: now submits a task to release the HALog files. There can be at most one instance of this task running for a given HAJournal. The task is wrapped by the FutureTaskInvariantMon and will be cancelled if the service is no longer joined with the met quorum. * HAJournalServer: A new configuration parameter exists to control the maximum delay for releasing the HALog files (default is ZERO milliseconds). * TestHARestorePolicy: This was modified to raise the timeout for the synchronous purge of the HALogs so the test assumptions would remain valid. Note: The HAJournalServer.ConfigurationOptions.HA_LOG_PURGE_TIMEOUT defaults to zero. This is probably what we always want. However, the existence of this option allows us to revert to the old behavior using a configuration change or by changing the default. See #780 Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-jini/src/java/com/bigdata/journal/jini/ha/HAJournalServer.java branches/BIGDATA_RELEASE_1_3_0/bigdata-jini/src/java/com/bigdata/journal/jini/ha/HALogNexus.java branches/BIGDATA_RELEASE_1_3_0/bigdata-jini/src/test/com/bigdata/journal/jini/ha/TestHA3RestorePolicy.java Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-jini/src/java/com/bigdata/journal/jini/ha/HAJournalServer.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-jini/src/java/com/bigdata/journal/jini/ha/HAJournalServer.java 2014-01-20 20:29:52 UTC (rev 7815) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-jini/src/java/com/bigdata/journal/jini/ha/HAJournalServer.java 2014-01-20 22:27:50 UTC (rev 7816) @@ -347,6 +347,27 @@ String DEFAULT_HA_LOG_DIR = "HALog"; /** + * The maximum amount of time in milliseconds to await the synchronous + * release of older HALog files during a 2-phase commit (default + * {@value #DEFAULT_HA_LOG_PURGE_TIMEOUT}). This MAY be ZERO to not + * wait. Large timeouts can cause significant latency during a 2-phase + * commit if a large number of HALog files should be released + * accordinging to the {@link IRestorePolicy}. + * + * @see <a href="http://sourceforge.net/apps/trac/bigdata/ticket/780" + * >Incremental or asynchronous purge of HALog files</a> + */ + String HA_LOG_PURGE_TIMEOUT = "HALogPurgeTimeout"; + + /** + * The default is ZERO (0L) milliseconds, which is probably what we + * always want. However, the existence of this option allows us to + * revert to the old behavior using a configuration change or by + * changing the default. + */ + long DEFAULT_HA_LOG_PURGE_TIMEOUT = 0L; // milliseconds + + /** * The name of the directory in which periodic snapshots of the journal * will be written. Each snapshot is a full copy of the journal. * Snapshots are compressed and therefore may be much more compact than Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-jini/src/java/com/bigdata/journal/jini/ha/HALogNexus.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-jini/src/java/com/bigdata/journal/jini/ha/HALogNexus.java 2014-01-20 20:29:52 UTC (rev 7815) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-jini/src/java/com/bigdata/journal/jini/ha/HALogNexus.java 2014-01-20 22:27:50 UTC (rev 7816) @@ -32,7 +32,15 @@ import java.nio.ByteBuffer; import java.util.Arrays; import java.util.Iterator; +import java.util.concurrent.Callable; +import java.util.concurrent.CancellationException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.concurrent.FutureTask; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; @@ -43,6 +51,9 @@ import com.bigdata.btree.ITuple; import com.bigdata.btree.ITupleIterator; +import com.bigdata.concurrent.FutureTaskInvariantMon; +import com.bigdata.ha.HAGlue; +import com.bigdata.ha.QuorumService; import com.bigdata.ha.QuorumServiceBase; import com.bigdata.ha.halog.HALogReader; import com.bigdata.ha.halog.HALogWriter; @@ -56,6 +67,7 @@ import com.bigdata.journal.RootBlockView; import com.bigdata.journal.jini.ha.HALogIndex.HALogRecord; import com.bigdata.journal.jini.ha.HALogIndex.IHALogRecord; +import com.bigdata.quorum.Quorum; import com.bigdata.striterator.Resolver; import com.bigdata.striterator.Striterator; import com.bigdata.util.ChecksumError; @@ -206,12 +218,41 @@ */ private final HALogIndex haLogIndex; + /** + * The maximum amount of time in milliseconds to await the synchronous purge + * of HALog files during a 2-phase commit. + * + * @see <a href="http://sourceforge.net/apps/trac/bigdata/ticket/780" + * >Incremental or asynchronous purge of HALog files</a> + * + * @see HAJournalServer.ConfigurationOptions#HA_LOG_PURGE_TIMEOUT + */ + private final long haLogPurgeTimeout; + public HALogNexus(final HAJournalServer server, final HAJournal journal, final Configuration config) throws IOException, ConfigurationException { this.journal = journal; - + + { + haLogPurgeTimeout = (Long) config + .getEntry( + HAJournalServer.ConfigurationOptions.COMPONENT, + HAJournalServer.ConfigurationOptions.HA_LOG_PURGE_TIMEOUT, + Long.TYPE, + HAJournalServer.ConfigurationOptions.DEFAULT_HA_LOG_PURGE_TIMEOUT); + + if (haLogPurgeTimeout < 0) { + throw new ConfigurationException( + HAJournalServer.ConfigurationOptions.HA_LOG_PURGE_TIMEOUT + + "=" + + haLogPurgeTimeout + + " : must be GTE ZERO"); + } + + } + // Note: This is the effective service directory. final File serviceDir = server.getServiceDir(); @@ -1021,6 +1062,87 @@ } /** + * Class purges all HALog files LT the specified commit counter. This class + * is intended to run asynchronously in order to avoid large latency during + * a commit in which many HALog files may be released. + * + * @see <a href="http://sourceforge.net/apps/trac/bigdata/ticket/780" + * >Incremental or asynchronous purge of HALog files</a> + * + * @author <a href="mailto:tho...@us...">Bryan + * Thompson</a> + */ + private class DeleteHALogsTask implements Callable<Void> { + + private final long token; + private final long earliestRetainedSnapshotCommitCounter; + + DeleteHALogsTask(final long token, + final long earliestRetainedSnapshotCommitCounter) { + this.token = token; + this.earliestRetainedSnapshotCommitCounter = earliestRetainedSnapshotCommitCounter; + } + + @Override + public Void call() throws Exception { + + final long nfiles = haLogIndex.getEntryCount(); + + long ndeleted = 0L, totalBytes = 0L; + + final Iterator<IHALogRecord> itr = getHALogs(); + + while(itr.hasNext() && logAccessors.get() == 0) { + + final IHALogRecord r = itr.next(); + + final long closingCommitCounter = r.getCommitCounter(); + + final boolean deleteFile = closingCommitCounter < earliestRetainedSnapshotCommitCounter; + + if (!deleteFile) { + + // No more files to delete. + break; + + } + + if (!journal.getQuorum().isQuorumFullyMet(token)) { + /* + * Halt operation. + * + * Note: This is not an error, but we can not remove + * snapshots or HALogs if this invariant is violated. + */ + break; + } + + // The HALog file to be removed. + final File logFile = getHALogFile(closingCommitCounter); + + // Remove that HALog file from the file system and our index. + removeHALog(logFile); + + ndeleted++; + + totalBytes += r.sizeOnDisk(); + + } + + if (haLog.isInfoEnabled()) + haLog.info("PURGED LOGS: nfound=" + nfiles + ", ndeleted=" + + ndeleted + ", totalBytes=" + totalBytes + + ", earliestRetainedSnapshotCommitCounter=" + + earliestRetainedSnapshotCommitCounter); + + // done + return null; + + } + + } // class DeleteHALogsTask + + /** * Delete HALogs that are no longer required. * * @param earliestRetainedSnapshotCommitCounter @@ -1028,60 +1150,126 @@ * retained snapshot. We need to retain any HALogs that are GTE * this commit counter since they will be applied to that * snapshot. + * + * @see <a href="http://sourceforge.net/apps/trac/bigdata/ticket/780" + * >Incremental or asynchronous purge of HALog files</a> */ void deleteHALogs(final long token, final long earliestRetainedSnapshotCommitCounter) { - final long nfiles = haLogIndex.getEntryCount(); - - long ndeleted = 0L, totalBytes = 0L; + synchronized (deleteHALogFuture) { - final Iterator<IHALogRecord> itr = getHALogs(); - - while(itr.hasNext() && logAccessors.get() == 0) { - - final IHALogRecord r = itr.next(); + { + final Future<Void> f = deleteHALogFuture.get(); - final long closingCommitCounter = r.getCommitCounter(); - - final boolean deleteFile = closingCommitCounter < earliestRetainedSnapshotCommitCounter; + if (f != null) { - if (!deleteFile) { + /* + * Existing task. Check to see if done or still running. + */ - // No more files to delete. - break; + if (!f.isDone()) { + // Still releasing some HALogs from a previous request. + return; + } - } + try { + f.get(); + } catch (InterruptedException e) { + // propagate interrupt. + Thread.currentThread().interrupt(); + return; + } catch (CancellationException e) { + /* + * Note: This is not an error. If the invariants are + * violated, the task will be cancelled. The task is + * "safe" as long as the invariants are valid. + */ + log.warn("Cancelled: " + e); + } catch (ExecutionException e) { + log.error(e, e); + } - if (!journal.getQuorum().isQuorumFullyMet(token)) { - /* - * Halt operation. - * - * Note: This is not an error, but we can not remove - * snapshots or HALogs if this invariant is violated. - */ - break; + // clear reference. + deleteHALogFuture.set(null); + + } } - // The HALog file to be removed. - final File logFile = getHALogFile(closingCommitCounter); + /* + * Start new request. + */ - // Remove that HALog file from the file system and our index. - removeHALog(logFile); + final Quorum<HAGlue, QuorumService<HAGlue>> quorum = journal + .getQuorum(); - ndeleted++; + final QuorumService<HAGlue> localService = quorum.getClient(); - totalBytes += r.sizeOnDisk(); + // Task sends an HALog file along the pipeline. + final FutureTask<Void> ft = new FutureTaskInvariantMon<Void>( + new DeleteHALogsTask(token, + earliestRetainedSnapshotCommitCounter), quorum) { - } + @Override + protected void establishInvariants() { + assertQuorumMet(); + assertJoined(localService.getServiceId()); + assertMember(localService.getServiceId()); + } - if (haLog.isInfoEnabled()) - haLog.info("PURGED LOGS: nfound=" + nfiles + ", ndeleted=" - + ndeleted + ", totalBytes=" + totalBytes - + ", earliestRetainedSnapshotCommitCounter=" - + earliestRetainedSnapshotCommitCounter); + }; + // save reference to prevent concurrent execution of this task + deleteHALogFuture.set(ft); + + // Run task. + journal.getExecutorService().submit(ft); + + /* + * Wait up to a deadline for the HALogs to be purged. If this + * operation can not be completed synchronously, then it will + * continus asynchronously while the invariants remain valid. + * + * Note: Some of the unit tests were written to assume that the + * purge of the HALog files was synchronous. This assumption is no + * longer valid since we will purge the HALog files asynchronously + * in order to avoid latency during a commit when a large number of + * HALog files must be purged. + */ + if (haLogPurgeTimeout > 0) { + try { + ft.get(haLogPurgeTimeout, TimeUnit.MILLISECONDS); + } catch (InterruptedException e) { + // propagate interrupt. + Thread.currentThread().interrupt(); + return; + } catch (CancellationException e) { + /* + * Note: This is not an error. If the invariants are + * violated, the task will be cancelled. The task is "safe" + * as long as the invariants are valid. + */ + log.warn("Cancelled: " + e); + return; + } catch (ExecutionException e) { + throw new RuntimeException(e); + } catch (TimeoutException e) { + // ignore. + } + } + + } + } + + /** + * Reference is used to avoid concurrent execution of multiple instances of + * the {@link DeleteHALogsTask}. + * <p> + * Note: This {@link AtomicReference} also doubles as a monitor object to + * provide a guard for {@link #deleteHALogs(long, long)}. + */ + private final AtomicReference<Future<Void>> deleteHALogFuture = new AtomicReference<Future<Void>>(); /** * Delete all HALog files (except the current one). The {@link #haLogIndex} Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-jini/src/test/com/bigdata/journal/jini/ha/TestHA3RestorePolicy.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-jini/src/test/com/bigdata/journal/jini/ha/TestHA3RestorePolicy.java 2014-01-20 20:29:52 UTC (rev 7815) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-jini/src/test/com/bigdata/journal/jini/ha/TestHA3RestorePolicy.java 2014-01-20 22:27:50 UTC (rev 7816) @@ -97,7 +97,8 @@ return new String[]{ "com.bigdata.journal.jini.ha.HAJournalServer.restorePolicy=new com.bigdata.journal.jini.ha.DefaultRestorePolicy("+restorePolicyMinSnapshotAgeMillis+","+restorePolicyMinSnapshots+","+restorePolicyMinRestorePoints+")", - "com.bigdata.journal.jini.ha.HAJournalServer.snapshotPolicy=new com.bigdata.journal.jini.ha.NoSnapshotPolicy()" + "com.bigdata.journal.jini.ha.HAJournalServer.snapshotPolicy=new com.bigdata.journal.jini.ha.NoSnapshotPolicy()", + "com.bigdata.journal.jini.ha.HAJournalServer.HALogPurgeTimeout="+Long.MAX_VALUE+"L" // force synchronous purge. }; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tho...@us...> - 2014-01-20 20:29:59
|
Revision: 7815 http://bigdata.svn.sourceforge.net/bigdata/?rev=7815&view=rev Author: thompsonbry Date: 2014-01-20 20:29:52 +0000 (Mon, 20 Jan 2014) Log Message: ----------- javadoc Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/concurrent/FutureTaskInvariantMon.java Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/concurrent/FutureTaskInvariantMon.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/concurrent/FutureTaskInvariantMon.java 2014-01-18 23:00:38 UTC (rev 7814) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/concurrent/FutureTaskInvariantMon.java 2014-01-20 20:29:52 UTC (rev 7815) @@ -193,7 +193,7 @@ /** * Establish an invariant that the quorum is met and remains met on the same - * token. + * token (the one specified to the constructor). */ public void assertQuorumMet() { m_triggers.add(new QuorumEventInvariant(QuorumEventEnum.QUORUM_BROKE, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tho...@us...> - 2014-01-18 23:00:49
|
Revision: 7814 http://bigdata.svn.sourceforge.net/bigdata/?rev=7814&view=rev Author: thompsonbry Date: 2014-01-18 23:00:38 +0000 (Sat, 18 Jan 2014) Log Message: ----------- Resolution for #803 (prefixMatch does not work in full text search). The root cause was a change in how this feature is invoked. It is now indicated by a wildcard in the bsd:search literal. Added a unit test for the simplified version of this syntax. Cleaned up many references to bd:search. The default namespace for this is now bds. Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/ASTSearchInSearchOptimizer.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/ASTSearchOptimizer.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/store/BDS.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/search-prefix-match.rq branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/service/TestSearch.java Added Paths: ----------- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/search-prefix-match2.rq Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/ASTSearchInSearchOptimizer.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/ASTSearchInSearchOptimizer.java 2014-01-17 15:38:51 UTC (rev 7813) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/ASTSearchInSearchOptimizer.java 2014-01-18 23:00:38 UTC (rev 7814) @@ -29,7 +29,6 @@ import java.util.Map; -import org.apache.log4j.Logger; import org.openrdf.model.Literal; import com.bigdata.bop.Constant; @@ -54,26 +53,28 @@ import com.bigdata.search.IHit; /** - * Converts a BDS.SEARCH_IN_SEARCH function call (inside a filter) - * into an IN filter using the full text index to determine the IN - * set. + * Converts a {@link BDS#SEARCH_IN_SEARCH} function call (inside a filter) into + * an IN filter using the full text index to determine the IN set. * * Convert: * + * <pre> * filter(<BDS.SEARCH_IN_SEARCH>(?o,"foo")) . + * </pre> * * To: * + * <pre> * filter(?o IN ("foo", "foo bar", "hello foo", ...)) . + * </pre> * - * This is a way of using the full text index to filter instead of - * using regex. + * This is a way of using the full text index to filter instead of using regex. */ public class ASTSearchInSearchOptimizer extends AbstractJoinGroupOptimizer { - private static final Logger log = Logger.getLogger(ASTSearchInSearchOptimizer.class); +// private static final Logger log = Logger.getLogger(ASTSearchInSearchOptimizer.class); - static long time = 0; +// static private long time = 0; /** * Optimize the join group. @@ -81,7 +82,7 @@ protected void optimizeJoinGroup(final AST2BOpContext ctx, final StaticAnalysis sa, final IBindingSet[] bSets, final JoinGroupNode group) { - final long start = System.currentTimeMillis(); +// final long start = System.currentTimeMillis(); for (FilterNode node : group.getChildren(FilterNode.class)) { @@ -89,7 +90,7 @@ } - time += (System.currentTimeMillis() - start); +// time += (System.currentTimeMillis() - start); // System.err.println(time); Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/ASTSearchOptimizer.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/ASTSearchOptimizer.java 2014-01-17 15:38:51 UTC (rev 7813) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/ASTSearchOptimizer.java 2014-01-18 23:00:38 UTC (rev 7814) @@ -57,19 +57,18 @@ import com.bigdata.rdf.sparql.ast.VarNode; import com.bigdata.rdf.sparql.ast.optimizers.IASTOptimizer; import com.bigdata.rdf.sparql.ast.service.ServiceNode; -import com.bigdata.rdf.store.BD; import com.bigdata.rdf.store.BDS; /** - * Translate {@link BD#SEARCH} and related magic predicates into a + * Translate {@link BDS#SEARCH} and related magic predicates into a * {@link ServiceNode} which will invoke the bigdata search engine. * * <pre> * with { * select ?subj ?score * where { - * ?lit bd:search "foo" . - * ?lit bd:relevance ?score . + * ?lit bds:search "foo" . + * ?lit bds:relevance ?score . * ?subj ?p ?lit . * } * ORDER BY DESC(?score) @@ -88,7 +87,7 @@ /** * The known search URIs. * <p> - * Note: We can recognize anything in {@link BD#SEARCH_NAMESPACE}, but the + * Note: We can recognize anything in {@link BDS#SEARCH_NAMESPACE}, but the * predicate still has to be something that we know how to interpret. */ static final Set<URI> searchUris; Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/store/BDS.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/store/BDS.java 2014-01-17 15:38:51 UTC (rev 7813) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/store/BDS.java 2014-01-18 23:00:38 UTC (rev 7814) @@ -103,8 +103,8 @@ * * select ?s ?relevance * where { - * ?s bd:search "scale-out RDF triplestore" . - * ?s bd:relevance ?relevance . + * ?s bds:search "scale-out RDF triplestore" . + * ?s bds:relevance ?relevance . * } * * </pre> @@ -131,8 +131,8 @@ * * select ?s ?rank * where { - * ?s bd:search "scale-out RDF triplestore" . - * ?s bd:rank ?rank . + * ?s bds:search "scale-out RDF triplestore" . + * ?s bds:rank ?rank . * } * * </pre> @@ -152,8 +152,8 @@ * * select ?s * where { - * ?s bd:search "scale-out RDF triplestore" . - * ?s bd:maxRank "5"^^xsd:int . + * ?s bds:search "scale-out RDF triplestore" . + * ?s bds:maxRank "5"^^xsd:int . * } * * </pre> @@ -183,8 +183,8 @@ * * select ?s * where { - * ?s bd:search "scale-out RDF triplestore" . - * ?s bd:minRank "5"^^xsd:int . + * ?s bds:search "scale-out RDF triplestore" . + * ?s bds:minRank "5"^^xsd:int . * } * * </pre> @@ -208,8 +208,8 @@ * * select ?s * where { - * ?s bd:search "scale-out RDF triplestore" . - * ?s bd:minRelevance "0.5"^^xsd:double . + * ?s bds:search "scale-out RDF triplestore" . + * ?s bds:minRelevance "0.5"^^xsd:double . * } * * </pre> @@ -232,8 +232,8 @@ * * select ?s * where { - * ?s bd:search "scale-out RDF triplestore" . - * ?s bd:maxRelevance "0.9"^^xsd:double . + * ?s bds:search "scale-out RDF triplestore" . + * ?s bds:maxRelevance "0.9"^^xsd:double . * } * * </pre> @@ -263,8 +263,8 @@ * * select ?s * where { - * ?s bd:search "scale-out RDF triplestore" . - * ?s bd:matchAllTerms "true" . + * ?s bds:search "scale-out RDF triplestore" . + * ?s bds:matchAllTerms "true" . * } * * </pre> @@ -283,8 +283,8 @@ * * select ?s * where { - * ?s bd:search "scale-out RDF triplestore" . - * ?s bd:matchExact "true" . + * ?s bds:search "scale-out RDF triplestore" . + * ?s bds:matchExact "true" . * } * * </pre> @@ -306,8 +306,8 @@ * * select ?s * where { - * ?s bd:search "scale-out RDF triplestore" . - * ?s bd:matchRegex "regex to apply to ?s bindings" . + * ?s bds:search "scale-out RDF triplestore" . + * ?s bds:matchRegex "regex to apply to ?s bindings" . * } * * </pre> @@ -320,6 +320,22 @@ final String DEFAULT_MATCH_REGEX = null; /** + * + * <strong>Prefix matching is now indicated using a wildcard</strong> + * + * <pre> + * PREFIX bds: <http://www.bigdata.com/rdf/search#> + * + * SELECT ?subj ?label + * WHERE { + * ?label bds:search "mi*" . + * ?label bds:relevance ?cosine . + * ?subj ?p ?label . + * } + * </pre> + * + * <strong>The following approach is no longer supported. </strong> + * * Magic predicate used to query for free text search metadata to turn on * prefix matching. Prefix matching will match all full text index tokens * that begin with the specified token(s) (default @@ -331,16 +347,25 @@ * * select ?s * where { - * ?s bd:search "scale-out RDF triplestore" . - * ?s bd:prefixMatch "true" . + * ?s bds:search "scale-out RDF triplestore" . + * ?s bds:prefixMatch "true" . * } * * </pre> * <p> * This will turn on prefix matching. + * + * @deprecated Prefix matching is now invoked using a wildcard. + * + * @see <a href="https://sourceforge.net/apps/trac/bigdata/ticket/803" > + * prefixMatch does not work in full text search </a> */ + @Deprecated final URI PREFIX_MATCH = new URIImpl(NAMESPACE + "prefixMatch"); - + + /** + * @deprecated This option is now invoked using a wildcard. + */ final boolean DEFAULT_PREFIX_MATCH = false; /** @@ -351,8 +376,8 @@ * * select ?s * where { - * ?s bd:search "scale-out RDF triplestore" . - * ?s bd:subjectSearch "true" . + * ?s bds:search "scale-out RDF triplestore" . + * ?s bds:subjectSearch "true" . * } * * </pre> @@ -381,8 +406,8 @@ * * select ?s * where { - * ?s bd:search "scale-out RDF triplestore" . - * ?s bd:searchTimeout "5000" . + * ?s bds:search "scale-out RDF triplestore" . + * ?s bds:searchTimeout "5000" . * } * * </pre> Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/search-prefix-match.rq =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/search-prefix-match.rq 2014-01-17 15:38:51 UTC (rev 7813) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/search-prefix-match.rq 2014-01-18 23:00:38 UTC (rev 7814) @@ -1,15 +1,9 @@ # Search query. -PREFIX bd: <http://www.bigdata.com/rdf/search#> +PREFIX bds: <http://www.bigdata.com/rdf/search#> SELECT ?subj ?label - WITH { - SELECT ?subj ( ?lit as ?label ) - WHERE { - ?lit bd:search "mi*" . - ?lit bd:relevance ?cosine . - ?subj ?p ?lit . - } - } as %searchSet1 WHERE { - include %searchSet1 + ?label bds:search "mi*" . + ?label bds:relevance ?cosine . + ?subj ?p ?label . } Added: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/search-prefix-match2.rq =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/search-prefix-match2.rq (rev 0) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/search-prefix-match2.rq 2014-01-18 23:00:38 UTC (rev 7814) @@ -0,0 +1,15 @@ +# Search query. +PREFIX bds: <http://www.bigdata.com/rdf/search#> + +SELECT ?subj ?label + WITH { + SELECT ?subj ( ?lit as ?label ) + WHERE { + ?lit bds:search "mi*" . + ?lit bds:relevance ?cosine . + ?subj ?p ?lit . + } + } as %searchSet1 +WHERE { + include %searchSet1 +} Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/service/TestSearch.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/service/TestSearch.java 2014-01-17 15:38:51 UTC (rev 7813) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/service/TestSearch.java 2014-01-18 23:00:38 UTC (rev 7814) @@ -154,11 +154,60 @@ /** * Unit test for a prefix match ("mi*"). + * + * <pre> + * # Search query. + * PREFIX bds: <http://www.bigdata.com/rdf/search#> + * + * SELECT ?subj ?label + * WHERE { + * ?lit bds:search "mi*" . + * ?lit bds:relevance ?cosine . + * ?subj ?p ?label . + * } + * </pre> */ public void test_search_prefix_match() throws Exception { - new TestHelper("search-prefix-match").runTest(); + new TestHelper( + "search-prefix-match",// testURI + "search-prefix-match.rq",// query + "search-prefix-match.trig",//data + "search-prefix-match.srx" // expected results + ).runTest(); + + } + + /** + * Unit test for a prefix match ("mi*"). + * + * <pre> + * # Search query. + * PREFIX bds: <http://www.bigdata.com/rdf/search#> + * + * SELECT ?subj ?label + * WITH { + * SELECT ?subj ( ?lit as ?label ) + * WHERE { + * ?lit bds:search "mi*" . + * ?lit bds:relevance ?cosine . + * ?subj ?p ?lit . + * } + * } as %searchSet1 + * WHERE { + * include %searchSet1 + * } + * </pre> + */ + public void test_search_prefix_match2() throws Exception { + new TestHelper( + "search-prefix-match2",// testURI + "search-prefix-match2.rq",// query + "search-prefix-match.trig",//data + "search-prefix-match.srx" // expected results + ).runTest(); + } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tho...@us...> - 2014-01-17 15:38:58
|
Revision: 7813 http://bigdata.svn.sourceforge.net/bigdata/?rev=7813&view=rev Author: thompsonbry Date: 2014-01-17 15:38:51 +0000 (Fri, 17 Jan 2014) Log Message: ----------- added link to ticket. See #802. Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/extensions/DateTimeExtension.java Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/extensions/DateTimeExtension.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/extensions/DateTimeExtension.java 2014-01-17 14:01:40 UTC (rev 7812) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/extensions/DateTimeExtension.java 2014-01-17 15:38:51 UTC (rev 7813) @@ -241,6 +241,9 @@ /** * Singleton caching pattern for the Datatype factory reference. + * + * @see <a href="http://sourceforge.net/apps/trac/bigdata/ticket/802"> + * Optimize DatatypeFactory instantiation in DateTimeExtension </a> */ static { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tho...@us...> - 2014-01-17 14:01:48
|
Revision: 7812 http://bigdata.svn.sourceforge.net/bigdata/?rev=7812&view=rev Author: thompsonbry Date: 2014-01-17 14:01:40 +0000 (Fri, 17 Jan 2014) Log Message: ----------- Committing a singleton pattern optimization for the DatatypeFactory used by the DateTimeExtension. This passes local tests for the AST and SPARQL execution test suites. Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/extensions/DateTimeExtension.java Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/extensions/DateTimeExtension.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/extensions/DateTimeExtension.java 2014-01-16 19:30:15 UTC (rev 7811) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/extensions/DateTimeExtension.java 2014-01-17 14:01:40 UTC (rev 7812) @@ -52,6 +52,7 @@ import com.bigdata.rdf.model.BigdataURI; import com.bigdata.rdf.model.BigdataValue; import com.bigdata.rdf.model.BigdataValueFactory; +import com.bigdata.util.InnerCause; /** * This implementation of {@link IExtension} implements inlining for literals @@ -87,16 +88,17 @@ } private void resolve(final IDatatypeURIResolver resolver, final URI uri) { + + if (log.isDebugEnabled()) { + log.debug("resolving: " + uri); + } - if (log.isDebugEnabled()) { - log.debug("resolving: " + uri); - } - final BigdataURI val = resolver.resolve(uri); datatypes.put(val.getIV(), val); } - + + @Override public Set<BigdataURI> getDatatypes() { return new LinkedHashSet<BigdataURI>(datatypes.values()); @@ -182,9 +184,10 @@ final BigdataURI dt = datatypes.get(iv.getExtensionIV()); - final XMLGregorianCalendar xmlGC = - DatatypeFactory.newInstance().newXMLGregorianCalendar(c); + final DatatypeFactory f = datatypeFactorySingleton; + final XMLGregorianCalendar xmlGC = f.newXMLGregorianCalendar(c); + String s = xmlGC.toString(); if (dt.equals(XSD.DATETIME)) { if (BSBMHACK) { @@ -219,12 +222,42 @@ return (V) vf.createLiteral(s, dt); - } catch (DatatypeConfigurationException ex) { + } catch (RuntimeException ex) { + + if (InnerCause.isInnerCause(ex, InterruptedException.class)) { + + throw ex; + + } throw new IllegalArgumentException("bad iv: " + iv, ex); } + + } + + /** Singleton. */ + private static final DatatypeFactory datatypeFactorySingleton; + + /** + * Singleton caching pattern for the Datatype factory reference. + */ + static { + + DatatypeFactory f = null; + try { + + f = DatatypeFactory.newInstance(); + + } catch (DatatypeConfigurationException ex) { + + log.error("Could not configure DatatypeFactory: " + ex, ex); + + } + + datatypeFactorySingleton = f; + } /** @@ -234,5 +267,5 @@ * @see http://sourceforge.net/apps/trac/bigdata/ticket/277 */ static private transient boolean BSBMHACK = Boolean.getBoolean("BSBM_HACK"); - + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mrp...@us...> - 2014-01-16 19:30:22
|
Revision: 7811 http://bigdata.svn.sourceforge.net/bigdata/?rev=7811&view=rev Author: mrpersonick Date: 2014-01-16 19:30:15 +0000 (Thu, 16 Jan 2014) Log Message: ----------- baby step 1: don't overload c in SPO Modified Paths: -------------- branches/RDR/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPO.java Modified: branches/RDR/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPO.java =================================================================== --- branches/RDR/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPO.java 2014-01-16 19:20:09 UTC (rev 7810) +++ branches/RDR/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPO.java 2014-01-16 19:30:15 UTC (rev 7811) @@ -78,15 +78,18 @@ @SuppressWarnings("rawtypes") public final IV o; + /** The internal value for the context position. */ + @SuppressWarnings("rawtypes") + private final IV c; + /** - * The context position or statement identifier (optional). + * The statement identifier (optional). * <p> - * Note: this is not final since, for SIDs mode, we have to set it lazily - * when adding an {@link SPO} to the database. + * Note: this is not final since we create it only on demand. */ @SuppressWarnings("rawtypes") - private IV c = null; - + private IV sid = null; + // /** // * Statement type (inferred, explicit, or axiom). // */ @@ -154,7 +157,7 @@ case 0: return s; case 1: return p; case 2: return o; - case 3: return c(); + case 3: return c; default: throw new IllegalArgumentException(); } } @@ -180,13 +183,18 @@ @Override @SuppressWarnings("rawtypes") final public IV c() { + return c; + } + + @SuppressWarnings("rawtypes") + final public IV sid() { // lazy instantiate the sid if necessary - if (c == null && sidable()) { - c = new SidIV(this); + if (sid == null && sidable()) { + sid = new SidIV(this); } - return c; + return sid; } @@ -203,7 +211,7 @@ sidable(sid); // clear the current value for c - this.c = null; + this.sid = null; } @@ -215,7 +223,7 @@ + toString()); // will lazy instantiate the sid - return c(); + return sid(); } @@ -253,6 +261,7 @@ this.s = s; this.p = p; this.o = o; + this.c = null; type(null); } @@ -295,6 +304,7 @@ this.s = s; this.p = p; this.o = o; + this.c = null; type(type); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mrp...@us...> - 2014-01-16 19:20:16
|
Revision: 7810 http://bigdata.svn.sourceforge.net/bigdata/?rev=7810&view=rev Author: mrpersonick Date: 2014-01-16 19:20:09 +0000 (Thu, 16 Jan 2014) Log Message: ----------- optimization: fix a poor usage of the reification vocabulary Modified Paths: -------------- branches/RDR/bigdata-rdf/src/java/com/bigdata/rdf/rio/StatementBuffer.java Modified: branches/RDR/bigdata-rdf/src/java/com/bigdata/rdf/rio/StatementBuffer.java =================================================================== --- branches/RDR/bigdata-rdf/src/java/com/bigdata/rdf/rio/StatementBuffer.java 2014-01-15 17:54:57 UTC (rev 7809) +++ branches/RDR/bigdata-rdf/src/java/com/bigdata/rdf/rio/StatementBuffer.java 2014-01-16 19:20:09 UTC (rev 7810) @@ -27,11 +27,9 @@ package com.bigdata.rdf.rio; -import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; -import java.util.LinkedList; import java.util.Map; import java.util.Set; @@ -41,7 +39,7 @@ import org.openrdf.model.Statement; import org.openrdf.model.URI; import org.openrdf.model.Value; -import org.semanticweb.yars.nx.namespace.RDF; +import org.openrdf.model.vocabulary.RDF; import com.bigdata.rdf.changesets.ChangeAction; import com.bigdata.rdf.changesets.ChangeRecord; @@ -217,6 +215,15 @@ } protected final BigdataValueFactory valueFactory; + + /** + * Reification vocabulary. + */ + private final BigdataURI RDF_SUBJECT; + private final BigdataURI RDF_PREDICATE; + private final BigdataURI RDF_OBJECT; + private final BigdataURI RDF_STATEMENT; + private final BigdataURI RDF_TYPE; /** * The maximum #of Statements, URIs, Literals, or BNodes that the buffer can @@ -374,6 +381,25 @@ } + this.RDF_SUBJECT = valueFactory.asValue(RDF.SUBJECT); + this.RDF_PREDICATE = valueFactory.asValue(RDF.PREDICATE); + this.RDF_OBJECT = valueFactory.asValue(RDF.OBJECT); + this.RDF_STATEMENT = valueFactory.asValue(RDF.STATEMENT); + this.RDF_TYPE = valueFactory.asValue(RDF.TYPE); + + if (distinct) { + + /* + * Get the reification vocabulary into the distinct term map. + */ + getDistinctTerm(RDF_SUBJECT); + getDistinctTerm(RDF_PREDICATE); + getDistinctTerm(RDF_OBJECT); + getDistinctTerm(RDF_STATEMENT); + getDistinctTerm(RDF_TYPE); + + } + } /** @@ -1270,21 +1296,21 @@ if (distinct) { { final BigdataValue tmp = getDistinctTerm((BigdataValue) s); - if (tmp != s) { + if (tmp != s && !equals(tmp, RDF_SUBJECT, RDF_PREDICATE, RDF_OBJECT, RDF_TYPE, RDF_STATEMENT)) { duplicateS = true; } s = (Resource) tmp; } { final BigdataValue tmp = getDistinctTerm((BigdataValue) p); - if (tmp != p) { + if (tmp != p && !equals(tmp, RDF_SUBJECT, RDF_PREDICATE, RDF_OBJECT, RDF_TYPE)) { duplicateP = true; } p = (URI) tmp; } { final BigdataValue tmp = getDistinctTerm((BigdataValue) o); - if (tmp != o) { + if (tmp != o && !equals(tmp, RDF_SUBJECT, RDF_PREDICATE, RDF_OBJECT, RDF_TYPE, RDF_STATEMENT)) { duplicateO = true; } o = (Value) tmp; @@ -1323,11 +1349,8 @@ log.info(stmt); - if (s instanceof BNode && - (RDF.SUBJECT.toString().equals(p.toString()) || RDF.PREDICATE.toString().equals(p.toString()) || RDF.OBJECT.toString().equals(p.toString())) || - (RDF.STATEMENT.toString().equals(o.toString()) && RDF.TYPE.toString().equals(p.toString()))) { - - if (!(RDF.STATEMENT.toString().equals(o.toString()) && RDF.TYPE.toString().equals(p.toString()))) { + if (s instanceof BNode && + equals((BigdataValue)p, RDF_SUBJECT, RDF_PREDICATE, RDF_OBJECT)) { final BigdataBNodeImpl sid = (BigdataBNodeImpl) s; @@ -1354,10 +1377,13 @@ if (log.isDebugEnabled()) log.debug("reified piece: "+stmt); - - } - } else { + } else if (s instanceof BNode && + equals((BigdataValue)o, RDF_STATEMENT) && equals((BigdataValue)p, RDF_TYPE)) { + + // ignore this statement + + } else { if (deferredStmts == null) { @@ -1492,6 +1518,41 @@ } + private boolean equals(final BigdataValue v1, final BigdataValue... v2) { + + if (v2.length == 1) { + + return _equals(v1, v2[0]); + + } else { + + for (BigdataValue v : v2) { + + if (_equals(v1, v)) + return true; + + } + + return false; + + } + + } + + private boolean _equals(final BigdataValue v1, final BigdataValue v2) { + + if (distinct) { + + return v1 == v2; + + } else { + + return v1.equals(v2); + + } + + } + private static class ReifiedStmt implements Statement { /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tho...@us...> - 2014-01-15 17:55:03
|
Revision: 7809 http://bigdata.svn.sourceforge.net/bigdata/?rev=7809&view=rev Author: thompsonbry Date: 2014-01-15 17:54:57 +0000 (Wed, 15 Jan 2014) Log Message: ----------- Bug fix to build.xml to correctly remove the sparql-* files (and implicitly remove empty directories remaining once those files are removed) after a CI run. Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/build.xml Modified: branches/BIGDATA_RELEASE_1_3_0/build.xml =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/build.xml 2014-01-15 17:20:04 UTC (rev 7808) +++ branches/BIGDATA_RELEASE_1_3_0/build.xml 2014-01-15 17:54:57 UTC (rev 7809) @@ -2313,13 +2313,18 @@ </target> -<target name="clean-sparql-test-suite" description="delete the files unpacked by the Sesame SPARQL test suite."> -<echo>"clearing: ${java.io.tmpdir}/sparql-*"</echo> -<delete verbose="true"> - <dirset dir="${java.io.tmpdir}" includes="sparql-*" /> -</delete> -</target> - + <target name="clean-sparql-test-suite" + description="Delete the files unpacked by the Sesame SPARQL test suite."> + <echo>"clearing: ${java.io.tmpdir}/sparql-*"</echo> + <delete verbose="true" includeemptydirs="true"> + <fileset dir="${java.io.tmpdir}"> + <patternset> + <include name="sparql-*/**"/> + </patternset> + </fileset> + </delete> + </target> + <!-- --> <!-- SESAME SERVER TARGETS --> <!-- --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tho...@us...> - 2014-01-15 17:20:11
|
Revision: 7808 http://bigdata.svn.sourceforge.net/bigdata/?rev=7808&view=rev Author: thompsonbry Date: 2014-01-15 17:20:04 +0000 (Wed, 15 Jan 2014) Log Message: ----------- javadoc on issues with named graph, default graph, and scale-out joins. Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/bop/joinGraph/rto/Vertex.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/AST2BOpJoins.java Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/bop/joinGraph/rto/Vertex.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/bop/joinGraph/rto/Vertex.java 2014-01-15 17:11:28 UTC (rev 7807) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/bop/joinGraph/rto/Vertex.java 2014-01-15 17:20:04 UTC (rev 7808) @@ -151,6 +151,41 @@ } + /* + * FIXME RTO: AST2BOpJoins is responsible for constructing the + * appropriate access path. Under some cases it can emit a DataSetJoin + * followed by a join against the access path. Under other cases, it + * will use a SCAN+FILTER pattern and attach a filter. The code below + * does not benefit from any of this because the vertex created from the + * [pred] before we invoke AST2BOpJoin#join() and hence lacks all of + * these interesting and critical annotations. When generating the join + * graph, the RTO needs to emit a set of vertices and filters that is + * sufficient for joins for named graphs and default graphs. It also + * needs to emit a set of predicates and filters that is sufficient for + * triples mode joins. + * + * Some possible approaches: + * + * - For the RTO, always do a DataSetJoin + SP. We would need to support + * the DataSetJoin as a Predicate (it does not get modeled that way + * right now). The SP would need to have the DISTINCT SPO filter + * attached for a default graph join. This might even be a DISTINCT + * FILTER that gets into the plan and winds up attached to either the + * DataSetJoin or the SP, depending on which runs first. This would give + * us two APs plus a visible FILTER rather than ONE AP with some hidden + * filters. The DataSetJoin would need to be associated with an AP that + * binds the (hidden) graph variable. This could be an opporunity to + * generalize for storing those data on the native heap / htree / etc. / + * named solution set as well. + * + * Basically, this amounts to saying that we will sample both the set of + * graphs that are in the named graphs or default graphs data set and + * the unconstrained triple pattern AP. + * + * - If C is bound, then we should just wind up with a FILTER that is + * imposing the DISTINCT SPO (for default graph APs) and do not need to + * do anything (for named graph AP)s. + */ final BOpContextBase context = new BOpContextBase(queryEngine); final IRelation r = context.getRelation(pred); Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/AST2BOpJoins.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/AST2BOpJoins.java 2014-01-15 17:11:28 UTC (rev 7807) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/AST2BOpJoins.java 2014-01-15 17:20:04 UTC (rev 7808) @@ -698,7 +698,6 @@ final int accessPathSampleLimit = pred.getProperty( QueryHints.ACCESS_PATH_SAMPLE_LIMIT, ctx.accessPathSampleLimit); final boolean estimateCosts = accessPathSampleLimit >= 0; - final IRelation r = ctx.context.getRelation(pred); final ScanCostReport scanCostReport; final SubqueryCostReport subqueryCostReport; final boolean scanAndFilter; @@ -736,6 +735,7 @@ * the cost of the scan regardless of whether the query runs with * partitioned or global index views when it is evaluated. */ + final IRelation r = ctx.context.getRelation(pred); scanCostReport = ((AccessPath) ctx.context.getAccessPath(r, (Predicate<?>) pred.setProperty( IPredicate.Annotations.REMOTE_ACCESS_PATH, true))) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tho...@us...> - 2014-01-15 17:11:35
|
Revision: 7807 http://bigdata.svn.sourceforge.net/bigdata/?rev=7807&view=rev Author: thompsonbry Date: 2014-01-15 17:11:28 +0000 (Wed, 15 Jan 2014) Log Message: ----------- @Override and final annotations. toString() for some types of filters that appear in named and default graph APs. License headers. Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/relation/accesspath/ElementFilter.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/spo/InGraphBinarySearchFilter.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/spo/InGraphHashSetFilter.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPOFilter.java branches/BIGDATA_RELEASE_1_3_0/ctc-striterators/src/java/cutthecrap/utils/striterators/FilterBase.java Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/relation/accesspath/ElementFilter.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/relation/accesspath/ElementFilter.java 2014-01-15 16:36:55 UTC (rev 7806) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/relation/accesspath/ElementFilter.java 2014-01-15 17:11:28 UTC (rev 7807) @@ -138,4 +138,17 @@ } + /** + * {@inheritDoc} + * <p> + * Extended to show a human readable representation of the test. + */ + @Override + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append(super.toString()); + sb.append("{test=" + test); + sb.append("}"); + return sb.toString(); + } } Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/spo/InGraphBinarySearchFilter.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/spo/InGraphBinarySearchFilter.java 2014-01-15 16:36:55 UTC (rev 7806) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/spo/InGraphBinarySearchFilter.java 2014-01-15 17:11:28 UTC (rev 7807) @@ -24,6 +24,7 @@ * * @see InGraphHashSetFilter */ +@SuppressWarnings("rawtypes") public final class InGraphBinarySearchFilter<E extends ISPO> extends SPOFilter<E> implements Externalizable { @@ -76,7 +77,8 @@ } - public boolean isValid(Object o) { + @Override + public boolean isValid(final Object o) { if (!canAccept(o)) { @@ -96,7 +98,14 @@ } - /** + @Override + public String toString() { + + return getClass().getName() + "{size=" + a.length + "}"; + + } + + /** * The initial version. */ private static final transient short VERSION0 = 0; @@ -106,6 +115,7 @@ */ private static final transient short VERSION = VERSION0; + @Override public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException { @@ -131,6 +141,7 @@ } + @Override public void writeExternal(final ObjectOutput out) throws IOException { out.writeShort(VERSION); Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/spo/InGraphHashSetFilter.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/spo/InGraphHashSetFilter.java 2014-01-15 16:36:55 UTC (rev 7806) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/spo/InGraphHashSetFilter.java 2014-01-15 17:11:28 UTC (rev 7807) @@ -1,3 +1,18 @@ +/** + Copyright (C) SYSTAP, LLC 2006-2012. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ package com.bigdata.rdf.spo; import java.util.HashSet; @@ -2,6 +17,3 @@ -import org.openrdf.model.URI; - import com.bigdata.rdf.internal.IV; -import com.bigdata.rdf.model.BigdataURI; @@ -19,6 +31,7 @@ * * @see InGraphBinarySearchFilter */ +@SuppressWarnings("rawtypes") public final class InGraphHashSetFilter<E extends ISPO> extends SPOFilter<E> { /** @@ -55,7 +68,8 @@ } - public boolean isValid(Object o) { + @Override + public boolean isValid(final Object o) { if (!canAccept(o)) { @@ -75,4 +89,11 @@ } + @Override + public String toString() { + + return getClass().getName() + "{size=" + contextSet.size() + "}"; + + } + } \ No newline at end of file Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPOFilter.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPOFilter.java 2014-01-15 16:36:55 UTC (rev 7806) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPOFilter.java 2014-01-15 17:11:28 UTC (rev 7807) @@ -1,3 +1,18 @@ +/** + Copyright (C) SYSTAP, LLC 2006-2012. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ package com.bigdata.rdf.spo; import com.bigdata.relation.accesspath.IElementFilter; @@ -9,6 +24,7 @@ */ private static final long serialVersionUID = 1L; + @Override public boolean canAccept(final Object o) { return o instanceof ISPO; Modified: branches/BIGDATA_RELEASE_1_3_0/ctc-striterators/src/java/cutthecrap/utils/striterators/FilterBase.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/ctc-striterators/src/java/cutthecrap/utils/striterators/FilterBase.java 2014-01-15 16:36:55 UTC (rev 7806) +++ branches/BIGDATA_RELEASE_1_3_0/ctc-striterators/src/java/cutthecrap/utils/striterators/FilterBase.java 2014-01-15 17:11:28 UTC (rev 7807) @@ -171,6 +171,7 @@ /** * Human readable representation of the filter chain. */ + @Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append(super.toString()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tho...@us...> - 2014-01-15 16:37:01
|
Revision: 7806 http://bigdata.svn.sourceforge.net/bigdata/?rev=7806&view=rev Author: thompsonbry Date: 2014-01-15 16:36:55 +0000 (Wed, 15 Jan 2014) Log Message: ----------- javadoc Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/AST2BOpFilters.java Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/AST2BOpFilters.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/AST2BOpFilters.java 2014-01-15 16:19:01 UTC (rev 7805) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/AST2BOpFilters.java 2014-01-15 16:36:55 UTC (rev 7806) @@ -516,9 +516,9 @@ * If we are doing cutoff join evaluation, then limit the parallelism of * this operator to prevent reordering of solutions. * - * TODO If query hints are allowed to override MAX_PARALLEL and this is - * being invoked for cutoff join evaluation, then that will break the - * "no reordering" guarantee. + * TODO RTO: If query hints are allowed to override MAX_PARALLEL and + * this is being invoked for cutoff join evaluation, then that will + * break the "no reordering" guarantee. */ // disable reordering of solutions for cutoff joins. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tho...@us...> - 2014-01-15 16:19:08
|
Revision: 7805 http://bigdata.svn.sourceforge.net/bigdata/?rev=7805&view=rev Author: thompsonbry Date: 2014-01-15 16:19:01 +0000 (Wed, 15 Jan 2014) Log Message: ----------- added template for remote debugging for the govtrack test suite. Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-perf/CI/govtrack/build.properties Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-perf/CI/govtrack/build.properties =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-perf/CI/govtrack/build.properties 2014-01-15 15:18:55 UTC (rev 7804) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-perf/CI/govtrack/build.properties 2014-01-15 16:19:01 UTC (rev 7805) @@ -57,5 +57,9 @@ # Configure GC. gcopts=-XX:+UseParallelOldGC +# Enable remote debugging at the specified port. +debug= +#debug=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1046 + # all jvm args for query. -queryJvmArgs=-ea -server -Xmx${ci.maxMem} -showversion ${gcopts} -Dlog4j.configuration=file:log4j.properties +queryJvmArgs=-ea -server -Xmx${ci.maxMem} -showversion ${debug} ${gcopts} -Dlog4j.configuration=file:log4j.properties This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tho...@us...> - 2014-01-15 15:19:07
|
Revision: 7804 http://bigdata.svn.sourceforge.net/bigdata/?rev=7804&view=rev Author: thompsonbry Date: 2014-01-15 15:18:55 +0000 (Wed, 15 Jan 2014) Log Message: ----------- The fix for (1) is easier than I had anticipated. The problem was in {{{ ASTSparql11SubqueryOptimizer:: private void liftSparql11Subquery(final AST2BOpContext context, final StaticAnalysis sa, final SubqueryRoot subqueryRoot) { }}} This method was failing to copy across the attached join filters to the new NamedSubqueryInclude. {{{ /** * Copy across attached join filters. * * @see <a href="https://sourceforge.net/apps/trac/bigdata/ticket/796" * >Filter assigned to sub-query by query generator is dropped from * evaluation</a> */ include.setAttachedJoinFilters(subqueryRoot.getAttachedJoinFilters()); }}} This change fixes both the case where the FILTER requires materialization of RDF Values and the case where it does not (which was the case for (1)). This fix also highlighted three unit tests where we had failed to test for the correct attachment of the FILTER to the lifted out NamedSubqueryInclude. TestASTSparql11SubqueryOptimizer:: * test_subSelectWithLimitAndOrderBy * test_subSelectWithAggregation * test_subSelectWithRunOnceAnnotation Regression tests for (1) are captured in the TestSubQuery class. Finally, I do observe that the join filters are attached to the SPARQL Sub-Select when it is not lifted out. Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/optimizers/ASTSparql11SubqueryOptimizer.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/TestSubQuery.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/optimizers/TestASTSparql11SubqueryOptimizer.java Added Paths: ----------- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/sparql11-subselect-filter-01.nt branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/sparql11-subselect-filter-01.rq branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/sparql11-subselect-filter-01.srx branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/sparql11-subselect-filter-01b.rq Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/optimizers/ASTSparql11SubqueryOptimizer.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/optimizers/ASTSparql11SubqueryOptimizer.java 2014-01-15 15:07:52 UTC (rev 7803) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/optimizers/ASTSparql11SubqueryOptimizer.java 2014-01-15 15:18:55 UTC (rev 7804) @@ -343,6 +343,15 @@ include.setQueryHints((Properties) parent .getProperty(ASTBase.Annotations.QUERY_HINTS)); + /** + * Copy across attached join filters. + * + * @see <a href="https://sourceforge.net/apps/trac/bigdata/ticket/796" + * >Filter assigned to sub-query by query generator is dropped from + * evaluation</a> + */ + include.setAttachedJoinFilters(subqueryRoot.getAttachedJoinFilters()); + /* * Note: A SubqueryRoot normally starts out as the sole child of a * JoinGroupNode. However, other rewrites may have written out that Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/TestSubQuery.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/TestSubQuery.java 2014-01-15 15:07:52 UTC (rev 7803) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/TestSubQuery.java 2014-01-15 15:18:55 UTC (rev 7804) @@ -27,6 +27,11 @@ package com.bigdata.rdf.sparql.ast.eval; +import org.openrdf.model.Value; + +import com.bigdata.bop.BOpUtility; +import com.bigdata.rdf.sparql.ast.NamedSubqueryRoot; +import com.bigdata.rdf.sparql.ast.QueryHints; import com.bigdata.rdf.sparql.ast.optimizers.ASTSparql11SubqueryOptimizer; import com.bigdata.rdf.sparql.ast.optimizers.TestASTSparql11SubqueryOptimizer; @@ -47,7 +52,7 @@ /** * @param name */ - public TestSubQuery(String name) { + public TestSubQuery(final String name) { super(name); } @@ -200,4 +205,97 @@ } + /** + * In this test variant, the FILTER winds up attached to a + * {@link NamedSubqueryRoot} (there are no shared variables projected out of + * the sub-select) and does not require RDF {@link Value} materialization. + * <p> + * Note: The sub-select explicitly annotated using + * {@link QueryHints#RUN_ONCE} to ensure that it gets lifted out as a + * {@link NamedSubqueryRoot}, but this query does not have any shared + * variables so the sub-select would be lifted out anyway. + * + * <pre> + * select distinct ?s + * where + * { + * ?s ?p ?o. + * { + * SELECT ?ps WHERE + * { + * hint:SubQuery hint:runOnce true. + * ?ps a <http://www.example.org/schema/Person> . + * } + * limit 1 + * } + * filter (?s = ?ps) + * } + * </pre> + * + * @see <a href="https://sourceforge.net/apps/trac/bigdata/ticket/796" + * >Filter assigned to sub-query by query generator is dropped from + * evaluation</a> + */ + public void test_sparql11_subquery_filter_01() + throws Exception { + + final TestHelper h = new TestHelper( + "sparql11-subselect-filter-01", // testURI, + "sparql11-subselect-filter-01.rq",// queryFileURL + "sparql11-subselect-filter-01.nt",// dataFileURL + "sparql11-subselect-filter-01.srx"// resultFileURL + ); + + // Run test. + h.runTest(); + + // Make sure that this query used a NamedSubqueryRoot. + assertTrue(BOpUtility.visitAll(h.getASTContainer().getOptimizedAST(), + NamedSubqueryRoot.class).hasNext()); + + } + + /** + * Variant where the FILTER requires RDF Value materialization and the + * sub-select is lifted out as a named subquery. + * + * <pre> + * select distinct ?s + * where + * { + * ?s ?p ?o. + * { + * SELECT ?ps WHERE + * { + * ?ps a <http://www.example.org/schema/Person> . + * } + * limit 1 + * } + * filter (str(?s) = str(?ps)) + * } + * </pre> + * + * @see <a href="https://sourceforge.net/apps/trac/bigdata/ticket/796" + * >Filter assigned to sub-query by query generator is dropped from + * evaluation</a> + */ + public void test_sparql11_subquery_filter_01b() + throws Exception { + + final TestHelper h = new TestHelper( + "sparql11-subselect-filter-01b", // testURI, + "sparql11-subselect-filter-01b.rq",// queryFileURL + "sparql11-subselect-filter-01.nt",// dataFileURL + "sparql11-subselect-filter-01.srx"// resultFileURL + ); + + // Run test. + h.runTest(); + + // Make sure that this query used a NamedSubqueryRoot. + assertTrue(BOpUtility.visitAll(h.getASTContainer().getOptimizedAST(), + NamedSubqueryRoot.class).hasNext()); + + } + } Added: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/sparql11-subselect-filter-01.nt =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/sparql11-subselect-filter-01.nt (rev 0) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/sparql11-subselect-filter-01.nt 2014-01-15 15:18:55 UTC (rev 7804) @@ -0,0 +1,35 @@ +<http://www.example.com/person1> <http://www.example.org/schema/age> "39"^^<http://www.w3.org/2001/XMLSchema#integer> . +<http://www.example.com/person1> <http://www.example.org/schema/name> "Person #1"^^<http://www.w3.org/2001/XMLSchema#string> . +<http://www.example.com/person1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.example.org/schema/Person> . + +<http://www.example.com/person2> <http://www.example.org/schema/age> "29"^^<http://www.w3.org/2001/XMLSchema#integer> . +<http://www.example.com/person2> <http://www.example.org/schema/name> "Person #2"^^<http://www.w3.org/2001/XMLSchema#string> . +<http://www.example.com/person2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.example.org/schema/Person> . + +<http://www.example.com/person3> <http://www.example.org/schema/age> "19"^^<http://www.w3.org/2001/XMLSchema#integer> . +<http://www.example.com/person3> <http://www.example.org/schema/name> "Person #3"^^<http://www.w3.org/2001/XMLSchema#string> . +<http://www.example.com/person3> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.example.org/schema/Person> . + +<http://www.example.com/post1> <http://www.example.org/schema/content> "Post 1 content"^^<http://www.w3.org/2001/XMLSchema#string> . +<http://www.example.com/post1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.example.org/schema/Post> . +<http://www.example.com/post1> <http://www.example.org/schema/postedBy> <http://www.example.com/person1>. + +<http://www.example.com/post2> <http://www.example.org/schema/content> "Post 2 content"^^<http://www.w3.org/2001/XMLSchema#string> . +<http://www.example.com/post2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.example.org/schema/Post> . +<http://www.example.com/post2> <http://www.example.org/schema/postedBy> <http://www.example.com/person1>. + +<http://www.example.com/comment1> <http://www.example.org/schema/content> "Comment 1 content"^^<http://www.w3.org/2001/XMLSchema#string> . +<http://www.example.com/comment1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.example.org/schema/Comment> . +<http://www.example.com/comment1> <http://www.example.org/schema/parentPost> <http://www.example.com/post1> . +<http://www.example.com/comment1> <http://www.example.org/schema/postedBy> <http://www.example.com/person2>. + +<http://www.example.com/comment2> <http://www.example.org/schema/content> "Comment 2 content"^^<http://www.w3.org/2001/XMLSchema#string> . +<http://www.example.com/comment2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.example.org/schema/Comment> . +<http://www.example.com/comment2> <http://www.example.org/schema/parentPost> <http://www.example.com/post1> . +<http://www.example.com/comment2> <http://www.example.org/schema/postedBy> <http://www.example.com/person3>. + + + + + + Added: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/sparql11-subselect-filter-01.rq =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/sparql11-subselect-filter-01.rq (rev 0) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/sparql11-subselect-filter-01.rq 2014-01-15 15:18:55 UTC (rev 7804) @@ -0,0 +1,16 @@ +# See #796 (Filter assigned to sub-query by query generator is dropped from evaluation) +# +select distinct ?s +where +{ + ?s ?p ?o. + { + SELECT ?ps WHERE + { + hint:SubQuery hint:runOnce true. + ?ps a <http://www.example.org/schema/Person> . + } + limit 1 + } + filter (?s = ?ps) +} \ No newline at end of file Added: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/sparql11-subselect-filter-01.srx =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/sparql11-subselect-filter-01.srx (rev 0) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/sparql11-subselect-filter-01.srx 2014-01-15 15:18:55 UTC (rev 7804) @@ -0,0 +1,16 @@ +<?xml version="1.0"?> +<sparql + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:xs="http://www.w3.org/2001/XMLSchema#" + xmlns="http://www.w3.org/2005/sparql-results#" > + <head> + <variable name="s"/> + </head> + <results> + <result> + <binding name="s"> + <uri>http://www.example.com/person1</uri> + </binding> + </result> + </results> +</sparql> Added: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/sparql11-subselect-filter-01b.rq =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/sparql11-subselect-filter-01b.rq (rev 0) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/sparql11-subselect-filter-01b.rq 2014-01-15 15:18:55 UTC (rev 7804) @@ -0,0 +1,16 @@ +# See #796 (Filter assigned to sub-query by query generator is dropped from evaluation) +# +select distinct ?s +where +{ + ?s ?p ?o. + { + SELECT ?ps WHERE + { + hint:SubQuery hint:runOnce true. + ?ps a <http://www.example.org/schema/Person> . + } + limit 1 + } + filter (str(?s) = str(?ps)) +} \ No newline at end of file Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/optimizers/TestASTSparql11SubqueryOptimizer.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/optimizers/TestASTSparql11SubqueryOptimizer.java 2014-01-15 15:07:52 UTC (rev 7803) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/optimizers/TestASTSparql11SubqueryOptimizer.java 2014-01-15 15:18:55 UTC (rev 7804) @@ -28,6 +28,7 @@ package com.bigdata.rdf.sparql.ast.optimizers; import java.util.Collections; +import java.util.LinkedList; import org.openrdf.model.impl.URIImpl; import org.openrdf.model.vocabulary.RDF; @@ -42,6 +43,7 @@ import com.bigdata.rdf.sparql.ast.AbstractASTEvaluationTestCase; import com.bigdata.rdf.sparql.ast.AssignmentNode; import com.bigdata.rdf.sparql.ast.ConstantNode; +import com.bigdata.rdf.sparql.ast.FilterNode; import com.bigdata.rdf.sparql.ast.FunctionNode; import com.bigdata.rdf.sparql.ast.FunctionRegistry; import com.bigdata.rdf.sparql.ast.GroupByNode; @@ -220,7 +222,9 @@ new ConstantNode(p), new VarNode("o"), null/* c */, Scope.DEFAULT_CONTEXTS)); - whereClause.addChild(new NamedSubqueryInclude(name)); + final NamedSubqueryInclude nsi = new NamedSubqueryInclude(name); + nsi.setAttachedJoinFilters(new LinkedList<FilterNode>()); + whereClause.addChild(nsi); subqueryRoot = new NamedSubqueryRoot(QueryType.SELECT,name); final NamedSubqueriesNode namedSubqueries = new NamedSubqueriesNode(); @@ -377,7 +381,9 @@ new ConstantNode(p), new VarNode("o"), null/* c */, Scope.DEFAULT_CONTEXTS)); - whereClause.addChild(new NamedSubqueryInclude(name)); + final NamedSubqueryInclude nsi = new NamedSubqueryInclude(name); + nsi.setAttachedJoinFilters(new LinkedList<FilterNode>()); + whereClause.addChild(nsi); subqueryRoot = new NamedSubqueryRoot(QueryType.SELECT,name); final NamedSubqueriesNode namedSubqueries = new NamedSubqueriesNode(); @@ -657,7 +663,9 @@ new ConstantNode(p), new VarNode("o"), null/* c */, Scope.DEFAULT_CONTEXTS)); - whereClause.addChild(new NamedSubqueryInclude(name)); + final NamedSubqueryInclude nsi = new NamedSubqueryInclude(name); + nsi.setAttachedJoinFilters(new LinkedList<FilterNode>()); + whereClause.addChild(nsi); subqueryRoot = new NamedSubqueryRoot(QueryType.SELECT,name); final NamedSubqueriesNode namedSubqueries = new NamedSubqueriesNode(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |