Skip to content

Commit

Permalink
GH-4993 check if null before using the removedStatementTarget
Browse files Browse the repository at this point in the history
  • Loading branch information
hmottestad committed May 30, 2024
1 parent 4626eec commit e6b2ab1
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ private PlanNode getAddedRemovedInner(ConnectionsGroup connectionsGroup, Resourc
dataGraph,
statementMatchers,
statementMatchers,
null, sparqlFragment,
null,
sparqlFragment,
vars,
scope,
false), false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public void calculateNextStatementMatcher() {
this.currentVarNames = currentStatementMatcher.getVarNames(varNames, removedStatement,
varNamesInQueryFragment);

assert !currentVarNames.isEmpty();
assert !currentVarNames.isEmpty() : "currentVarNames is empty!";

statements = connection.getStatements(
currentStatementMatcher.getSubjectValue(),
Expand Down Expand Up @@ -289,7 +289,7 @@ private List<BindingSet> readStatementsInBulk(Set<String> varNames) {
Statement next = statements.next();
Stream<EffectiveTarget.StatementsAndMatcher> rootStatements = Stream
.of(new EffectiveTarget.StatementsAndMatcher(List.of(next), currentStatementMatcher));
if (removedStatement) {
if (removedStatement && removedStatementTarget != null) {
Stream<EffectiveTarget.StatementsAndMatcher> root = removedStatementTarget.getRoot(
connectionsGroup,
dataGraph, currentStatementMatcher,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
PREFIX ex: <http://example.com/ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX sh: <http://www.w3.org/ns/shacl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

INSERT DATA {
ex:validPerson1 a ex:Person ;
rdfs:label "Jennifer";
ex:knows ex:peter.

ex:peter a ex:Person.

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
PREFIX ex: <http://example.com/ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX sh: <http://www.w3.org/ns/shacl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

DELETE DATA {
ex:validPerson1 a ex:Person .
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@prefix ex: <http://example.com/ns#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rsx: <http://rdf4j.org/shacl-extensions#> .
@prefix rdf4j: <http://rdf4j.org/schema/rdf4j#> .

[] a sh:ValidationReport;
rdf4j:truncated false;
sh:conforms true .
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
PREFIX ex: <http://example.com/ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX sh: <http://www.w3.org/ns/shacl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

INSERT DATA {
ex:validPerson1 a ex:Person ;
rdfs:label "Jennifer";
ex:knows ex:peter.

ex:peter a ex:Person.

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
PREFIX ex: <http://example.com/ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX sh: <http://www.w3.org/ns/shacl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

DELETE DATA {
ex:validPerson1 rdfs:label "Jennifer" .
ex:peter a ex:Person.
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@prefix ex: <http://example.com/ns#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rsx: <http://rdf4j.org/shacl-extensions#> .
@prefix rdf4j: <http://rdf4j.org/schema/rdf4j#> .

[] a sh:ValidationReport;
rdf4j:truncated false;
sh:conforms true .

0 comments on commit e6b2ab1

Please sign in to comment.