sszuev opened a new issue, #1992:
URL: https://github.com/apache/jena/issues/1992
### Version
4.9.0
### Question
`GraphMem` does not guarantee that the iterator will not be broken if it is
interrupted by a modification operation.
So this is just a question.
In some scenarios when we do so we may expect that it will not be broken if
search pattern and concrete triple do not match.
See:
```java
import org.apache.jena.graph.Graph;
import org.apache.jena.graph.GraphMemFactory;
import org.apache.jena.graph.Node;
import org.apache.jena.graph.NodeFactory;
import org.apache.jena.graph.Triple;
import org.apache.jena.vocabulary.OWL;
import org.apache.jena.vocabulary.RDF;
import java.util.Iterator;
public class TmpGraphMem {
public static void main(String... args) {
Graph graph = GraphMemFactory.createGraphMem2();
for (int i = 0; i < 42; i++) {
graph.add(Triple.create(NodeFactory.createURI("a" + i),
RDF.type.asNode(), OWL.Class.asNode()));
}
Triple pattern = Triple.create(Node.ANY, RDF.type.asNode(),
OWL.Class.asNode());
Triple triple1 = Triple.create(NodeFactory.createURI("x"),
NodeFactory.createURI("p"), NodeFactory.createURI("W"));
Triple triple2 = Triple.create(NodeFactory.createURI("x"),
NodeFactory.createURI("p"), OWL.Class.asNode());
System.out.println(pattern.matches(triple1)); // false
System.out.println(pattern.matches(triple2)); // false
Iterator<Triple> it = graph.find(pattern);
it.next();
it.next();
graph.add(triple1);
it.next(); // no ConcurrentModificationException
it.next(); // no ConcurrentModificationException
graph.add(triple2);
it.next(); // ConcurrentModificationException
it.next(); // ConcurrentModificationException
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]