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/08/01 13:37:43 UTC
svn commit: r1367927 - in /jena/Scratch/AFS:
Dev/trunk/src/main/java/projects/riot_reader/MainWebReader.java
Jena-Dev/trunk/.classpath Jena-Dev/trunk/src/dev/T_TDBWriteTransaction.java
Author: andy
Date: Wed Aug 1 11:37:42 2012
New Revision: 1367927
URL: http://svn.apache.org/viewvc?rev=1367927&view=rev
Log: (empty)
Added:
jena/Scratch/AFS/Jena-Dev/trunk/src/dev/T_TDBWriteTransaction.java
Modified:
jena/Scratch/AFS/Dev/trunk/src/main/java/projects/riot_reader/MainWebReader.java
jena/Scratch/AFS/Jena-Dev/trunk/.classpath
Modified: jena/Scratch/AFS/Dev/trunk/src/main/java/projects/riot_reader/MainWebReader.java
URL: http://svn.apache.org/viewvc/jena/Scratch/AFS/Dev/trunk/src/main/java/projects/riot_reader/MainWebReader.java?rev=1367927&r1=1367926&r2=1367927&view=diff
==============================================================================
--- jena/Scratch/AFS/Dev/trunk/src/main/java/projects/riot_reader/MainWebReader.java (original)
+++ jena/Scratch/AFS/Dev/trunk/src/main/java/projects/riot_reader/MainWebReader.java Wed Aug 1 11:37:42 2012
@@ -20,6 +20,7 @@ package projects.riot_reader;
import org.openjena.atlas.logging.Log ;
import org.openjena.riot.WebContent ;
+import projects.riot_reader.fm2.FileManager2 ;
import com.hp.hpl.jena.rdf.model.Model ;
import com.hp.hpl.jena.rdf.model.ModelFactory ;
@@ -31,15 +32,26 @@ public class MainWebReader
WebReader2.wireIntoJena() ;
Log.enable(WebReader2.class) ;
+ {
+ Model m = FileManager2.get().loadModel("http://www.w3.org/2000/10/swap/grammar/n3.n3") ;
+ System.out.println(m.size()) ;
+ }
+ System.out.println("DONE") ;
+ System.exit(0) ;
+
dwim("http://people.apache.org/~andy/RIOT-test/D.ttl") ;
dwim("http://people.apache.org/~andy/RIOT-test/D.nt") ;
dwim("http://people.apache.org/~andy/RIOT-test/D.rdf") ;
dwim("http://people.apache.org/~andy/RIOT-test/D.trig") ;
dwim("http://people.apache.org/~andy/RIOT-test/elephant") ;
+
+
System.out.println("DONE") ;
System.exit(0) ;
+
+
Model m = ModelFactory.createDefaultModel() ;
WebReader2.read(m, "http://localhost:3030/ds/data?default", Langs.nameToLang(WebContent.contentTypeTurtle), null) ;
WebReader2.read(m, "file:./D.ttl", null, null) ;
Modified: jena/Scratch/AFS/Jena-Dev/trunk/.classpath
URL: http://svn.apache.org/viewvc/jena/Scratch/AFS/Jena-Dev/trunk/.classpath?rev=1367927&r1=1367926&r2=1367927&view=diff
==============================================================================
--- jena/Scratch/AFS/Jena-Dev/trunk/.classpath (original)
+++ jena/Scratch/AFS/Jena-Dev/trunk/.classpath Wed Aug 1 11:37:42 2012
@@ -1,21 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="var" path="M2_REPO/org/apache/jena/jena-iri/0.9.3-SNAPSHOT/jena-iri-0.9.3-SNAPSHOT.jar" sourcepath="M2_REPO/org/apache/jena/jena-iri/0.9.3-SNAPSHOT/jena-iri-0.9.3-SNAPSHOT-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/apache/jena/jena-core/2.7.3-SNAPSHOT/jena-core-2.7.3-SNAPSHOT-tests.jar" sourcepath="M2_REPO/org/apache/jena/jena-core/2.7.3-SNAPSHOT/jena-core-2.7.3-SNAPSHOT-test-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/apache/jena/jena-core/2.7.3-SNAPSHOT/jena-core-2.7.3-SNAPSHOT.jar" sourcepath="M2_REPO/org/apache/jena/jena-core/2.7.3-SNAPSHOT/jena-core-2.7.3-SNAPSHOT-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/commons-codec/commons-codec/1.5/commons-codec-1.5.jar" sourcepath="M2_REPO/commons-codec/commons-codec/1.5/commons-codec-1.5-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar" sourcepath="M2_REPO/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/apache/httpcomponents/httpclient/4.1.2/httpclient-4.1.2.jar" sourcepath="M2_REPO/org/apache/httpcomponents/httpclient/4.1.2/httpclient-4.1.2-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/apache/httpcomponents/httpcore/4.1.3/httpcore-4.1.3.jar" sourcepath="M2_REPO/org/apache/httpcomponents/httpcore/4.1.3/httpcore-4.1.3-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/junit/junit/4.9/junit-4.9.jar" sourcepath="M2_REPO/junit/junit/4.9/junit-4.9-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.16/log4j-1.2.16.jar" sourcepath="M2_REPO/log4j/log4j/1.2.16/log4j-1.2.16-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-api/1.6.4/slf4j-api-1.6.4.jar" sourcepath="M2_REPO/org/slf4j/slf4j-api/1.6.4/slf4j-api-1.6.4-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-log4j12/1.6.4/slf4j-log4j12-1.6.4.jar" sourcepath="M2_REPO/org/slf4j/slf4j-log4j12/1.6.4/slf4j-log4j12-1.6.4-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/slf4j/jcl-over-slf4j/1.6.4/jcl-over-slf4j-1.6.4.jar" sourcepath="M2_REPO/org/slf4j/jcl-over-slf4j/1.6.4/jcl-over-slf4j-1.6.4-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/xerces/xercesImpl/2.10.0/xercesImpl-2.10.0.jar"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
- <classpathentry combineaccessrules="false" kind="src" path="/jena-arq"/>
- <classpathentry combineaccessrules="false" kind="src" path="/jena-tdb"/>
- <classpathentry kind="output" path="classes"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/jena/jena-iri/0.9.3-SNAPSHOT/jena-iri-0.9.3-SNAPSHOT.jar" sourcepath="M2_REPO/org/apache/jena/jena-iri/0.9.3-SNAPSHOT/jena-iri-0.9.3-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/commons-codec/commons-codec/1.5/commons-codec-1.5.jar" sourcepath="M2_REPO/commons-codec/commons-codec/1.5/commons-codec-1.5-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar" sourcepath="M2_REPO/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/httpcomponents/httpclient/4.1.2/httpclient-4.1.2.jar" sourcepath="M2_REPO/org/apache/httpcomponents/httpclient/4.1.2/httpclient-4.1.2-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/httpcomponents/httpcore/4.1.3/httpcore-4.1.3.jar" sourcepath="M2_REPO/org/apache/httpcomponents/httpcore/4.1.3/httpcore-4.1.3-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/junit/junit/4.9/junit-4.9.jar" sourcepath="M2_REPO/junit/junit/4.9/junit-4.9-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.16/log4j-1.2.16.jar" sourcepath="M2_REPO/log4j/log4j/1.2.16/log4j-1.2.16-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-api/1.6.4/slf4j-api-1.6.4.jar" sourcepath="M2_REPO/org/slf4j/slf4j-api/1.6.4/slf4j-api-1.6.4-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-log4j12/1.6.4/slf4j-log4j12-1.6.4.jar" sourcepath="M2_REPO/org/slf4j/slf4j-log4j12/1.6.4/slf4j-log4j12-1.6.4-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/slf4j/jcl-over-slf4j/1.6.4/jcl-over-slf4j-1.6.4.jar" sourcepath="M2_REPO/org/slf4j/jcl-over-slf4j/1.6.4/jcl-over-slf4j-1.6.4-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/xerces/xercesImpl/2.10.0/xercesImpl-2.10.0.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/jena-core"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/jena-arq"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/jena-tdb"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/jena-fuseki"/>
+ <classpathentry kind="output" path="classes"/>
</classpath>
Added: jena/Scratch/AFS/Jena-Dev/trunk/src/dev/T_TDBWriteTransaction.java
URL: http://svn.apache.org/viewvc/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/T_TDBWriteTransaction.java?rev=1367927&view=auto
==============================================================================
--- jena/Scratch/AFS/Jena-Dev/trunk/src/dev/T_TDBWriteTransaction.java (added)
+++ jena/Scratch/AFS/Jena-Dev/trunk/src/dev/T_TDBWriteTransaction.java Wed Aug 1 11:37:42 2012
@@ -0,0 +1,145 @@
+/*
+ * 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.
+ */
+
+/* ******************************************************************************
+ * Licensed Materials - Property of IBM
+ * (c) Copyright IBM Corporation 2011. All Rights Reserved.
+ *
+ * Note to U.S. Government Users Restricted Rights: Use,
+ * duplication or disclosure restricted by GSA ADP Schedule
+ * Contract with IBM Corp.
+ * *****************************************************************************/
+
+// Submitted JENA-256
+
+package dev ;
+
+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 ;
+import com.hp.hpl.jena.rdf.model.Model ;
+import com.hp.hpl.jena.rdf.model.Property ;
+import com.hp.hpl.jena.rdf.model.Resource ;
+import com.hp.hpl.jena.tdb.TDBFactory ;
+import com.hp.hpl.jena.tdb.base.block.FileMode ;
+import com.hp.hpl.jena.tdb.sys.SystemTDB ;
+import com.hp.hpl.jena.tdb.transaction.TransactionManager ;
+
+public class T_TDBWriteTransaction {
+
+ private final static int TOTAL = 100 ; // 100;
+ static boolean bracketWithReader = false ;
+
+ 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";
+
+ @SuppressWarnings("deprecation")
+ public static void main(String[] args) {
+
+ Log.setLog4j() ;
+ TransactionManager.QueueBatchSize = 10;
+
+// if (args.length == 0) {
+// System.out.println("Provide index location");
+// return;
+// }
+
+ String location = "DBX" ;
+ FileOps.ensureDir(location) ;
+ //FileOps.clearDirectory(location) ;
+ bracketWithReader = false ;
+
+ //Submitted without ....
+ if ( true )
+ SystemTDB.setFileMode(FileMode.direct) ;
+
+ run(location) ;
+// StoreConnection.make(location).forceRecoverFromJournal() ;
+// run(location) ;
+ }
+
+ static public void run(String location)
+ {
+ //String location = args[0]; // + "/" + UUID.randomUUID().toString();
+
+ //String baseGraphName = "com.ibm.test.graphNamePrefix.";
+
+ long totalExecTime = 0L;
+ long size = 0;
+ Dataset dataset = TDBFactory.createDataset(location);
+ Dataset dataset1 = TDBFactory.createDataset(location);
+
+ if ( bracketWithReader )
+ dataset1.begin(ReadWrite.READ) ;
+
+ for (int i = 0; i < TOTAL; i++) {
+ List<String> lastProcessedUris = new ArrayList<String>();
+ 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;
+ long t = System.currentTimeMillis();
+
+ try {
+ dataset.begin(ReadWrite.WRITE);
+ Model m = dataset.getDefaultModel();
+
+ m.removeAll();
+ Resource subject = m.createResource(INDEX_INFO_SUBJECT);
+ Property predicate = m.createProperty(TIMESTAMP_PREDICATE);
+ m.addLiteral(subject, predicate, System.currentTimeMillis());
+ predicate = m.createProperty(URI_PREDICATE);
+ for (String uri : lastProcessedUris) {
+ m.add(subject, predicate, m.createResource(uri));
+ }
+ predicate = m.createProperty(VERSION_PREDICATE);
+ m.addLiteral(subject, predicate, 1.0);
+
+ size += m.size() + 1;
+
+ predicate = m.createProperty(INDEX_SIZE_PREDICATE);
+ m.addLiteral(subject, predicate, size);
+
+ dataset.commit();
+ } catch (Throwable e) {
+ dataset.abort();
+ throw new RuntimeException(e);
+ } finally {
+ dataset.end();
+ long writeOperationDuration = System.currentTimeMillis() - t;
+ totalExecTime += writeOperationDuration;
+ 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");
+ }
+
+}