You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Jean-Marc Vanel <je...@gmail.com> on 2015/02/20 12:24:12 UTC

NPE with tdbloader : in readPrefix

Hi

It seems that the database , or some graph in it , is corrupted.
That's with :
 "org.apache.jena" % "apache-jena-libs" % "2.12.1"

On another TDB directory instance , the same file is loaded fine.

The relevant code seems to be:
    public synchronized String readPrefix(String graphName, String prefix) {
        Node g = NodeFactory.createURI(graphName) ;
        Node p = NodeFactory.createLiteral(prefix) ;

        Iterator<Tuple<Node>> iter = nodeTupleTable.find(g, p, null) ;
        try {
            if ( ! iter.hasNext() )
                return null ;
            Tuple<Node> t = iter.next() ;
            Node uri = t.get(2) ;
*            return uri.getURI() ; // uri is probably null !*
        } finally { Iter.close(iter) ; }
    }

A user can hope that a better error message is displayed :) .


java -cp $JARS tdb.tdbloader --verbose --loc=TDB --graph=av-cobus-onto
$ONTOS/barter_user.owl.n3
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in
[jar:file:/home/jmv/deploy/semantic_forms_play-1.0-SNAPSHOT/lib/ch.qos.logback.logback-classic-1.1.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in
[jar:file:/home/jmv/deploy/semantic_forms_play-1.0-SNAPSHOT/lib/org.slf4j.slf4j-log4j12-1.7.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an
explanation.
SLF4J: Actual binding is of type
[ch.qos.logback.classic.util.ContextSelectorStaticBinder]
Java maximum memory: 259522560
symbol:http://jena.hpl.hp.com/ARQ#constantBNodeLabels = true
symbol:http://jena.hpl.hp.com/ARQ#regexImpl = symbol:
http://jena.hpl.hp.com/ARQ#javaRegex
symbol:http://jena.hpl.hp.com/ARQ#stageGenerator =
com.hp.hpl.jena.tdb.solver.StageGeneratorDirectTDB@1049a04
symbol:http://jena.hpl.hp.com/ARQ#strictSPARQL = false
symbol:http://jena.hpl.hp.com/ARQ#enablePropertyFunctions = true
Exception in thread "main" java.lang.NullPointerException
* at
com.hp.hpl.jena.tdb.store.DatasetPrefixesTDB.readPrefix(DatasetPrefixesTDB.java:88)*
at
com.hp.hpl.jena.sparql.graph.GraphPrefixesProjection.get(GraphPrefixesProjection.java:96)
at
com.hp.hpl.jena.sparql.graph.GraphPrefixesProjection.set(GraphPrefixesProjection.java:74)
at
com.hp.hpl.jena.shared.impl.PrefixMappingImpl.setNsPrefix(PrefixMappingImpl.java:70)
at
com.hp.hpl.jena.tdb.store.bulkloader.BulkLoader$DestinationGraph.prefix(BulkLoader.java:361)
at
org.apache.jena.riot.lang.LangTurtleBase.emitPrefix(LangTurtleBase.java:492)
at
org.apache.jena.riot.lang.LangTurtleBase.directivePrefix(LangTurtleBase.java:164)
at
org.apache.jena.riot.lang.LangTurtleBase.directive(LangTurtleBase.java:140)
at
org.apache.jena.riot.lang.LangTurtleBase.runParser(LangTurtleBase.java:79)
at org.apache.jena.riot.lang.LangBase.parse(LangBase.java:42)
at
org.apache.jena.riot.RDFParserRegistry$ReaderRIOTLang.read(RDFParserRegistry.java:182)
at org.apache.jena.riot.RDFDataMgr.process(RDFDataMgr.java:906)
at org.apache.jena.riot.RDFDataMgr.parse(RDFDataMgr.java:687)
at org.apache.jena.riot.RDFDataMgr.parse(RDFDataMgr.java:666)
at org.apache.jena.riot.RDFDataMgr.parse(RDFDataMgr.java:654)
at
com.hp.hpl.jena.tdb.store.bulkloader.BulkLoader.loadTriples$(BulkLoader.java:129)
at
com.hp.hpl.jena.tdb.store.bulkloader.BulkLoader.loadNamedGraph(BulkLoader.java:102)
at com.hp.hpl.jena.tdb.TDBLoader.loadNamedGraph$(TDBLoader.java:253)
at com.hp.hpl.jena.tdb.TDBLoader.loadGraph$(TDBLoader.java:232)
at com.hp.hpl.jena.tdb.TDBLoader.loadGraph(TDBLoader.java:174)
at com.hp.hpl.jena.tdb.TDBLoader.load(TDBLoader.java:111)
at tdb.tdbloader.loadNamedGraph(tdbloader.java:113)
at tdb.tdbloader.exec(tdbloader.java:102)
at arq.cmdline.CmdMain.mainMethod(CmdMain.java:102)
at arq.cmdline.CmdMain.mainRun(CmdMain.java:63)
at arq.cmdline.CmdMain.mainRun(CmdMain.java:50)
at tdb.tdbloader.main(tdbloader.java:44)


-- 
Jean-Marc Vanel
Déductions SARL - Consulting, services, training,
Rule-based programming, Semantic Web
http://deductions-software.com/
+33 (0)6 89 16 29 52
Twitter: @jmvanel , @jmvanel_fr ; chat: irc://irc.freenode.net#eulergui

Re: NPE with tdbloader : in readPrefix

Posted by Andy Seaborne <an...@apache.org>.
On 20/02/15 15:15, Jean-Marc Vanel wrote:
> Thanks,
> and indeed it was loading and empty database.
>
> One conclusion is that for small files that may be wrong, it 's safer to
> load with SPARQL Update and
> LOAD <remoteURI> [ INTO <uri> ]
>
> and for that it would be convenient if
> tdb.tdbupdate --update=FILE
>
> would also accept a string :)

Yes - how about sending a patch?

	Andy


>
>
> 2015-02-20 15:51 GMT+01:00 Andy Seaborne <an...@apache.org>:
>
>> On 20/02/15 11:40, Jean-Marc Vanel wrote:
>>
>>> When rebuilding my TDB from scratch,
>>> I found a way to reproduce the problem.
>>>
>>> 1. load a bad syntax file ( attached )
>>> 2. load any good file in same named graph
>>>
>>> Hope it helps.
>>>
>>
>> Was it loading and empty database?
>>
>> It's because of the syntax error.  It breaks the load.
>>
>> The bulk loader into an empty database does not load triples as they come
>> in.  It does the minimum work then goes back and builds indexes. If it
>> breaks during loading, the database is not built properly.  It is trading
>> speed for reliability.
>>
>> It is a good idea to parse a file before loading it to check for errors.
>> It is much easier to correct an error before loading into a database than
>> fixing it in a database.  "riot --validate" does more checks than tdbloader
>> does., e.g. literal lexical forms.
>>
>>          Andy
>>
>>
>>>
>>> 2015-02-20 12:24 GMT+01:00 Jean-Marc Vanel <jeanmarc.vanel@gmail.com
>>> <ma...@gmail.com>>:
>>>
>>>      Hi
>>>
>>>      It seems that the database , or some graph in it , is corrupted.
>>>      That's with :
>>>        "org.apache.jena" % "apache-jena-libs" % "2.12.1"
>>>
>>>      On another TDB directory instance , the same file is loaded fine.
>>>
>>>      The relevant code seems to be:
>>>           public synchronized String readPrefix(String graphName, String
>>>      prefix) {
>>>               Node g = NodeFactory.createURI(graphName) ;
>>>               Node p = NodeFactory.createLiteral(prefix) ;
>>>               Iterator<Tuple<Node>> iter = nodeTupleTable.find(g, p, null)
>>> ;
>>>               try {
>>>                   if ( ! iter.hasNext() )
>>>                       return null ;
>>>                   Tuple<Node> t = iter.next() ;
>>>                   Node uri = t.get(2) ;
>>>      *            return uri.getURI() ; // uri is probably null !*
>>>               } finally { Iter.close(iter) ; }
>>>           }
>>>
>>>      A user can hope that a better error message is displayed :) .
>>>
>>>
>>>      java -cp $JARS tdb.tdbloader --verbose --loc=TDB
>>>      --graph=av-cobus-onto $ONTOS/barter_user.owl.n3
>>>      SLF4J: Class path contains multiple SLF4J bindings.
>>>      SLF4J: Found binding in
>>>      [jar:file:/home/jmv/deploy/semantic_forms_play-1.0-
>>> SNAPSHOT/lib/ch.qos.logback.logback-classic-1.1.1.jar!/org/slf4j/impl/
>>> StaticLoggerBinder.class]
>>>      SLF4J: Found binding in
>>>      [jar:file:/home/jmv/deploy/semantic_forms_play-1.0-
>>> SNAPSHOT/lib/org.slf4j.slf4j-log4j12-1.7.6.jar!/org/slf4j/
>>> impl/StaticLoggerBinder.class]
>>>      SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an
>>>      explanation.
>>>      SLF4J: Actual binding is of type
>>>      [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
>>>      Java maximum memory: 259522560
>>>      symbol:http://jena.hpl.hp.com/ARQ#constantBNodeLabels = true
>>>      symbol:http://jena.hpl.hp.com/ARQ#regexImpl =
>>>      symbol:http://jena.hpl.hp.com/ARQ#javaRegex
>>>      symbol:http://jena.hpl.hp.com/ARQ#stageGenerator =
>>>      com.hp.hpl.jena.tdb.solver.StageGeneratorDirectTDB@1049a04
>>>      symbol:http://jena.hpl.hp.com/ARQ#strictSPARQL = false
>>>      symbol:http://jena.hpl.hp.com/ARQ#enablePropertyFunctions = true
>>>      Exception in thread "main" java.lang.NullPointerException
>>>      *at
>>>      com.hp.hpl.jena.tdb.store.DatasetPrefixesTDB.readPrefix(
>>> DatasetPrefixesTDB.java:88)*
>>>
>>>      at
>>>      com.hp.hpl.jena.sparql.graph.GraphPrefixesProjection.get(
>>> GraphPrefixesProjection.java:96)
>>>      at
>>>      com.hp.hpl.jena.sparql.graph.GraphPrefixesProjection.set(
>>> GraphPrefixesProjection.java:74)
>>>      at
>>>      com.hp.hpl.jena.shared.impl.PrefixMappingImpl.setNsPrefix(
>>> PrefixMappingImpl.java:70)
>>>      at
>>>      com.hp.hpl.jena.tdb.store.bulkloader.BulkLoader$
>>> DestinationGraph.prefix(BulkLoader.java:361)
>>>      at
>>>      org.apache.jena.riot.lang.LangTurtleBase.emitPrefix(
>>> LangTurtleBase.java:492)
>>>      at
>>>      org.apache.jena.riot.lang.LangTurtleBase.directivePrefix(
>>> LangTurtleBase.java:164)
>>>      at
>>>      org.apache.jena.riot.lang.LangTurtleBase.directive(
>>> LangTurtleBase.java:140)
>>>      at
>>>      org.apache.jena.riot.lang.LangTurtleBase.runParser(
>>> LangTurtleBase.java:79)
>>>      at org.apache.jena.riot.lang.LangBase.parse(LangBase.java:42)
>>>      at
>>>      org.apache.jena.riot.RDFParserRegistry$ReaderRIOTLang.read(
>>> RDFParserRegistry.java:182)
>>>      at org.apache.jena.riot.RDFDataMgr.process(RDFDataMgr.java:906)
>>>      at org.apache.jena.riot.RDFDataMgr.parse(RDFDataMgr.java:687)
>>>      at org.apache.jena.riot.RDFDataMgr.parse(RDFDataMgr.java:666)
>>>      at org.apache.jena.riot.RDFDataMgr.parse(RDFDataMgr.java:654)
>>>      at
>>>      com.hp.hpl.jena.tdb.store.bulkloader.BulkLoader.
>>> loadTriples$(BulkLoader.java:129)
>>>      at
>>>      com.hp.hpl.jena.tdb.store.bulkloader.BulkLoader.
>>> loadNamedGraph(BulkLoader.java:102)
>>>      at com.hp.hpl.jena.tdb.TDBLoader.loadNamedGraph$(TDBLoader.java:253)
>>>      at com.hp.hpl.jena.tdb.TDBLoader.loadGraph$(TDBLoader.java:232)
>>>      at com.hp.hpl.jena.tdb.TDBLoader.loadGraph(TDBLoader.java:174)
>>>      at com.hp.hpl.jena.tdb.TDBLoader.load(TDBLoader.java:111)
>>>      at tdb.tdbloader.loadNamedGraph(tdbloader.java:113)
>>>      at tdb.tdbloader.exec(tdbloader.java:102)
>>>      at arq.cmdline.CmdMain.mainMethod(CmdMain.java:102)
>>>      at arq.cmdline.CmdMain.mainRun(CmdMain.java:63)
>>>      at arq.cmdline.CmdMain.mainRun(CmdMain.java:50)
>>>      at tdb.tdbloader.main(tdbloader.java:44)
>>>
>>>
>>>      --
>>>      Jean-Marc Vanel
>>>      Déductions SARL - Consulting, services, training,
>>>      Rule-based programming, Semantic Web
>>>      http://deductions-software.com/
>>>      +33 (0)6 89 16 29 52 <tel:%2B33%20%280%296%2089%2016%2029%2052>
>>>      Twitter: @jmvanel , @jmvanel_fr ; chat:
>>>      irc://irc.freenode.net#eulergui <http://irc.freenode.net#eulergui>
>>>
>>>
>>>
>>>
>>> --
>>> Jean-Marc Vanel
>>> Déductions SARL - Consulting, services, training,
>>> Rule-based programming, Semantic Web
>>> http://deductions-software.com/
>>> +33 (0)6 89 16 29 52
>>> Twitter: @jmvanel , @jmvanel_fr ; chat: irc://irc.freenode.net#eulergui
>>> <http://irc.freenode.net#eulergui>
>>>
>>
>>
>
>


Re: NPE with tdbloader : in readPrefix

Posted by Jean-Marc Vanel <je...@gmail.com>.
Thanks,
and indeed it was loading and empty database.

One conclusion is that for small files that may be wrong, it 's safer to
load with SPARQL Update and
LOAD <remoteURI> [ INTO <uri> ]

and for that it would be convenient if
tdb.tdbupdate --update=FILE

would also accept a string :) .


2015-02-20 15:51 GMT+01:00 Andy Seaborne <an...@apache.org>:

> On 20/02/15 11:40, Jean-Marc Vanel wrote:
>
>> When rebuilding my TDB from scratch,
>> I found a way to reproduce the problem.
>>
>> 1. load a bad syntax file ( attached )
>> 2. load any good file in same named graph
>>
>> Hope it helps.
>>
>
> Was it loading and empty database?
>
> It's because of the syntax error.  It breaks the load.
>
> The bulk loader into an empty database does not load triples as they come
> in.  It does the minimum work then goes back and builds indexes. If it
> breaks during loading, the database is not built properly.  It is trading
> speed for reliability.
>
> It is a good idea to parse a file before loading it to check for errors.
> It is much easier to correct an error before loading into a database than
> fixing it in a database.  "riot --validate" does more checks than tdbloader
> does., e.g. literal lexical forms.
>
>         Andy
>
>
>>
>> 2015-02-20 12:24 GMT+01:00 Jean-Marc Vanel <jeanmarc.vanel@gmail.com
>> <ma...@gmail.com>>:
>>
>>     Hi
>>
>>     It seems that the database , or some graph in it , is corrupted.
>>     That's with :
>>       "org.apache.jena" % "apache-jena-libs" % "2.12.1"
>>
>>     On another TDB directory instance , the same file is loaded fine.
>>
>>     The relevant code seems to be:
>>          public synchronized String readPrefix(String graphName, String
>>     prefix) {
>>              Node g = NodeFactory.createURI(graphName) ;
>>              Node p = NodeFactory.createLiteral(prefix) ;
>>              Iterator<Tuple<Node>> iter = nodeTupleTable.find(g, p, null)
>> ;
>>              try {
>>                  if ( ! iter.hasNext() )
>>                      return null ;
>>                  Tuple<Node> t = iter.next() ;
>>                  Node uri = t.get(2) ;
>>     *            return uri.getURI() ; // uri is probably null !*
>>              } finally { Iter.close(iter) ; }
>>          }
>>
>>     A user can hope that a better error message is displayed :) .
>>
>>
>>     java -cp $JARS tdb.tdbloader --verbose --loc=TDB
>>     --graph=av-cobus-onto $ONTOS/barter_user.owl.n3
>>     SLF4J: Class path contains multiple SLF4J bindings.
>>     SLF4J: Found binding in
>>     [jar:file:/home/jmv/deploy/semantic_forms_play-1.0-
>> SNAPSHOT/lib/ch.qos.logback.logback-classic-1.1.1.jar!/org/slf4j/impl/
>> StaticLoggerBinder.class]
>>     SLF4J: Found binding in
>>     [jar:file:/home/jmv/deploy/semantic_forms_play-1.0-
>> SNAPSHOT/lib/org.slf4j.slf4j-log4j12-1.7.6.jar!/org/slf4j/
>> impl/StaticLoggerBinder.class]
>>     SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an
>>     explanation.
>>     SLF4J: Actual binding is of type
>>     [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
>>     Java maximum memory: 259522560
>>     symbol:http://jena.hpl.hp.com/ARQ#constantBNodeLabels = true
>>     symbol:http://jena.hpl.hp.com/ARQ#regexImpl =
>>     symbol:http://jena.hpl.hp.com/ARQ#javaRegex
>>     symbol:http://jena.hpl.hp.com/ARQ#stageGenerator =
>>     com.hp.hpl.jena.tdb.solver.StageGeneratorDirectTDB@1049a04
>>     symbol:http://jena.hpl.hp.com/ARQ#strictSPARQL = false
>>     symbol:http://jena.hpl.hp.com/ARQ#enablePropertyFunctions = true
>>     Exception in thread "main" java.lang.NullPointerException
>>     *at
>>     com.hp.hpl.jena.tdb.store.DatasetPrefixesTDB.readPrefix(
>> DatasetPrefixesTDB.java:88)*
>>
>>     at
>>     com.hp.hpl.jena.sparql.graph.GraphPrefixesProjection.get(
>> GraphPrefixesProjection.java:96)
>>     at
>>     com.hp.hpl.jena.sparql.graph.GraphPrefixesProjection.set(
>> GraphPrefixesProjection.java:74)
>>     at
>>     com.hp.hpl.jena.shared.impl.PrefixMappingImpl.setNsPrefix(
>> PrefixMappingImpl.java:70)
>>     at
>>     com.hp.hpl.jena.tdb.store.bulkloader.BulkLoader$
>> DestinationGraph.prefix(BulkLoader.java:361)
>>     at
>>     org.apache.jena.riot.lang.LangTurtleBase.emitPrefix(
>> LangTurtleBase.java:492)
>>     at
>>     org.apache.jena.riot.lang.LangTurtleBase.directivePrefix(
>> LangTurtleBase.java:164)
>>     at
>>     org.apache.jena.riot.lang.LangTurtleBase.directive(
>> LangTurtleBase.java:140)
>>     at
>>     org.apache.jena.riot.lang.LangTurtleBase.runParser(
>> LangTurtleBase.java:79)
>>     at org.apache.jena.riot.lang.LangBase.parse(LangBase.java:42)
>>     at
>>     org.apache.jena.riot.RDFParserRegistry$ReaderRIOTLang.read(
>> RDFParserRegistry.java:182)
>>     at org.apache.jena.riot.RDFDataMgr.process(RDFDataMgr.java:906)
>>     at org.apache.jena.riot.RDFDataMgr.parse(RDFDataMgr.java:687)
>>     at org.apache.jena.riot.RDFDataMgr.parse(RDFDataMgr.java:666)
>>     at org.apache.jena.riot.RDFDataMgr.parse(RDFDataMgr.java:654)
>>     at
>>     com.hp.hpl.jena.tdb.store.bulkloader.BulkLoader.
>> loadTriples$(BulkLoader.java:129)
>>     at
>>     com.hp.hpl.jena.tdb.store.bulkloader.BulkLoader.
>> loadNamedGraph(BulkLoader.java:102)
>>     at com.hp.hpl.jena.tdb.TDBLoader.loadNamedGraph$(TDBLoader.java:253)
>>     at com.hp.hpl.jena.tdb.TDBLoader.loadGraph$(TDBLoader.java:232)
>>     at com.hp.hpl.jena.tdb.TDBLoader.loadGraph(TDBLoader.java:174)
>>     at com.hp.hpl.jena.tdb.TDBLoader.load(TDBLoader.java:111)
>>     at tdb.tdbloader.loadNamedGraph(tdbloader.java:113)
>>     at tdb.tdbloader.exec(tdbloader.java:102)
>>     at arq.cmdline.CmdMain.mainMethod(CmdMain.java:102)
>>     at arq.cmdline.CmdMain.mainRun(CmdMain.java:63)
>>     at arq.cmdline.CmdMain.mainRun(CmdMain.java:50)
>>     at tdb.tdbloader.main(tdbloader.java:44)
>>
>>
>>     --
>>     Jean-Marc Vanel
>>     Déductions SARL - Consulting, services, training,
>>     Rule-based programming, Semantic Web
>>     http://deductions-software.com/
>>     +33 (0)6 89 16 29 52 <tel:%2B33%20%280%296%2089%2016%2029%2052>
>>     Twitter: @jmvanel , @jmvanel_fr ; chat:
>>     irc://irc.freenode.net#eulergui <http://irc.freenode.net#eulergui>
>>
>>
>>
>>
>> --
>> Jean-Marc Vanel
>> Déductions SARL - Consulting, services, training,
>> Rule-based programming, Semantic Web
>> http://deductions-software.com/
>> +33 (0)6 89 16 29 52
>> Twitter: @jmvanel , @jmvanel_fr ; chat: irc://irc.freenode.net#eulergui
>> <http://irc.freenode.net#eulergui>
>>
>
>


-- 
Jean-Marc Vanel
Déductions SARL - Consulting, services, training,
Rule-based programming, Semantic Web
http://deductions-software.com/
+33 (0)6 89 16 29 52
Twitter: @jmvanel , @jmvanel_fr ; chat: irc://irc.freenode.net#eulergui

Re: NPE with tdbloader : in readPrefix

Posted by Andy Seaborne <an...@apache.org>.
On 20/02/15 11:40, Jean-Marc Vanel wrote:
> When rebuilding my TDB from scratch,
> I found a way to reproduce the problem.
>
> 1. load a bad syntax file ( attached )
> 2. load any good file in same named graph
>
> Hope it helps.

Was it loading and empty database?

It's because of the syntax error.  It breaks the load.

The bulk loader into an empty database does not load triples as they 
come in.  It does the minimum work then goes back and builds indexes. 
If it breaks during loading, the database is not built properly.  It is 
trading speed for reliability.

It is a good idea to parse a file before loading it to check for errors. 
  It is much easier to correct an error before loading into a database 
than fixing it in a database.  "riot --validate" does more checks than 
tdbloader does., e.g. literal lexical forms.

	Andy

>
>
> 2015-02-20 12:24 GMT+01:00 Jean-Marc Vanel <jeanmarc.vanel@gmail.com
> <ma...@gmail.com>>:
>
>     Hi
>
>     It seems that the database , or some graph in it , is corrupted.
>     That's with :
>       "org.apache.jena" % "apache-jena-libs" % "2.12.1"
>
>     On another TDB directory instance , the same file is loaded fine.
>
>     The relevant code seems to be:
>          public synchronized String readPrefix(String graphName, String
>     prefix) {
>              Node g = NodeFactory.createURI(graphName) ;
>              Node p = NodeFactory.createLiteral(prefix) ;
>              Iterator<Tuple<Node>> iter = nodeTupleTable.find(g, p, null) ;
>              try {
>                  if ( ! iter.hasNext() )
>                      return null ;
>                  Tuple<Node> t = iter.next() ;
>                  Node uri = t.get(2) ;
>     *            return uri.getURI() ; // uri is probably null !*
>              } finally { Iter.close(iter) ; }
>          }
>
>     A user can hope that a better error message is displayed :) .
>
>
>     java -cp $JARS tdb.tdbloader --verbose --loc=TDB
>     --graph=av-cobus-onto $ONTOS/barter_user.owl.n3
>     SLF4J: Class path contains multiple SLF4J bindings.
>     SLF4J: Found binding in
>     [jar:file:/home/jmv/deploy/semantic_forms_play-1.0-SNAPSHOT/lib/ch.qos.logback.logback-classic-1.1.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
>     SLF4J: Found binding in
>     [jar:file:/home/jmv/deploy/semantic_forms_play-1.0-SNAPSHOT/lib/org.slf4j.slf4j-log4j12-1.7.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
>     SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an
>     explanation.
>     SLF4J: Actual binding is of type
>     [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
>     Java maximum memory: 259522560
>     symbol:http://jena.hpl.hp.com/ARQ#constantBNodeLabels = true
>     symbol:http://jena.hpl.hp.com/ARQ#regexImpl =
>     symbol:http://jena.hpl.hp.com/ARQ#javaRegex
>     symbol:http://jena.hpl.hp.com/ARQ#stageGenerator =
>     com.hp.hpl.jena.tdb.solver.StageGeneratorDirectTDB@1049a04
>     symbol:http://jena.hpl.hp.com/ARQ#strictSPARQL = false
>     symbol:http://jena.hpl.hp.com/ARQ#enablePropertyFunctions = true
>     Exception in thread "main" java.lang.NullPointerException
>     *at
>     com.hp.hpl.jena.tdb.store.DatasetPrefixesTDB.readPrefix(DatasetPrefixesTDB.java:88)*
>     at
>     com.hp.hpl.jena.sparql.graph.GraphPrefixesProjection.get(GraphPrefixesProjection.java:96)
>     at
>     com.hp.hpl.jena.sparql.graph.GraphPrefixesProjection.set(GraphPrefixesProjection.java:74)
>     at
>     com.hp.hpl.jena.shared.impl.PrefixMappingImpl.setNsPrefix(PrefixMappingImpl.java:70)
>     at
>     com.hp.hpl.jena.tdb.store.bulkloader.BulkLoader$DestinationGraph.prefix(BulkLoader.java:361)
>     at
>     org.apache.jena.riot.lang.LangTurtleBase.emitPrefix(LangTurtleBase.java:492)
>     at
>     org.apache.jena.riot.lang.LangTurtleBase.directivePrefix(LangTurtleBase.java:164)
>     at
>     org.apache.jena.riot.lang.LangTurtleBase.directive(LangTurtleBase.java:140)
>     at
>     org.apache.jena.riot.lang.LangTurtleBase.runParser(LangTurtleBase.java:79)
>     at org.apache.jena.riot.lang.LangBase.parse(LangBase.java:42)
>     at
>     org.apache.jena.riot.RDFParserRegistry$ReaderRIOTLang.read(RDFParserRegistry.java:182)
>     at org.apache.jena.riot.RDFDataMgr.process(RDFDataMgr.java:906)
>     at org.apache.jena.riot.RDFDataMgr.parse(RDFDataMgr.java:687)
>     at org.apache.jena.riot.RDFDataMgr.parse(RDFDataMgr.java:666)
>     at org.apache.jena.riot.RDFDataMgr.parse(RDFDataMgr.java:654)
>     at
>     com.hp.hpl.jena.tdb.store.bulkloader.BulkLoader.loadTriples$(BulkLoader.java:129)
>     at
>     com.hp.hpl.jena.tdb.store.bulkloader.BulkLoader.loadNamedGraph(BulkLoader.java:102)
>     at com.hp.hpl.jena.tdb.TDBLoader.loadNamedGraph$(TDBLoader.java:253)
>     at com.hp.hpl.jena.tdb.TDBLoader.loadGraph$(TDBLoader.java:232)
>     at com.hp.hpl.jena.tdb.TDBLoader.loadGraph(TDBLoader.java:174)
>     at com.hp.hpl.jena.tdb.TDBLoader.load(TDBLoader.java:111)
>     at tdb.tdbloader.loadNamedGraph(tdbloader.java:113)
>     at tdb.tdbloader.exec(tdbloader.java:102)
>     at arq.cmdline.CmdMain.mainMethod(CmdMain.java:102)
>     at arq.cmdline.CmdMain.mainRun(CmdMain.java:63)
>     at arq.cmdline.CmdMain.mainRun(CmdMain.java:50)
>     at tdb.tdbloader.main(tdbloader.java:44)
>
>
>     --
>     Jean-Marc Vanel
>     Déductions SARL - Consulting, services, training,
>     Rule-based programming, Semantic Web
>     http://deductions-software.com/
>     +33 (0)6 89 16 29 52 <tel:%2B33%20%280%296%2089%2016%2029%2052>
>     Twitter: @jmvanel , @jmvanel_fr ; chat:
>     irc://irc.freenode.net#eulergui <http://irc.freenode.net#eulergui>
>
>
>
>
> --
> Jean-Marc Vanel
> Déductions SARL - Consulting, services, training,
> Rule-based programming, Semantic Web
> http://deductions-software.com/
> +33 (0)6 89 16 29 52
> Twitter: @jmvanel , @jmvanel_fr ; chat: irc://irc.freenode.net#eulergui
> <http://irc.freenode.net#eulergui>


Re: NPE with tdbloader : in readPrefix

Posted by Jean-Marc Vanel <je...@gmail.com>.
When rebuilding my TDB from scratch,
I found a way to reproduce the problem.

1. load a bad syntax file ( attached )
2. load any good file in same named graph

Hope it helps.


2015-02-20 12:24 GMT+01:00 Jean-Marc Vanel <je...@gmail.com>:

> Hi
>
> It seems that the database , or some graph in it , is corrupted.
> That's with :
>  "org.apache.jena" % "apache-jena-libs" % "2.12.1"
>
> On another TDB directory instance , the same file is loaded fine.
>
> The relevant code seems to be:
>     public synchronized String readPrefix(String graphName, String prefix)
> {
>         Node g = NodeFactory.createURI(graphName) ;
>         Node p = NodeFactory.createLiteral(prefix) ;
>
>         Iterator<Tuple<Node>> iter = nodeTupleTable.find(g, p, null) ;
>         try {
>             if ( ! iter.hasNext() )
>                 return null ;
>             Tuple<Node> t = iter.next() ;
>             Node uri = t.get(2) ;
> *            return uri.getURI() ; // uri is probably null !*
>         } finally { Iter.close(iter) ; }
>     }
>
> A user can hope that a better error message is displayed :) .
>
>
> java -cp $JARS tdb.tdbloader --verbose --loc=TDB --graph=av-cobus-onto
> $ONTOS/barter_user.owl.n3
> SLF4J: Class path contains multiple SLF4J bindings.
> SLF4J: Found binding in
> [jar:file:/home/jmv/deploy/semantic_forms_play-1.0-SNAPSHOT/lib/ch.qos.logback.logback-classic-1.1.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
> SLF4J: Found binding in
> [jar:file:/home/jmv/deploy/semantic_forms_play-1.0-SNAPSHOT/lib/org.slf4j.slf4j-log4j12-1.7.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
> SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an
> explanation.
> SLF4J: Actual binding is of type
> [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
> Java maximum memory: 259522560
> symbol:http://jena.hpl.hp.com/ARQ#constantBNodeLabels = true
> symbol:http://jena.hpl.hp.com/ARQ#regexImpl = symbol:
> http://jena.hpl.hp.com/ARQ#javaRegex
> symbol:http://jena.hpl.hp.com/ARQ#stageGenerator =
> com.hp.hpl.jena.tdb.solver.StageGeneratorDirectTDB@1049a04
> symbol:http://jena.hpl.hp.com/ARQ#strictSPARQL = false
> symbol:http://jena.hpl.hp.com/ARQ#enablePropertyFunctions = true
> Exception in thread "main" java.lang.NullPointerException
> * at
> com.hp.hpl.jena.tdb.store.DatasetPrefixesTDB.readPrefix(DatasetPrefixesTDB.java:88)*
> at
> com.hp.hpl.jena.sparql.graph.GraphPrefixesProjection.get(GraphPrefixesProjection.java:96)
> at
> com.hp.hpl.jena.sparql.graph.GraphPrefixesProjection.set(GraphPrefixesProjection.java:74)
> at
> com.hp.hpl.jena.shared.impl.PrefixMappingImpl.setNsPrefix(PrefixMappingImpl.java:70)
> at
> com.hp.hpl.jena.tdb.store.bulkloader.BulkLoader$DestinationGraph.prefix(BulkLoader.java:361)
> at
> org.apache.jena.riot.lang.LangTurtleBase.emitPrefix(LangTurtleBase.java:492)
> at
> org.apache.jena.riot.lang.LangTurtleBase.directivePrefix(LangTurtleBase.java:164)
> at
> org.apache.jena.riot.lang.LangTurtleBase.directive(LangTurtleBase.java:140)
> at
> org.apache.jena.riot.lang.LangTurtleBase.runParser(LangTurtleBase.java:79)
> at org.apache.jena.riot.lang.LangBase.parse(LangBase.java:42)
> at
> org.apache.jena.riot.RDFParserRegistry$ReaderRIOTLang.read(RDFParserRegistry.java:182)
> at org.apache.jena.riot.RDFDataMgr.process(RDFDataMgr.java:906)
> at org.apache.jena.riot.RDFDataMgr.parse(RDFDataMgr.java:687)
> at org.apache.jena.riot.RDFDataMgr.parse(RDFDataMgr.java:666)
> at org.apache.jena.riot.RDFDataMgr.parse(RDFDataMgr.java:654)
> at
> com.hp.hpl.jena.tdb.store.bulkloader.BulkLoader.loadTriples$(BulkLoader.java:129)
> at
> com.hp.hpl.jena.tdb.store.bulkloader.BulkLoader.loadNamedGraph(BulkLoader.java:102)
> at com.hp.hpl.jena.tdb.TDBLoader.loadNamedGraph$(TDBLoader.java:253)
> at com.hp.hpl.jena.tdb.TDBLoader.loadGraph$(TDBLoader.java:232)
> at com.hp.hpl.jena.tdb.TDBLoader.loadGraph(TDBLoader.java:174)
> at com.hp.hpl.jena.tdb.TDBLoader.load(TDBLoader.java:111)
> at tdb.tdbloader.loadNamedGraph(tdbloader.java:113)
> at tdb.tdbloader.exec(tdbloader.java:102)
> at arq.cmdline.CmdMain.mainMethod(CmdMain.java:102)
> at arq.cmdline.CmdMain.mainRun(CmdMain.java:63)
> at arq.cmdline.CmdMain.mainRun(CmdMain.java:50)
> at tdb.tdbloader.main(tdbloader.java:44)
>
>
> --
> Jean-Marc Vanel
> Déductions SARL - Consulting, services, training,
> Rule-based programming, Semantic Web
> http://deductions-software.com/
> +33 (0)6 89 16 29 52
> Twitter: @jmvanel , @jmvanel_fr ; chat: irc://irc.freenode.net#eulergui
>



-- 
Jean-Marc Vanel
Déductions SARL - Consulting, services, training,
Rule-based programming, Semantic Web
http://deductions-software.com/
+33 (0)6 89 16 29 52
Twitter: @jmvanel , @jmvanel_fr ; chat: irc://irc.freenode.net#eulergui