Open agustaf9 opened 1 month ago
Hi @agustaf9,
Thanks for the complete report.
I've managed to reproduce the problem at my end.
Reproduced outside Fuseki and reduced to smaller data.
The NPE occurs on the attempt to delete rdfs:range rdfs:subPropertyOf rdfs:range
.
public static void testCaseGH2616() {
JenaSystem.init();
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();
Dataset ds = DatasetFactory.wrap(inf);
UpdateExecution uExec = UpdateExecution
//.model(inf)
.dataset(ds)
.update(updateString)
.build();
uExec.execute();
System.out.println("DONE");
}
Version
5.0.0
What happened?
Steps to Reproduce
curl -X POST 'http://localhost:3030/$/datasets' --upload-file ./dsConfigTemplate.ttl --header "Content-Type: text/turtle"
wheredsConfigTemplate.ttl
is:rdfs:range rdf:type rdf:Property , rdfs:Resource; rdfs:comment "A range of the subject property."; rdfs:domain rdf:Property; rdfs:isDefinedBy rdfs:; rdfs:label "range"; rdfs:range rdfs:Class; rdfs:seeAlso rdfs:; rdfs:subPropertyOf rdfs:range .
rdfs:subPropertyOf rdf:type rdf:Property , rdfs:Resource; rdfs:comment "The subject is a subproperty of a property."; rdfs:domain rdf:Property; rdfs:isDefinedBy rdfs:; rdfs:label "subPropertyOf"; rdfs:range rdf:Property; rdfs:seeAlso rdfs:; rdfs:subPropertyOf rdfs:subPropertyOf .
DELETE {?s ?p ?o} WHERE { VALUES ?s{ http://www.w3.org/2000/01/rdf-schema#range http://www.w3.org/2000/01/rdf-schema#subPropertyOf } ?s ?p ?o . }
Are you interested in making a pull request?
No