I tried sending this once before subscribing to the list, so my apologies if 
this arrives twice.

It seems that the underlying graph of a TDB-backed named model doesn't support 
the RenameResource function in ResourceUtils. I get an 
UnsupportedOperationException when I try to use this, though the exception 
seems to come from the WrappedIterator/NiceIterator not supporting the remove.

Are there known workarounds for this case, or should I implement my own 
renameResource that uses DELETE SPARQL queries to do the removes?

This issue seems like a cousin of:
http://tech.groups.yahoo.com/group/jena-dev/message/35431

Stack trace:

java.lang.UnsupportedOperationException
                at 
com.hp.hpl.jena.util.iterator.WrappedIterator.remove(WrappedIterator.java:76)
                at 
com.hp.hpl.jena.util.iterator.NiceIterator$1.remove(NiceIterator.java:109)
                at 
com.hp.hpl.jena.util.iterator.WrappedIterator.remove(WrappedIterator.java:77)
                at 
com.hp.hpl.jena.util.iterator.FilterIterator.remove(FilterIterator.java:65)
                at 
com.hp.hpl.jena.util.ResourceUtils.renameResource(ResourceUtils.java:270)
                at 
com.basistech.jug.rdfdb.task.RdfGenerator.mergeEntities(RdfGenerator.java:271)
                at 
com.basistech.jug.rdfdb.RdfGeneratorTest.testMergeEntities(RdfGeneratorTest.java:156)

Versions:
Jena 2.6.4
TDB 0.8.10

I also tried Jena 2.6.5-SNAPSHOT as of June 6, 2011, for kicks. The stacktrace 
is slightly different, due to a rewrite of RenameResource, but the result is 
the same UnsupportedOperationException.

If it's helpful, I can pack up a unit test to demonstrate that renameResource 
fails for a TDB-backed model, but works fine on a model created by 
ModelFactory.createDefaultModel().


Thanks,
Steve

Reply via email to