I've been acquainting myself with the jena code base by trying to find
out how to add idiomatically correct java8-style iteration to jena
(while staying java7 compatible).

One thing I am wondering about is the logic to attempt consistent
iterations over changing models for the the iterators that are
returned by for instance listStatements (as opposed to throwing
ConcurrentModificationException when the underlying model changes). I
can certainly see that it has some interesting merits when it comes to
analytical manipulation/modification of models, but even on my first
attempt at actually modifying a model I was iterating over it fell
over because the consistency is only partial. Is there any
documentation as to what operations are permitted/safe/unsafe while
iterating ?

Futhermore I observed that there is a fairly substantial cost to
maintaining this style of iteration. Using a simple flyweight to
implement "Statement" I can easily make them 3x faster than the
current iterators. Our application is really only running in 2
"modes"; rdf creation or analyzing immutable rdf data. When analyzing
immutable data the current implementation really seem to generate a
lot of hot air, and I'm tempted to suggest that 2 different modes of
iteration could be supported; fail-fast and "consistent".

Currently I'm just dabbling around with the code (can be seen here
https://github.com/krosenvold/jena/compare/java8iterators) and I
expect to keep on with that for some time, but I'd appreciate your
thoughts on this topic :)

Kristian

Reply via email to