use of org.apache.jena.rdf.model.Statement in project jena by apache.
the class TestConcurrentAccess method mrswGraph3.
@Test(expected = ConcurrentModificationException.class)
public void mrswGraph3() {
Model m = create().getDefaultModel();
Resource r = m.createResource("x");
ExtendedIterator<Statement> iter1 = m.listStatements(r, null, (RDFNode) null);
assertNotNull(iter1.next());
Triple t = SSE.parseTriple("(<y> <p> 99)");
m.getGraph().delete(t);
// Bad
iter1.hasNext();
}
use of org.apache.jena.rdf.model.Statement in project jena by apache.
the class StandardAnalyzerAssembler method toList.
private List<String> toList(Resource list) {
List<String> result = new ArrayList<>();
Resource current = list;
while (current != null && !current.equals(RDF.nil)) {
Statement stmt = current.getProperty(RDF.first);
if (stmt == null) {
throw new TextIndexException("stop word list not well formed");
}
RDFNode node = stmt.getObject();
if (!node.isLiteral()) {
throw new TextIndexException("stop word is not a literal : " + node);
}
result.add(((Literal) node).getLexicalForm());
stmt = current.getProperty(RDF.rest);
if (stmt == null) {
throw new TextIndexException("stop word list not terminated by rdf:nil");
}
node = stmt.getObject();
if (!node.isResource()) {
throw new TextIndexException("stop word list node is not a resource : " + node);
}
current = (Resource) node;
}
return result;
}
Aggregations