jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1554076 - in /jena/trunk: jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/ jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/ jena-arq/src/main/java/org/apache/jena/riot/out/ jena-tdb/src/main/java/com/hp/hpl/jena/tdb/assembler/ jena-td...
Date Sun, 29 Dec 2013 22:08:39 GMT
Author: andy
Date: Sun Dec 29 22:08:38 2013
New Revision: 1554076

URL: http://svn.apache.org/r1554076
Log:
Clearing up
(1) Sort out 2 difefrent NodeFmtLib classes
(2) Remove duplicate QueryEngineFactoryWrapper
(3) Minor items in passing.

Removed:
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/QueryEngineFactoryWrapper.java
    jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/lib/NodeFmtLib.java
Modified:
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DatasetChangesCapture.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DatasetGraphWrapper.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/ARQMgt.java
    jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/out/NodeFmtLib.java
    jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/assembler/TDBGraphAssembler.java
    jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/lib/DumpOps.java
    jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/lib/NodeLib.java
    jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodecLib.java
    jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodecSSE.java
    jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/solver/BindingTDB.java

Modified: jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DatasetChangesCapture.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DatasetChangesCapture.java?rev=1554076&r1=1554075&r2=1554076&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DatasetChangesCapture.java
(original)
+++ jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DatasetChangesCapture.java
Sun Dec 29 22:08:38 2013
@@ -40,7 +40,7 @@ class DatasetChangesCapture implements D
     { this(true, true, false, false) ; }
 
     /** Capture quad actions, either includeing or excluding the "no ops"
-     * @param recordNoOps   Wrhther to record {@linkplain QuadAction#NO_ADD} and {@linkplain
QuadAction#NO_DELETE}  
+     * @param recordNoOps   Whether to record {@linkplain QuadAction#NO_ADD} and {@linkplain
QuadAction#NO_DELETE}  
      */
     public DatasetChangesCapture(boolean recordNoOps)
     { this(true, true, recordNoOps, recordNoOps) ; }

Modified: jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DatasetGraphWrapper.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DatasetGraphWrapper.java?rev=1554076&r1=1554075&r2=1554076&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DatasetGraphWrapper.java
(original)
+++ jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DatasetGraphWrapper.java
Sun Dec 29 22:08:38 2013
@@ -28,13 +28,14 @@ import com.hp.hpl.jena.shared.Lock ;
 import com.hp.hpl.jena.sparql.SystemARQ ;
 import com.hp.hpl.jena.sparql.util.Context ;
 
-public class DatasetGraphWrapper implements DatasetGraph, Sync
+public class DatasetGraphWrapper implements DatasetGraph, Sync 
 {
+    // Associated query engine factory - QueryEngineFactoryWrapper
+    // which executes on the unwraped DSG. 
     private final DatasetGraph dsg ;
     public final DatasetGraph getWrapped() { return dsg ; }
 
-    public DatasetGraphWrapper(DatasetGraph dsg)
-    {
+    public DatasetGraphWrapper(DatasetGraph dsg) {
         this.dsg = dsg ;
     }
 

Modified: jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/ARQMgt.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/ARQMgt.java?rev=1554076&r1=1554075&r2=1554076&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/ARQMgt.java (original)
+++ jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/mgt/ARQMgt.java Sun Dec 29 22:08:38
2013
@@ -34,6 +34,12 @@ import com.hp.hpl.jena.sparql.ARQExcepti
 import com.hp.hpl.jena.sparql.engine.QueryEngineBase ;
 
 public class ARQMgt {
+//    // No-op version.
+//    public static void init() {}
+//    public static void register(String name, Object bean) { }
+//    public static void unregister(String name) { }
+    // Or noJMX=true
+    
     // In some environments, JMX does not exist.
     static private Logger                  log         = LoggerFactory.getLogger(ARQMgt.class)
;
     private static boolean                 initialized = false ;
@@ -45,24 +51,28 @@ public class ARQMgt {
         if (initialized)
             return ;
         initialized = true ;
+        if ( noJMX )
+            return ;
 
         try {
             mbs = ManagementFactory.getPlatformMBeanServer() ;
-            String NS = ARQ.PATH ;
-            ContextMBean cxtBean = new ContextMBean(ARQ.getContext()) ;
-            QueryEngineInfo qeInfo = QueryEngineBase.queryEngineInfo ;
-
-            // Done in ARQ initialization --
-            // register(NS+".system:type=SystemInfo", ARQ.systemInfo) ;
-            register(NS + ".system:type=Context", cxtBean) ;
-            register(NS + ".system:type=Engine", qeInfo) ;
-
         } catch (Throwable ex) {
             Log.debug(ARQMgt.class, "Failed to initialize JMX: "+ex.getMessage()) ;
             noJMX = true ;
             mbs = null ;
         }
     }
+    
+    public static void register() {
+        init() ;
+        String NS = ARQ.PATH ;
+        ContextMBean cxtBean = new ContextMBean(ARQ.getContext()) ;
+        QueryEngineInfo qeInfo = QueryEngineBase.queryEngineInfo ;
+        // Done in ARQ initialization --
+        // register(NS+".system:type=SystemInfo", ARQ.systemInfo) ;
+        register(NS + ".system:type=Context", cxtBean) ;
+        register(NS + ".system:type=Engine", qeInfo) ;
+    }
 
     public static void register(String name, Object bean) {
         init() ;

Modified: jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/out/NodeFmtLib.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/out/NodeFmtLib.java?rev=1554076&r1=1554075&r2=1554076&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/out/NodeFmtLib.java (original)
+++ jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/out/NodeFmtLib.java Sun Dec 29
22:08:38 2013
@@ -28,13 +28,18 @@ import org.apache.jena.atlas.lib.Chars ;
 import org.apache.jena.iri.IRI ;
 import org.apache.jena.iri.IRIFactory ;
 import org.apache.jena.iri.IRIRelativize ;
-import org.apache.jena.riot.system.* ;
+import org.apache.jena.riot.system.PrefixMap ;
+import org.apache.jena.riot.system.PrefixMapFactory ;
+import org.apache.jena.riot.system.Prologue ;
+import org.apache.jena.riot.system.RiotChars ;
 
 import com.hp.hpl.jena.graph.Node ;
 import com.hp.hpl.jena.graph.Triple ;
+import com.hp.hpl.jena.rdf.model.RDFNode ;
 import com.hp.hpl.jena.shared.PrefixMapping ;
 import com.hp.hpl.jena.sparql.ARQConstants ;
 import com.hp.hpl.jena.sparql.core.Quad ;
+import com.hp.hpl.jena.sparql.util.FmtUtils ;
 
 /** Presentation utilitiles for Nodes, Triples, Quads and more */ 
 public class NodeFmtLib
@@ -59,8 +64,23 @@ public class NodeFmtLib
     {
         return strNodes(q.getGraph(), q.getSubject(), q.getPredicate(), q.getObject()) ;
     }
+
+    public static String str(Node n)
+    {
+        IndentedLineBuffer sw = new IndentedLineBuffer() ;
+        str(sw, n) ;
+        return sw.toString() ; 
+    }
+
+    /** A displayable string for an RDFNode. Includes common abbreviations */
+    public static String displayStr(RDFNode obj)
+    {
+        return FmtUtils.stringForRDFNode(obj) ;
+    }
     
+    public static String displayStr(Node n) { return FmtUtils.stringForNode(n) ; }
 
+    
     // Worker
     public static String strNodes(Node ... nodes)
     {
@@ -76,23 +96,25 @@ public class NodeFmtLib
         return sw.toString() ; 
     }
 
-    public static String str(Node n)
-    {
-        IndentedLineBuffer sw = new IndentedLineBuffer() ;
-        str(sw, n) ;
-        return sw.toString() ; 
-    }
-
-    private static final boolean onlySafeBNodeLabels = true ;
-
     //public static String displayStr(Node n) { return serialize(n) ; }
 
     public static void str(IndentedWriter w, Node n)
     { serialize(w, n, null, null) ; }
 
+    public static String str(Node n, Prologue prologue)
+    {
+        return str(n, prologue.getBaseURI(), prologue.getPrefixMap()) ;
+    }
+
+    public static String str(Node n, String base, PrefixMap prefixMap)
+    {
+        IndentedLineBuffer sw = new IndentedLineBuffer() ;
+        serialize(sw, n, base, prefixMap) ;
+        return sw.toString() ;
+    }
+
     public static void serialize(IndentedWriter w, Node n, Prologue prologue)
     { serialize(w, n, prologue.getBaseURI(), prologue.getPrefixMap()) ; }
-
     
     public static void serialize(IndentedWriter w, Node n, String base, PrefixMap prefixMap)
     {

Modified: jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/assembler/TDBGraphAssembler.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/assembler/TDBGraphAssembler.java?rev=1554076&r1=1554075&r2=1554076&view=diff
==============================================================================
--- jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/assembler/TDBGraphAssembler.java
(original)
+++ jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/assembler/TDBGraphAssembler.java
Sun Dec 29 22:08:38 2013
@@ -21,22 +21,19 @@ package com.hp.hpl.jena.tdb.assembler;
 import static com.hp.hpl.jena.sparql.util.graph.GraphUtils.*;
 import static com.hp.hpl.jena.tdb.assembler.VocabTDB.*;
 import org.apache.jena.atlas.logging.Log ;
-
+import org.apache.jena.riot.out.NodeFmtLib ;
 
 import com.hp.hpl.jena.query.Dataset;
 import com.hp.hpl.jena.rdf.model.*;
-
 import com.hp.hpl.jena.assembler.Assembler;
 import com.hp.hpl.jena.assembler.Mode;
 import com.hp.hpl.jena.assembler.assemblers.AssemblerBase;
 import com.hp.hpl.jena.assembler.exceptions.AssemblerException;
-
 import com.hp.hpl.jena.tdb.TDB;
 import com.hp.hpl.jena.tdb.TDBException;
 import com.hp.hpl.jena.tdb.TDBFactory;
 import com.hp.hpl.jena.tdb.assembler.IndexAssembler;
 import com.hp.hpl.jena.tdb.base.file.Location;
-import com.hp.hpl.jena.tdb.lib.NodeFmtLib ;
 
 public class TDBGraphAssembler extends AssemblerBase implements Assembler
 {

Modified: jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/lib/DumpOps.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/lib/DumpOps.java?rev=1554076&r1=1554075&r2=1554076&view=diff
==============================================================================
--- jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/lib/DumpOps.java (original)
+++ jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/lib/DumpOps.java Sun Dec 29 22:08:38
2013
@@ -28,6 +28,7 @@ import org.apache.jena.atlas.io.Indented
 import org.apache.jena.atlas.lib.ByteBufferLib ;
 import org.apache.jena.atlas.lib.Pair ;
 import org.apache.jena.atlas.lib.Tuple ;
+import org.apache.jena.riot.out.NodeFmtLib ;
 import arq.cmd.CmdException ;
 
 import com.hp.hpl.jena.graph.Node ;
@@ -110,7 +111,7 @@ public class DumpOps
             Pair<NodeId, Node> pair = iter.next() ;
             NodeId nid = pair.car() ;
             Node n = pair.cdr();
-            String x = NodeFmtLib.serialize(n) ;
+            String x = NodeFmtLib.str(n) ;
             System.out.printf("%016X %s\n", nid.getId(), x) ; 
         }
         dumpedNodeTables.add(nodeTable) ;

Modified: jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/lib/NodeLib.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/lib/NodeLib.java?rev=1554076&r1=1554075&r2=1554076&view=diff
==============================================================================
--- jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/lib/NodeLib.java (original)
+++ jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/lib/NodeLib.java Sun Dec 29 22:08:38
2013
@@ -33,6 +33,7 @@ import org.apache.jena.atlas.lib.Pool ;
 import org.apache.jena.atlas.lib.PoolBase ;
 import org.apache.jena.atlas.lib.PoolSync ;
 import org.apache.jena.atlas.logging.Log ;
+import org.apache.jena.riot.out.NodeFmtLib ;
 
 import com.hp.hpl.jena.graph.Node ;
 import com.hp.hpl.jena.tdb.TDBException ;
@@ -204,7 +205,7 @@ public class NodeLib
         {
             if ( i != 0 ) 
                 b.append(sep) ;
-            b.append(NodeFmtLib.serialize(nodes[i])) ;
+            b.append(NodeFmtLib.str(nodes[i])) ;
         }
         return b.toString() ;
     }

Modified: jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodecLib.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodecLib.java?rev=1554076&r1=1554075&r2=1554076&view=diff
==============================================================================
--- jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodecLib.java (original)
+++ jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodecLib.java Sun Dec
29 22:08:38 2013
@@ -20,6 +20,7 @@ package com.hp.hpl.jena.tdb.nodetable;
 
 import org.apache.jena.atlas.lib.StrUtils ;
 import org.apache.jena.atlas.logging.Log ;
+import org.apache.jena.riot.out.NodeFmtLib ;
 
 import com.hp.hpl.jena.graph.Node ;
 import com.hp.hpl.jena.graph.NodeFactory ;
@@ -27,7 +28,6 @@ import com.hp.hpl.jena.rdf.model.AnonId 
 import com.hp.hpl.jena.shared.PrefixMapping ;
 import com.hp.hpl.jena.sparql.sse.SSE ;
 import com.hp.hpl.jena.sparql.sse.SSEParseException ;
-import com.hp.hpl.jena.tdb.lib.NodeFmtLib ;
 import com.hp.hpl.jena.tdb.lib.NodeLib ;
 
 /** Utilities for encoding/decoding nodes as strings.
@@ -58,7 +58,7 @@ public class NodecLib
                 node = NodeFactory.createURI(x) ; 
         }
         
-        return NodeFmtLib.serialize(node) ;
+        return NodeFmtLib.str(node) ;
     }
 
     public static Node decode(String s)     { return decode(s, null) ; }

Modified: jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodecSSE.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodecSSE.java?rev=1554076&r1=1554075&r2=1554076&view=diff
==============================================================================
--- jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodecSSE.java (original)
+++ jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodecSSE.java Sun Dec
29 22:08:38 2013
@@ -23,6 +23,9 @@ import java.nio.ByteBuffer ;
 import org.apache.jena.atlas.io.BlockUTF8 ;
 import org.apache.jena.atlas.lib.StrUtils ;
 import org.apache.jena.riot.RiotException ;
+import org.apache.jena.riot.out.NodeFmtLib ;
+import org.apache.jena.riot.system.PrefixMap ;
+import org.apache.jena.riot.system.PrefixMapNull ;
 import org.apache.jena.riot.tokens.Token ;
 import org.apache.jena.riot.tokens.Tokenizer ;
 import org.apache.jena.riot.tokens.TokenizerFactory ;
@@ -33,7 +36,6 @@ import com.hp.hpl.jena.graph.NodeFactory
 import com.hp.hpl.jena.rdf.model.AnonId ;
 import com.hp.hpl.jena.shared.PrefixMapping ;
 import com.hp.hpl.jena.tdb.TDBException ;
-import com.hp.hpl.jena.tdb.lib.NodeFmtLib ;
 import com.hp.hpl.jena.tdb.lib.StringAbbrev ;
 
 /** Simple encoder/decoder for nodes that uses Turtle term string encoding. */
@@ -53,9 +55,13 @@ public class NodecSSE implements Nodec
         return maxLength(node) ;
     }
 
+    private static final PrefixMap pmap0 = PrefixMapNull.empty ;
+    private static final boolean onlySafeBNodeLabels = false ;
     @Override
     public int encode(Node node, ByteBuffer bb, PrefixMapping pmap)
     {
+        String str = null ;
+
         if ( node.isURI() ) 
         {
             // Pesky spaces etc
@@ -66,22 +72,24 @@ public class NodecSSE implements Nodec
         
         if ( node.isLiteral() && node.getLiteralLanguage() != null )
         {
-            // Check syntactcally valid.
+            // Check syntactically valid.
             String lang = node.getLiteralLanguage() ;
             if ( ! LangTag.check(lang) )
                 throw new TDBException("bad language tag: "+node) ;
         }
         
+        if ( node.isBlank() && ! onlySafeBNodeLabels ) {
+            // Special case.
+            str = "_:"+node.getBlankNodeLabel() ;
+        }
+        
         // Node->String
-        String str = NodeFmtLib.serialize(node) ;
+        if ( str == null )
+            str = NodeFmtLib.str(node, (String)null, pmap0) ;
         // String -> bytes ;
         BlockUTF8.fromChars(str, bb) ;
         bb.flip() ;
         return bb.limit() ;
-//        int x = Bytes.toByteBuffer(str, bb) ;
-//        bb.position(0) ;        // Around the space used
-//        bb.limit(x) ;           // The space we have used.
-//        return x ;
     }
 
     @Override

Modified: jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/solver/BindingTDB.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/solver/BindingTDB.java?rev=1554076&r1=1554075&r2=1554076&view=diff
==============================================================================
--- jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/solver/BindingTDB.java (original)
+++ jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/solver/BindingTDB.java Sun Dec 29
22:08:38 2013
@@ -21,12 +21,12 @@ package com.hp.hpl.jena.tdb.solver;
 import java.util.* ;
 
 import org.apache.jena.atlas.logging.Log ;
+import org.apache.jena.riot.out.NodeFmtLib ;
 
 import com.hp.hpl.jena.graph.Node ;
 import com.hp.hpl.jena.sparql.core.Var ;
 import com.hp.hpl.jena.sparql.engine.binding.Binding ;
 import com.hp.hpl.jena.sparql.engine.binding.BindingBase ;
-import com.hp.hpl.jena.tdb.lib.NodeFmtLib ;
 import com.hp.hpl.jena.tdb.nodetable.NodeTable ;
 import com.hp.hpl.jena.tdb.store.NodeId ;
 



Mime
View raw message