From: <tho...@us...> - 2014-10-28 17:35:33
|
Revision: 8695 http://sourceforge.net/p/bigdata/code/8695 Author: thompsonbry Date: 2014-10-28 17:35:25 +0000 (Tue, 28 Oct 2014) Log Message: ----------- fix for #1028 (xsd:boolean materialization) also made AbstractIV.needsMaterialization() final. Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/bop/rdf/join/ChunkedMaterializationOp.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/literal/AbstractLiteralIV.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/literal/XSDBooleanIV.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/uri/IPv4AddrIV.java Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/bop/rdf/join/ChunkedMaterializationOp.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/bop/rdf/join/ChunkedMaterializationOp.java 2014-10-28 13:39:00 UTC (rev 8694) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/bop/rdf/join/ChunkedMaterializationOp.java 2014-10-28 17:35:25 UTC (rev 8695) @@ -502,21 +502,9 @@ } final BigdataValue value = terms.get(iv); - // FIXME Temporarily rolled back for 1.3.3 release. See #1028 (xsd:boolean materialization issue) - if (value == null && iv.needsMaterialization()) { + + conditionallySetIVCache(iv,value); - throw new RuntimeException("Could not resolve: iv=" + iv); - - } - - /* - * Replace the binding. - * - * FIXME This probably needs to strip out the - * BigdataSail#NULL_GRAPH since that should not become bound. - */ - ((IV) iv).setValue(value); - } } else { @@ -546,23 +534,53 @@ final BigdataValue value = terms.get(iv); - if (value == null && iv.needsMaterialization()) { + conditionallySetIVCache(iv, value); - throw new RuntimeException("Could not resolve: iv=" + iv); + } - } + } - /* - * Replace the binding. - * - * FIXME This probably needs to strip out the - * BigdataSail#NULL_GRAPH since that should not become bound. - */ - ((IV) iv).setValue(value); + } - } - } + /** + * If the {@link BigdataValue} is non-null, then set it on the + * {@link IVCache} interface. + * + * @param iv + * The {@link IV} + * @param value + * The {@link BigdataValue} for that {@link IV} (from the + * dictionary). + * + * @throws RuntimeException + * If the {@link BigdataValue} is null (could not be discovered + * in the dictionary) and the {@link IV} requires + * materialization ({@link IV#needsMaterialization() is + * <code>true</code>). + * + * @see #1028 (xsd:boolean materialization issue) + */ + private static void conditionallySetIVCache(IV<?, ?> iv, BigdataValue value) { - } + if (value == null) { + if (iv.needsMaterialization()) { + // Not found in dictionary. This is an error. + throw new RuntimeException("Could not resolve: iv=" + iv); + + } // else NOP - Value is not required. + + } else { + + /* + * Value was found in the dictionary, so replace the binding. + * + * FIXME This probably needs to strip out the BigdataSail#NULL_GRAPH + * since that should not become bound. + */ + ((IV) iv).setValue(value); + } + + } + } Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/literal/AbstractLiteralIV.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/literal/AbstractLiteralIV.java 2014-10-28 13:39:00 UTC (rev 8694) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/literal/AbstractLiteralIV.java 2014-10-28 17:35:25 UTC (rev 8695) @@ -71,7 +71,8 @@ * Implement {@link IV#needsMaterialization()}. Materialization not required * to answer the {@link Literal} interface methods. */ - public boolean needsMaterialization() { + @Override + final public boolean needsMaterialization() { return false; } Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/literal/XSDBooleanIV.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/literal/XSDBooleanIV.java 2014-10-28 13:39:00 UTC (rev 8694) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/literal/XSDBooleanIV.java 2014-10-28 17:35:25 UTC (rev 8695) @@ -52,6 +52,7 @@ private final boolean value; + @Override public IV<V, Boolean> clone(final boolean clearCache) { final XSDBooleanIV<V> tmp = new XSDBooleanIV<V>(value); @@ -74,12 +75,14 @@ } + @Override final public Boolean getInlineValue() { return value ? Boolean.TRUE : Boolean.FALSE; } + @Override @SuppressWarnings("unchecked") public V asValue(final LexiconRelation lex) { @@ -121,10 +124,12 @@ * * @see Boolean#hashCode() */ + @Override public int hashCode() { return value ? Boolean.TRUE.hashCode() : Boolean.FALSE.hashCode(); } + @Override public int byteLength() { return 1 + 1; } Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/uri/IPv4AddrIV.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/uri/IPv4AddrIV.java 2014-10-28 13:39:00 UTC (rev 8694) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/internal/impl/uri/IPv4AddrIV.java 2014-10-28 17:35:25 UTC (rev 8695) @@ -367,12 +367,12 @@ // // } - /** - * Does not need materialization to answer URI interface methods. - */ - @Override - public boolean needsMaterialization() { - return false; - } +// /** +// * Does not need materialization to answer URI interface methods. +// */ +// @Override +// public boolean needsMaterialization() { +// return false; +// } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |