diff --git a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ShapeValidationContainer.java b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ShapeValidationContainer.java index 9f951a94bb1..9545135c8e9 100644 --- a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ShapeValidationContainer.java +++ b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ShapeValidationContainer.java @@ -16,9 +16,7 @@ import java.util.function.Supplier; import java.util.stream.Collectors; -import org.apache.commons.text.StringEscapeUtils; import org.eclipse.rdf4j.common.iteration.CloseableIteration; -import org.eclipse.rdf4j.sail.SailConnection; import org.eclipse.rdf4j.sail.SailException; import org.eclipse.rdf4j.sail.shacl.ast.Shape; import org.eclipse.rdf4j.sail.shacl.ast.planNodes.PlanNode; diff --git a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/StatementMatcher.java b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/StatementMatcher.java index ec04e8e02b5..68daca2381e 100644 --- a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/StatementMatcher.java +++ b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/StatementMatcher.java @@ -11,7 +11,9 @@ package org.eclipse.rdf4j.sail.shacl.ast; import java.util.ArrayList; +import java.util.Collections; import java.util.HashSet; +import java.util.LinkedHashSet; import java.util.List; import java.util.Objects; import java.util.Set; @@ -31,10 +33,10 @@ public class StatementMatcher { private final Variable predicate; private final Variable object; -// private final Set varNames; + // private final Set varNames; private final Targetable origin; - private final Set inheritedVarNames; + private Set inheritedVarNames; private List subset = List.of(); @@ -216,11 +218,17 @@ private static String formatForToString(String field, String name, Value value) private StatementMatcher swap(Variable existingVariable, Variable newVariable) { String subjectName = getSubjectName(); + String subjectBasename = getSubjectBasename(); Resource subjectValue = getSubjectValue(); + String predicateName = getPredicateName(); + String predicateBasename = getPredicateBasename(); IRI predicateValue = getPredicateValue(); + String objectName = getObjectName(); + String objectBasename = getObjectBasename(); Value objectValue = getObjectValue(); + boolean changed = false; if (Objects.equals(existingVariable.name, subjectName) @@ -228,6 +236,7 @@ private StatementMatcher swap(Variable existingVariable, Variable newVaria changed = true; subjectName = newVariable.name; subjectValue = (Resource) newVariable.value; + subjectBasename = newVariable.baseName; } if (Objects.equals(existingVariable.name, predicateName) @@ -235,18 +244,21 @@ private StatementMatcher swap(Variable existingVariable, Variable newVaria changed = true; predicateName = newVariable.name; predicateValue = (IRI) newVariable.value; + predicateBasename = newVariable.baseName; } if (Objects.equals(existingVariable.name, objectName) && Objects.equals(existingVariable.value, objectValue)) { changed = true; objectName = newVariable.name; objectValue = newVariable.value; + objectBasename = newVariable.baseName; } if (changed) { assert subset.isEmpty(); - return new StatementMatcher(new Variable<>(subjectName, subjectValue), - new Variable<>(predicateName, predicateValue), new Variable<>(objectName, objectValue), origin, + return new StatementMatcher(new Variable<>(subjectName, subjectValue, subjectBasename), + new Variable<>(predicateName, predicateValue, predicateBasename), + new Variable<>(objectName, objectValue, objectBasename), origin, inheritedVarNames); } return this; @@ -268,6 +280,10 @@ public String getSubjectName() { return subject.name; } + public String getSubjectBasename() { + return subject.baseName; + } + public Resource getSubjectValue() { return subject.value; } @@ -280,6 +296,10 @@ public String getPredicateName() { return predicate.name; } + public String getPredicateBasename() { + return predicate.baseName; + } + public IRI getPredicateValue() { return predicate.value; } @@ -292,6 +312,10 @@ public String getObjectName() { return object.name; } + public String getObjectBasename() { + return object.baseName; + } + public Value getObjectValue() { return object.value; } @@ -376,13 +400,13 @@ public String getSparqlValuesDecl(Set varNamesRestriction, boolean addIn return sb.toString(); } - public Set getVarNames(Set varNamesRestriction, boolean addInheritedVarNames, + public LinkedHashSet getVarNames(Set varNamesRestriction, boolean addInheritedVarNames, Set varNamesInQueryFragment) { if (varNamesRestriction.isEmpty()) { - return Set.of(); + return new LinkedHashSet<>(); } - HashSet ret = new HashSet<>(); + LinkedHashSet ret = new LinkedHashSet<>(); if (subject.name != null && varNamesRestriction.contains(subject.name) && varNamesInQueryFragment.contains(subject.name)) { ret.add(subject.name); @@ -462,6 +486,26 @@ public boolean hasObject(Variable variable) { return variable.name.equals(object.name); } + public Set getInheritedVarNames() { + return Set.copyOf(inheritedVarNames); + } + + public Set getVarNames() { + Set varNames = new HashSet<>(); + + if (subject.name != null) { + varNames.add(subject.name); + } + if (predicate.name != null) { + varNames.add(predicate.name); + } + if (object.name != null) { + varNames.add(object.name); + } + + return Collections.unmodifiableSet(varNames); + } + public static class StableRandomVariableProvider { // We just need a random base that isn't used elsewhere in the ShaclSail, but we don't want it to be stable so @@ -485,9 +529,12 @@ public StableRandomVariableProvider(String prefix) { * increments of one. * * @param inputQuery the query string that should be normalized + * @param union * @return a normalized query string */ - public static String normalize(String inputQuery) { + public static String normalize(String inputQuery, List protectedVars, + List union) { + if (!inputQuery.contains(BASE)) { return inputQuery; } @@ -513,18 +560,30 @@ public static String normalize(String inputQuery) { if (lowest == 0 && incrementsOfOne) { return inputQuery; } + String joinedProtectedVars = protectedVars.stream() + .map(Variable::getName) + .filter(Objects::nonNull) + .filter(s -> s.contains(BASE)) + .collect(Collectors.joining()); - return normalizeRange(inputQuery, lowest, highest); + return normalizeRange(inputQuery, lowest, highest, joinedProtectedVars, union); } - private static String normalizeRange(String inputQuery, int lowest, int highest) { + private static String normalizeRange(String inputQuery, int lowest, int highest, String joinedProtectedVars, + List union) { String normalizedQuery = inputQuery; for (int i = 0; i <= highest; i++) { - if (!normalizedQuery.contains(BASE + i + "_")) { + String replacement = BASE + i + "_"; + if (!normalizedQuery.contains(replacement)) { for (int j = Math.max(i + 1, lowest); j <= highest; j++) { - if (normalizedQuery.contains(BASE + j + "_")) { - normalizedQuery = normalizedQuery.replace(BASE + j + "_", BASE + i + "_"); + String original = BASE + j + "_"; + if (normalizedQuery.contains(original)) { + if (joinedProtectedVars.contains(original)) { + continue; + } + normalizedQuery = normalizedQuery.replace(original, replacement); + replaceInStatementMatcher(union, original, replacement); break; } } @@ -534,6 +593,13 @@ private static String normalizeRange(String inputQuery, int lowest, int highest) return normalizedQuery; } + private static void replaceInStatementMatcher(List statementMatchers, String original, + String replacement) { + for (StatementMatcher statementMatcher : statementMatchers) { + statementMatcher.replaceVariableName(original, replacement); + } + } + public Variable next() { counter++; @@ -552,6 +618,44 @@ public Variable current() { } } + private void replaceVariableName(String original, String replacement) { + + if (subject.name != null && subject.name.contains(original)) { + subject.name = subject.name.replace(original, replacement); + } + if (subject.baseName != null && subject.baseName.contains(original)) { + subject.baseName = subject.baseName.replace(original, replacement); + } + if (predicate.name != null && predicate.name.contains(original)) { + predicate.name = predicate.name.replace(original, replacement); + } + if (predicate.baseName != null && predicate.baseName.contains(original)) { + predicate.baseName = predicate.baseName.replace(original, replacement); + } + if (object.name != null && object.name.contains(original)) { + object.name = object.name.replace(original, replacement); + } + if (object.baseName != null && object.baseName.contains(original)) { + object.baseName = object.baseName.replace(original, replacement); + } + + boolean contains = false; + for (String inheritedVarName : inheritedVarNames) { + if (inheritedVarName.contains(original)) { + contains = true; + break; + } + } + if (contains) { + HashSet newInheritedVarNames = new HashSet<>(); + for (String inheritedVarName : inheritedVarNames) { + newInheritedVarNames.add(inheritedVarName.replace(original, replacement)); + } + inheritedVarNames = newInheritedVarNames; + } + + } + public static class Variable { public static final Variable VALUE = new Variable<>("value"); public static final Variable THIS = new Variable<>("this"); @@ -576,6 +680,12 @@ public Variable(Variable baseVariable, String name) { this.baseName = baseVariable.name; } + public Variable(String name, T value, String baseName) { + this.name = name; + this.value = value; + this.baseName = baseName; + } + public Variable(T value) { this.value = value; } diff --git a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/BindSelect.java b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/BindSelect.java index c0ad89dfab0..6f3a1ae607d 100644 --- a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/BindSelect.java +++ b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/BindSelect.java @@ -90,7 +90,7 @@ public BindSelect(SailConnection connection, Resource[] dataGraph, SparqlFragmen throw new IllegalStateException(); } - this.query = StatementMatcher.StableRandomVariableProvider.normalize(query.getFragment()); + this.query = StatementMatcher.StableRandomVariableProvider.normalize(query.getFragment(), vars, List.of()); this.prefixes = query.getNamespacesForSparql(); this.direction = direction; this.includePropertyShapeValues = includePropertyShapeValues; diff --git a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/BulkedExternalInnerJoin.java b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/BulkedExternalInnerJoin.java index c48e3ee02c6..4fa535418b1 100644 --- a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/BulkedExternalInnerJoin.java +++ b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/BulkedExternalInnerJoin.java @@ -13,6 +13,7 @@ import java.util.ArrayDeque; import java.util.LinkedHashMap; +import java.util.List; import java.util.Objects; import java.util.function.Function; @@ -25,7 +26,6 @@ import org.eclipse.rdf4j.query.algebra.TupleExpr; import org.eclipse.rdf4j.query.algebra.evaluation.iterator.PeekMarkIterator; import org.eclipse.rdf4j.sail.SailConnection; -import org.eclipse.rdf4j.sail.memory.MemoryStoreConnection; import org.eclipse.rdf4j.sail.shacl.ast.SparqlFragment; import org.eclipse.rdf4j.sail.shacl.ast.StatementMatcher; import org.eclipse.rdf4j.sail.shacl.ast.constraintcomponents.ConstraintComponent; @@ -67,7 +67,7 @@ public BulkedExternalInnerJoin(PlanNode leftNode, SailConnection connection, Res this.leftNode = PlanNodeHelper.handleSorting(this, leftNode, connectionsGroup); this.query = query.getNamespacesForSparql() + StatementMatcher.StableRandomVariableProvider - .normalize(query.getFragment()); + .normalize(query.getFragment(), List.of(), List.of()); this.connection = connection; assert this.connection != null; this.skipBasedOnPreviousConnection = skipBasedOnPreviousConnection; diff --git a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/BulkedExternalLeftOuterJoin.java b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/BulkedExternalLeftOuterJoin.java index 8ea6b629229..ef5689508df 100644 --- a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/BulkedExternalLeftOuterJoin.java +++ b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/BulkedExternalLeftOuterJoin.java @@ -12,6 +12,7 @@ package org.eclipse.rdf4j.sail.shacl.ast.planNodes; import java.util.ArrayDeque; +import java.util.List; import java.util.Objects; import java.util.function.Function; @@ -23,7 +24,6 @@ import org.eclipse.rdf4j.query.algebra.TupleExpr; import org.eclipse.rdf4j.query.algebra.evaluation.iterator.PeekMarkIterator; import org.eclipse.rdf4j.sail.SailConnection; -import org.eclipse.rdf4j.sail.memory.MemoryStoreConnection; import org.eclipse.rdf4j.sail.shacl.ast.SparqlFragment; import org.eclipse.rdf4j.sail.shacl.ast.StatementMatcher; import org.eclipse.rdf4j.sail.shacl.wrapper.data.ConnectionsGroup; @@ -51,7 +51,7 @@ public BulkedExternalLeftOuterJoin(PlanNode leftNode, SailConnection connection, leftNode = PlanNodeHelper.handleSorting(this, leftNode, connectionsGroup); this.leftNode = leftNode; this.query = query.getNamespacesForSparql() - + StatementMatcher.StableRandomVariableProvider.normalize(query.getFragment()); + + StatementMatcher.StableRandomVariableProvider.normalize(query.getFragment(), List.of(), List.of()); this.connection = connection; assert this.connection != null; this.mapper = mapper; diff --git a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/ExternalFilterByQuery.java b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/ExternalFilterByQuery.java index 274533ebc25..81f558766a5 100644 --- a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/ExternalFilterByQuery.java +++ b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/ExternalFilterByQuery.java @@ -11,6 +11,7 @@ package org.eclipse.rdf4j.sail.shacl.ast.planNodes; +import java.util.List; import java.util.Objects; import java.util.function.BiFunction; import java.util.function.Function; @@ -59,15 +60,15 @@ public ExternalFilterByQuery(SailConnection connection, Resource[] dataGraph, Pl if (map != null) { this.queryString = queryFragment.getNamespacesForSparql() + StatementMatcher.StableRandomVariableProvider.normalize("SELECT * " - + " WHERE {\n" + queryFragment.getFragment() + "\n}"); + + " WHERE {\n" + queryFragment.getFragment() + "\n}", List.of(queryVariable), List.of()); } else { this.queryString = queryFragment.getNamespacesForSparql() + StatementMatcher.StableRandomVariableProvider .normalize("SELECT " + queryVariable.asSparqlVariable() - + " WHERE {\n" + queryFragment.getFragment() + "\n}"); + + " WHERE {\n" + queryFragment.getFragment() + "\n}", List.of(queryVariable), + List.of()); } - try { this.query = SparqlQueryParserCache.get(queryString); } catch (MalformedQueryException e) { diff --git a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/Formatter.java b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/Formatter.java index 6628f3d0988..e6f182190ea 100644 --- a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/Formatter.java +++ b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/Formatter.java @@ -19,7 +19,6 @@ import org.eclipse.rdf4j.model.vocabulary.DCAT; import org.eclipse.rdf4j.model.vocabulary.FOAF; import org.eclipse.rdf4j.model.vocabulary.RDF; -import org.eclipse.rdf4j.model.vocabulary.RDFS; import org.eclipse.rdf4j.model.vocabulary.SHACL; import org.eclipse.rdf4j.model.vocabulary.XSD; diff --git a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/PlanNode.java b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/PlanNode.java index 99cd22d3fa1..919d39323f0 100644 --- a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/PlanNode.java +++ b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/PlanNode.java @@ -15,11 +15,8 @@ import java.util.Set; import org.eclipse.rdf4j.common.iteration.CloseableIteration; -import org.eclipse.rdf4j.model.IRI; import org.eclipse.rdf4j.model.Resource; import org.eclipse.rdf4j.model.Value; -import org.eclipse.rdf4j.model.vocabulary.FOAF; -import org.eclipse.rdf4j.model.vocabulary.RDF; /** * @author HÃ¥vard Mikkelsen Ottestad diff --git a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/Select.java b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/Select.java index f8fb2a63bc5..157869cbc0d 100644 --- a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/Select.java +++ b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/Select.java @@ -11,6 +11,7 @@ package org.eclipse.rdf4j.sail.shacl.ast.planNodes; +import java.util.List; import java.util.Objects; import java.util.function.Function; @@ -65,10 +66,11 @@ public Select(SailConnection connection, SparqlFragment queryFragment, String or if (!sorted && fragment.trim().startsWith("select ")) { this.query = queryFragment.getNamespacesForSparql() + "\n" - + StatementMatcher.StableRandomVariableProvider.normalize(fragment); + + StatementMatcher.StableRandomVariableProvider.normalize(fragment, List.of(), List.of()); } else { this.query = queryFragment.getNamespacesForSparql() + "\n" + StatementMatcher.StableRandomVariableProvider - .normalize("select * where {\n" + fragment + "\n}" + (sorted ? " order by " + orderBy : "")); + .normalize("select * where {\n" + fragment + "\n}" + (sorted ? " order by " + orderBy : ""), + List.of(), List.of()); } dataset = PlanNodeHelper.asDefaultGraphDataset(dataGraph); @@ -85,7 +87,7 @@ public Select(SailConnection connection, String query, Function(vars); - vars.add(optional.var); - } + var vars = getVars(includePropertyShapeValues); List varNames = vars.stream().map(StatementMatcher.Variable::getName).collect(Collectors.toList()); @@ -155,7 +152,26 @@ public PlanNode extend(PlanNode source, ConnectionsGroup connectionsGroup, Resou } } - private List> getVars() { + private List> getVars(boolean optional) { + int chainSize = chain.size(); + if (chainSize == 1) { + if (optional) { + return List.of(chain.getFirst().var, this.optional.var); + } else { + return List.of(chain.getFirst().var); + } + } else if (chainSize == 2) { + if (optional) { + return List.of(chain.getFirst().var, chain.getLast().var, this.optional.var); + } else { + return List.of(chain.getFirst().var, chain.getLast().var); + } + } + + if (optional) { + return Stream.concat(chain.stream(), Stream.of(this.optional)).map(t -> t.var).collect(Collectors.toList()); + } + return chain.stream().map(t -> t.var).collect(Collectors.toList()); } @@ -223,7 +239,7 @@ public boolean couldMatch(ConnectionsGroup connectionsGroup, Resource[] dataGrap public PlanNode getAllTargets(ConnectionsGroup connectionsGroup, Resource[] dataGraph, ConstraintComponent.Scope scope) { - return new AllTargetsPlanNode(connectionsGroup.getBaseConnection(), dataGraph, chain, getVars(), scope); + return new AllTargetsPlanNode(connectionsGroup.getBaseConnection(), dataGraph, chain, getVars(false), scope); } public PlanNode getPlanNode(ConnectionsGroup connectionsGroup, Resource[] dataGraph, @@ -289,7 +305,7 @@ public PlanNode getPlanNode(ConnectionsGroup connectionsGroup, Resource[] dataGr statementMatchersRemoval, optional, fragment, - getVars(), + getVars(false), scope, false); } else { @@ -300,14 +316,14 @@ public PlanNode getPlanNode(ConnectionsGroup connectionsGroup, Resource[] dataGr null, null, fragment, - getVars(), + getVars(false), scope, false); } } else { targetsPlanNode = new AllTargetsPlanNode(connectionsGroup.getBaseConnection(), dataGraph, chain, - getVars(), scope); + getVars(false), scope); } @@ -489,13 +505,9 @@ public Stream getRoot(ConnectionsGroup connectionsGroup, R if (target instanceof Path) { Path path = (Path) target; assert !(path instanceof InversePath); - Stream root = queryFragment.getRoot(connectionsGroup, dataGraph, path, + return queryFragment.getRoot(connectionsGroup, dataGraph, path, currentStatementMatcher, List.of(currentStatement)); - - List collect = root.collect(Collectors.toList()); - - return collect.stream(); } throw new UnsupportedOperationException(); @@ -527,6 +539,14 @@ public StatementMatcher getStatementMatcher() { public boolean hasStatements() { return !statements.isEmpty(); } + + @Override + public String toString() { + return "StatementsAndMatcher{" + + "statements=" + Arrays.toString(statements.toArray()) + + ", statementMatcher=" + statementMatcher + + '}'; + } } static class ActiveTargetTupleMapper implements Function { diff --git a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/targets/TargetChainRetriever.java b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/targets/TargetChainRetriever.java index eaa5af256e1..767b7a7a377 100644 --- a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/targets/TargetChainRetriever.java +++ b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/targets/TargetChainRetriever.java @@ -14,6 +14,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; +import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Objects; @@ -80,8 +81,10 @@ public class TargetChainRetriever implements PlanNode { private final EffectiveTarget.EffectiveTargetFragment removedStatementTarget; private final boolean hasValue; private final Set varNamesInQueryFragment; + private final Set originalStatementMatchers; private StackTraceElement[] stackTrace; + private ValidationExecutionLogger validationExecutionLogger; public TargetChainRetriever(ConnectionsGroup connectionsGroup, @@ -94,7 +97,19 @@ public TargetChainRetriever(ConnectionsGroup connectionsGroup, this.varNames = vars.stream().map(StatementMatcher.Variable::getName).collect(Collectors.toSet()); assert !this.varNames.isEmpty(); this.dataset = PlanNodeHelper.asDefaultGraphDataset(this.dataGraph); + + var union = statementMatchers; + if (removedStatementMatchers != null) { + union = new ArrayList<>(statementMatchers); + union.addAll(removedStatementMatchers); + } + + this.queryFragment = queryFragment.getNamespacesForSparql() + + StatementMatcher.StableRandomVariableProvider.normalize(queryFragment.getFragment(), vars, union); + + this.originalStatementMatchers = new HashSet<>(statementMatchers); this.statementMatchers = StatementMatcher.reduce(statementMatchers); + assert originalStatementMatchers.containsAll(this.statementMatchers); this.scope = scope; @@ -103,11 +118,6 @@ public TargetChainRetriever(ConnectionsGroup connectionsGroup, .reduce((a, b) -> a + " " + b) .orElseThrow(IllegalStateException::new); - this.queryFragment = queryFragment.getNamespacesForSparql() - + StatementMatcher.StableRandomVariableProvider.normalize(queryFragment.getFragment()); - -// this.stackTrace = Thread.currentThread().getStackTrace(); - this.queryParserFactory = QueryParserRegistry.getInstance() .get(QueryLanguage.SPARQL) .get(); @@ -123,12 +133,17 @@ public TargetChainRetriever(ConnectionsGroup connectionsGroup, ? StatementMatcher.reduce(removedStatementMatchers) : Collections.emptyList(); + assert removedStatementMatchers == null || removedStatementMatchers.containsAll(this.removedStatementMatchers); + this.removedStatementTarget = removedStatementTarget; this.hasValue = hasValue; assert scope == ConstraintComponent.Scope.propertyShape || !this.hasValue; + if (logger.isDebugEnabled()) { + this.stackTrace = Thread.currentThread().getStackTrace(); + } } @Override @@ -197,12 +212,19 @@ public void calculateNextStatementMatcher() { removedStatement = true; } - this.sparqlValuesDecl = currentStatementMatcher.getSparqlValuesDecl(varNames, removedStatement, + // we need to add the inherited names if we are going to chase the root of the + // currentStatementMatcher later + boolean addInherited = chaseRoot(); + + this.sparqlValuesDecl = currentStatementMatcher.getSparqlValuesDecl(varNames, addInherited, varNamesInQueryFragment); - this.currentVarNames = currentStatementMatcher.getVarNames(varNames, removedStatement, + this.currentVarNames = currentStatementMatcher.getVarNames(varNames, addInherited, varNamesInQueryFragment); - assert !currentVarNames.isEmpty() : "currentVarNames is empty!"; + if (currentVarNames.isEmpty()) { + logger.error("currentVarNames should not be empty!"); + throw new IllegalStateException("currentVarNames should not be empty!"); + } statements = connection.getStatements( currentStatementMatcher.getSubjectValue(), @@ -215,6 +237,11 @@ public void calculateNextStatementMatcher() { } + private boolean chaseRoot() { + return removedStatementTarget != null && removedStatement + && !originalStatementMatchers.contains(currentStatementMatcher); + } + private void calculateNextResult() { if (next != null) { return; @@ -280,18 +307,21 @@ private void calculateNextResult() { } - private List readStatementsInBulk(Set varNames) { + private List readStatementsInBulk(Set variableNames) { bulk.clear(); while (bulk.size() < BULK_SIZE && statements.hasNext()) { Statement next = statements.next(); Stream rootStatements = Stream .of(new EffectiveTarget.StatementsAndMatcher(List.of(next), currentStatementMatcher)); - if (removedStatement && removedStatementTarget != null) { + if (chaseRoot()) { + // we only need to find the root if the currentStatementMatcher doesn't match anything in the + // query Stream root = removedStatementTarget.getRoot( connectionsGroup, dataGraph, currentStatementMatcher, next); + if (root != null) { rootStatements = root; } @@ -306,7 +336,7 @@ private List readStatementsInBulk(Set varNames) { return statementsAndMatcher.getStatements() .stream() .map(temp -> { - Binding[] bindings = new Binding[varNames.size()]; + Binding[] bindings = new Binding[variableNames.size()]; int j = 0; if (newCurrentStatementMatcher.getSubjectValue() == null @@ -337,7 +367,7 @@ private List readStatementsInBulk(Set varNames) { bindings[0].getValue()); } else { - return new SimpleBindingSet(varNames, bindings); + return new SimpleBindingSet(variableNames, bindings); } }); diff --git a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/targets/TargetClass.java b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/targets/TargetClass.java index d022824d379..0036591c91b 100644 --- a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/targets/TargetClass.java +++ b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/targets/TargetClass.java @@ -97,7 +97,7 @@ String getQueryFragment(String subjectVariable, String objectVariable, "{", "BIND(rdf:type as " + stableRandomVariableProvider.next().asSparqlVariable() + ")", "BIND(" + r + " as " + objectVariable + ")", - "" + subjectVariable + " " + stableRandomVariableProvider.current().asSparqlVariable() + subjectVariable + " " + stableRandomVariableProvider.current().asSparqlVariable() + objectVariable + ".", "}" ) diff --git a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/wrapper/data/ConnectionsGroup.java b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/wrapper/data/ConnectionsGroup.java index 5e8ecba0743..38461cb1edf 100644 --- a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/wrapper/data/ConnectionsGroup.java +++ b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/wrapper/data/ConnectionsGroup.java @@ -16,7 +16,6 @@ import org.eclipse.rdf4j.common.annotation.InternalUseOnly; import org.eclipse.rdf4j.common.transaction.IsolationLevels; -import org.eclipse.rdf4j.model.Resource; import org.eclipse.rdf4j.sail.Sail; import org.eclipse.rdf4j.sail.SailConnection; import org.eclipse.rdf4j.sail.shacl.ShaclSailConnection; @@ -28,8 +27,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.google.common.cache.Cache; - /** * @apiNote since 3.0. This feature is for internal use only: its existence, signature or behavior may change without * warning from one release to the next. diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/AbstractShaclTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/AbstractShaclTest.java index 9392cbf043d..f62d336424d 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/AbstractShaclTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/AbstractShaclTest.java @@ -11,6 +11,7 @@ package org.eclipse.rdf4j.sail.shacl; +import static org.junit.jupiter.api.parallel.ExecutionMode.CONCURRENT; import static org.junit.jupiter.params.provider.Arguments.arguments; import java.io.File; @@ -83,6 +84,7 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.parallel.Execution; import org.junit.jupiter.api.parallel.Isolated; import org.junit.jupiter.params.provider.Arguments; import org.slf4j.Logger; @@ -115,7 +117,7 @@ abstract public class AbstractShaclTest { "test-cases/path/zeroOrOnePath" ); - public static final Set ISOLATION_LEVELS = Set.of( + public static final List ISOLATION_LEVELS = List.of( IsolationLevels.NONE, IsolationLevels.SNAPSHOT, IsolationLevels.SERIALIZABLE @@ -222,7 +224,7 @@ private static Stream findTestCases(String testCase, ExpectedResult ba if (files != null) { Optional initialData = Arrays.stream(files) .map(File::getName) - .filter(name -> name.equals("initialData.ttl")) + .filter(name -> name.equals("initialData.trig")) .findAny(); List queries = Arrays.stream(files) .filter(f -> f.getName().endsWith(".rq")) @@ -553,16 +555,21 @@ void referenceImplementationTestCaseValidation(TestCase testCase) { return; } - // uses rsx:nodeShape + // uses rsx:targetShape if (testCase.testCasePath.startsWith("test-cases/qualifiedShape/complex/")) { return; } - // uses rsx:nodeShape + // uses rsx:targetShape if (testCase.testCasePath.startsWith("test-cases/complex/targetShapeAndQualifiedShape/")) { return; } + // uses rsx:targetShape + if (testCase.testCasePath.startsWith("test-cases/path/sequencePathTargetShape")) { + return; + } + // sh:shapesGraph if (testCase.testCasePath.startsWith("test-cases/datatype/simpleNamedGraph/")) { return; @@ -1067,7 +1074,13 @@ void runParsingTest(TestCase testCase) { return; } - SailRepository shaclRepository = getShaclSail(testCase); + SailRepository shaclRepository; + try { + shaclRepository = getShaclSail(testCase); + } catch (Exception e) { + System.err.println(testCase.getTestCasePath() + "shacl.trig"); + throw e; + } try { List shapes = ((ShaclSail) shaclRepository.getSail()).getCachedShapes() diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/Utils.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/Utils.java index a64f42077f3..a72a41c0196 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/Utils.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/Utils.java @@ -12,6 +12,7 @@ package org.eclipse.rdf4j.sail.shacl; import java.io.BufferedInputStream; +import java.io.File; import java.io.IOException; import java.io.InputStream; import java.net.URL; @@ -137,7 +138,7 @@ public static void loadInitialData(SailRepository repo, String resourceName) thr try (RepositoryConnection conn = repo.getConnection()) { conn.begin(IsolationLevels.NONE, ShaclSail.TransactionSettings.ValidationApproach.Disabled); - conn.add(initialData, "", RDFFormat.TURTLE); + conn.add(initialData, "", RDFFormat.TRIG); conn.commit(); } } diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ast/targets/StableQueryGenerationTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ast/targets/StableQueryGenerationTest.java index e4f68e5b36c..04f7ab0033a 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ast/targets/StableQueryGenerationTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ast/targets/StableQueryGenerationTest.java @@ -71,22 +71,28 @@ public void testNormalizationOfQuery() { }; String test1 = names[4] + names[4] + names[9]; - assertEquals(names[0] + names[0] + names[1], StatementMatcher.StableRandomVariableProvider.normalize(test1)); + assertEquals(names[0] + names[0] + names[1], + StatementMatcher.StableRandomVariableProvider.normalize(test1, List.of(), List.of())); String test2 = names[9] + names[4] + names[9]; - assertEquals(names[1] + names[0] + names[1], StatementMatcher.StableRandomVariableProvider.normalize(test2)); + assertEquals(names[1] + names[0] + names[1], + StatementMatcher.StableRandomVariableProvider.normalize(test2, List.of(), List.of())); String test3 = names[0] + names[1] + names[2]; - assertEquals(names[0] + names[1] + names[2], StatementMatcher.StableRandomVariableProvider.normalize(test3)); + assertEquals(names[0] + names[1] + names[2], + StatementMatcher.StableRandomVariableProvider.normalize(test3, List.of(), List.of())); String test4 = names[1] + names[2] + names[3]; - assertEquals(names[0] + names[1] + names[2], StatementMatcher.StableRandomVariableProvider.normalize(test4)); + assertEquals(names[0] + names[1] + names[2], + StatementMatcher.StableRandomVariableProvider.normalize(test4, List.of(), List.of())); String test5 = names[2] + names[4] + names[8]; - assertEquals(names[0] + names[1] + names[2], StatementMatcher.StableRandomVariableProvider.normalize(test5)); + assertEquals(names[0] + names[1] + names[2], + StatementMatcher.StableRandomVariableProvider.normalize(test5, List.of(), List.of())); String test6 = names[8] + names[4] + names[2]; - assertEquals(names[2] + names[1] + names[0], StatementMatcher.StableRandomVariableProvider.normalize(test6)); + assertEquals(names[2] + names[1] + names[0], + StatementMatcher.StableRandomVariableProvider.normalize(test6, List.of(), List.of())); } diff --git a/core/sail/shacl/src/test/resources/test-cases/class/simple/invalid/case10/initialData.ttl b/core/sail/shacl/src/test/resources/test-cases/class/simple/invalid/case10/initialData.trig similarity index 100% rename from core/sail/shacl/src/test/resources/test-cases/class/simple/invalid/case10/initialData.ttl rename to core/sail/shacl/src/test/resources/test-cases/class/simple/invalid/case10/initialData.trig diff --git a/core/sail/shacl/src/test/resources/test-cases/class/simpleNested/invalid/case10/initialData.ttl b/core/sail/shacl/src/test/resources/test-cases/class/simpleNested/invalid/case10/initialData.trig similarity index 100% rename from core/sail/shacl/src/test/resources/test-cases/class/simpleNested/invalid/case10/initialData.ttl rename to core/sail/shacl/src/test/resources/test-cases/class/simpleNested/invalid/case10/initialData.trig diff --git a/core/sail/shacl/src/test/resources/test-cases/class/simpleNested/invalid/case11/initialData.ttl b/core/sail/shacl/src/test/resources/test-cases/class/simpleNested/invalid/case11/initialData.trig similarity index 100% rename from core/sail/shacl/src/test/resources/test-cases/class/simpleNested/invalid/case11/initialData.ttl rename to core/sail/shacl/src/test/resources/test-cases/class/simpleNested/invalid/case11/initialData.trig diff --git a/core/sail/shacl/src/test/resources/test-cases/class/simpleNested/invalid/case12/initialData.ttl b/core/sail/shacl/src/test/resources/test-cases/class/simpleNested/invalid/case12/initialData.trig similarity index 100% rename from core/sail/shacl/src/test/resources/test-cases/class/simpleNested/invalid/case12/initialData.ttl rename to core/sail/shacl/src/test/resources/test-cases/class/simpleNested/invalid/case12/initialData.trig diff --git a/core/sail/shacl/src/test/resources/test-cases/class/subclass/invalid/case7/initialData.ttl b/core/sail/shacl/src/test/resources/test-cases/class/subclass/invalid/case7/initialData.trig similarity index 100% rename from core/sail/shacl/src/test/resources/test-cases/class/subclass/invalid/case7/initialData.ttl rename to core/sail/shacl/src/test/resources/test-cases/class/subclass/invalid/case7/initialData.trig diff --git a/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd/invalid/case5/initialData.ttl b/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd/invalid/case5/initialData.trig similarity index 100% rename from core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd/invalid/case5/initialData.ttl rename to core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd/invalid/case5/initialData.trig diff --git a/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd/invalid/case6/initialData.ttl b/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd/invalid/case6/initialData.trig similarity index 100% rename from core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd/invalid/case6/initialData.ttl rename to core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd/invalid/case6/initialData.trig diff --git a/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd/invalid/case7/initialData.ttl b/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd/invalid/case7/initialData.trig similarity index 100% rename from core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd/invalid/case7/initialData.ttl rename to core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd/invalid/case7/initialData.trig diff --git a/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd2/invalid/case2/initialData.ttl b/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd2/invalid/case2/initialData.trig similarity index 100% rename from core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd2/invalid/case2/initialData.ttl rename to core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd2/invalid/case2/initialData.trig diff --git a/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd2/invalid/case3/initialData.ttl b/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd2/invalid/case3/initialData.trig similarity index 100% rename from core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd2/invalid/case3/initialData.ttl rename to core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd2/invalid/case3/initialData.trig diff --git a/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd3/invalid/case3/query1.rq b/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd3/invalid/case3/query1.rq index 6788d7401bb..57c5d70a7a4 100644 --- a/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd3/invalid/case3/query1.rq +++ b/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd3/invalid/case3/query1.rq @@ -5,6 +5,6 @@ PREFIX rdfs: PREFIX sh: PREFIX xsd: -DELETE DATA { - ex:validPerson1 ex:info "red" . +INSERT DATA { + ex:validPerson1 ex:info "blue", "red" . } diff --git a/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd3/invalid/case3/query2.rq b/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd3/invalid/case3/query2.rq new file mode 100644 index 00000000000..6788d7401bb --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd3/invalid/case3/query2.rq @@ -0,0 +1,10 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +DELETE DATA { + ex:validPerson1 ex:info "red" . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd3/invalid/case3/initialData.ttl b/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd3/invalid/case4/initialData.trig similarity index 100% rename from core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd3/invalid/case3/initialData.ttl rename to core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd3/invalid/case4/initialData.trig diff --git a/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd3/invalid/case4/query1.rq b/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd3/invalid/case4/query1.rq new file mode 100644 index 00000000000..6788d7401bb --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd3/invalid/case4/query1.rq @@ -0,0 +1,10 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +DELETE DATA { + ex:validPerson1 ex:info "red" . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd3/invalid/case4/report.ttl b/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd3/invalid/case4/report.ttl new file mode 100644 index 00000000000..b2db3f94dfc --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd3/invalid/case4/report.ttl @@ -0,0 +1,23 @@ +@prefix ex: . +@prefix foaf: . +@prefix xsd: . +@prefix sh: . +@prefix rdf: . +@prefix rdfs: . +@prefix rsx: . +@prefix rdf4j: . + +[] a sh:ValidationReport; + rdf4j:truncated false; + sh:conforms false; + sh:result [ a sh:ValidationResult; + rsx:shapesGraph rdf4j:SHACLShapeGraph; + sh:focusNode ex:validPerson1; + sh:resultPath ex:info2; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:MinCountConstraintComponent; + sh:sourceShape [ a sh:PropertyShape; + sh:minCount 1; + sh:path ex:info2 + ] + ] . diff --git a/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd3/valid/case1/initialData.ttl b/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd3/valid/case1/initialData.trig similarity index 100% rename from core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd3/valid/case1/initialData.ttl rename to core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd3/valid/case1/initialData.trig diff --git a/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd3/valid/case2/initialData.ttl b/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd3/valid/case2/initialData.trig similarity index 100% rename from core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd3/valid/case2/initialData.ttl rename to core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd3/valid/case2/initialData.trig diff --git a/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd3/valid/case3/initialData.ttl b/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd3/valid/case3/initialData.trig similarity index 100% rename from core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd3/valid/case3/initialData.ttl rename to core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAnd3/valid/case3/initialData.trig diff --git a/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAndOr/invalid/case2/initialData.ttl b/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAndOr/invalid/case2/initialData.trig similarity index 100% rename from core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAndOr/invalid/case2/initialData.ttl rename to core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAndOr/invalid/case2/initialData.trig diff --git a/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAndOr/invalid/case3/initialData.ttl b/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAndOr/invalid/case3/initialData.trig similarity index 100% rename from core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAndOr/invalid/case3/initialData.ttl rename to core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAndOr/invalid/case3/initialData.trig diff --git a/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAndOr2/valid/case1/initialData.ttl b/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAndOr2/valid/case1/initialData.trig similarity index 100% rename from core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAndOr2/valid/case1/initialData.ttl rename to core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAndOr2/valid/case1/initialData.trig diff --git a/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAndOr2/valid/case2/initialData.ttl b/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAndOr2/valid/case2/initialData.trig similarity index 100% rename from core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAndOr2/valid/case2/initialData.ttl rename to core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAndOr2/valid/case2/initialData.trig diff --git a/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAndOr3/invalid/case2/initialData.ttl b/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAndOr3/invalid/case2/initialData.trig similarity index 100% rename from core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAndOr3/invalid/case2/initialData.ttl rename to core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAndOr3/invalid/case2/initialData.trig diff --git a/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAndOr3/invalid/case3/initialData.ttl b/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAndOr3/invalid/case3/initialData.trig similarity index 100% rename from core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAndOr3/invalid/case3/initialData.ttl rename to core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAndOr3/invalid/case3/initialData.trig diff --git a/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAndOr3/invalid/case4/initialData.ttl b/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAndOr3/invalid/case4/initialData.trig similarity index 100% rename from core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAndOr3/invalid/case4/initialData.ttl rename to core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeAndOr3/invalid/case4/initialData.trig diff --git a/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeOr/invalid/case4/initialData.ttl b/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeOr/invalid/case4/initialData.trig similarity index 100% rename from core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeOr/invalid/case4/initialData.ttl rename to core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeOr/invalid/case4/initialData.trig diff --git a/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeOr/invalid/case5/initialData.ttl b/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeOr/invalid/case5/initialData.trig similarity index 100% rename from core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeOr/invalid/case5/initialData.ttl rename to core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeOr/invalid/case5/initialData.trig diff --git a/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeOr/invalid/case6/initialData.ttl b/core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeOr/invalid/case6/initialData.trig similarity index 100% rename from core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeOr/invalid/case6/initialData.ttl rename to core/sail/shacl/src/test/resources/test-cases/hasValue/targetShapeOr/invalid/case6/initialData.trig diff --git a/core/sail/shacl/src/test/resources/test-cases/maxCount/notNot/invalid/case4/initialData.ttl b/core/sail/shacl/src/test/resources/test-cases/maxCount/notNot/invalid/case4/initialData.trig similarity index 100% rename from core/sail/shacl/src/test/resources/test-cases/maxCount/notNot/invalid/case4/initialData.ttl rename to core/sail/shacl/src/test/resources/test-cases/maxCount/notNot/invalid/case4/initialData.trig diff --git a/core/sail/shacl/src/test/resources/test-cases/minCount/targetNode/invalid/case1/initialData.ttl b/core/sail/shacl/src/test/resources/test-cases/minCount/targetNode/invalid/case1/initialData.trig similarity index 100% rename from core/sail/shacl/src/test/resources/test-cases/minCount/targetNode/invalid/case1/initialData.ttl rename to core/sail/shacl/src/test/resources/test-cases/minCount/targetNode/invalid/case1/initialData.trig diff --git a/core/sail/shacl/src/test/resources/test-cases/minCount/targetNode/invalid/case2/initialData.ttl b/core/sail/shacl/src/test/resources/test-cases/minCount/targetNode/invalid/case2/initialData.trig similarity index 100% rename from core/sail/shacl/src/test/resources/test-cases/minCount/targetNode/invalid/case2/initialData.ttl rename to core/sail/shacl/src/test/resources/test-cases/minCount/targetNode/invalid/case2/initialData.trig diff --git a/core/sail/shacl/src/test/resources/test-cases/minCount/targetNode/valid/case1/initialData.ttl b/core/sail/shacl/src/test/resources/test-cases/minCount/targetNode/valid/case1/initialData.trig similarity index 100% rename from core/sail/shacl/src/test/resources/test-cases/minCount/targetNode/valid/case1/initialData.ttl rename to core/sail/shacl/src/test/resources/test-cases/minCount/targetNode/valid/case1/initialData.trig diff --git a/core/sail/shacl/src/test/resources/test-cases/minCount/targetNode/valid/case2/initialData.ttl b/core/sail/shacl/src/test/resources/test-cases/minCount/targetNode/valid/case2/initialData.trig similarity index 100% rename from core/sail/shacl/src/test/resources/test-cases/minCount/targetNode/valid/case2/initialData.ttl rename to core/sail/shacl/src/test/resources/test-cases/minCount/targetNode/valid/case2/initialData.trig diff --git a/core/sail/shacl/src/test/resources/test-cases/minCount/targetNode/valid/case3/initialData.ttl b/core/sail/shacl/src/test/resources/test-cases/minCount/targetNode/valid/case3/initialData.trig similarity index 100% rename from core/sail/shacl/src/test/resources/test-cases/minCount/targetNode/valid/case3/initialData.ttl rename to core/sail/shacl/src/test/resources/test-cases/minCount/targetNode/valid/case3/initialData.trig diff --git a/core/sail/shacl/src/test/resources/test-cases/minCount/targetNode/valid/case4/initialData.ttl b/core/sail/shacl/src/test/resources/test-cases/minCount/targetNode/valid/case4/initialData.trig similarity index 100% rename from core/sail/shacl/src/test/resources/test-cases/minCount/targetNode/valid/case4/initialData.ttl rename to core/sail/shacl/src/test/resources/test-cases/minCount/targetNode/valid/case4/initialData.trig diff --git a/core/sail/shacl/src/test/resources/test-cases/minCount/targetNode/valid/case5/initialData.ttl b/core/sail/shacl/src/test/resources/test-cases/minCount/targetNode/valid/case5/initialData.trig similarity index 100% rename from core/sail/shacl/src/test/resources/test-cases/minCount/targetNode/valid/case5/initialData.ttl rename to core/sail/shacl/src/test/resources/test-cases/minCount/targetNode/valid/case5/initialData.trig diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/invalid/case1/query1.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/invalid/case1/query1.rq new file mode 100644 index 00000000000..c2c9cb98c5d --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/invalid/case1/query1.rq @@ -0,0 +1,24 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + + ex:person1 a ex:Person. + + ex:person1 ex:knows1 ex:person2 . + ex:person2 ex:knows2 ex:person3 . + ex:person3 ex:knows3 ex:person4 . + ex:person4 ex:knows4 ex:person5 . + ex:person5 ex:knows5 ex:person6 . + ex:person6 ex:knows6 ex:person7 . + ex:person7 ex:knows7 ex:person8 . + ex:person8 ex:knows8 ex:person9 . + ex:person9 ex:knows9 ex:person10 . + ex:person10 ex:knows10 ex:person11 . + ex:person11 rdf:type ex:NotPerson . + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/invalid/case1/report.ttl b/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/invalid/case1/report.ttl new file mode 100644 index 00000000000..02e72e7242e --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/invalid/case1/report.ttl @@ -0,0 +1,26 @@ +@prefix ex: . +@prefix foaf: . +@prefix xsd: . +@prefix sh: . +@prefix rdf: . +@prefix rdfs: . +@prefix rsx: . +@prefix rdf4j: . + +[] a sh:ValidationReport; + rdf4j:truncated false; + sh:conforms false; + sh:result [ a sh:ValidationResult; + rsx:shapesGraph rdf4j:SHACLShapeGraph; + sh:focusNode ex:person6; + sh:resultPath _:dc6027fb6bea4bc5aa60e7ed606c2db116354; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:HasValueConstraintComponent; + sh:sourceShape [ a sh:PropertyShape; + sh:hasValue ex:Person; + sh:path _:dc6027fb6bea4bc5aa60e7ed606c2db116354 + ] + ] . + +_:dc6027fb6bea4bc5aa60e7ed606c2db116354 rdf:first ex:knows6; + rdf:rest (ex:knows7 ex:knows8 ex:knows9 ex:knows10 rdf:type) . diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/invalid/case2/query1.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/invalid/case2/query1.rq new file mode 100644 index 00000000000..f93b3de9bf4 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/invalid/case2/query1.rq @@ -0,0 +1,23 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + + ex:person1 a ex:Person. + + ex:person1 ex:knows1 ex:person2 . + ex:person2 ex:knows2 ex:person3 . + ex:person3 ex:knows3 ex:person4 . + ex:person4 ex:knows4 ex:person5 . + ex:person5 ex:knows5 ex:person6 . + ex:person6 ex:knows6 ex:person7 . + ex:person7 ex:knows7 ex:person8 . + ex:person8 ex:knows8 ex:person9 . + ex:person9 ex:knows9 ex:person10 . + ex:person10 ex:knows10 ex:person11 . + ex:person11 rdf:type ex:Person . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/invalid/case2/query2.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/invalid/case2/query2.rq new file mode 100644 index 00000000000..ebd96286f23 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/invalid/case2/query2.rq @@ -0,0 +1,10 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +DELETE DATA { + ex:person8 ex:knows8 ex:person9 . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/invalid/case2/report.ttl b/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/invalid/case2/report.ttl new file mode 100644 index 00000000000..69338383780 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/invalid/case2/report.ttl @@ -0,0 +1,26 @@ +@prefix ex: . +@prefix foaf: . +@prefix xsd: . +@prefix sh: . +@prefix rdf: . +@prefix rdfs: . +@prefix rsx: . +@prefix rdf4j: . + +[] a sh:ValidationReport; + rdf4j:truncated false; + sh:conforms false; + sh:result [ a sh:ValidationResult; + rsx:shapesGraph rdf4j:SHACLShapeGraph; + sh:focusNode ex:person6; + sh:resultPath _:dc6027fb6bea4bc5aa60e7ed606c2db116373; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:HasValueConstraintComponent; + sh:sourceShape [ a sh:PropertyShape; + sh:hasValue ex:Person; + sh:path _:dc6027fb6bea4bc5aa60e7ed606c2db116373 + ] + ] . + +_:dc6027fb6bea4bc5aa60e7ed606c2db116373 rdf:first ex:knows6; + rdf:rest (ex:knows7 ex:knows8 ex:knows9 ex:knows10 rdf:type) . diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/invalid/case3/query1.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/invalid/case3/query1.rq new file mode 100644 index 00000000000..d47ac31b3c6 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/invalid/case3/query1.rq @@ -0,0 +1,23 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + + ex:person1 a ex:Person. + + ex:person1 ex:knows1 ex:person2 . + ex:person2 ex:knows2 ex:person3 . + ex:person3 ex:knows3 ex:person4 . + + ex:person5 ex:knows5 ex:person6 . + ex:person6 ex:knows6 ex:person7 . + ex:person7 ex:knows7 ex:person8 . + ex:person8 ex:knows8 ex:person9 . + ex:person9 ex:knows9 ex:person10 . + ex:person10 ex:knows10 ex:person11 . + ex:person11 rdf:type ex:NotAPerson . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/invalid/case3/query2.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/invalid/case3/query2.rq new file mode 100644 index 00000000000..d89a6c2e2e4 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/invalid/case3/query2.rq @@ -0,0 +1,23 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +DELETE { + ex:person9 ex:knows9 ex:person10 . + +} + +INSERT { + ex:person4 ex:knows4 ex:person5 . + +} + +WHERE { + +?a ?b ?c. +} + + diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/invalid/case3/report.ttl b/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/invalid/case3/report.ttl new file mode 100644 index 00000000000..6f9c546753f --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/invalid/case3/report.ttl @@ -0,0 +1,26 @@ +@prefix ex: . +@prefix foaf: . +@prefix xsd: . +@prefix sh: . +@prefix rdf: . +@prefix rdfs: . +@prefix rsx: . +@prefix rdf4j: . + +[] a sh:ValidationReport; + rdf4j:truncated false; + sh:conforms false; + sh:result [ a sh:ValidationResult; + rsx:shapesGraph rdf4j:SHACLShapeGraph; + sh:focusNode ex:person6; + sh:resultPath _:8957fac2895740b4917680a91e95267516420; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:HasValueConstraintComponent; + sh:sourceShape [ a sh:PropertyShape; + sh:hasValue ex:Person; + sh:path _:8957fac2895740b4917680a91e95267516420 + ] + ] . + +_:8957fac2895740b4917680a91e95267516420 rdf:first ex:knows6; + rdf:rest (ex:knows7 ex:knows8 ex:knows9 ex:knows10 rdf:type) . diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/shacl.trig b/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/shacl.trig new file mode 100644 index 00000000000..6e9639c521c --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/shacl.trig @@ -0,0 +1,20 @@ +@prefix ex: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@prefix sh: . +@prefix xsd: . +@prefix rdf4j: . + +rdf4j:SHACLShapeGraph { + ex:PersonShape a sh:NodeShape; + sh:targetClass ex:Person; + sh:property [ + sh:path (ex:knows1 ex:knows2 ex:knows3 ex:knows4 ex:knows5 ); + sh:property [ + sh:path (ex:knows6 ex:knows7 ex:knows8 ex:knows9 ex:knows10 rdf:type); + sh:hasValue ex:Person + ] + ] . + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/valid/case1/query1.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/valid/case1/query1.rq new file mode 100644 index 00000000000..a0357843e54 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/valid/case1/query1.rq @@ -0,0 +1,22 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + + ex:person1 ex:knows1 ex:person2 . + ex:person2 ex:knows2 ex:person3 . + ex:person3 ex:knows3 ex:person4 . + ex:person4 ex:knows4 ex:person5 . + ex:person5 ex:knows5 ex:person6 . + ex:person6 ex:knows6 ex:person7 . + ex:person7 ex:knows7 ex:person8 . + ex:person8 ex:knows8 ex:person9 . + ex:person9 ex:knows9 ex:person10 . + ex:person10 ex:knows10 ex:person11 . + ex:person11 rdf:type ex:Person . + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/valid/case1/report.ttl b/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/valid/case1/report.ttl new file mode 100644 index 00000000000..c0518dc88b5 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/valid/case1/report.ttl @@ -0,0 +1,12 @@ +@prefix ex: . +@prefix foaf: . +@prefix xsd: . +@prefix sh: . +@prefix rdf: . +@prefix rdfs: . +@prefix rsx: . +@prefix rdf4j: . + +[] a sh:ValidationReport; + rdf4j:truncated false; + sh:conforms true . diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/valid/case2/query1.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/valid/case2/query1.rq new file mode 100644 index 00000000000..c35b1423f83 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/valid/case2/query1.rq @@ -0,0 +1,21 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + + ex:person1 ex:knows1 ex:person2 . + ex:person2 ex:knows2 ex:person3 . + ex:person3 ex:knows3 ex:person4 . + ex:person4 ex:knows4 ex:person5 . + ex:person5 ex:knows5 ex:person6 . + ex:person6 ex:knows6 ex:person7 . + ex:person8 ex:knows8 ex:person9 . + ex:person9 ex:knows9 ex:person10 . + ex:person10 ex:knows10 ex:person11 . + ex:person11 rdf:type ex:Person . + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/valid/case2/query2.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/valid/case2/query2.rq new file mode 100644 index 00000000000..233c388990e --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/valid/case2/query2.rq @@ -0,0 +1,10 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + ex:person7 ex:knows7 ex:person8 . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/valid/case2/report.ttl b/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/valid/case2/report.ttl new file mode 100644 index 00000000000..c0518dc88b5 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePath2/valid/case2/report.ttl @@ -0,0 +1,12 @@ +@prefix ex: . +@prefix foaf: . +@prefix xsd: . +@prefix sh: . +@prefix rdf: . +@prefix rdfs: . +@prefix rsx: . +@prefix rdf4j: . + +[] a sh:ValidationReport; + rdf4j:truncated false; + sh:conforms true . diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/invalid/case1/query1.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/invalid/case1/query1.rq new file mode 100644 index 00000000000..47231297172 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/invalid/case1/query1.rq @@ -0,0 +1,17 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + ex:person1 ex:knows1 ex:person2. + ex:person2 ex:knows2 ex:person3. + ex:person3 ex:knows3 ex:person4. + ex:person4 ex:knows4 ex:person5. + ex:person5 ex:knows5 ex:person6. + ex:person6 rdf:type ex:Person. + + ex:person1 ex:knows [ex:knows ex:peter]. +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/invalid/case1/report.ttl b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/invalid/case1/report.ttl new file mode 100644 index 00000000000..1397a76414d --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/invalid/case1/report.ttl @@ -0,0 +1,40 @@ +@prefix ex: . +@prefix foaf: . +@prefix xsd: . +@prefix sh: . +@prefix rdf: . +@prefix rdfs: . +@prefix rsx: . +@prefix rdf4j: . + +[] a sh:ValidationReport; + rdf4j:truncated false; + sh:conforms false; + sh:result [ a sh:ValidationResult; + rsx:shapesGraph rdf4j:SHACLShapeGraph; + sh:focusNode ex:person1; + sh:resultPath _:c1559dfa8ea34564af0ca11efbae9a1416378; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:ClassConstraintComponent; + sh:sourceShape [ a sh:PropertyShape; + sh:class ex:Person; + sh:path _:c1559dfa8ea34564af0ca11efbae9a1416378 + ]; + sh:value ex:peter + ], [ a sh:ValidationResult; + rsx:shapesGraph rdf4j:SHACLShapeGraph; + sh:focusNode ex:person1; + sh:resultPath _:c1559dfa8ea34564af0ca11efbae9a1416381; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:HasValueConstraintComponent; + sh:sourceShape [ a sh:PropertyShape; + sh:hasValue ex:Person; + sh:path _:c1559dfa8ea34564af0ca11efbae9a1416381 + ] + ] . + +_:c1559dfa8ea34564af0ca11efbae9a1416378 rdf:first ex:knows; + rdf:rest (ex:knows) . + +_:c1559dfa8ea34564af0ca11efbae9a1416381 rdf:first ex:knows; + rdf:rest (ex:knows rdf:type) . diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/invalid/case2/query1.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/invalid/case2/query1.rq new file mode 100644 index 00000000000..a0d4d35df24 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/invalid/case2/query1.rq @@ -0,0 +1,20 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + ex:person1 ex:knows1 ex:person2. + ex:person2 ex:knows2 ex:person3. + ex:person3 ex:knows3 ex:person4. + ex:person4 ex:knows4 ex:person5. + ex:person5 ex:knows5 ex:person6. + ex:person6 rdf:type ex:Person. + + + ex:person1 ex:knows [ex:knows ex:peter]. + + ex:peter a ex:Person . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/invalid/case2/query2.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/invalid/case2/query2.rq new file mode 100644 index 00000000000..59f53e614bf --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/invalid/case2/query2.rq @@ -0,0 +1,12 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +DELETE DATA { + ex:person3 ex:knows3 ex:person4. + ex:peter a ex:Person . + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/invalid/case2/query3.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/invalid/case2/query3.rq new file mode 100644 index 00000000000..bac764e2fa5 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/invalid/case2/query3.rq @@ -0,0 +1,10 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + ex:person3 ex:knows3 ex:person4. +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/invalid/case2/report.ttl b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/invalid/case2/report.ttl new file mode 100644 index 00000000000..1397a76414d --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/invalid/case2/report.ttl @@ -0,0 +1,40 @@ +@prefix ex: . +@prefix foaf: . +@prefix xsd: . +@prefix sh: . +@prefix rdf: . +@prefix rdfs: . +@prefix rsx: . +@prefix rdf4j: . + +[] a sh:ValidationReport; + rdf4j:truncated false; + sh:conforms false; + sh:result [ a sh:ValidationResult; + rsx:shapesGraph rdf4j:SHACLShapeGraph; + sh:focusNode ex:person1; + sh:resultPath _:c1559dfa8ea34564af0ca11efbae9a1416378; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:ClassConstraintComponent; + sh:sourceShape [ a sh:PropertyShape; + sh:class ex:Person; + sh:path _:c1559dfa8ea34564af0ca11efbae9a1416378 + ]; + sh:value ex:peter + ], [ a sh:ValidationResult; + rsx:shapesGraph rdf4j:SHACLShapeGraph; + sh:focusNode ex:person1; + sh:resultPath _:c1559dfa8ea34564af0ca11efbae9a1416381; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:HasValueConstraintComponent; + sh:sourceShape [ a sh:PropertyShape; + sh:hasValue ex:Person; + sh:path _:c1559dfa8ea34564af0ca11efbae9a1416381 + ] + ] . + +_:c1559dfa8ea34564af0ca11efbae9a1416378 rdf:first ex:knows; + rdf:rest (ex:knows) . + +_:c1559dfa8ea34564af0ca11efbae9a1416381 rdf:first ex:knows; + rdf:rest (ex:knows rdf:type) . diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/invalid/case3/query1.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/invalid/case3/query1.rq new file mode 100644 index 00000000000..aa354b4c474 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/invalid/case3/query1.rq @@ -0,0 +1,20 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + ex:person1 ex:knows1 ex:person2. + ex:person2 ex:knows2 ex:person3. + ex:person3 ex:knows3 ex:person4. + ex:person4 ex:knows4 ex:person5. + ex:person5 ex:knows5 ex:person6. + ex:person6 rdf:type ex:Person. + + + ex:person1 ex:knows ex:steve. + ex:steve ex:knows ex:peter. + ex:peter a ex:Person . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/invalid/case3/query2.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/invalid/case3/query2.rq new file mode 100644 index 00000000000..2fc53f9e702 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/invalid/case3/query2.rq @@ -0,0 +1,10 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +DELETE DATA { + ex:person1 ex:knows ex:steve. +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/invalid/case3/report.ttl b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/invalid/case3/report.ttl new file mode 100644 index 00000000000..0d1c5872194 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/invalid/case3/report.ttl @@ -0,0 +1,26 @@ +@prefix ex: . +@prefix foaf: . +@prefix xsd: . +@prefix sh: . +@prefix rdf: . +@prefix rdfs: . +@prefix rsx: . +@prefix rdf4j: . + +[] a sh:ValidationReport; + rdf4j:truncated false; + sh:conforms false; + sh:result [ a sh:ValidationResult; + rsx:shapesGraph rdf4j:SHACLShapeGraph; + sh:focusNode ex:person1; + sh:resultPath _:9cc6828666734d6692c632592ba0f13c6114; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:HasValueConstraintComponent; + sh:sourceShape [ a sh:PropertyShape; + sh:hasValue ex:Person; + sh:path _:9cc6828666734d6692c632592ba0f13c6114 + ] + ] . + +_:9cc6828666734d6692c632592ba0f13c6114 rdf:first ex:knows; + rdf:rest (ex:knows rdf:type) . diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/invalid/case4/query1.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/invalid/case4/query1.rq new file mode 100644 index 00000000000..aa354b4c474 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/invalid/case4/query1.rq @@ -0,0 +1,20 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + ex:person1 ex:knows1 ex:person2. + ex:person2 ex:knows2 ex:person3. + ex:person3 ex:knows3 ex:person4. + ex:person4 ex:knows4 ex:person5. + ex:person5 ex:knows5 ex:person6. + ex:person6 rdf:type ex:Person. + + + ex:person1 ex:knows ex:steve. + ex:steve ex:knows ex:peter. + ex:peter a ex:Person . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/invalid/case4/query2.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/invalid/case4/query2.rq new file mode 100644 index 00000000000..9f65c203dc1 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/invalid/case4/query2.rq @@ -0,0 +1,10 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +DELETE DATA { + ex:steve ex:knows ex:peter. +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/invalid/case4/report.ttl b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/invalid/case4/report.ttl new file mode 100644 index 00000000000..0d1c5872194 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/invalid/case4/report.ttl @@ -0,0 +1,26 @@ +@prefix ex: . +@prefix foaf: . +@prefix xsd: . +@prefix sh: . +@prefix rdf: . +@prefix rdfs: . +@prefix rsx: . +@prefix rdf4j: . + +[] a sh:ValidationReport; + rdf4j:truncated false; + sh:conforms false; + sh:result [ a sh:ValidationResult; + rsx:shapesGraph rdf4j:SHACLShapeGraph; + sh:focusNode ex:person1; + sh:resultPath _:9cc6828666734d6692c632592ba0f13c6114; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:HasValueConstraintComponent; + sh:sourceShape [ a sh:PropertyShape; + sh:hasValue ex:Person; + sh:path _:9cc6828666734d6692c632592ba0f13c6114 + ] + ] . + +_:9cc6828666734d6692c632592ba0f13c6114 rdf:first ex:knows; + rdf:rest (ex:knows rdf:type) . diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/shacl.trig b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/shacl.trig new file mode 100644 index 00000000000..28f7e225b16 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/shacl.trig @@ -0,0 +1,23 @@ +@prefix ex: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@prefix sh: . +@prefix xsd: . +@prefix rdf4j: . +@prefix rsx: . + + +rdf4j:SHACLShapeGraph { + ex:PersonShape a sh:NodeShape; + rsx:targetShape [ sh:path (ex:knows1 ex:knows2 ex:knows3 ex:knows4 ex:knows5 rdf:type); sh:hasValue ex:Person ]; + sh:property [ + sh:path (ex:knows ex:knows); + sh:class ex:Person + ] , + [ + sh:path (ex:knows ex:knows rdf:type); + sh:hasValue ex:Person + ] . + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case1/query1.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case1/query1.rq new file mode 100644 index 00000000000..f9f2cf08e17 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case1/query1.rq @@ -0,0 +1,19 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + ex:person1 ex:knows1 ex:person2. + ex:person2 ex:knows2 ex:person3. + ex:person3 ex:knows3 ex:person4. + ex:person4 ex:knows4 ex:person5. + ex:person5 ex:knows5 ex:person6. + ex:person6 rdf:type ex:Person. + + + ex:person1 ex:knows [ex:knows ex:peter]. + ex:peter a ex:Person . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case1/report.ttl b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case1/report.ttl new file mode 100644 index 00000000000..c0518dc88b5 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case1/report.ttl @@ -0,0 +1,12 @@ +@prefix ex: . +@prefix foaf: . +@prefix xsd: . +@prefix sh: . +@prefix rdf: . +@prefix rdfs: . +@prefix rsx: . +@prefix rdf4j: . + +[] a sh:ValidationReport; + rdf4j:truncated false; + sh:conforms true . diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case2/query1.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case2/query1.rq new file mode 100644 index 00000000000..71ebbf6056d --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case2/query1.rq @@ -0,0 +1,18 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + ex:person1 ex:knows1 ex:person2. + ex:person2 ex:knows2 ex:person3. + ex:person3 ex:knows3 ex:person4. + ex:person4 ex:knows4 ex:person5. + ex:person5 ex:knows5 ex:person6. + + + ex:person1 ex:knows [ex:knows ex:peter]. + ex:peter a ex:Person . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case2/query2.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case2/query2.rq new file mode 100644 index 00000000000..81ef24e4d58 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case2/query2.rq @@ -0,0 +1,12 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + + ex:person6 rdf:type ex:Person. + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case2/report.ttl b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case2/report.ttl new file mode 100644 index 00000000000..c0518dc88b5 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case2/report.ttl @@ -0,0 +1,12 @@ +@prefix ex: . +@prefix foaf: . +@prefix xsd: . +@prefix sh: . +@prefix rdf: . +@prefix rdfs: . +@prefix rsx: . +@prefix rdf4j: . + +[] a sh:ValidationReport; + rdf4j:truncated false; + sh:conforms true . diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case3/query1.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case3/query1.rq new file mode 100644 index 00000000000..f9f2cf08e17 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case3/query1.rq @@ -0,0 +1,19 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + ex:person1 ex:knows1 ex:person2. + ex:person2 ex:knows2 ex:person3. + ex:person3 ex:knows3 ex:person4. + ex:person4 ex:knows4 ex:person5. + ex:person5 ex:knows5 ex:person6. + ex:person6 rdf:type ex:Person. + + + ex:person1 ex:knows [ex:knows ex:peter]. + ex:peter a ex:Person . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case3/query2.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case3/query2.rq new file mode 100644 index 00000000000..f4bf58cf8db --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case3/query2.rq @@ -0,0 +1,15 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +DELETE DATA { + ex:person1 ex:knows1 ex:person2. + ex:person2 ex:knows2 ex:person3. + ex:person3 ex:knows3 ex:person4. + ex:person4 ex:knows4 ex:person5. + ex:person5 ex:knows5 ex:person6. + ex:person6 rdf:type ex:Person. +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case3/report.ttl b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case3/report.ttl new file mode 100644 index 00000000000..c0518dc88b5 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case3/report.ttl @@ -0,0 +1,12 @@ +@prefix ex: . +@prefix foaf: . +@prefix xsd: . +@prefix sh: . +@prefix rdf: . +@prefix rdfs: . +@prefix rsx: . +@prefix rdf4j: . + +[] a sh:ValidationReport; + rdf4j:truncated false; + sh:conforms true . diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case4/query1.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case4/query1.rq new file mode 100644 index 00000000000..f9f2cf08e17 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case4/query1.rq @@ -0,0 +1,19 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + ex:person1 ex:knows1 ex:person2. + ex:person2 ex:knows2 ex:person3. + ex:person3 ex:knows3 ex:person4. + ex:person4 ex:knows4 ex:person5. + ex:person5 ex:knows5 ex:person6. + ex:person6 rdf:type ex:Person. + + + ex:person1 ex:knows [ex:knows ex:peter]. + ex:peter a ex:Person . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case4/query2.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case4/query2.rq new file mode 100644 index 00000000000..0d8b055908d --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case4/query2.rq @@ -0,0 +1,10 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +DELETE DATA { + ex:person1 ex:knows1 ex:person2. +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case4/report.ttl b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case4/report.ttl new file mode 100644 index 00000000000..c0518dc88b5 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case4/report.ttl @@ -0,0 +1,12 @@ +@prefix ex: . +@prefix foaf: . +@prefix xsd: . +@prefix sh: . +@prefix rdf: . +@prefix rdfs: . +@prefix rsx: . +@prefix rdf4j: . + +[] a sh:ValidationReport; + rdf4j:truncated false; + sh:conforms true . diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case5/query1.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case5/query1.rq new file mode 100644 index 00000000000..f9f2cf08e17 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case5/query1.rq @@ -0,0 +1,19 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + ex:person1 ex:knows1 ex:person2. + ex:person2 ex:knows2 ex:person3. + ex:person3 ex:knows3 ex:person4. + ex:person4 ex:knows4 ex:person5. + ex:person5 ex:knows5 ex:person6. + ex:person6 rdf:type ex:Person. + + + ex:person1 ex:knows [ex:knows ex:peter]. + ex:peter a ex:Person . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case5/query2.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case5/query2.rq new file mode 100644 index 00000000000..324da579200 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case5/query2.rq @@ -0,0 +1,10 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +DELETE DATA { + ex:person6 rdf:type ex:Person. +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case5/report.ttl b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case5/report.ttl new file mode 100644 index 00000000000..c0518dc88b5 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape1/valid/case5/report.ttl @@ -0,0 +1,12 @@ +@prefix ex: . +@prefix foaf: . +@prefix xsd: . +@prefix sh: . +@prefix rdf: . +@prefix rdfs: . +@prefix rsx: . +@prefix rdf4j: . + +[] a sh:ValidationReport; + rdf4j:truncated false; + sh:conforms true . diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape2/shacl.trig b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape2/shacl.trig new file mode 100644 index 00000000000..6d6fc34e39c --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape2/shacl.trig @@ -0,0 +1,29 @@ +@prefix dash: . +@prefix ex: . +@prefix rdf4j: . +@prefix rdf: . +@prefix rdfs: . +@prefix rsx: . +@prefix sh: . +@prefix xsd: . + + +rdf4j:SHACLShapeGraph { + + +ex:shape1 a sh:NodeShape ; + rsx:targetShape [ + sh:property [ + sh:path rdf:type ; + sh:hasValue ex:Type1 ; + ], [ + sh:path ( ex:knows rdf:type ) ; + sh:hasValue ex:Type2 ; + ] ; + ] ; + + sh:property [ + sh:path ex:trueProp ; + sh:hasValue true ; + ]. +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape2/valid/case1/query1.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape2/valid/case1/query1.rq new file mode 100644 index 00000000000..79f86a7a7d1 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape2/valid/case1/query1.rq @@ -0,0 +1,15 @@ +PREFIX dash: +PREFIX ex: +PREFIX rdf4j: +PREFIX rdf: +PREFIX rdfs: +PREFIX rsx: +PREFIX sh: +PREFIX xsd: + + +INSERT DATA { + ex:validNode ex:knows ex:node2 . + ex:node2 rdf:type ex:Type1 ; + rdf:type ex:Type2 . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape2/valid/case1/query2.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape2/valid/case1/query2.rq new file mode 100644 index 00000000000..e25912e9e5f --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape2/valid/case1/query2.rq @@ -0,0 +1,12 @@ +PREFIX dash: +PREFIX ex: +PREFIX rdf4j: +PREFIX rdf: +PREFIX rdfs: +PREFIX rsx: +PREFIX sh: +PREFIX xsd: + +DELETE DATA { + ex:node2 rdf:type ex:Type2 . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape2/valid/case1/report.ttl b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape2/valid/case1/report.ttl new file mode 100644 index 00000000000..c0518dc88b5 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape2/valid/case1/report.ttl @@ -0,0 +1,12 @@ +@prefix ex: . +@prefix foaf: . +@prefix xsd: . +@prefix sh: . +@prefix rdf: . +@prefix rdfs: . +@prefix rsx: . +@prefix rdf4j: . + +[] a sh:ValidationReport; + rdf4j:truncated false; + sh:conforms true . diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape2/valid/case2/query1.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape2/valid/case2/query1.rq new file mode 100644 index 00000000000..0222c9b4562 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape2/valid/case2/query1.rq @@ -0,0 +1,16 @@ +PREFIX dash: +PREFIX ex: +PREFIX rdf4j: +PREFIX rdf: +PREFIX rdfs: +PREFIX rsx: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + ex:validNode1 a ex:Type1 . + ex:validNode1 ex:trueProp true . + ex:validNode1 ex:knows ex:validNode2 . + + ex:validNode2 rdf:type ex:Type2 . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape2/valid/case2/report.ttl b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape2/valid/case2/report.ttl new file mode 100644 index 00000000000..c0518dc88b5 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape2/valid/case2/report.ttl @@ -0,0 +1,12 @@ +@prefix ex: . +@prefix foaf: . +@prefix xsd: . +@prefix sh: . +@prefix rdf: . +@prefix rdfs: . +@prefix rsx: . +@prefix rdf4j: . + +[] a sh:ValidationReport; + rdf4j:truncated false; + sh:conforms true . diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape2/valid/case3/initialData.trig b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape2/valid/case3/initialData.trig new file mode 100644 index 00000000000..ccd28689cd2 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape2/valid/case3/initialData.trig @@ -0,0 +1,15 @@ +@prefix dash: . +@prefix ex: . +@prefix rdf4j: . +@prefix rdf: . +@prefix rdfs: . +@prefix rsx: . +@prefix sh: . +@prefix xsd: . + + + + ex:validNode ex:knows ex:node2 . + ex:node2 rdf:type ex:Type1 ; + rdf:type ex:Type2 . + diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape2/valid/case3/query1.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape2/valid/case3/query1.rq new file mode 100644 index 00000000000..e25912e9e5f --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape2/valid/case3/query1.rq @@ -0,0 +1,12 @@ +PREFIX dash: +PREFIX ex: +PREFIX rdf4j: +PREFIX rdf: +PREFIX rdfs: +PREFIX rsx: +PREFIX sh: +PREFIX xsd: + +DELETE DATA { + ex:node2 rdf:type ex:Type2 . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape2/valid/case3/report.ttl b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape2/valid/case3/report.ttl new file mode 100644 index 00000000000..c0518dc88b5 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape2/valid/case3/report.ttl @@ -0,0 +1,12 @@ +@prefix ex: . +@prefix foaf: . +@prefix xsd: . +@prefix sh: . +@prefix rdf: . +@prefix rdfs: . +@prefix rsx: . +@prefix rdf4j: . + +[] a sh:ValidationReport; + rdf4j:truncated false; + sh:conforms true . diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/invalid/case1/query1.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/invalid/case1/query1.rq new file mode 100644 index 00000000000..4476dd8e93b --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/invalid/case1/query1.rq @@ -0,0 +1,19 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + ex:person1 a ex:Person. + ex:person1 ex:knows1 ex:person2. + ex:person2 ex:knows2 ex:person3. + ex:person3 ex:knows3 ex:person4. + ex:person4 ex:knows4 ex:person5. + ex:person5 ex:knows5 ex:person6. + ex:person6 rdf:type ex:Person. + + ex:person1 ex:knows [ex:knows ex:peter]. + ex:peter a ex:NotPerson . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/invalid/case1/report.ttl b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/invalid/case1/report.ttl new file mode 100644 index 00000000000..903364fefbe --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/invalid/case1/report.ttl @@ -0,0 +1,64 @@ +@prefix ex: . +@prefix foaf: . +@prefix xsd: . +@prefix sh: . +@prefix rdf: . +@prefix rdfs: . +@prefix rsx: . +@prefix rdf4j: . + +[] a sh:ValidationReport; + rdf4j:truncated false; + sh:conforms false; + sh:result [ a sh:ValidationResult; + rsx:shapesGraph rdf4j:SHACLShapeGraph; + sh:focusNode ex:person1; + sh:resultPath _:c14bfc459ea04babae502c7b0cdc3a9c16977; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NotConstraintComponent; + sh:sourceShape [ a sh:PropertyShape; + sh:not [ a sh:NodeShape; + sh:hasValue ex:NotPerson + ]; + sh:path _:c14bfc459ea04babae502c7b0cdc3a9c16977 + ]; + sh:value ex:NotPerson + ], [ a sh:ValidationResult; + rsx:shapesGraph rdf4j:SHACLShapeGraph; + sh:focusNode ex:person1; + sh:resultPath ex:test; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:HasValueConstraintComponent; + sh:sourceShape [ a sh:PropertyShape; + sh:hasValue ex:yay; + sh:path ex:test + ] + ], [ a sh:ValidationResult; + rsx:shapesGraph rdf4j:SHACLShapeGraph; + sh:focusNode ex:person1; + sh:resultPath _:c14bfc459ea04babae502c7b0cdc3a9c16985; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:HasValueConstraintComponent; + sh:sourceShape [ a sh:PropertyShape; + sh:hasValue ex:NotPerson; + sh:path _:c14bfc459ea04babae502c7b0cdc3a9c16985 + ] + ], [ a sh:ValidationResult; + rsx:shapesGraph rdf4j:SHACLShapeGraph; + sh:focusNode ex:person1; + sh:resultPath _:c14bfc459ea04babae502c7b0cdc3a9c16988; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:HasValueConstraintComponent; + sh:sourceShape [ a sh:PropertyShape; + sh:hasValue ex:person1; + sh:path _:c14bfc459ea04babae502c7b0cdc3a9c16988 + ] + ] . + +_:c14bfc459ea04babae502c7b0cdc3a9c16977 rdf:first ex:knows; + rdf:rest (ex:knows rdf:type) . + +_:c14bfc459ea04babae502c7b0cdc3a9c16985 rdf:first ex:test; + rdf:rest (rdf:type) . + +_:c14bfc459ea04babae502c7b0cdc3a9c16988 sh:inversePath ex:knows1 . diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/invalid/case2/query1.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/invalid/case2/query1.rq new file mode 100644 index 00000000000..a1e821ace42 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/invalid/case2/query1.rq @@ -0,0 +1,24 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + ex:person1 a ex:Person. + ex:person1 ex:knows1 ex:person2. + ex:person2 ex:knows2 ex:person3. + ex:person3 ex:knows3 ex:person4. + ex:person4 ex:knows4 ex:person5. + ex:person5 ex:knows5 ex:person6. + ex:person6 rdf:type ex:Person. + + ex:person1 ex:test ex:yay. + ex:yay a ex:NotPerson. + ex:person1 ex:knows1 ex:person1. + + ex:person1 ex:knows [ex:knows ex:peter]. + + ex:peter a ex:Person . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/invalid/case2/query2.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/invalid/case2/query2.rq new file mode 100644 index 00000000000..59f53e614bf --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/invalid/case2/query2.rq @@ -0,0 +1,12 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +DELETE DATA { + ex:person3 ex:knows3 ex:person4. + ex:peter a ex:Person . + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/invalid/case2/query3.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/invalid/case2/query3.rq new file mode 100644 index 00000000000..287b888d1ef --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/invalid/case2/query3.rq @@ -0,0 +1,12 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + ex:person3 ex:knows3 ex:person4. + ex:peter a ex:NotPerson . + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/invalid/case2/report.ttl b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/invalid/case2/report.ttl new file mode 100644 index 00000000000..d44735b2797 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/invalid/case2/report.ttl @@ -0,0 +1,29 @@ +@prefix ex: . +@prefix foaf: . +@prefix xsd: . +@prefix sh: . +@prefix rdf: . +@prefix rdfs: . +@prefix rsx: . +@prefix rdf4j: . + +[] a sh:ValidationReport; + rdf4j:truncated false; + sh:conforms false; + sh:result [ a sh:ValidationResult; + rsx:shapesGraph rdf4j:SHACLShapeGraph; + sh:focusNode ex:person1; + sh:resultPath _:786feb3f7a5141ef885d37038c6d72dc6527; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NotConstraintComponent; + sh:sourceShape [ a sh:PropertyShape; + sh:not [ a sh:NodeShape; + sh:hasValue ex:NotPerson + ]; + sh:path _:786feb3f7a5141ef885d37038c6d72dc6527 + ]; + sh:value ex:NotPerson + ] . + +_:786feb3f7a5141ef885d37038c6d72dc6527 rdf:first ex:knows; + rdf:rest (ex:knows rdf:type) . diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/shacl.trig b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/shacl.trig new file mode 100644 index 00000000000..6601e29b661 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/shacl.trig @@ -0,0 +1,54 @@ +@prefix ex: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@prefix sh: . +@prefix xsd: . +@prefix rdf4j: . +@prefix rsx: . +@prefix dash: . + + +rdf4j:SHACLShapeGraph { + ex:PersonShape a sh:NodeShape; + rsx:targetShape [ + sh:property [ + sh:path rdf:type ; + sh:hasValue ex:Person ; + ]; + sh:property [ + sh:path (ex:knows1 ex:knows2 ex:knows3 ex:knows4 ex:knows5 rdf:type); + sh:hasValue ex:Person + ]; + sh:property [ + sh:path (ex:knows1 ex:knows2 ex:knows3 ex:knows4 ); + dash:hasValueIn (ex:person1 ex:person2 ex:person3 ex:person4 ex:person5 ex:person6) + ]; + + ]; + sh:property [ + sh:path (ex:knows ex:knows rdf:type); + sh:not [sh:hasValue ex:NotPerson] + ] ; + + sh:property [ + sh:path ex:test; + sh:hasValue ex:yay + ] ; + + sh:property [ + sh:path ex:test; + sh:not [sh:hasValue ex:nay] + ] ; + + sh:property [ + sh:path (ex:test rdf:type); + sh:hasValue ex:NotPerson + ] ; + + sh:property [ + sh:path [sh:inversePath ex:knows1]; + sh:hasValue ex:person1 + ] . + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case1/query1.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case1/query1.rq new file mode 100644 index 00000000000..f9f2cf08e17 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case1/query1.rq @@ -0,0 +1,19 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + ex:person1 ex:knows1 ex:person2. + ex:person2 ex:knows2 ex:person3. + ex:person3 ex:knows3 ex:person4. + ex:person4 ex:knows4 ex:person5. + ex:person5 ex:knows5 ex:person6. + ex:person6 rdf:type ex:Person. + + + ex:person1 ex:knows [ex:knows ex:peter]. + ex:peter a ex:Person . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case1/report.ttl b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case1/report.ttl new file mode 100644 index 00000000000..c0518dc88b5 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case1/report.ttl @@ -0,0 +1,12 @@ +@prefix ex: . +@prefix foaf: . +@prefix xsd: . +@prefix sh: . +@prefix rdf: . +@prefix rdfs: . +@prefix rsx: . +@prefix rdf4j: . + +[] a sh:ValidationReport; + rdf4j:truncated false; + sh:conforms true . diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case2/query1.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case2/query1.rq new file mode 100644 index 00000000000..71ebbf6056d --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case2/query1.rq @@ -0,0 +1,18 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + ex:person1 ex:knows1 ex:person2. + ex:person2 ex:knows2 ex:person3. + ex:person3 ex:knows3 ex:person4. + ex:person4 ex:knows4 ex:person5. + ex:person5 ex:knows5 ex:person6. + + + ex:person1 ex:knows [ex:knows ex:peter]. + ex:peter a ex:Person . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case2/query2.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case2/query2.rq new file mode 100644 index 00000000000..81ef24e4d58 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case2/query2.rq @@ -0,0 +1,12 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + + ex:person6 rdf:type ex:Person. + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case2/report.ttl b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case2/report.ttl new file mode 100644 index 00000000000..c0518dc88b5 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case2/report.ttl @@ -0,0 +1,12 @@ +@prefix ex: . +@prefix foaf: . +@prefix xsd: . +@prefix sh: . +@prefix rdf: . +@prefix rdfs: . +@prefix rsx: . +@prefix rdf4j: . + +[] a sh:ValidationReport; + rdf4j:truncated false; + sh:conforms true . diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case3/query1.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case3/query1.rq new file mode 100644 index 00000000000..f9f2cf08e17 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case3/query1.rq @@ -0,0 +1,19 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + ex:person1 ex:knows1 ex:person2. + ex:person2 ex:knows2 ex:person3. + ex:person3 ex:knows3 ex:person4. + ex:person4 ex:knows4 ex:person5. + ex:person5 ex:knows5 ex:person6. + ex:person6 rdf:type ex:Person. + + + ex:person1 ex:knows [ex:knows ex:peter]. + ex:peter a ex:Person . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case3/query2.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case3/query2.rq new file mode 100644 index 00000000000..f4bf58cf8db --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case3/query2.rq @@ -0,0 +1,15 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +DELETE DATA { + ex:person1 ex:knows1 ex:person2. + ex:person2 ex:knows2 ex:person3. + ex:person3 ex:knows3 ex:person4. + ex:person4 ex:knows4 ex:person5. + ex:person5 ex:knows5 ex:person6. + ex:person6 rdf:type ex:Person. +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case3/report.ttl b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case3/report.ttl new file mode 100644 index 00000000000..c0518dc88b5 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case3/report.ttl @@ -0,0 +1,12 @@ +@prefix ex: . +@prefix foaf: . +@prefix xsd: . +@prefix sh: . +@prefix rdf: . +@prefix rdfs: . +@prefix rsx: . +@prefix rdf4j: . + +[] a sh:ValidationReport; + rdf4j:truncated false; + sh:conforms true . diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case4/query1.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case4/query1.rq new file mode 100644 index 00000000000..f9f2cf08e17 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case4/query1.rq @@ -0,0 +1,19 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + ex:person1 ex:knows1 ex:person2. + ex:person2 ex:knows2 ex:person3. + ex:person3 ex:knows3 ex:person4. + ex:person4 ex:knows4 ex:person5. + ex:person5 ex:knows5 ex:person6. + ex:person6 rdf:type ex:Person. + + + ex:person1 ex:knows [ex:knows ex:peter]. + ex:peter a ex:Person . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case4/query2.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case4/query2.rq new file mode 100644 index 00000000000..0d8b055908d --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case4/query2.rq @@ -0,0 +1,10 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +DELETE DATA { + ex:person1 ex:knows1 ex:person2. +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case4/report.ttl b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case4/report.ttl new file mode 100644 index 00000000000..c0518dc88b5 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case4/report.ttl @@ -0,0 +1,12 @@ +@prefix ex: . +@prefix foaf: . +@prefix xsd: . +@prefix sh: . +@prefix rdf: . +@prefix rdfs: . +@prefix rsx: . +@prefix rdf4j: . + +[] a sh:ValidationReport; + rdf4j:truncated false; + sh:conforms true . diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case5/query1.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case5/query1.rq new file mode 100644 index 00000000000..f9f2cf08e17 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case5/query1.rq @@ -0,0 +1,19 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + ex:person1 ex:knows1 ex:person2. + ex:person2 ex:knows2 ex:person3. + ex:person3 ex:knows3 ex:person4. + ex:person4 ex:knows4 ex:person5. + ex:person5 ex:knows5 ex:person6. + ex:person6 rdf:type ex:Person. + + + ex:person1 ex:knows [ex:knows ex:peter]. + ex:peter a ex:Person . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case5/query2.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case5/query2.rq new file mode 100644 index 00000000000..324da579200 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case5/query2.rq @@ -0,0 +1,10 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +DELETE DATA { + ex:person6 rdf:type ex:Person. +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case5/report.ttl b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case5/report.ttl new file mode 100644 index 00000000000..c0518dc88b5 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case5/report.ttl @@ -0,0 +1,12 @@ +@prefix ex: . +@prefix foaf: . +@prefix xsd: . +@prefix sh: . +@prefix rdf: . +@prefix rdfs: . +@prefix rsx: . +@prefix rdf4j: . + +[] a sh:ValidationReport; + rdf4j:truncated false; + sh:conforms true . diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case6/query1.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case6/query1.rq new file mode 100644 index 00000000000..6d11f0f656e --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case6/query1.rq @@ -0,0 +1,19 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + ex:person1 ex:knows1 ex:person2_a. + ex:person2_a ex:knows2 ex:person3. + ex:person3 ex:knows3 ex:person4. + ex:person4 ex:knows4 ex:person5. + ex:person5 ex:knows5 ex:person6. + ex:person6 rdf:type ex:Person. + + + ex:person1 ex:knows [ex:knows ex:peter]. + ex:peter a ex:NotPerson . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case6/query2.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case6/query2.rq new file mode 100644 index 00000000000..d471acc9523 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case6/query2.rq @@ -0,0 +1,12 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +DELETE DATA { + + ex:person3 ex:knows3 ex:person4. + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case6/report.ttl b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case6/report.ttl new file mode 100644 index 00000000000..c0518dc88b5 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case6/report.ttl @@ -0,0 +1,12 @@ +@prefix ex: . +@prefix foaf: . +@prefix xsd: . +@prefix sh: . +@prefix rdf: . +@prefix rdfs: . +@prefix rsx: . +@prefix rdf4j: . + +[] a sh:ValidationReport; + rdf4j:truncated false; + sh:conforms true . diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case7/query1.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case7/query1.rq new file mode 100644 index 00000000000..2bf318ea994 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case7/query1.rq @@ -0,0 +1,19 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + + ex:person1 ex:knows1 ex:person2. + ex:person2 ex:knows2 ex:person3. + ex:person3 ex:knows3 ex:person4. + ex:person4 ex:knows4 ex:person5. + ex:person5 ex:knows5 ex:person6. + ex:person6 rdf:type ex:Person, ex:NotPerson. + + + ex:person1 ex:knowsA ex:peter. +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case7/query2.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case7/query2.rq new file mode 100644 index 00000000000..6b25667267b --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case7/query2.rq @@ -0,0 +1,12 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +DELETE DATA { + + ex:person6 rdf:type ex:Person. + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case7/report.ttl b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case7/report.ttl new file mode 100644 index 00000000000..c0518dc88b5 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case7/report.ttl @@ -0,0 +1,12 @@ +@prefix ex: . +@prefix foaf: . +@prefix xsd: . +@prefix sh: . +@prefix rdf: . +@prefix rdfs: . +@prefix rsx: . +@prefix rdf4j: . + +[] a sh:ValidationReport; + rdf4j:truncated false; + sh:conforms true . diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case8/query1.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case8/query1.rq new file mode 100644 index 00000000000..2bf318ea994 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case8/query1.rq @@ -0,0 +1,19 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + + ex:person1 ex:knows1 ex:person2. + ex:person2 ex:knows2 ex:person3. + ex:person3 ex:knows3 ex:person4. + ex:person4 ex:knows4 ex:person5. + ex:person5 ex:knows5 ex:person6. + ex:person6 rdf:type ex:Person, ex:NotPerson. + + + ex:person1 ex:knowsA ex:peter. +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case8/query2.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case8/query2.rq new file mode 100644 index 00000000000..fe08b6e8e75 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case8/query2.rq @@ -0,0 +1,12 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +DELETE DATA { + + ex:person5 ex:knows5 ex:person6. + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case8/report.ttl b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case8/report.ttl new file mode 100644 index 00000000000..c0518dc88b5 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShape3/valid/case8/report.ttl @@ -0,0 +1,12 @@ +@prefix ex: . +@prefix foaf: . +@prefix xsd: . +@prefix sh: . +@prefix rdf: . +@prefix rdfs: . +@prefix rsx: . +@prefix rdf4j: . + +[] a sh:ValidationReport; + rdf4j:truncated false; + sh:conforms true . diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShapeNot/shacl.trig b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShapeNot/shacl.trig new file mode 100644 index 00000000000..4c3480caa42 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShapeNot/shacl.trig @@ -0,0 +1,29 @@ +@prefix dash: . +@prefix ex: . +@prefix rdf4j: . +@prefix rdf: . +@prefix rdfs: . +@prefix rsx: . +@prefix sh: . +@prefix xsd: . + + +rdf4j:SHACLShapeGraph { + + +ex:shape1 a sh:NodeShape ; + rsx:targetShape [ + sh:property [ + sh:path rdf:type ; + sh:hasValue ex:Type1 ; + ], [ + sh:path ( ex:knows rdf:type ) ; + sh:hasValue ex:Type2 ; + ] ; + ] ; + + sh:property [ + sh:path ex:trueProp ; + sh:not [sh:hasValue false] ; + ]. +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShapeNot/valid/case1/query1.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShapeNot/valid/case1/query1.rq new file mode 100644 index 00000000000..79f86a7a7d1 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShapeNot/valid/case1/query1.rq @@ -0,0 +1,15 @@ +PREFIX dash: +PREFIX ex: +PREFIX rdf4j: +PREFIX rdf: +PREFIX rdfs: +PREFIX rsx: +PREFIX sh: +PREFIX xsd: + + +INSERT DATA { + ex:validNode ex:knows ex:node2 . + ex:node2 rdf:type ex:Type1 ; + rdf:type ex:Type2 . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShapeNot/valid/case1/query2.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShapeNot/valid/case1/query2.rq new file mode 100644 index 00000000000..e25912e9e5f --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShapeNot/valid/case1/query2.rq @@ -0,0 +1,12 @@ +PREFIX dash: +PREFIX ex: +PREFIX rdf4j: +PREFIX rdf: +PREFIX rdfs: +PREFIX rsx: +PREFIX sh: +PREFIX xsd: + +DELETE DATA { + ex:node2 rdf:type ex:Type2 . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShapeNot/valid/case1/report.ttl b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShapeNot/valid/case1/report.ttl new file mode 100644 index 00000000000..c0518dc88b5 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShapeNot/valid/case1/report.ttl @@ -0,0 +1,12 @@ +@prefix ex: . +@prefix foaf: . +@prefix xsd: . +@prefix sh: . +@prefix rdf: . +@prefix rdfs: . +@prefix rsx: . +@prefix rdf4j: . + +[] a sh:ValidationReport; + rdf4j:truncated false; + sh:conforms true . diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShapeNot/valid/case2/query1.rq b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShapeNot/valid/case2/query1.rq new file mode 100644 index 00000000000..0222c9b4562 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShapeNot/valid/case2/query1.rq @@ -0,0 +1,16 @@ +PREFIX dash: +PREFIX ex: +PREFIX rdf4j: +PREFIX rdf: +PREFIX rdfs: +PREFIX rsx: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + ex:validNode1 a ex:Type1 . + ex:validNode1 ex:trueProp true . + ex:validNode1 ex:knows ex:validNode2 . + + ex:validNode2 rdf:type ex:Type2 . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShapeNot/valid/case2/report.ttl b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShapeNot/valid/case2/report.ttl new file mode 100644 index 00000000000..c0518dc88b5 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/path/sequencePathTargetShapeNot/valid/case2/report.ttl @@ -0,0 +1,12 @@ +@prefix ex: . +@prefix foaf: . +@prefix xsd: . +@prefix sh: . +@prefix rdf: . +@prefix rdfs: . +@prefix rsx: . +@prefix rdf4j: . + +[] a sh:ValidationReport; + rdf4j:truncated false; + sh:conforms true . diff --git a/core/sail/shacl/src/test/resources/test-cases/qualifiedShape/maxCountSimple/invalid/case3/initialData.ttl b/core/sail/shacl/src/test/resources/test-cases/qualifiedShape/maxCountSimple/invalid/case3/initialData.trig similarity index 100% rename from core/sail/shacl/src/test/resources/test-cases/qualifiedShape/maxCountSimple/invalid/case3/initialData.ttl rename to core/sail/shacl/src/test/resources/test-cases/qualifiedShape/maxCountSimple/invalid/case3/initialData.trig diff --git a/core/sail/shacl/src/test/resources/test-cases/qualifiedShape/maxCountSimple/invalid/case4/initialData.ttl b/core/sail/shacl/src/test/resources/test-cases/qualifiedShape/maxCountSimple/invalid/case4/initialData.trig similarity index 100% rename from core/sail/shacl/src/test/resources/test-cases/qualifiedShape/maxCountSimple/invalid/case4/initialData.ttl rename to core/sail/shacl/src/test/resources/test-cases/qualifiedShape/maxCountSimple/invalid/case4/initialData.trig diff --git a/core/sail/shacl/src/test/resources/test-cases/qualifiedShape/minCountSimple/invalid/case5/initialData.ttl b/core/sail/shacl/src/test/resources/test-cases/qualifiedShape/minCountSimple/invalid/case5/initialData.trig similarity index 100% rename from core/sail/shacl/src/test/resources/test-cases/qualifiedShape/minCountSimple/invalid/case5/initialData.ttl rename to core/sail/shacl/src/test/resources/test-cases/qualifiedShape/minCountSimple/invalid/case5/initialData.trig diff --git a/site/content/download.md b/site/content/download.md index 07ca1cd21a5..1c2a5c6ec73 100644 --- a/site/content/download.md +++ b/site/content/download.md @@ -54,8 +54,8 @@ which artifacts RDF4J provides. ### RDF4J 4.3 -- [RDF4J 4.3.14 SDK (zip)](http://www.eclipse.org/downloads/download.php?file=/rdf4j/eclipse-rdf4j-4.3.14-sdk.zip) -- [RDF4J 4.3.14 onejar](http://www.eclipse.org/downloads/download.php?file=/rdf4j/eclipse-rdf4j-4.3.14-onejar.jar) +- [RDF4J 4.3.15 SDK (zip)](http://www.eclipse.org/downloads/download.php?file=/rdf4j/eclipse-rdf4j-4.3.15-sdk.zip) +- [RDF4J 4.3.15 onejar](http://www.eclipse.org/downloads/download.php?file=/rdf4j/eclipse-rdf4j-4.3.15-onejar.jar) ### RDF4J 4.2 diff --git a/site/content/news/rdf4j-4315.md b/site/content/news/rdf4j-4315.md new file mode 100644 index 00000000000..faf97beecf3 --- /dev/null +++ b/site/content/news/rdf4j-4315.md @@ -0,0 +1,14 @@ +--- +title: "RDF4J 4.3.15 released" +date: 2024-11-07T15:39:52+0100 +layout: "single" +categories: ["news"] +--- +RDF4J 4.3.15 is now available. This is a patch release fixing 4 bugs. + +For more details, have a look at the [release notes](/release-notes/4.3.15). + +### Links + +- [Download RDF4J](/download/) +- [release notes](/release-notes/4.3.15). diff --git a/site/content/release-notes/4.3.15.md b/site/content/release-notes/4.3.15.md new file mode 100644 index 00000000000..8a454c89203 --- /dev/null +++ b/site/content/release-notes/4.3.15.md @@ -0,0 +1,7 @@ +--- +title: "4.3.15" +toc: true +--- +RDF4J 4.3.15 is a patch release that fixes 4 issues. + +For a complete overview, see [all issues fixed in 4.3.15](https://github.com/eclipse/rdf4j/milestone/112?closed=1). diff --git a/site/static/javadoc/4.3.15.tgz b/site/static/javadoc/4.3.15.tgz new file mode 100644 index 00000000000..49f8832f60f Binary files /dev/null and b/site/static/javadoc/4.3.15.tgz differ