[Mulgara-svn] r1322 - trunk/src/jar/query/java/org/mulgara/query/rdf

pag at mulgara.org pag at mulgara.org
Thu Oct 16 05:14:34 UTC 2008


Author: pag
Date: 2008-10-15 22:14:34 -0700 (Wed, 15 Oct 2008)
New Revision: 1322

Modified:
   trunk/src/jar/query/java/org/mulgara/query/rdf/BlankNodeImpl.java
Log:
Updated toString to remove the blank node bit when it is present

Modified: trunk/src/jar/query/java/org/mulgara/query/rdf/BlankNodeImpl.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/rdf/BlankNodeImpl.java	2008-10-15 07:29:00 UTC (rev 1321)
+++ trunk/src/jar/query/java/org/mulgara/query/rdf/BlankNodeImpl.java	2008-10-16 05:14:34 UTC (rev 1322)
@@ -71,6 +71,10 @@
 
   private String stringValue;
 
+  /** The mask that can remove the BLANK_NODE_BIT on nodes that use it. */
+  static final private long COUNTER_MASK = 0x3FFFFFFFFFFFFFFFL;
+
+
   /**
    * Create an empty blank node.  Just a place holder.
    */
@@ -87,7 +91,7 @@
    */
   public BlankNodeImpl(long newNodeId) {
     nodeId = newNodeId;
-    stringValue = "node" + nodeId;
+    stringValue = "node" + printable(nodeId);
   }
 
 
@@ -106,7 +110,7 @@
    */
   public void setNodeId(long nodeId) {
     this.nodeId = nodeId;
-    stringValue = "node" + nodeId;
+    stringValue = "node" + printable(nodeId);
   }
 
 
@@ -155,10 +159,15 @@
    * @return the string value of the uri and node id.
    */
   public String toString() {
-    return "_node" + nodeId;
+    return "_node" + printable(nodeId);
   }
 
   public String getID() {
     return stringValue;
   }
+
+  /** Strips off the blank node bit for blank nodes that use it. */
+  private long printable(long l) {
+    return l > 0 ? COUNTER_MASK & l : l;
+  }
 }




More information about the Mulgara-svn mailing list