You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2014/12/01 20:07:54 UTC
[1/2] jena git commit: JENA-816 : Fix for deprecated N3 writer.
Repository: jena
Updated Branches:
refs/heads/master 1097c6f0c -> b9b49abf3
JENA-816 : Fix for deprecated N3 writer.
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/e453e0fd
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/e453e0fd
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/e453e0fd
Branch: refs/heads/master
Commit: e453e0fd0ed3d46df727c537e28abe0116e36db0
Parents: 1097c6f
Author: Andy Seaborne <an...@apache.org>
Authored: Mon Dec 1 19:01:41 2014 +0000
Committer: Andy Seaborne <an...@apache.org>
Committed: Mon Dec 1 19:01:41 2014 +0000
----------------------------------------------------------------------
.../java/com/hp/hpl/jena/n3/N3JenaWriterCommon.java | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/e453e0fd/jena-core/src/main/java/com/hp/hpl/jena/n3/N3JenaWriterCommon.java
----------------------------------------------------------------------
diff --git a/jena-core/src/main/java/com/hp/hpl/jena/n3/N3JenaWriterCommon.java b/jena-core/src/main/java/com/hp/hpl/jena/n3/N3JenaWriterCommon.java
index e16f087..bf79648 100644
--- a/jena-core/src/main/java/com/hp/hpl/jena/n3/N3JenaWriterCommon.java
+++ b/jena-core/src/main/java/com/hp/hpl/jena/n3/N3JenaWriterCommon.java
@@ -31,10 +31,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.hp.hpl.jena.rdf.model.*;
-
+import com.hp.hpl.jena.rdf.model.impl.Util ;
import com.hp.hpl.jena.util.iterator.ClosableIterator;
import com.hp.hpl.jena.util.iterator.WrappedIterator;
-
import com.hp.hpl.jena.JenaRuntime;
import com.hp.hpl.jena.shared.JenaException;
import com.hp.hpl.jena.vocabulary.OWL;
@@ -606,16 +605,10 @@ public class N3JenaWriterCommon implements RDFWriter
string(sbuff, s, singleQuoteLiteral) ;
sbuff.append(quoteMarks);
- // Format the language tag
- if ( lang != null && lang.length()>0)
- {
+ if ( Util.isLangString(literal) ) {
sbuff.append("@") ;
sbuff.append(lang) ;
- }
-
- // Format the datatype
- if ( datatype != null )
- {
+ } else if ( ! Util.isSimpleString(literal) ) {
sbuff.append("^^") ;
sbuff.append(formatURI(datatype)) ;
}
[2/2] jena git commit: JENA-816 : Test results change in RDF 1.1.
Posted by an...@apache.org.
JENA-816 : Test results change in RDF 1.1.
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/b9b49abf
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/b9b49abf
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/b9b49abf
Branch: refs/heads/master
Commit: b9b49abf32aa4eab9c110c5f5204861bb39fe595
Parents: e453e0f
Author: Andy Seaborne <an...@apache.org>
Authored: Mon Dec 1 19:06:49 2014 +0000
Committer: Andy Seaborne <an...@apache.org>
Committed: Mon Dec 1 19:06:49 2014 +0000
----------------------------------------------------------------------
.../hpl/jena/graph/test/TestFindLiterals.java | 49 ++++++++++----------
1 file changed, 25 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/b9b49abf/jena-core/src/test/java/com/hp/hpl/jena/graph/test/TestFindLiterals.java
----------------------------------------------------------------------
diff --git a/jena-core/src/test/java/com/hp/hpl/jena/graph/test/TestFindLiterals.java b/jena-core/src/test/java/com/hp/hpl/jena/graph/test/TestFindLiterals.java
index 47f19e2..a43d26c 100644
--- a/jena-core/src/test/java/com/hp/hpl/jena/graph/test/TestFindLiterals.java
+++ b/jena-core/src/test/java/com/hp/hpl/jena/graph/test/TestFindLiterals.java
@@ -22,6 +22,7 @@ import java.util.Set;
import junit.framework.TestSuite;
+import com.hp.hpl.jena.JenaRuntime ;
import com.hp.hpl.jena.graph.Graph;
import com.hp.hpl.jena.graph.Node;
import com.hp.hpl.jena.graph.NodeFactory ;
@@ -41,7 +42,7 @@ public class TestFindLiterals extends GraphTestBase
};
public static TestFindLiterals aTest
- ( final String graph, final String size, final String search, final String results )
+ ( final String graph, final int size, final String search, final String results )
{
return new TestFindLiterals
( "TestFindLiterals: graph {" + graph
@@ -53,10 +54,9 @@ public class TestFindLiterals extends GraphTestBase
public void runBare()
{
Graph g = graphWith( graph );
- int n = Integer.parseInt( size );
Node literal = NodeCreateUtils.create( search );
//
- assertEquals( "graph has wrong size", n, g.size() );
+ assertEquals( "graph has wrong size", size, g.size() );
Set<Node> got = g.find( Node.ANY, Node.ANY, literal ).mapWith( getObject ).toSet();
assertEquals( nodeSet( results ), got );
}
@@ -67,34 +67,35 @@ public class TestFindLiterals extends GraphTestBase
{
TestSuite result = new TestSuite( TestFindLiterals.class );
//
- result.addTest( aTest( "a P 'simple'", "1", "'simple'", "'simple'" ) );
- result.addTest( aTest( "a P 'simple'xsd:string", "1", "'simple'", "'simple'xsd:string" ) );
- result.addTest( aTest( "a P 'simple'", "1", "'simple'xsd:string", "'simple'" ) );
- result.addTest( aTest( "a P 'simple'xsd:string", "1", "'simple'xsd:string", "'simple'xsd:string" ) );
+ result.addTest( aTest( "a P 'simple'", 1, "'simple'", "'simple'" ) );
+ result.addTest( aTest( "a P 'simple'xsd:string", 1, "'simple'", "'simple'xsd:string" ) );
+ result.addTest( aTest( "a P 'simple'", 1, "'simple'xsd:string", "'simple'" ) );
+ result.addTest( aTest( "a P 'simple'xsd:string", 1, "'simple'xsd:string", "'simple'xsd:string" ) );
//
- result.addTest( aTest( "a P 'simple'; a P 'simple'xsd:string", "2", "'simple'", "'simple' 'simple'xsd:string" ) );
- result.addTest( aTest( "a P 'simple'; a P 'simple'xsd:string", "2", "'simple'xsd:string", "'simple' 'simple'xsd:string" ) );
+ int expected = JenaRuntime.isRDF11 ? 1 : 2 ;
+ result.addTest( aTest( "a P 'simple'; a P 'simple'xsd:string", expected, "'simple'", "'simple' 'simple'xsd:string" ) );
+ result.addTest( aTest( "a P 'simple'; a P 'simple'xsd:string", expected, "'simple'xsd:string", "'simple' 'simple'xsd:string" ) );
//
- result.addTest( aTest( "a P 1", "1", "1", "1" ) );
- result.addTest( aTest( "a P '1'xsd:float", "1", "'1'xsd:float", "'1'xsd:float" ) );
- result.addTest( aTest( "a P '1'xsd:double", "1", "'1'xsd:double", "'1'xsd:double" ) );
- result.addTest( aTest( "a P '1'xsd:float", "1", "'1'xsd:float", "'1'xsd:float" ) );
- result.addTest( aTest( "a P '1.1'xsd:float", "1", "'1'xsd:float", "" ) );
- result.addTest( aTest( "a P '1'xsd:double", "1", "'1'xsd:int", "" ) );
+ result.addTest( aTest( "a P 1", 1, "1", "1" ) );
+ result.addTest( aTest( "a P '1'xsd:float", 1, "'1'xsd:float", "'1'xsd:float" ) );
+ result.addTest( aTest( "a P '1'xsd:double", 1, "'1'xsd:double", "'1'xsd:double" ) );
+ result.addTest( aTest( "a P '1'xsd:float", 1, "'1'xsd:float", "'1'xsd:float" ) );
+ result.addTest( aTest( "a P '1.1'xsd:float", 1, "'1'xsd:float", "" ) );
+ result.addTest( aTest( "a P '1'xsd:double", 1, "'1'xsd:int", "" ) );
//
- result.addTest( aTest( "a P 'abc'rdf:XMLLiteral", "1", "'abc'", "" ) );
- result.addTest( aTest( "a P 'abc'", "1", "'abc'rdf:XMLLiteral", "" ) );
+ result.addTest( aTest( "a P 'abc'rdf:XMLLiteral", 1, "'abc'", "" ) );
+ result.addTest( aTest( "a P 'abc'", 1, "'abc'rdf:XMLLiteral", "" ) );
//
// floats & doubles are not compatible
//
- result.addTest( aTest( "a P '1'xsd:float", "1", "'1'xsd:double", "" ) );
- result.addTest( aTest( "a P '1'xsd:double", "1", "'1'xsd:float", "" ) );
+ result.addTest( aTest( "a P '1'xsd:float", 1, "'1'xsd:double", "" ) );
+ result.addTest( aTest( "a P '1'xsd:double", 1, "'1'xsd:float", "" ) );
//
- result.addTest( aTest( "a P 1", "1", "'1'", "" ) );
- result.addTest( aTest( "a P 1", "1", "'1'xsd:integer", "'1'xsd:integer" ) );
- result.addTest( aTest( "a P 1", "1", "'1'", "" ) );
- result.addTest( aTest( "a P '1'xsd:short", "1", "'1'xsd:integer", "'1'xsd:short" ) );
- result.addTest( aTest( "a P '1'xsd:int", "1", "'1'xsd:integer", "'1'xsd:int" ) );
+ result.addTest( aTest( "a P 1", 1, "'1'", "" ) );
+ result.addTest( aTest( "a P 1", 1, "'1'xsd:integer", "'1'xsd:integer" ) );
+ result.addTest( aTest( "a P 1", 1, "'1'", "" ) );
+ result.addTest( aTest( "a P '1'xsd:short", 1, "'1'xsd:integer", "'1'xsd:short" ) );
+ result.addTest( aTest( "a P '1'xsd:int", 1, "'1'xsd:integer", "'1'xsd:int" ) );
return result;
}