Revision: 7835
http://bigdata.svn.sourceforge.net/bigdata/?rev=7835&view=rev
Author: mrpersonick
Date: 2014-01-31 15:18:07 +0000 (Fri, 31 Jan 2014)
Log Message:
-----------
detect ungrounded (self-referential) sids
Modified Paths:
--------------
branches/RDR/bigdata-rdf/src/java/com/bigdata/rdf/model/BigdataBNodeImpl.java
Modified: branches/RDR/bigdata-rdf/src/java/com/bigdata/rdf/model/BigdataBNodeImpl.java
===================================================================
--- branches/RDR/bigdata-rdf/src/java/com/bigdata/rdf/model/BigdataBNodeImpl.java 2014-01-27 21:23:38 UTC (rev 7834)
+++ branches/RDR/bigdata-rdf/src/java/com/bigdata/rdf/model/BigdataBNodeImpl.java 2014-01-31 15:18:07 UTC (rev 7835)
@@ -119,17 +119,33 @@
}
+ /**
+ * Used to detect ungrounded sids (self-referential).
+ */
+ private transient boolean selfRef = false;
+
@Override
public IV getIV() {
if (super.iv == null && sid != null) {
-
- if (sid.getSubject() == this || sid.getObject() == this)
+
+// if (sid.getSubject() == this || sid.getObject() == this)
+// throw new UnificationException("illegal self-referential sid");
+
+ if (selfRef) {
throw new UnificationException("illegal self-referential sid");
+ }
+
+ // temporarily set it to true while we get the IVs on the sid
+ selfRef = true;
final IV s = sid.s();
final IV p = sid.p();
final IV o = sid.o();
+
+ // if we make it to here then we have a fully grounded sid
+ selfRef = false;
+
if (s != null && p != null && o != null) {
setIV(new SidIV(new SPO(s, p, o)));
}
@@ -137,7 +153,7 @@
return super.iv;
}
-
+
public String toString() {
return "_:" + id;
@@ -220,7 +236,7 @@
this.statementIdentifier = true;
this.sid = sid;
}
-
+
/**
* Return the statement modeled by this blank node.
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|