On Sat, Mar 2, 2013 at 5:19 PM, Andy Seaborne <[email protected]> wrote:

> On 02/03/13 10:02, Claude Warren wrote:
>
>> First some background.
>>
>> I am debugging an app and did kill the app in the middle of an execution.
>>
>> <code>
>>      dataset = TDBFactory.createDataset( "./jena" );
>>      model = dataset.getDefaultModel();
>> </code>
>>
>> the getDefaultModel() method throws a null pointer.
>>
>> in DatasetPrefixesTDB.**readPrefixMap()
>>
>> <code>
>> public synchronized Map<String, String> readPrefixMap(String graphName)
>>      {
>>          Node g = Node.createURI(graphName) ;
>>          Iterator<Tuple<Node>> iter = nodeTupleTable.find(g, null, null) ;
>>          Map<String, String> map = new HashMap<String, String>() ;
>>          for ( ; iter.hasNext() ; )
>>          {
>>              Tuple<Node> t = iter.next();
>>              String prefix = t.get(1).**getLiteralLexicalForm() ;
>>              String uri = t.get(2).getURI() ;
>>              map.put(prefix, uri) ;
>>          }
>>          Iter.close(iter) ;
>>          return map ;
>>      }
>> </code>
>>
>> graphName = "";
>> t = [<null>, <null>, <null> ]
>>
>>   String prefix = t.get(1).**getLiteralLexicalForm() ;
>> throws a null pointer exception.
>>
>> My question is: What can I do to restore the data?  I tried reloading
>> using
>> tdbloader2 to reload the data but that did not work.
>>
>
> Did you delete the old database?  tdbloader2 is (currently) not
> prefix-aware so it may be that the old prefix table is being left in place.
>  Try in a fresh directory.
>
> You can also just go in and delete the prefix table files, prefix*.
>
> An empty prefix table will be recreated on the next start up.
>
>
>  My other question is where should I look to find the problem?
>>
>
> At guess, there was some non-transactional use of the database.  A change
> to the prefix table did not get completely written (the node file changes
> were not written but the tuples part was).
>
> This could be due to an interrupted load or use of TDB non-transactionally.
>
>         Andy
>
>
Your last line was spot on.  It was an interrupted use of TDB
non-transactionally.  The only change was that I added namespace prefixes.

I ended up removing the prefix table files and that recovered nicely.

Should TDB detect a null namespace triple and delete it, or perhaps delete
the namespace prefixes at that point?  Is this an enhancement that makes
sense?


-- 
I like: Like Like - The likeliest place on the web<http://like-like.xenei.com>
Identity: https://www.identify.nu/[email protected]
LinkedIn: http://www.linkedin.com/in/claudewarren

Reply via email to