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/20 10:23:06 UTC
svn commit: r1351986 - in /jena/Scratch/AFS/Jena-Dev/trunk/src/dev:
Jena256_TDBWritePerf.java Jena263_NodeTableTransUnexpected.java
Author: andy
Date: Wed Jun 20 08:23:06 2012
New Revision: 1351986
URL: http://svn.apache.org/viewvc?rev=1351986&view=rev
Log: (empty)
Added:
jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Jena263_NodeTableTransUnexpected.java
Modified:
jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Jena256_TDBWritePerf.java
Modified: jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Jena256_TDBWritePerf.java
URL: http://svn.apache.org/viewvc/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Jena256_TDBWritePerf.java?rev=1351986&r1=1351985&r2=1351986&view=diff
==============================================================================
--- jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Jena256_TDBWritePerf.java (original)
+++ jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Jena256_TDBWritePerf.java Wed Jun 20 08:23:06 2012
@@ -16,6 +16,7 @@ import java.util.ArrayList ;
import java.util.List ;
import org.openjena.atlas.lib.FileOps ;
+import org.openjena.atlas.logging.Log ;
import com.hp.hpl.jena.query.Dataset ;
import com.hp.hpl.jena.query.ReadWrite ;
@@ -29,17 +30,16 @@ import com.hp.hpl.jena.tdb.sys.SystemTDB
public class Jena256_TDBWritePerf {
private final static int TOTAL = 100;
- final static String INDEX_INFO_SUBJECT = "http://test.net/xmlns/test/1.0/Triple-Indexer";
- final static String TIMESTAMP_PREDICATE = "http://test.net/xmlns/test/1.0/lastProcessedTimestamp";
- final static String URI_PREDICATE = "http://test.net/xmlns/test/1.0/lastProcessedUri";
- final static String VERSION_PREDICATE = "http://test.net/xmlns/test/1.0/indexVersion";
+ final static String INDEX_INFO_SUBJECT = "http://test.net/xmlns/test/1.0/Triple-Indexer";
+ final static String TIMESTAMP_PREDICATE = "http://test.net/xmlns/test/1.0/lastProcessedTimestamp";
+ final static String URI_PREDICATE = "http://test.net/xmlns/test/1.0/lastProcessedUri";
+ final static String VERSION_PREDICATE = "http://test.net/xmlns/test/1.0/indexVersion";
final static String INDEX_SIZE_PREDICATE = "http://test.net/xmlns/test/1.0/indexSize";
- /**
- * @param args
- */
- public static void main(String[] args) {
+ public static void main(String[] args) {
+ Log.setLog4j() ;
+
// if (args.length == 0) {
// System.out.println("Provide index location");
// return;
@@ -50,28 +50,35 @@ public class Jena256_TDBWritePerf {
FileOps.clearDirectory(location) ;
//Submitted without ....
- if ( false )
+ if ( true )
SystemTDB.setFileMode(FileMode.direct) ;
//String location = args[0]; // + "/" + UUID.randomUUID().toString();
- String baseGraphName = "com.ibm.test.graphNamePrefix.";
+ //String baseGraphName = "com.ibm.test.graphNamePrefix.";
long totalExecTime = 0L;
long size = 0;
+ Dataset dataset = TDBFactory.createDataset(location);
+ Dataset dataset1 = TDBFactory.createDataset(location);
+ boolean bracketWithReader = false ;
+
+ if ( bracketWithReader )
+ dataset1.begin(ReadWrite.READ) ;
+
for (int i = 0; i < TOTAL; i++) {
List<String> lastProcessedUris = new ArrayList<String>();
- for (int j = 0; j < i; j++) {
+ for (int j = 0; j < 10*i; j++) {
String lastProcessedUri = "http://test.net/xmlns/test/1.0/someUri" + j;
lastProcessedUris.add(lastProcessedUri);
}
- Dataset dataset = TDBFactory.createDataset(location);
- String graphName = baseGraphName + i;
+ //Dataset dataset = TDBFactory.createDataset(location);
+ //String graphName = baseGraphName + i;
long t = System.currentTimeMillis();
try {
dataset.begin(ReadWrite.WRITE);
- Model m = dataset.getNamedModel(graphName);
+ Model m = dataset.getDefaultModel();
m.removeAll();
Resource subject = m.createResource(INDEX_INFO_SUBJECT);
@@ -100,6 +107,8 @@ public class Jena256_TDBWritePerf {
System.out.println("Write operation " + i + " took " + writeOperationDuration + "ms");
}
}
+ if ( bracketWithReader )
+ dataset1.end() ;
System.out.println("All " + TOTAL + " write operations wrote " + size + " triples and took " + totalExecTime + "ms");
}
Added: jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Jena263_NodeTableTransUnexpected.java
URL: http://svn.apache.org/viewvc/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Jena263_NodeTableTransUnexpected.java?rev=1351986&view=auto
==============================================================================
--- jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Jena263_NodeTableTransUnexpected.java (added)
+++ jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Jena263_NodeTableTransUnexpected.java Wed Jun 20 08:23:06 2012
@@ -0,0 +1,58 @@
+/**
+ * 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 java.io.File ;
+
+import com.hp.hpl.jena.query.Dataset ;
+import com.hp.hpl.jena.query.ReadWrite ;
+import com.hp.hpl.jena.rdf.model.Model ;
+import com.hp.hpl.jena.rdf.model.Resource ;
+import com.hp.hpl.jena.tdb.TDBFactory ;
+import com.hp.hpl.jena.vocabulary.RDFS ;
+
+public class Jena263_NodeTableTransUnexpected
+{
+ public static void main(String...argv)
+ {
+ String DIR = "tmp/tdb" ;
+ new File(DIR).mkdirs();
+
+ Dataset ds = TDBFactory.createDataset( DIR );
+ // Wrong
+ //Model m = ds.getDefaultModel() ;
+
+ ds.begin(ReadWrite.WRITE);
+ // Right
+ Model m = ds.getDefaultModel() ;
+ try {
+ Resource r = m.getResource( "http://test.com/foo#bar" );
+ //r.removeAll( RDFS.seeAlso );
+ Resource r2 = m.createResource() ;
+ r.addProperty( RDFS.seeAlso, r2 );
+ ds.commit();
+ }
+ finally {
+ ds.end();
+ }
+ System.out.println("DONE") ;
+ System.exit(0) ;
+ }
+}
+