jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [4/5] jena git commit: JENA-1039: Tidy up file - add notes about initialization.
Date Fri, 02 Oct 2015 10:10:26 GMT
JENA-1039: Tidy up file - add notes about initialization.

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

Branch: refs/heads/master
Commit: 1f9de03793e8791b5a57e78cf94c595fc015b14c
Parents: bf549f3
Author: Andy Seaborne <andy@apache.org>
Authored: Fri Oct 2 10:51:55 2015 +0100
Committer: Andy Seaborne <andy@apache.org>
Committed: Fri Oct 2 10:51:55 2015 +0100

----------------------------------------------------------------------
 .../org/apache/jena/sparql/graph/NodeConst.java | 35 ++++++++++++--------
 1 file changed, 21 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/1f9de037/jena-arq/src/main/java/org/apache/jena/sparql/graph/NodeConst.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/graph/NodeConst.java b/jena-arq/src/main/java/org/apache/jena/sparql/graph/NodeConst.java
index 0638ed4..ea89816 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/graph/NodeConst.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/graph/NodeConst.java
@@ -22,30 +22,37 @@ import org.apache.jena.datatypes.RDFDatatype ;
 import org.apache.jena.datatypes.xsd.XSDDatatype ;
 import org.apache.jena.graph.Node ;
 import org.apache.jena.graph.NodeFactory ;
-import org.apache.jena.system.JenaSystem ;
 import org.apache.jena.vocabulary.OWL ;
 import org.apache.jena.vocabulary.RDF ;
 
 /** Some node constants */
 public class NodeConst
 {
-    static { JenaSystem.init(); }
-    public static final Node nodeTrue       = NodeFactory.createLiteral("true", XSDDatatype.XSDboolean)
; 
-    public static final Node nodeFalse      = NodeFactory.createLiteral("false",XSDDatatype.XSDboolean)
; 
-    public static final Node nodeZero       = NodeFactory.createLiteral("0",    XSDDatatype.XSDinteger)
;
-    public static final Node nodeOne        = NodeFactory.createLiteral("1",    XSDDatatype.XSDinteger)
;
-    public static final Node nodeTwo        = NodeFactory.createLiteral("2",    XSDDatatype.XSDinteger)
;
-    public static final Node nodeMinusOne   = NodeFactory.createLiteral("-1",   XSDDatatype.XSDinteger)
;
+    private static Node literal(String lex, RDFDatatype dt) {
+        return NodeFactory.createLiteral(lex, dt) ;
+    }
+    
+    private static Node uri(String uriStr) {
+        return NodeFactory.createURI(uriStr) ;
+    }
+    
+    public static final Node nodeTrue       = literal("true",  XSDDatatype.XSDboolean) ;

+    public static final Node nodeFalse      = literal("false", XSDDatatype.XSDboolean) ;

+    public static final Node nodeZero       = literal("0",     XSDDatatype.XSDinteger) ;
+    public static final Node nodeOne        = literal("1",     XSDDatatype.XSDinteger) ;
+    public static final Node nodeTwo        = literal("2",     XSDDatatype.XSDinteger) ;
+    public static final Node nodeMinusOne   = literal("-1",    XSDDatatype.XSDinteger) ;
     public static final Node emptyString    = NodeFactory.createLiteral("") ;
     
-    public static final Node nodeRDFType    = RDF.Nodes.type ;
-    public static final Node nodeFirst      = RDF.Nodes.first ;
-    public static final Node nodeRest       = RDF.Nodes.rest ;
-    public static final Node nodeNil        = RDF.Nodes.nil ;
+    // It should be safe to use RDF.Nodes.
+    // Falback code "just in case"
+    public static final Node nodeRDFType    = RDF.Nodes.type ;  //uri(RDF.uri+"type") ;
+    public static final Node nodeFirst      = RDF.Nodes.first ; //uri(RDF.uri+"first") ;
+    public static final Node nodeRest       = RDF.Nodes.rest ;  //uri(RDF.uri+"rest") ;
+    public static final Node nodeNil        = RDF.Nodes.nil;    //uri(RDF.uri+"nil") ;
     public static final Node nodeANY        = Node.ANY ;
     
-    // Avoid OWL.sameAs.asNode() ;
-    public static final Node nodeOwlSameAs          = OWL.sameAs.asNode() ; // NodeFactory.createURI("http://www.w3.org/2002/07/owl#sameAs")
;
+    public static final Node nodeOwlSameAs          = OWL.sameAs.asNode() ; //NodeFactory.createURI("http://www.w3.org/2002/07/owl#sameAs")
;
     public static final Node rdfLangString          = RDF.Nodes.langString ;
     public static final RDFDatatype dtLangString    = RDF.dtLangString ;
 }


Mime
View raw message