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 2012/06/08 19:23:24 UTC
svn commit: r1348160 - in /jena/Scratch/AFS/Jena-Dev/trunk/src:
dev/Jena250_Explore.java dev/Jena250_TestStoreRelease.java dev/Run.java
dev/RunARQ.java reports/archive/Jena250_Explore.java
reports/archive/Jena250_TestStoreRelease.java
Author: andy
Date: Fri Jun 8 17:23:23 2012
New Revision: 1348160
URL: http://svn.apache.org/viewvc?rev=1348160&view=rev
Log: (empty)
Added:
jena/Scratch/AFS/Jena-Dev/trunk/src/reports/archive/Jena250_Explore.java
- copied, changed from r1348021, jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Jena250_Explore.java
jena/Scratch/AFS/Jena-Dev/trunk/src/reports/archive/Jena250_TestStoreRelease.java
- copied, changed from r1347708, jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Jena250_TestStoreRelease.java
Removed:
jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Jena250_Explore.java
jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Jena250_TestStoreRelease.java
jena/Scratch/AFS/Jena-Dev/trunk/src/dev/RunARQ.java
Modified:
jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Run.java
Modified: jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Run.java
URL: http://svn.apache.org/viewvc/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Run.java?rev=1348160&r1=1348159&r2=1348160&view=diff
==============================================================================
--- jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Run.java (original)
+++ jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Run.java Fri Jun 8 17:23:23 2012
@@ -25,6 +25,7 @@ import java.nio.ByteBuffer ;
import java.util.UUID ;
import org.openjena.atlas.lib.Bytes ;
+import org.openjena.atlas.lib.FileOps ;
import org.openjena.atlas.lib.Lib ;
import org.openjena.atlas.logging.Log ;
@@ -32,107 +33,50 @@ import com.hp.hpl.jena.graph.Graph ;
import com.hp.hpl.jena.query.* ;
import com.hp.hpl.jena.rdf.model.Model ;
import com.hp.hpl.jena.rdf.model.RDFReader ;
+import com.hp.hpl.jena.sparql.core.DatasetGraph ;
+import com.hp.hpl.jena.sparql.core.Quad ;
import com.hp.hpl.jena.sparql.mgt.Explain.InfoLevel ;
+import com.hp.hpl.jena.sparql.sse.SSE ;
import com.hp.hpl.jena.sparql.util.Timer ;
+import com.hp.hpl.jena.tdb.ConfigTest ;
+import com.hp.hpl.jena.tdb.StoreConnection ;
+import com.hp.hpl.jena.tdb.TDB ;
import com.hp.hpl.jena.tdb.TDBFactory ;
+import com.hp.hpl.jena.tdb.base.file.Location ;
+import com.hp.hpl.jena.tdb.transaction.DatasetGraphTransaction ;
import com.hp.hpl.jena.tdb.transaction.DatasetGraphTxn ;
public class Run extends RunBase
{
- static { Log.setLog4j() ; }
+ static { Log.setCmdLogging() ; }
- static int N = 1000000;
+ static String DIR = "DB" ;
public static void main(String[] argv) throws Exception
{
- Dataset dataset = TDBFactory.createDataset("DB");
- Model model = dataset.getNamedModel("urn:x-arq:UnionGraph");
- Graph graph = model.getGraph();
- int size = graph.size();
- System.out.println(size) ;
-
-
- exit(0) ;
-
- arq.query.main("--data=D.ttl", "--file=Q.rq") ;
- exit(0) ;
-
- ARQ.setExecutionLogging(InfoLevel.ALL) ;
- tdb.tdbquery.main("--set=arq:logExec=ALL",
- "--loc=DB",
- "--file=Q.rq");
- exit(0) ;
-
- timeConvertingStrings() ;
- exit(0) ;
- prefixesAndTDB() ;
-
- }
-
- private static void timeConvertingStrings() throws Exception
- {
- String[] x = new String[N] ;
-
- for ( int i = 0 ; i < N ; i++ )
- x[i] = randomString() ;
-
- System.out.println("Waiting") ;
- System.in.read();
-
- for ( int i = 0 ; i < 10 ; i++ )
- {
- foo(x) ;
- System.out.println() ;
- }
- }
-
- public static void foo(String[] x)
- {
-
- ByteBuffer bb[] = new ByteBuffer[N] ;
- for ( int i = 0 ; i < N ; i++ )
- bb[i] = ByteBuffer.allocate(100*4) ;
-
- Timer t1 = new Timer() ;
- t1.startTimer() ;
- for ( int i = 0 ; i < N ; i++ )
- {
- Bytes.toByteBuffer(x[i], bb[i]) ;
- bb[i].flip() ;
- }
- for ( int i = 0 ; i < N ; i++ )
- Bytes.fromByteBuffer(bb[i]) ;
-
- long time1 = t1.endTimer() ;
- System.out.println(Timer.timeStr(time1)) ;
+ long x = System.currentTimeMillis() ;
+ Quad q = SSE.parseQuad("(<g> <s> <p> '000-"+x+"') ") ;
- for ( int i = 0 ; i < N ; i++ )
- bb[i] = ByteBuffer.allocate(100*4) ;
-
-
- Timer t2 = new Timer() ;
- t2.startTimer() ;
-// for ( int i = 0 ; i < N ; i++ )
-// {
-// BlockUTF8.fromChars(x[i], bb[i]) ; // faster.
-// bb[i].flip() ;
-// }
-//
-// for ( int i = 0 ; i < N ; i++ ) // Slower
-// BlockUTF8.toString(bb[i]) ;
-
- long time2 = t2.endTimer() ;
- System.out.println(Timer.timeStr(time2)) ;
-
+ StoreConnection.reset() ;
+// FileOps.ensureDir(DIR) ;
+// FileOps.clearDirectory(DIR) ;
+//
+// File d = new File(DIR) ;
+// if ( d.list().length > 2 ) // . and ..
+// throw new RuntimeException("not empty") ;
+// DatasetGraphTransaction ds = (DatasetGraphTransaction)TDBFactory.createDatasetGraph(DIR) ;
+
+ DatasetGraphTransaction ds = (DatasetGraphTransaction)TDBFactory.createDatasetGraph() ;
+ ds.begin(ReadWrite.WRITE) ;
+ ds.add(q) ;
+ ds.commit() ;
+ ds.end() ;
+
+ ds.begin(ReadWrite.READ) ;
+ System.out.println(ds) ;
+ ds.end() ;
}
- private static int i = 0 ;
- private static String randomString()
- {
- i++ ;
- return "http://jena.apache.org/abc"+UUID.randomUUID() ;
- }
-
public static void prefixesAndTDB() throws Exception
{
Dataset ds = TDBFactory.createDataset( "DB" ) ; // tdbDest is a String
@@ -147,50 +91,5 @@ public class Run extends RunBase
}
- static class Killer implements Runnable
- {
- private QueryExecution qe ;
- public Killer(QueryExecution qe) { this.qe = qe ; }
- @Override
- public void run()
- {
- Lib.sleep(200) ;
- qe.abort() ;
- Lib.sleep(10) ;
- qe.abort() ;
- Lib.sleep(10) ;
- }
- }
-
- static class QRunner implements Runnable
- {
- private QueryExecution qe ;
- private DatasetGraphTxn dsg ;
- public QRunner(DatasetGraphTxn dsGraph, QueryExecution qe) { this.dsg = dsGraph ; this.qe = qe ; }
- @Override
- public void run()
- {
- ResultSet results = qe.execSelect();
- int count = 0 ;
- try {
- while(results.hasNext())
- {
- count++ ;
- QuerySolution soln = results.next() ;
- // Force nodes
- soln.toString() ;
- if ( count %100 == 0 ) System.out.println(soln) ;
- }
- qe.close();
- } catch (QueryCancelledException e) {
- System.out.println("QueryCancelledException") ;
- dsg.abort();
- } finally {
- dsg.end();
- }
- // There 344195 triples.
- System.out.println("count = "+count) ;
- }
- }
}
Copied: jena/Scratch/AFS/Jena-Dev/trunk/src/reports/archive/Jena250_Explore.java (from r1348021, jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Jena250_Explore.java)
URL: http://svn.apache.org/viewvc/jena/Scratch/AFS/Jena-Dev/trunk/src/reports/archive/Jena250_Explore.java?p2=jena/Scratch/AFS/Jena-Dev/trunk/src/reports/archive/Jena250_Explore.java&p1=jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Jena250_Explore.java&r1=1348021&r2=1348160&rev=1348160&view=diff
==============================================================================
--- jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Jena250_Explore.java (original)
+++ jena/Scratch/AFS/Jena-Dev/trunk/src/reports/archive/Jena250_Explore.java Fri Jun 8 17:23:23 2012
@@ -1,5 +1,5 @@
/* See JENA-250 */
-package dev ;
+package reports.archive ;
import static com.hp.hpl.jena.query.ReadWrite.READ ;
import static com.hp.hpl.jena.query.ReadWrite.WRITE ;
Copied: jena/Scratch/AFS/Jena-Dev/trunk/src/reports/archive/Jena250_TestStoreRelease.java (from r1347708, jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Jena250_TestStoreRelease.java)
URL: http://svn.apache.org/viewvc/jena/Scratch/AFS/Jena-Dev/trunk/src/reports/archive/Jena250_TestStoreRelease.java?p2=jena/Scratch/AFS/Jena-Dev/trunk/src/reports/archive/Jena250_TestStoreRelease.java&p1=jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Jena250_TestStoreRelease.java&r1=1347708&r2=1348160&rev=1348160&view=diff
==============================================================================
--- jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Jena250_TestStoreRelease.java (original)
+++ jena/Scratch/AFS/Jena-Dev/trunk/src/reports/archive/Jena250_TestStoreRelease.java Fri Jun 8 17:23:23 2012
@@ -1,5 +1,5 @@
//package com.ibm.jena.tdb.tx.test;
-package dev ;
+package reports.archive ;
import java.io.File ;
import java.util.UUID ;