|
From: <tho...@us...> - 2014-07-09 15:22:26
|
Revision: 8527
http://sourceforge.net/p/bigdata/code/8527
Author: thompsonbry
Date: 2014-07-09 15:22:24 +0000 (Wed, 09 Jul 2014)
Log Message:
-----------
Potential fix for #983 (Concurrent insert data with boolean object causes IllegalArgumentException).
This fix always sets the IV on TRUE and FALSE constants used by the BigdataValueFactoryImpl rather than having them be set dynamically during evaluate.
Modified Paths:
--------------
branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/model/BigdataValueFactoryImpl.java
Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/model/BigdataValueFactoryImpl.java
===================================================================
--- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/model/BigdataValueFactoryImpl.java 2014-07-09 14:07:47 UTC (rev 8526)
+++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/model/BigdataValueFactoryImpl.java 2014-07-09 15:22:24 UTC (rev 8527)
@@ -36,7 +36,6 @@
import org.openrdf.model.BNode;
import org.openrdf.model.Literal;
import org.openrdf.model.Resource;
-import org.openrdf.model.Statement;
import org.openrdf.model.URI;
import org.openrdf.model.Value;
import org.openrdf.model.datatypes.XMLDatatypeUtil;
@@ -44,6 +43,7 @@
import com.bigdata.cache.WeakValueCache;
import com.bigdata.rdf.internal.IV;
+import com.bigdata.rdf.internal.impl.literal.XSDBooleanIV;
import com.bigdata.rdf.internal.impl.literal.XSDUnsignedByteIV;
import com.bigdata.rdf.internal.impl.literal.XSDUnsignedIntIV;
import com.bigdata.rdf.internal.impl.literal.XSDUnsignedLongIV;
@@ -64,12 +64,12 @@
* @todo Consider a {@link WeakValueCache} to shortcut recently used statements?
*
* @author <a href="mailto:tho...@us...">Bryan Thompson</a>
- * @version $Id$
*/
public class BigdataValueFactoryImpl implements BigdataValueFactory {
private final String namespace;
+ @Override
public String getNamespace() {
return namespace;
@@ -81,10 +81,18 @@
*/
private BigdataValueFactoryImpl(final String namespace) {
- this.namespace = namespace;
-
- xsdMap = getXSDMap();
+ this.namespace = namespace;
+
+ xsdMap = getXSDMap();
+ /**
+ * Cache the IV on the BigdataValue for these boolean constants.
+ *
+ * @see <a href="http://trac.bigdata.com/ticket/983"> Concurrent insert
+ * data with boolean object causes IllegalArgumentException </a>
+ */
+ TRUE.setIV(XSDBooleanIV.TRUE);
+ FALSE.setIV(XSDBooleanIV.FALSE);
}
/**
@@ -182,6 +190,7 @@
*/
// * @param namespace
// * The namespace of the {@link LexiconRelation}.
+ @Override
public void remove(/*final String namespace*/) {
// if (namespace == null)
@@ -197,6 +206,7 @@
}
+ @Override
public BNodeContextFactory newBNodeContext() {
return new BNodeContextFactory(this);
@@ -215,6 +225,7 @@
*
* @see #newBNodeContext()
*/
+ @Override
public BigdataBNodeImpl createBNode() {
return createBNode(nextID());
@@ -230,18 +241,21 @@
}
+ @Override
public BigdataBNodeImpl createBNode(final String id) {
return new BigdataBNodeImpl(this, id);
}
+ @Override
public BigdataBNodeImpl createBNode(final BigdataStatement stmt) {
return new BigdataBNodeImpl(this, nextID(), stmt);
}
+ @Override
public BigdataLiteralImpl createLiteral(final String label) {
return new BigdataLiteralImpl(this, label, null, null);
@@ -331,72 +345,84 @@
}
+ @Override
public BigdataLiteralImpl createLiteral(boolean arg0) {
return (arg0 ? TRUE : FALSE);
}
+ @Override
public BigdataLiteralImpl createLiteral(byte arg0) {
return new BigdataLiteralImpl(this, "" + arg0, null, xsd_byte);
}
+ @Override
public BigdataLiteralImpl createLiteral(byte arg0, final boolean unsigned) {
return new BigdataLiteralImpl(this, "" + (unsigned ? XSDUnsignedByteIV.promote(arg0) : arg0), null, unsigned ? xsd_ubyte : xsd_byte);
}
+ @Override
public BigdataLiteralImpl createLiteral(short arg0) {
return new BigdataLiteralImpl(this, "" + arg0, null, xsd_short);
}
+ @Override
public BigdataLiteralImpl createLiteral(short arg0, final boolean unsigned) {
return new BigdataLiteralImpl(this, "" + (unsigned ? XSDUnsignedShortIV.promote(arg0) : arg0), null, unsigned ? xsd_ushort :xsd_short);
}
+ @Override
public BigdataLiteralImpl createLiteral(int arg0) {
return new BigdataLiteralImpl(this, "" + arg0, null, xsd_int);
}
+ @Override
public BigdataLiteralImpl createLiteral(int arg0, final boolean unsigned) {
return new BigdataLiteralImpl(this, "" + (unsigned ? XSDUnsignedIntIV.promote(arg0) : arg0), null, unsigned ? xsd_uint :xsd_int);
}
+ @Override
public BigdataLiteralImpl createLiteral(long arg0) {
return new BigdataLiteralImpl(this, "" + arg0, null, xsd_long);
}
+ @Override
public BigdataLiteralImpl createLiteral(long arg0, final boolean unsigned) {
return new BigdataLiteralImpl(this, "" + (unsigned ? XSDUnsignedLongIV.promote(arg0) : arg0), null, unsigned ? xsd_ulong : xsd_long);
}
+ @Override
public BigdataLiteralImpl createLiteral(float arg0) {
return new BigdataLiteralImpl(this, "" + arg0, null, xsd_float);
}
+ @Override
public BigdataLiteralImpl createLiteral(double arg0) {
return new BigdataLiteralImpl(this, "" + arg0, null, xsd_double);
}
+ @Override
public BigdataLiteralImpl createLiteral(final XMLGregorianCalendar arg0) {
/*
@@ -411,12 +437,14 @@
}
+ @Override
public BigdataLiteralImpl createLiteral(final String label, final String language) {
return new BigdataLiteralImpl(this, label, language, null/* datatype */);
}
+ @Override
public BigdataLiteralImpl createLiteral(final String label, URI datatype) {
/*
@@ -435,6 +463,7 @@
}
+ @Override
public BigdataURIImpl createURI(final String uriString) {
final String str = uriString;
@@ -456,18 +485,21 @@
}
+ @Override
public BigdataURIImpl createURI(final String namespace, final String localName) {
return new BigdataURIImpl(this, namespace + localName);
}
+ @Override
public BigdataStatementImpl createStatement(Resource s, URI p, Value o) {
return createStatement(s, p, o, null/* c */, null/* type */);
}
+ @Override
public BigdataStatementImpl createStatement(Resource s, URI p, Value o,
Resource c) {
@@ -475,6 +507,7 @@
}
+ @Override
public BigdataStatementImpl createStatement(Resource s, URI p, Value o,
Resource c, StatementEnum type) {
@@ -482,6 +515,7 @@
}
+ @Override
public BigdataStatementImpl createStatement(Resource s, URI p, Value o,
Resource c, StatementEnum type, final boolean userFlag) {
@@ -496,6 +530,7 @@
}
+ @Override
final public BigdataValue asValue(final Value v) {
if (v == null)
@@ -566,30 +601,35 @@
private final transient BigdataValueSerializer<BigdataValue> valueSer = new BigdataValueSerializer<BigdataValue>(
this);
+ @Override
public BigdataValueSerializer<BigdataValue> getValueSerializer() {
return valueSer;
}
+ @Override
public BigdataResource asValue(Resource v) {
return (BigdataResource) asValue((Value) v);
}
+ @Override
public BigdataURI asValue(URI v) {
return (BigdataURI)asValue((Value)v);
}
+ @Override
public BigdataLiteral asValue(Literal v) {
return (BigdataLiteral)asValue((Value)v);
}
+ @Override
public BigdataBNode asValue(BNode v) {
return (BigdataBNode)asValue((Value)v);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tho...@us...> - 2014-10-06 16:59:18
|
Revision: 8685
http://sourceforge.net/p/bigdata/code/8685
Author: thompsonbry
Date: 2014-10-06 16:59:15 +0000 (Mon, 06 Oct 2014)
Log Message:
-----------
Fix for #980 and #983 (xsd:boolean data race)
Modified Paths:
--------------
branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/model/BigdataValueFactoryImpl.java
Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/model/BigdataValueFactoryImpl.java
===================================================================
--- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/model/BigdataValueFactoryImpl.java 2014-10-04 21:01:57 UTC (rev 8684)
+++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/model/BigdataValueFactoryImpl.java 2014-10-06 16:59:15 UTC (rev 8685)
@@ -43,7 +43,6 @@
import com.bigdata.cache.WeakValueCache;
import com.bigdata.rdf.internal.IV;
-import com.bigdata.rdf.internal.impl.literal.XSDBooleanIV;
import com.bigdata.rdf.internal.impl.literal.XSDUnsignedByteIV;
import com.bigdata.rdf.internal.impl.literal.XSDUnsignedIntIV;
import com.bigdata.rdf.internal.impl.literal.XSDUnsignedLongIV;
@@ -85,14 +84,16 @@
xsdMap = getXSDMap();
- /**
- * Cache the IV on the BigdataValue for these boolean constants.
- *
- * @see <a href="http://trac.bigdata.com/ticket/983"> Concurrent insert
- * data with boolean object causes IllegalArgumentException </a>
- */
- TRUE.setIV(XSDBooleanIV.TRUE);
- FALSE.setIV(XSDBooleanIV.FALSE);
+ // @see <a href="http://trac.bigdata.com/ticket/983"> Concurrent insert data with boolean object causes IllegalArgumentException </a>
+ // @see <a href="http://trac.bigdata.com/ticket/980"> Object position query hint is not a Literal </a>
+// /**
+// * Cache the IV on the BigdataValue for these boolean constants.
+// *
+// * @see <a href="http://trac.bigdata.com/ticket/983"> Concurrent insert
+// * data with boolean object causes IllegalArgumentException </a>
+// */
+// TRUE.setIV(XSDBooleanIV.TRUE);
+// FALSE.setIV(XSDBooleanIV.FALSE);
}
/**
@@ -311,12 +312,12 @@
private final BigdataURIImpl xsd_boolean = new BigdataURIImpl(this, xsd
+ "boolean");
- private final BigdataLiteralImpl TRUE = new BigdataLiteralImpl(this, "true", null,
- xsd_boolean);
+// private final BigdataLiteralImpl TRUE = new BigdataLiteralImpl(this, "true", null,
+// xsd_boolean);
+//
+// private final BigdataLiteralImpl FALSE = new BigdataLiteralImpl(this, "false", null,
+// xsd_boolean);
- private final BigdataLiteralImpl FALSE = new BigdataLiteralImpl(this, "false", null,
- xsd_boolean);
-
/**
* Map for fast resolution of XSD URIs. The keys are the string values of
* the URIs. The values are the URIs.
@@ -345,10 +346,21 @@
}
+ /**
+ * {@inheritDoc}
+ *
+ * @see <a href="http://trac.bigdata.com/ticket/983"> Concurrent insert data
+ * with boolean object causes IllegalArgumentException </a>
+ * @see <a href="http://trac.bigdata.com/ticket/980"> Object position of
+ * query hint is not a Literal </a>
+ */
@Override
- public BigdataLiteralImpl createLiteral(boolean arg0) {
+ public BigdataLiteralImpl createLiteral(final boolean arg0) {
- return (arg0 ? TRUE : FALSE);
+ return (arg0 //
+ ? new BigdataLiteralImpl(this, "true", null, xsd_boolean)
+ : new BigdataLiteralImpl(this, "false", null, xsd_boolean)
+ );
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|