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/14 23:48:10 UTC
svn commit: r1373129 - in /jena/Scratch/AFS:
Dev/trunk/src/main/java/projects/riot_reader/MainWebReader.java
Jena-Dev/trunk/src/dev/Run.java
Author: andy
Date: Tue Aug 14 21:48:09 2012
New Revision: 1373129
URL: http://svn.apache.org/viewvc?rev=1373129&view=rev
Log: (empty)
Modified:
jena/Scratch/AFS/Dev/trunk/src/main/java/projects/riot_reader/MainWebReader.java
jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Run.java
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=1373129&r1=1373128&r2=1373129&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 Tue Aug 14 21:48:09 2012
@@ -33,7 +33,7 @@ public class MainWebReader
Log.enable(WebReader2.class) ;
{
- Model m = FileManager2.get().loadModel("http://www.w3.org/2000/10/swap/grammar/n3.n3") ;
+ Model m = FileManager2.get().loadModel("http://jena.apache.org/about_jena/jena.rdf") ;
System.out.println(m.size()) ;
}
System.out.println("DONE") ;
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=1373129&r1=1373128&r2=1373129&view=diff
==============================================================================
--- jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Run.java (original)
+++ jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Run.java Tue Aug 14 21:48:09 2012
@@ -18,40 +18,17 @@
package dev;
-import java.io.File ;
-import java.io.FileInputStream ;
-import java.io.InputStream ;
-
import org.openjena.atlas.logging.Log ;
-import com.hp.hpl.jena.graph.Node ;
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.Quad ;
import com.hp.hpl.jena.sparql.mgt.Explain ;
import com.hp.hpl.jena.sparql.sse.SSE ;
import com.hp.hpl.jena.sparql.util.QueryExecUtils ;
+import com.hp.hpl.jena.tdb.StoreConnection ;
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.base.file.FileFactory ;
-import com.hp.hpl.jena.tdb.base.file.FileSet ;
-import com.hp.hpl.jena.tdb.base.objectfile.ObjectFile ;
-import com.hp.hpl.jena.tdb.base.record.RecordFactory ;
-import com.hp.hpl.jena.tdb.index.Index ;
-import com.hp.hpl.jena.tdb.index.IndexMap ;
-import com.hp.hpl.jena.tdb.nodetable.NodeTable ;
-import com.hp.hpl.jena.tdb.nodetable.NodeTableInline ;
-import com.hp.hpl.jena.tdb.nodetable.NodeTableWrapper ;
-import com.hp.hpl.jena.tdb.setup.NodeTableBuilder ;
-import com.hp.hpl.jena.tdb.store.DatasetGraphTDB ;
-import com.hp.hpl.jena.tdb.store.NodeId ;
-import com.hp.hpl.jena.tdb.sys.FileRef ;
-import com.hp.hpl.jena.tdb.sys.Names ;
-import com.hp.hpl.jena.tdb.sys.SystemTDB ;
-import com.hp.hpl.jena.tdb.transaction.NodeTableTrans ;
-import com.hp.hpl.jena.tdb.transaction.Transaction ;
+import com.hp.hpl.jena.tdb.base.file.Location ;
public class Run extends RunBase
{
@@ -59,7 +36,7 @@ public class Run extends RunBase
static String DIR = "DB" ;
- public static void main(String[] argv) throws Exception
+ public static void main2(String[] argv) throws Exception
{
ARQ.setExecutionLogging(Explain.InfoLevel.ALL) ;
ARQ.getContext().set(TDB.symUnionDefaultGraph, true) ;
@@ -75,85 +52,20 @@ public class Run extends RunBase
ds.end() ;
}
- public static void prefixesAndTDB() throws Exception
+ public static void main(String[] argv) throws Exception
{
- Dataset ds = TDBFactory.createDataset( "DB" ) ; // tdbDest is a String
- Model model = ds.getDefaultModel() ;
+ Location location = new Location("DB") ;
+ Dataset ds = TDBFactory.createDataset(location) ;
+ ds.begin(ReadWrite.READ) ;
+ ds.commit();
+ ds.end();
+ StoreConnection.release(location) ;
- RDFReader rdfRdr = model.getReader( "TTL" );
- File f = new File( "D.ttl" ); // ttlDir is a File, fn is a String
- InputStream dataStream = new FileInputStream( f );
- rdfRdr.read( model, dataStream, null ); // <-- this is where the error occurs
- dataStream.close();
- exit(0) ;
-
- }
-
-
- static class Outer
- {
- private DatasetGraphTDB dataset ;
- private Transaction txn ;
+ ds = TDBFactory.createDataset(location) ;
+ ds.begin(ReadWrite.READ) ;
+ ds.end();
- Outer(DatasetGraphTDB dsg, Transaction txn) { dataset = dsg ; this.txn = txn ; }
-
- class NodeTableBuilderTx implements NodeTableBuilder
- {
- @Override
- public NodeTable buildNodeTable(FileSet fsIndex, FileSet fsObjectFile, int sizeNode2NodeIdCache,
- int sizeNodeId2NodeCache, int sizeNodeMissCacheSize)
- {
- FileRef ref = FileRef.create(fsObjectFile.filename(Names.extNodeData)) ;
-
- // ******* WRONG??? Should use:
- //ObjectFileTrans
- // +
- //new Builder.NodeTableBuilderStd(IndexBuilder indexBuilder, ObjectFileBuilder objectFileBuilder) ;
-
- //NodeTable ntBase = nodeTables.get(ref) ;
- NodeTable ntBase = dataset.getConfig().nodeTables.get(ref) ;
-
- if ( ntBase == null )
- throw new TDBException("No NodeTable for "+ref) ;
-
-
- RecordFactory recordFactory = new RecordFactory(SystemTDB.LenNodeHash, SystemTDB.SizeOfNodeId) ;
- Index idx = new IndexMap(recordFactory) ;
- String objFilename = fsObjectFile.filename(Names.extNodeData+"-"+Names.extJournal) ;
- ObjectFile objectFile ;
-
- if ( fsObjectFile.isMem() )
- objectFile = FileFactory.createObjectFileMem(objFilename) ;
- else
- objectFile = FileFactory.createObjectFileDisk(objFilename) ;
-
- NodeTableTrans ntt = new NodeTableTrans(txn ,fsObjectFile.getBasename(), ntBase, idx, objectFile) ;
- txn.addComponent(ntt) ;
-
- // Add inline wrapper.
- NodeTable nt = NodeTableInline.create(ntt) ;
- return nt ;
- }
- }
- }
-
- public static class NodeTableReadonly extends NodeTableWrapper
- {
- public NodeTableReadonly(NodeTable nodeTable)
- {
- super(nodeTable) ;
- }
-
- @Override
- public NodeId getAllocateNodeId(Node node)
- {
- NodeId nodeId = getNodeIdForNode(node) ;
- if ( NodeId.isDoesNotExist(nodeId) )
- throw new TDBException("Allocation attempt on NodeTableReadonly") ;
- return nodeId ;
- }
+ System.out.println("DONE") ;
}
-
-
}