commonsrdf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wik...@apache.org
Subject [24/50] [abbrv] incubator-commonsrdf git commit: Return named UUID (MD5) if internalIdentififier is ntriples-invalid
Date Fri, 27 Mar 2015 18:15:22 GMT
Return named UUID (MD5) if internalIdentififier is ntriples-invalid

Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/ee329b5a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/ee329b5a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/ee329b5a

Branch: refs/heads/master
Commit: ee329b5a195b68ba5bea76615aa6557739ed73c8
Parents: 65db769
Author: Stian Soiland-Reyes <stain@apache.org>
Authored: Mon Jan 26 10:42:20 2015 +0000
Committer: Stian Soiland-Reyes <stain@apache.org>
Committed: Mon Jan 26 10:42:20 2015 +0000

----------------------------------------------------------------------
 .../java/com/github/commonsrdf/simple/BlankNodeImpl.java     | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/ee329b5a/simple/src/main/java/com/github/commonsrdf/simple/BlankNodeImpl.java
----------------------------------------------------------------------
diff --git a/simple/src/main/java/com/github/commonsrdf/simple/BlankNodeImpl.java b/simple/src/main/java/com/github/commonsrdf/simple/BlankNodeImpl.java
index 760024a..51ebdbf 100644
--- a/simple/src/main/java/com/github/commonsrdf/simple/BlankNodeImpl.java
+++ b/simple/src/main/java/com/github/commonsrdf/simple/BlankNodeImpl.java
@@ -13,8 +13,10 @@
  */
 package com.github.commonsrdf.simple;
 
+import java.nio.charset.Charset;
 import java.util.Objects;
 import java.util.Optional;
+import java.util.UUID;
 import java.util.concurrent.atomic.AtomicLong;
 
 import com.github.commonsrdf.api.BlankNode;
@@ -26,6 +28,7 @@ import com.github.commonsrdf.api.Graph;
  */
 class BlankNodeImpl implements BlankNode {
 
+	private static final Charset UTF8 = Charset.forName("UTF-8");
 	private static AtomicLong bnodeCounter = new AtomicLong();
 	private String id;
 	private Optional<Graph> localScope;
@@ -52,10 +55,7 @@ class BlankNodeImpl implements BlankNode {
 	@Override
 	public String ntriplesString() {
 		if (id.contains(":")) {
-			// FIXME: Perhaps do a SHA hash of the id?
-			throw new IllegalStateException(
-					"Blank node identifier can't be expressed as ntriples string: "
-							+ id);
+			return "_:u" + UUID.nameUUIDFromBytes(id.getBytes(UTF8));
 		}
 		return "_:" + id;
 	}


Mime
View raw message