You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by ch...@apache.org on 2012/10/10 15:53:12 UTC
svn commit: r1396601 - in /jena/Scratch/Eyeball/trunk/src:
main/java/com/hp/hpl/jena/extras/tools/notations/likeN3/
main/java/com/hp/hpl/jena/eyeball/util/
test/java/com/hp/hpl/jena/extras/tools/notations/likeN3/
test/java/com/hp/hpl/jena/eyeball/util/...
Author: chrisdollin
Date: Wed Oct 10 13:53:12 2012
New Revision: 1396601
URL: http://svn.apache.org/viewvc?rev=1396601&view=rev
Log:
Sorted out dependency where main depended on test.
Added:
jena/Scratch/Eyeball/trunk/src/test/java/com/hp/hpl/jena/extras/tools/notations/likeN3/
- copied from r1396566, jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/extras/tools/notations/likeN3/
Removed:
jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/extras/tools/notations/likeN3/
Modified:
jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/util/SetPropertiesFromString.java
jena/Scratch/Eyeball/trunk/src/test/java/com/hp/hpl/jena/eyeball/util/test/TestSetPropertiesFromString.java
Modified: jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/util/SetPropertiesFromString.java
URL: http://svn.apache.org/viewvc/jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/util/SetPropertiesFromString.java?rev=1396601&r1=1396600&r2=1396601&view=diff
==============================================================================
--- jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/util/SetPropertiesFromString.java (original)
+++ jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/util/SetPropertiesFromString.java Wed Oct 10 13:53:12 2012
@@ -18,8 +18,8 @@
package com.hp.hpl.jena.eyeball.util;
+import com.hp.hpl.jena.datatypes.xsd.XSDDatatype;
import com.hp.hpl.jena.graph.*;
-import com.hp.hpl.jena.graph.test.NodeCreateUtils;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.shared.PrefixMapping;
@@ -49,5 +49,24 @@ public class SetPropertiesFromString
}
private Node createNode( String s )
- { return NodeCreateUtils.create( pm, s ); }
+ {
+ if (s.equals("")) s = "''";
+ char ch = s.charAt(0);
+ //
+ if (Character.isDigit( ch )) return createInteger(s);
+ if (ch == '\'') return createLiteral(s);
+ if (s.indexOf(':') < 0) s = ":" + s;
+ return Node.createURI( pm.expandPrefix( s ) );
+ }
+
+ private Node createLiteral( String s ) {
+ int closeQuote = s.indexOf( '\'', 1 );
+ String spelling = s.substring( 1, closeQuote );
+ return Node.createLiteral( spelling );
+ }
+
+ public Node createInteger( String s )
+ {
+ return Node.createLiteral( s, "", XSDDatatype.XSDinteger );
+ }
}
Modified: jena/Scratch/Eyeball/trunk/src/test/java/com/hp/hpl/jena/eyeball/util/test/TestSetPropertiesFromString.java
URL: http://svn.apache.org/viewvc/jena/Scratch/Eyeball/trunk/src/test/java/com/hp/hpl/jena/eyeball/util/test/TestSetPropertiesFromString.java?rev=1396601&r1=1396600&r2=1396601&view=diff
==============================================================================
--- jena/Scratch/Eyeball/trunk/src/test/java/com/hp/hpl/jena/eyeball/util/test/TestSetPropertiesFromString.java (original)
+++ jena/Scratch/Eyeball/trunk/src/test/java/com/hp/hpl/jena/eyeball/util/test/TestSetPropertiesFromString.java Wed Oct 10 13:53:12 2012
@@ -52,11 +52,11 @@ import com.hp.hpl.jena.rdf.model.Model;
testSettingStringAddsModel( EYE.getURI(), "eye:a eye:b 'hello'", "a.b='hello'" );
}
- private void testSettingStringAddsModel( String emptyPrefix, String expected, String settting )
+ private void testSettingStringAddsModel( String emptyPrefix, String expected, String setting )
{
Model m = model();
m.setNsPrefix( "", emptyPrefix );
- new SetPropertiesFromString( m ).set( settting );
+ new SetPropertiesFromString( m ).set( setting );
assertIsoModels( model( expected ), m );
}
}