From: <tho...@us...> - 2011-06-24 16:12:02
|
Revision: 4792 http://bigdata.svn.sourceforge.net/bigdata/?rev=4792&view=rev Author: thompsonbry Date: 2011-06-24 16:11:56 +0000 (Fri, 24 Jun 2011) Log Message: ----------- Modified the BigdataValueReplacer to use a DummyIV rather than throwing an exception if a value bound using AbstractQuery#setBinding(name,value) is not known to the database. Removed TODO from BigdataOpenRDFBindingSetResolverator. Modified Paths: -------------- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/store/BigdataOpenRDFBindingSetsResolverator.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/java/com/bigdata/rdf/sail/BigdataValueReplacer.java Modified: branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/store/BigdataOpenRDFBindingSetsResolverator.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/store/BigdataOpenRDFBindingSetsResolverator.java 2011-06-24 15:17:57 UTC (rev 4791) +++ branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/store/BigdataOpenRDFBindingSetsResolverator.java 2011-06-24 16:11:56 UTC (rev 4792) @@ -203,29 +203,22 @@ final BigdataValue outVal = map.get(value); - /* - * TODO An alternative to using a DummyIV would be to drop the - * BindingSet if there are any Values in it which are not known to - * the database. - */ - if (outVal != null) { + assert outVal != null; - final Constant<?> c; - - if (outVal.getIV() == null) { + final Constant<?> c; + + if (outVal.getIV() == null) { - c = new Constant(DummyIV.INSTANCE); - - } else { - - c = new Constant(outVal.getIV()); - - } + c = new Constant(DummyIV.INSTANCE); - out.set(Var.var(name), c); - + } else { + + c = new Constant(outVal.getIV()); + } + out.set(Var.var(name), c); + } return out; Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/java/com/bigdata/rdf/sail/BigdataValueReplacer.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/java/com/bigdata/rdf/sail/BigdataValueReplacer.java 2011-06-24 15:17:57 UTC (rev 4791) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/java/com/bigdata/rdf/sail/BigdataValueReplacer.java 2011-06-24 16:11:56 UTC (rev 4792) @@ -38,7 +38,6 @@ import org.openrdf.query.Binding; import org.openrdf.query.BindingSet; import org.openrdf.query.Dataset; -import org.openrdf.query.algebra.LangMatches; import org.openrdf.query.algebra.StatementPattern; import org.openrdf.query.algebra.TupleExpr; import org.openrdf.query.algebra.ValueConstant; @@ -49,6 +48,7 @@ import org.openrdf.query.impl.MapBindingSet; import org.openrdf.sail.SailException; +import com.bigdata.rdf.internal.DummyIV; import com.bigdata.rdf.internal.IV; import com.bigdata.rdf.model.BigdataValue; import com.bigdata.rdf.model.BigdataValueFactory; @@ -319,6 +319,10 @@ if (bindings != null) { + /* + * Replace the bindings with one's which have their IV set. + */ + final MapBindingSet bindings2 = new MapBindingSet(); final Iterator<Binding> it = bindings.iterator(); @@ -349,21 +353,31 @@ log.debug("value: " + val + " : " + val2 + " (" + val2.getIV() + ")"); - if (val2.getIV() == null) { - +// if (val2.getIV() == null) { +// +// /* +// * Since the term identifier is NULL this value is not known +// * to the kb. +// */ +// +// if (log.isInfoEnabled()) +// log.info("Not in knowledge base: " + val2); +// +// } + + if(val2.getIV() == null) { /* - * Since the term identifier is NULL this value is - * not known to the kb. + * The Value is not in the database, so assign it a mock IV. + * This IV will not match anything during query. However, we + * can not simply fail the query since an OPTIONAL or UNION + * might have solutions even though this Value is not known. */ - - if(log.isInfoEnabled()) - log.info("Not in knowledge base: " + val2); - + val2.setIV(DummyIV.INSTANCE); } - // replace the constant in the query. + // rewrite the constant in the query. bindings2.addBinding(binding.getName(), val2); - + } bindings = bindings2; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |