jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cla...@apache.org
Subject jena git commit: Added change for JENA-839 Added test case.
Date Sun, 18 Jan 2015 23:03:01 GMT
Repository: jena
Updated Branches:
  refs/heads/master fa456a2f3 -> 2baabaeab


Added change for JENA-839
Added test case.


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

Branch: refs/heads/master
Commit: 2baabaeab3f5c2c53fcc19bbd9940ff05dd0ab30
Parents: fa456a2
Author: Claude Warren <claude@apache.org>
Authored: Sun Jan 18 23:00:46 2015 +0000
Committer: Claude Warren <claude@apache.org>
Committed: Sun Jan 18 23:00:46 2015 +0000

----------------------------------------------------------------------
 .../com/hp/hpl/jena/sparql/expr/nodevalue/NodeFunctions.java   | 5 +++--
 .../java/com/hp/hpl/jena/sparql/expr/TestNodeFunctions.java    | 6 ++++++
 2 files changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/2baabaea/jena-arq/src/main/java/com/hp/hpl/jena/sparql/expr/nodevalue/NodeFunctions.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/expr/nodevalue/NodeFunctions.java
b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/expr/nodevalue/NodeFunctions.java
index 825fda0..7928261 100644
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/expr/nodevalue/NodeFunctions.java
+++ b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/expr/nodevalue/NodeFunctions.java
@@ -23,6 +23,7 @@ import java.util.UUID ;
 
 import com.hp.hpl.jena.datatypes.RDFDatatype ;
 import com.hp.hpl.jena.datatypes.xsd.XSDDatatype ;
+import com.hp.hpl.jena.datatypes.xsd.impl.XSDBaseStringType;
 import com.hp.hpl.jena.graph.Node ;
 import com.hp.hpl.jena.graph.NodeFactory ;
 
@@ -66,8 +67,8 @@ public class NodeFunctions {
         RDFDatatype dt = n.getLiteralDatatype() ;
         if ( dt == null )
             return n ;
-        if ( XSDDatatype.XSDstring.equals(dt) )
-            return n ;
+        if (dt instanceof XSDBaseStringType)
+                return n ;
         throw new ExprEvalException(label + ": Not a string literal: " + nv) ;
     }
 

http://git-wip-us.apache.org/repos/asf/jena/blob/2baabaea/jena-arq/src/test/java/com/hp/hpl/jena/sparql/expr/TestNodeFunctions.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/com/hp/hpl/jena/sparql/expr/TestNodeFunctions.java b/jena-arq/src/test/java/com/hp/hpl/jena/sparql/expr/TestNodeFunctions.java
index 7b54d6e..671f303 100644
--- a/jena-arq/src/test/java/com/hp/hpl/jena/sparql/expr/TestNodeFunctions.java
+++ b/jena-arq/src/test/java/com/hp/hpl/jena/sparql/expr/TestNodeFunctions.java
@@ -316,4 +316,10 @@ public class TestNodeFunctions extends BaseTest {
         NodeValue r = NodeFunctions.isLiteral(nv) ;
         assertEquals(NodeValue.FALSE, r) ;
     }
+    
+    @Test public void testCheckAndGetStringLiteral() {
+        NodeValue nv = NodeValue.makeNode("abc", XSDDatatype.XSDnormalizedString) ;
+        Node n = NodeFunctions.checkAndGetStringLiteral("Test", nv);
+        assertEquals( "abc", n.getLiteralLexicalForm());
+    }
 }


Mime
View raw message