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 2011/11/02 15:38:14 UTC

svn commit: r1196607 - /incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/

Author: andy
Date: Wed Nov  2 14:38:13 2011
New Revision: 1196607

URL: http://svn.apache.org/viewvc?rev=1196607&view=rev
Log: (empty)

Added:
    incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportGraphVarScope.java   (with props)
    incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena102_TDBstats.java   (contents, props changed)
      - copied, changed from r1195377, incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena102.java
    incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena142_VarScopeBind.java   (contents, props changed)
      - copied, changed from r1195377, incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena142.java
    incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena143_TDBConcurrency.java   (contents, props changed)
      - copied, changed from r1195377, incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena143.java
    incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena149_Duration.java   (with props)
Removed:
    incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/DT_DayTimeDuration.java
    incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena102.java
    incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena142.java
    incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena143.java

Added: incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportGraphVarScope.java
URL: http://svn.apache.org/viewvc/incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportGraphVarScope.java?rev=1196607&view=auto
==============================================================================
--- incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportGraphVarScope.java (added)
+++ incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportGraphVarScope.java Wed Nov  2 14:38:13 2011
@@ -0,0 +1,133 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dev;
+
+import com.hp.hpl.jena.query.ARQ ;
+import com.hp.hpl.jena.query.DatasetFactory ;
+import com.hp.hpl.jena.query.Query ;
+import com.hp.hpl.jena.query.QueryExecution ;
+import com.hp.hpl.jena.query.QueryExecutionFactory ;
+import com.hp.hpl.jena.query.QueryFactory ;
+import com.hp.hpl.jena.query.ResultSet ;
+import com.hp.hpl.jena.query.ResultSetFormatter ;
+import com.hp.hpl.jena.sparql.algebra.Algebra ;
+import com.hp.hpl.jena.sparql.algebra.Op ;
+import com.hp.hpl.jena.sparql.core.DatasetGraph ;
+import com.hp.hpl.jena.sparql.core.DatasetGraphFactory ;
+import com.hp.hpl.jena.sparql.core.Quad ;
+import com.hp.hpl.jena.sparql.mgt.Explain ;
+import com.hp.hpl.jena.sparql.sse.SSE ;
+import com.hp.hpl.jena.tdb.DatasetGraphTxn ;
+import com.hp.hpl.jena.tdb.ReadWrite ;
+import com.hp.hpl.jena.tdb.StoreConnection ;
+import com.hp.hpl.jena.tdb.TDBFactory ;
+import com.hp.hpl.jena.tdb.base.file.Location ;
+
+public class ReportGraphVarScope
+{
+    static String queryStr =
+        "SELECT ?g WHERE { GRAPH ?g { ?s ?p ?o . FILTER (bound(?g) ) } }";
+        //"SELECT ?g WHERE { GRAPH ?g { ?s ?p ?o . } }";
+    
+    public static void main(String[] args) {
+
+        ARQ.setExecutionLogging(Explain.InfoLevel.ALL) ;
+        
+        if ( true )
+        {
+            Query q = QueryFactory.create(queryStr) ; 
+            Op op1 = Algebra.compile(q) ;
+            Op op1a = Algebra.optimize(op1) ;
+            System.out.println(op1a) ;
+            
+            Op op2 = Algebra.toQuadForm(op1) ;
+            Op op2a = Algebra.toQuadForm(op1a) ;
+            System.out.println(op2a) ;
+            
+           
+        }
+        
+        if ( true )
+        {
+            System.out.println("Plain ARQ") ;
+            DatasetGraph dsg = DatasetGraphFactory.createMem() ; 
+            setup(dsg) ;
+            query(dsg) ; 
+            System.out.println() ;
+        }
+        
+        if ( true )
+        {
+            System.out.println("Plain TDB") ;
+            DatasetGraph dsg = TDBFactory.createDatasetGraph() ;
+            setup(dsg) ;
+            query(dsg) ; 
+            System.out.println() ;
+        }
+        System.exit(0) ;
+//        String DIR = "DB" ;
+//        FileOps.ensureDir(DIR) ;
+//        FileOps.clearDirectory(DIR) ;
+//        StoreConnection storeConnection = StoreConnection.make(DIR);
+
+        StoreConnection storeConnection = StoreConnection.make(Location.mem());
+        DatasetGraphTxn dsgTxn = null;
+        
+        DatasetGraph dsg = storeConnection.getBaseDataset() ;
+        
+        if ( dsg.isEmpty() )
+        {
+            System.out.println("Transactionally add quad") ;
+            try {
+                dsgTxn = storeConnection.begin(ReadWrite.WRITE);
+                setup(dsgTxn) ;
+                dsgTxn.commit();
+            } catch (Exception e) {
+                dsgTxn.abort();
+            } finally { dsgTxn.close(); }
+        }
+        System.out.println("Query over Base") ;
+        query(dsg) ;
+        
+        System.out.println("Query over TXN") ;
+        dsgTxn = storeConnection.begin(ReadWrite.READ);
+        query(dsgTxn) ;
+        dsgTxn.close();
+
+        System.out.println("END"); 
+        StoreConnection.release(Location.mem());
+    }
+
+    public static void query(DatasetGraph dsg)
+    {
+        SSE.write(dsg) ;
+        QueryExecution queryExecution =
+            //QueryExecutionFactory.create(queryStr, dsgTxn.toDataset()) ;
+            QueryExecutionFactory.create(queryStr, DatasetFactory.create(dsg)) ;
+        ResultSet result = queryExecution.execSelect();
+        ResultSetFormatter.out(result) ;
+        queryExecution.close();
+    }
+    
+    public static void setup(DatasetGraph dsg)
+    {
+        Quad q = SSE.parseQuad("(<graphURI> <s> <p> <o>)") ;
+        dsg.add(q) ;
+    }
+}

Propchange: incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportGraphVarScope.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena102_TDBstats.java (from r1195377, incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena102.java)
URL: http://svn.apache.org/viewvc/incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena102_TDBstats.java?p2=incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena102_TDBstats.java&p1=incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena102.java&r1=1195377&r2=1196607&rev=1196607&view=diff
==============================================================================
--- incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena102.java (original)
+++ incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena102_TDBstats.java Wed Nov  2 14:38:13 2011
@@ -27,7 +27,7 @@ import com.hp.hpl.jena.tdb.TDBFactory ;
 import com.hp.hpl.jena.tdb.TDBLoader ;
 import com.hp.hpl.jena.tdb.store.DatasetGraphTDB ;
 
-public class ReportJena102
+public class ReportJena102_TDBstats
 {
     public static void main(String[] argv) throws Exception
     {

Propchange: incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena102_TDBstats.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena142_VarScopeBind.java (from r1195377, incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena142.java)
URL: http://svn.apache.org/viewvc/incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena142_VarScopeBind.java?p2=incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena142_VarScopeBind.java&p1=incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena142.java&r1=1195377&r2=1196607&rev=1196607&view=diff
==============================================================================
--- incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena142.java (original)
+++ incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena142_VarScopeBind.java Wed Nov  2 14:38:13 2011
@@ -26,7 +26,7 @@ import com.hp.hpl.jena.query.QueryExcept
 import com.hp.hpl.jena.query.QueryFactory ;
 import com.hp.hpl.jena.sparql.lang.SyntaxVarScope ;
 
-public class ReportJena142
+public class ReportJena142_VarScopeBind
 {
    static { Log.setLog4j() ; }
     

Propchange: incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena142_VarScopeBind.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena143_TDBConcurrency.java (from r1195377, incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena143.java)
URL: http://svn.apache.org/viewvc/incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena143_TDBConcurrency.java?p2=incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena143_TDBConcurrency.java&p1=incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena143.java&r1=1195377&r2=1196607&rev=1196607&view=diff
==============================================================================
--- incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena143.java (original)
+++ incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena143_TDBConcurrency.java Wed Nov  2 14:38:13 2011
@@ -40,12 +40,13 @@ import com.hp.hpl.jena.tdb.TDBFactory ;
 import com.hp.hpl.jena.tdb.TDBLoader ;
 import com.hp.hpl.jena.tdb.store.DatasetGraphTDB ;
 
-public class ReportJena143
+public class ReportJena143_TDBConcurrency
 {
 static { Log.setLog4j() ; }
     
     public static void main(String[] argv) throws Exception
     {
+        //https://issues.apache.org/jira/browse/JENA-143
         // JENA-143 :TDB Concurrency
         String ns  = "http://example/ns#" ;
         FunctionRegistry.get().put(ns + "wait", wait.class) ;

Propchange: incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena143_TDBConcurrency.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena149_Duration.java
URL: http://svn.apache.org/viewvc/incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena149_Duration.java?rev=1196607&view=auto
==============================================================================
--- incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena149_Duration.java (added)
+++ incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena149_Duration.java Wed Nov  2 14:38:13 2011
@@ -0,0 +1,44 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dev;
+
+import com.hp.hpl.jena.datatypes.xsd.XSDDatatype ;
+import com.hp.hpl.jena.datatypes.xsd.XSDDuration ;
+import com.hp.hpl.jena.graph.Node ;
+
+public class ReportJena149_Duration
+{
+    
+    public static void main(String[] argv) throws Exception
+    {
+        testXSDDurationBug() ;
+        
+    }
+    public static void testXSDDurationBug() {
+        Node d1 = Node.createLiteral("PT110S", null, XSDDatatype.XSDduration);
+        Node d2 = Node.createLiteral("PT1M50S", null, XSDDatatype.XSDduration);
+        System.out.println(d1.getLiteral().isWellFormed());
+        System.out.println(d2.getLiteral().isWellFormed());
+        XSDDuration dur1 = (XSDDuration) d1.getLiteralValue();
+        XSDDuration dur2 = (XSDDuration) d2.getLiteralValue();
+        int cmp = dur1.compare(dur2);
+        System.out.println("Compare = " + cmp);
+    }
+}
+

Propchange: incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena149_Duration.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain