afs commented on issue #2616:
URL: https://github.com/apache/jena/issues/2616#issuecomment-2285844673
Reproduced outside Fuseki and reduced to smaller data.
The NPE occurs on the attempt to delete <code>rdfs:range rdfs:subPropertyOf
rdfs:range</code>.
```java
public static void testCaseGH2616() {
String PREFIXES = """
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
""";
String queryString = PREFIXES + """
SELECT * {
VALUES ?s { rdfs:range rdfs:subPropertyOf }
?s ?p ?o .
}
""";
String updateString = PREFIXES + """
DELETE {?s ?p ?o}
WHERE {
VALUES ?s {
## Only this order, both needed, one single operation.
rdfs:range
rdfs:subPropertyOf
}
?s ?p ?o .
## Exclude this and there is no NPE
##FILTER ( ! ( ?s = rdfs:range && ?p =
rdfs:subPropertyOf && ?o = rdfs:range ) )
## No effect - this isn't reached in the gathered
triples to delete.
##FILTER ( ! ( ?s = rdfs:subPropertyOf && ?p = rdf:type
&& ?o = rdf:Property ) )
}
""";
String data = PREFIXES + """
## Triple that triggers the problem.
rdfs:range rdfs:subPropertyOf rdfs:range .
## Must be rdf:type rdf:Property
rdfs:subPropertyOf rdf:type rdf:Property .
""";
Model base = RDFParser.fromString(data, Lang.TTL).toModel();
InfModel inf = ModelFactory.createRDFSModel(base);
// This is the delete order
System.out.println("==== Deletes preview:");
try ( QueryExecution qExec =
QueryExecution.model(inf).query(queryString).build()) {
ResultSetFormatter.out(qExec.execSelect(),qExec.getQuery());
}
System.out.println("==== Update");
System.out.flush();
UpdateExecution uExec =
UpdateExecution.model(inf).update(updateString).build();
uExec.execute();
System.out.println("DONE");
}
```
--
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]