You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by pa...@gmail.com on 2011/12/13 14:31:43 UTC
NoSuchElementException trying to load tdb
I'm getting this error trying to load a turtles file (.ttl) into a new tdb
database.
Here is the traceback:
java.util.NoSuchElementException
at org.openjena.riot.tokens.TokenizerText.next(TokenizerText.java:90)
at com.hp.hpl.jena.tdb.nodetable.NodecSSE.decode(NodecSSE.java:91)
at com.hp.hpl.jena.tdb.lib.NodeLib.decode(NodeLib.java:89)
at com.hp.hpl.jena.tdb.lib.NodeLib.fetchDecode(NodeLib.java:71)
at
com.hp.hpl.jena.tdb.nodetable.NodeTableNative.readNodeByNodeId(NodeTableNative.java:158)
at
com.hp.hpl.jena.tdb.nodetable.NodeTableNative._retrieveNodeByNodeId(NodeTableNative.java:85)
at
com.hp.hpl.jena.tdb.nodetable.NodeTableNative.getNodeForNodeId(NodeTableNative.java:58)
at
com.hp.hpl.jena.tdb.nodetable.NodeTableWrapper.getNodeForNodeId(NodeTableWrapper.java:44)
at
com.hp.hpl.jena.tdb.nodetable.NodeTableInline.getNodeForNodeId(NodeTableInline.java:55)
at com.hp.hpl.jena.tdb.lib.TupleLib.tupleNodes(TupleLib.java:86)
at com.hp.hpl.jena.tdb.lib.TupleLib$1.convert(TupleLib.java:40)
at com.hp.hpl.jena.tdb.lib.TupleLib$1.convert(TupleLib.java:36)
at org.openjena.atlas.iterator.Iter$4.next(Iter.java:267)
at
com.hp.hpl.jena.tdb.sys.ConcurrencyPolicyMRSW$IteratorCheckNotConcurrent.next(ConcurrencyPolicyMRSW.java:113)
at
com.hp.hpl.jena.tdb.store.DatasetPrefixesTDB.readPrefix(DatasetPrefixesTDB.java:130)
at
com.hp.hpl.jena.sparql.graph.GraphPrefixesProjection.get(GraphPrefixesProjection.java:85)
at
com.hp.hpl.jena.sparql.graph.GraphPrefixesProjection.set(GraphPrefixesProjection.java:63)
at
com.hp.hpl.jena.shared.impl.PrefixMappingImpl.setNsPrefix(PrefixMappingImpl.java:52)
at com.hp.hpl.jena.rdf.model.impl.ModelCom.setNsPrefix(ModelCom.java:792)
at
org.openjena.riot.system.JenaReaderTurtle2.readWorker(JenaReaderTurtle2.java:37)
at org.openjena.riot.system.JenaReaderRIOT.readImpl(JenaReaderRIOT.java:120)
at org.openjena.riot.system.JenaReaderRIOT.read(JenaReaderRIOT.java:79)
The code in question is:
Dataset ds = TDBFactory.createDataset( tdbDest ) ; // tdbDest is a String
Model model = ds.getDefaultModel() ;
RDFReader rdfRdr = model.getReader( "TTL" );
File f = new File( ttlDir, fn ); // 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();
Is there a way to find out where in the file the error occurred? Is this
indicative of a specific problem?
My ttl file has many lines with \unnnn UTF-8 coded entries, if that has any
impact.
Thanks
Dave Patterson
Re: Fwd: FW: NoSuchElementException trying to load tdb
Posted by Andy Seaborne <an...@apache.org>.
On 13/12/11 17:54, David Patterson wrote:
> Andy,
>
> I'm running tdb 0.8.10 on a mac.
>
> Here is a small subset of the file:
> #-- start of file ---
> @prefix :<http://www.xyz.com/art/data#> .
> @prefix as:<http://www.xyz.com/art/structure#> .
> @prefix dc:<http://purl.org/dc/elements/1.1/#> .
> @prefix rdfs:<http://www.w3.org/2000/01/rdf-schema#> .
>
> :place_00001 a as:Place ;
> rdfs:label "Aartsbisschoppelijke Musea, Utrecht" .
>
> :place_00005 a as:Place ;
> rdfs:label "Abbey Church of Notre-Dame, Saint-Chef (Is\u00e8re)" .
>
> :place_00037 a as:Place ;
> rdfs:label "Ackland Art Museum, University of North Carolina, Chapel
> Hill, North Carolina, USA" ;
> rdfs:label "Ackland Art Museum, University of North Carolina, Chapel Hill" ;
> rdfs:label "Ackland Art Museum, Chapel Hill" .
>
> #-- end of file ---
>
> One thing I just realized. I have not yet included the structure
> folder and file. So, the as:Place does not refer to anything known by
> tcb. Is that likely to be the cause?
No. TDB loads the URI, it does not deference it or see if it's
elsewhere in the file.
>
> Tonight I'll (a) make a structure file that defines Place, and if the
> problem still occurs, I'll download the latest code.
I tried your example code with this data on the development version
(actually, I tried with TDB 0.9.0-SNAPSHOT + the Apache release
bytes-to-hopefully-be for ARQ, Jena and IRI) and it worked for me.
I also used the bulk loader and that worked as well.
Andy
Fwd: FW: NoSuchElementException trying to load tdb
Posted by David Patterson <pa...@gmail.com>.
Andy,
I'm running tdb 0.8.10 on a mac.
Here is a small subset of the file:
#-- start of file ---
@prefix : <http://www.xyz.com/art/data#> .
@prefix as: <http://www.xyz.com/art/structure#> .
@prefix dc: <http://purl.org/dc/elements/1.1/#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
:place_00001 a as:Place ;
rdfs:label "Aartsbisschoppelijke Musea, Utrecht" .
:place_00005 a as:Place ;
rdfs:label "Abbey Church of Notre-Dame, Saint-Chef (Is\u00e8re)" .
:place_00037 a as:Place ;
rdfs:label "Ackland Art Museum, University of North Carolina, Chapel
Hill, North Carolina, USA" ;
rdfs:label "Ackland Art Museum, University of North Carolina, Chapel Hill" ;
rdfs:label "Ackland Art Museum, Chapel Hill" .
#-- end of file ---
One thing I just realized. I have not yet included the structure
folder and file. So, the as:Place does not refer to anything known by
tcb. Is that likely to be the cause?
Tonight I'll (a) make a structure file that defines Place, and if the
problem still occurs, I'll download the latest code.
Thanks
Dave Patterson
Re: NoSuchElementException trying to load tdb
Posted by Andy Seaborne <an...@apache.org>.
Dave,
Which version are you running?
There has been a bug in this area - fixed in the development codebase.
https://repository.apache.org/content/groups/snapshots/org/apache/jena/jena-tdb/
But it's also one of those places in the code where when something goes
wrong, it shows up here. It's looking in the prefixes file.
Is the data publicly accessible so I can try it?
Andy
On 13/12/11 13:31, patterd@gmail.com wrote:
> I'm getting this error trying to load a turtles file (.ttl) into a new
> tdb database.
>
> Here is the traceback:
>
> java.util.NoSuchElementException
> at org.openjena.riot.tokens.TokenizerText.next(TokenizerText.java:90)
> at com.hp.hpl.jena.tdb.nodetable.NodecSSE.decode(NodecSSE.java:91)
> at com.hp.hpl.jena.tdb.lib.NodeLib.decode(NodeLib.java:89)
> at com.hp.hpl.jena.tdb.lib.NodeLib.fetchDecode(NodeLib.java:71)
> at
> com.hp.hpl.jena.tdb.nodetable.NodeTableNative.readNodeByNodeId(NodeTableNative.java:158)
>
> at
> com.hp.hpl.jena.tdb.nodetable.NodeTableNative._retrieveNodeByNodeId(NodeTableNative.java:85)
>
> at
> com.hp.hpl.jena.tdb.nodetable.NodeTableNative.getNodeForNodeId(NodeTableNative.java:58)
>
> at
> com.hp.hpl.jena.tdb.nodetable.NodeTableWrapper.getNodeForNodeId(NodeTableWrapper.java:44)
>
> at
> com.hp.hpl.jena.tdb.nodetable.NodeTableInline.getNodeForNodeId(NodeTableInline.java:55)
>
> at com.hp.hpl.jena.tdb.lib.TupleLib.tupleNodes(TupleLib.java:86)
> at com.hp.hpl.jena.tdb.lib.TupleLib$1.convert(TupleLib.java:40)
> at com.hp.hpl.jena.tdb.lib.TupleLib$1.convert(TupleLib.java:36)
> at org.openjena.atlas.iterator.Iter$4.next(Iter.java:267)
> at
> com.hp.hpl.jena.tdb.sys.ConcurrencyPolicyMRSW$IteratorCheckNotConcurrent.next(ConcurrencyPolicyMRSW.java:113)
>
> at
> com.hp.hpl.jena.tdb.store.DatasetPrefixesTDB.readPrefix(DatasetPrefixesTDB.java:130)
>
> at
> com.hp.hpl.jena.sparql.graph.GraphPrefixesProjection.get(GraphPrefixesProjection.java:85)
>
> at
> com.hp.hpl.jena.sparql.graph.GraphPrefixesProjection.set(GraphPrefixesProjection.java:63)
>
> at
> com.hp.hpl.jena.shared.impl.PrefixMappingImpl.setNsPrefix(PrefixMappingImpl.java:52)
>
> at com.hp.hpl.jena.rdf.model.impl.ModelCom.setNsPrefix(ModelCom.java:792)
> at
> org.openjena.riot.system.JenaReaderTurtle2.readWorker(JenaReaderTurtle2.java:37)
>
> at
> org.openjena.riot.system.JenaReaderRIOT.readImpl(JenaReaderRIOT.java:120)
> at org.openjena.riot.system.JenaReaderRIOT.read(JenaReaderRIOT.java:79)
>
>
> The code in question is:
> Dataset ds = TDBFactory.createDataset( tdbDest ) ; // tdbDest is a String
> Model model = ds.getDefaultModel() ;
>
> RDFReader rdfRdr = model.getReader( "TTL" );
> File f = new File( ttlDir, fn ); // 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();
>
> Is there a way to find out where in the file the error occurred? Is this
> indicative of a specific problem?
>
> My ttl file has many lines with \unnnn UTF-8 coded entries, if that has
> any impact.
>
> Thanks
>
> Dave Patterson
>