jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [04/10] jena git commit: JENA-816 : RDF 1.0./1.1 neutral LiteralLabel.equals.
Date Sat, 22 Nov 2014 15:54:47 GMT
JENA-816 : RDF 1.0./1.1 neutral LiteralLabel.equals.

Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/782e002e
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/782e002e
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/782e002e

Branch: refs/heads/master
Commit: 782e002eca0b2736bba27490c48ede9204aa0872
Parents: 8864bd0
Author: Andy Seaborne <andy@apache.org>
Authored: Sat Nov 22 15:22:09 2014 +0000
Committer: Andy Seaborne <andy@apache.org>
Committed: Sat Nov 22 15:22:09 2014 +0000

----------------------------------------------------------------------
 .../hpl/jena/graph/impl/LiteralLabelImpl.java   | 27 ++++++++++++--------
 1 file changed, 17 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/782e002e/jena-core/src/main/java/com/hp/hpl/jena/graph/impl/LiteralLabelImpl.java
----------------------------------------------------------------------
diff --git a/jena-core/src/main/java/com/hp/hpl/jena/graph/impl/LiteralLabelImpl.java b/jena-core/src/main/java/com/hp/hpl/jena/graph/impl/LiteralLabelImpl.java
index b31288c..50a3979 100644
--- a/jena-core/src/main/java/com/hp/hpl/jena/graph/impl/LiteralLabelImpl.java
+++ b/jena-core/src/main/java/com/hp/hpl/jena/graph/impl/LiteralLabelImpl.java
@@ -19,6 +19,7 @@
 package com.hp.hpl.jena.graph.impl;
 
 import java.util.Locale ;
+import java.util.Objects ;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -299,7 +300,7 @@ final /*public*/ class LiteralLabelImpl implements LiteralLabel {
     public Object getIndexingValue() {
         return
             isXML() ? this
-            : !lang.equals( "" ) ? getLexicalForm() + "@" + lang.toLowerCase(Locale.ENGLISH)
+            : !lang.equals( "" ) ? getLexicalForm() + "@" + lang.toLowerCase(Locale.ROOT)
             : wellformed ? getValue()
             : getLexicalForm() 
             ;
@@ -359,15 +360,21 @@ final /*public*/ class LiteralLabelImpl implements LiteralLabel {
 	        return false;
 	    }
 	    LiteralLabel otherLiteral = (LiteralLabel) other;
-	    boolean typeEqual =
-	        (dtype == null
-	            ? otherLiteral.getDatatype() == null
-	            : dtype.equals(otherLiteral.getDatatype()));
-	    boolean langEqual =
-	        (dtype == null ? lang.equals(otherLiteral.language()) : true);
-	    return typeEqual
-	        && langEqual
-	        && getLexicalForm().equals(otherLiteral.getLexicalForm());
+	    
+	    boolean typeEqual = Objects.equals(dtype, otherLiteral.getDatatype()) ;
+	    if ( !typeEqual )
+	        return false ;
+
+	    boolean lexEquals = Objects.equals(lexicalForm, otherLiteral.getLexicalForm());
+        if ( ! lexEquals )
+            return false ;
+
+        boolean langEqual = Objects.equals(lang, otherLiteral.language()) ;
+	    if ( ! langEqual )
+	        return false ;
+	    // Ignore xml flag as it is calculated from the lexical form + datatype 
+	    // Ignore value as lexical form + datatype -> value is a function. 
+	    return true ;
 	}
 
 	/** 


Mime
View raw message