diff --git a/core/queryalgebra/evaluation/src/main/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/evaluationsteps/values/QueryValueEvaluationStepSupplier.java b/core/queryalgebra/evaluation/src/main/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/evaluationsteps/values/QueryValueEvaluationStepSupplier.java index da0f8aeed6a..15ad8eb7d64 100644 --- a/core/queryalgebra/evaluation/src/main/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/evaluationsteps/values/QueryValueEvaluationStepSupplier.java +++ b/core/queryalgebra/evaluation/src/main/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/evaluationsteps/values/QueryValueEvaluationStepSupplier.java @@ -50,7 +50,7 @@ private QueryValueEvaluationStepSupplier() { } public static QueryValueEvaluationStep prepareStr(QueryValueEvaluationStep arg, ValueFactory valueFactory) { - return make(arg, "Unkown constant argument for STR()", bs -> str(arg, valueFactory, bs)); + return make(arg, "Unknown constant argument for STR()", bs -> str(arg, valueFactory, bs)); } private static Value str(QueryValueEvaluationStep arg, ValueFactory valueFactory, BindingSet bindings) { @@ -67,7 +67,7 @@ private static Value str(QueryValueEvaluationStep arg, ValueFactory valueFactory return valueFactory.createLiteral(literal.getLabel()); } } else { - throw new ValueExprEvaluationException("Unkown constant argument for STR()"); + throw new ValueExprEvaluationException("Unknown constant argument for STR()"); } } diff --git a/core/queryalgebra/evaluation/src/main/java/org/eclipse/rdf4j/query/algebra/evaluation/iterator/PeekMarkIterator.java b/core/queryalgebra/evaluation/src/main/java/org/eclipse/rdf4j/query/algebra/evaluation/iterator/PeekMarkIterator.java index 55b412a2267..7849e60adbe 100644 --- a/core/queryalgebra/evaluation/src/main/java/org/eclipse/rdf4j/query/algebra/evaluation/iterator/PeekMarkIterator.java +++ b/core/queryalgebra/evaluation/src/main/java/org/eclipse/rdf4j/query/algebra/evaluation/iterator/PeekMarkIterator.java @@ -39,7 +39,7 @@ public class PeekMarkIterator implements CloseableIteration { private boolean closed; - PeekMarkIterator(CloseableIteration iterator) { + public PeekMarkIterator(CloseableIteration iterator) { this.iterator = iterator; } diff --git a/core/queryresultio/binary/src/main/java/org/eclipse/rdf4j/query/resultio/binary/BinaryQueryResultParser.java b/core/queryresultio/binary/src/main/java/org/eclipse/rdf4j/query/resultio/binary/BinaryQueryResultParser.java index b256a2198db..5fb8dfc770c 100644 --- a/core/queryresultio/binary/src/main/java/org/eclipse/rdf4j/query/resultio/binary/BinaryQueryResultParser.java +++ b/core/queryresultio/binary/src/main/java/org/eclipse/rdf4j/query/resultio/binary/BinaryQueryResultParser.java @@ -227,7 +227,7 @@ private void processError() throws IOException, QueryResultParseException { } else if (errTypeFlag == QUERY_EVALUATION_ERROR) { errType = QueryErrorType.QUERY_EVALUATION_ERROR; } else { - throw new QueryResultParseException("Unkown error type: " + errTypeFlag); + throw new QueryResultParseException("Unknown error type: " + errTypeFlag); } String msg = readString(); diff --git a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ShaclSailBaseConfiguration.java b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ShaclSailBaseConfiguration.java index 1256eb8a3f8..cc43e3e6015 100644 --- a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ShaclSailBaseConfiguration.java +++ b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ShaclSailBaseConfiguration.java @@ -27,7 +27,7 @@ abstract class ShaclSailBaseConfiguration extends NotifyingSailWrapper { private static final Logger logger = LoggerFactory.getLogger(ShaclSailBaseConfiguration.class); // Field used to control if the new SPARQL based validation should be enabled or disabled. Enabled by default. - final boolean sparqlValidation; + boolean sparqlValidation; private boolean parallelValidation = ShaclSailConfig.PARALLEL_VALIDATION_DEFAULT; private boolean logValidationPlans = ShaclSailConfig.LOG_VALIDATION_PLANS_DEFAULT; @@ -375,4 +375,5 @@ public Set getShapesGraphs() { public void setShapesGraphs(Set shapesGraphs) { this.shapesGraphs = shapesGraphs; } + } 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 463f16dba50..85b40bf1cf3 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 @@ -82,12 +82,13 @@ public ValidationResultIterator performValidation() { validationResults = new ValidationResultIterator(iterator, effectiveValidationResultsLimitPerConstraint); return validationResults; } catch (Throwable e) { - logger.warn("Error validating SHACL Shape {}", shape.getId(), e); - logger.warn("Error validating SHACL Shape\n{}", shape, e); + logger.warn("Internal error while trying to validate SHACL Shape {}", shape.getId(), e); + logger.warn("Internal error while trying to validate SHACL Shape\n{}", shape, e); if (e instanceof Error) { throw e; } - throw new SailException("Error validating SHACL Shape " + shape.getId() + "\n" + shape, e); + throw new SailException( + "Internal error while trying to validate SHACL Shape " + shape.getId() + "\n" + shape, e); } finally { handlePostLogging(before, validationResults); } diff --git a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/SourceConstraintComponent.java b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/SourceConstraintComponent.java index a382d502efe..dc6dd7a0678 100644 --- a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/SourceConstraintComponent.java +++ b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/SourceConstraintComponent.java @@ -16,53 +16,53 @@ import org.eclipse.rdf4j.model.vocabulary.SHACL; public enum SourceConstraintComponent { - MaxCountConstraintComponent(SHACL.MAX_COUNT_CONSTRAINT_COMPONENT, false), - MinCountConstraintComponent(SHACL.MIN_COUNT_CONSTRAINT_COMPONENT, false), - - DatatypeConstraintComponent(SHACL.DATATYPE_CONSTRAINT_COMPONENT, true), - NodeKindConstraintComponent(SHACL.NODE_KIND_CONSTRAINT_COMPONENT, true), - ClassConstraintComponent(SHACL.CLASS_CONSTRAINT_COMPONENT, true), - - PatternConstraintComponent(SHACL.PATTERN_CONSTRAINT_COMPONENT, true), - UniqueLangConstraintComponent(SHACL.UNIQUE_LANG_CONSTRAINT_COMPONENT, false), - LanguageInConstraintComponent(SHACL.LANGUAGE_IN_CONSTRAINT_COMPONENT, true), - MaxLengthConstraintComponent(SHACL.MAX_LENGTH_CONSTRAINT_COMPONENT, true), - MinLengthConstraintComponent(SHACL.MIN_LENGTH_CONSTRAINT_COMPONENT, true), - - InConstraintComponent(SHACL.IN_CONSTRAINT_COMPONENT, true), - HasValueConstraintComponent(SHACL.HAS_VALUE_CONSTRAINT_COMPONENT, false), - HasValueInConstraintComponent(DASH.HasValueInConstraintComponent, false), - ClosedConstraintComponent(SHACL.CLOSED_CONSTRAINT_COMPONENT, true), - - MinExclusiveConstraintComponent(SHACL.MIN_EXCLUSIVE_CONSTRAINT_COMPONENT, true), - MaxExclusiveConstraintComponent(SHACL.MAX_EXCLUSIVE_CONSTRAINT_COMPONENT, true), - MaxInclusiveConstraintComponent(SHACL.MAX_INCLUSIVE_CONSTRAINT_COMPONENT, true), - MinInclusiveConstraintComponent(SHACL.MIN_INCLUSIVE_CONSTRAINT_COMPONENT, true), - - AndConstraintComponent(SHACL.AND_CONSTRAINT_COMPONENT, true), - OrConstraintComponent(SHACL.OR_CONSTRAINT_COMPONENT, true), - NotConstraintComponent(SHACL.NOT_CONSTRAINT_COMPONENT, true), - XoneConstraintComponent(SHACL.XONE_CONSTRAINT_COMPONENT, true), - - DisjointConstraintComponent(SHACL.DISJOINT_CONSTRAINT_COMPONENT, true), - EqualsConstraintComponent(SHACL.EQUALS_CONSTRAINT_COMPONENT, true), - LessThanConstraintComponent(SHACL.LESS_THAN_CONSTRAINT_COMPONENT, true), + MaxCountConstraintComponent(SHACL.MAX_COUNT_CONSTRAINT_COMPONENT, ProducesValidationResultValue.NEVER), + MinCountConstraintComponent(SHACL.MIN_COUNT_CONSTRAINT_COMPONENT, ProducesValidationResultValue.NEVER), + + DatatypeConstraintComponent(SHACL.DATATYPE_CONSTRAINT_COMPONENT, ProducesValidationResultValue.ALWAYS), + NodeKindConstraintComponent(SHACL.NODE_KIND_CONSTRAINT_COMPONENT, ProducesValidationResultValue.ALWAYS), + ClassConstraintComponent(SHACL.CLASS_CONSTRAINT_COMPONENT, ProducesValidationResultValue.ALWAYS), + + PatternConstraintComponent(SHACL.PATTERN_CONSTRAINT_COMPONENT, ProducesValidationResultValue.ALWAYS), + UniqueLangConstraintComponent(SHACL.UNIQUE_LANG_CONSTRAINT_COMPONENT, ProducesValidationResultValue.NEVER), + LanguageInConstraintComponent(SHACL.LANGUAGE_IN_CONSTRAINT_COMPONENT, ProducesValidationResultValue.ALWAYS), + MaxLengthConstraintComponent(SHACL.MAX_LENGTH_CONSTRAINT_COMPONENT, ProducesValidationResultValue.ALWAYS), + MinLengthConstraintComponent(SHACL.MIN_LENGTH_CONSTRAINT_COMPONENT, ProducesValidationResultValue.ALWAYS), + + InConstraintComponent(SHACL.IN_CONSTRAINT_COMPONENT, ProducesValidationResultValue.ALWAYS), + HasValueConstraintComponent(SHACL.HAS_VALUE_CONSTRAINT_COMPONENT, ProducesValidationResultValue.NEVER), + HasValueInConstraintComponent(DASH.HasValueInConstraintComponent, ProducesValidationResultValue.NEVER), + ClosedConstraintComponent(SHACL.CLOSED_CONSTRAINT_COMPONENT, ProducesValidationResultValue.ALWAYS), + + MinExclusiveConstraintComponent(SHACL.MIN_EXCLUSIVE_CONSTRAINT_COMPONENT, ProducesValidationResultValue.ALWAYS), + MaxExclusiveConstraintComponent(SHACL.MAX_EXCLUSIVE_CONSTRAINT_COMPONENT, ProducesValidationResultValue.ALWAYS), + MaxInclusiveConstraintComponent(SHACL.MAX_INCLUSIVE_CONSTRAINT_COMPONENT, ProducesValidationResultValue.ALWAYS), + MinInclusiveConstraintComponent(SHACL.MIN_INCLUSIVE_CONSTRAINT_COMPONENT, ProducesValidationResultValue.ALWAYS), + + AndConstraintComponent(SHACL.AND_CONSTRAINT_COMPONENT, ProducesValidationResultValue.ALWAYS), + OrConstraintComponent(SHACL.OR_CONSTRAINT_COMPONENT, ProducesValidationResultValue.ALWAYS), + NotConstraintComponent(SHACL.NOT_CONSTRAINT_COMPONENT, ProducesValidationResultValue.ALWAYS), + XoneConstraintComponent(SHACL.XONE_CONSTRAINT_COMPONENT, ProducesValidationResultValue.ALWAYS), + + DisjointConstraintComponent(SHACL.DISJOINT_CONSTRAINT_COMPONENT, ProducesValidationResultValue.ALWAYS), + EqualsConstraintComponent(SHACL.EQUALS_CONSTRAINT_COMPONENT, ProducesValidationResultValue.ALWAYS), + LessThanConstraintComponent(SHACL.LESS_THAN_CONSTRAINT_COMPONENT, ProducesValidationResultValue.ALWAYS), LessThanOrEqualsConstraintComponent(SHACL.LESS_THAN_OR_EQUALS_CONSTRAINT_COMPONENT, - true), + ProducesValidationResultValue.ALWAYS), QualifiedMaxCountConstraintComponent(SHACL.QUALIFIED_MAX_COUNT_CONSTRAINT_COMPONENT, - false), + ProducesValidationResultValue.NEVER), QualifiedMinCountConstraintComponent(SHACL.QUALIFIED_MIN_COUNT_CONSTRAINT_COMPONENT, - false), - NodeConstraintComponent(SHACL.NODE_CONSTRAINT_COMPONENT, true), - PropertyConstraintComponent(SHACL.PROPERTY_CONSTRAINT_COMPONENT, false), + ProducesValidationResultValue.NEVER), + NodeConstraintComponent(SHACL.NODE_CONSTRAINT_COMPONENT, ProducesValidationResultValue.ALWAYS), + PropertyConstraintComponent(SHACL.PROPERTY_CONSTRAINT_COMPONENT, ProducesValidationResultValue.NEVER), - SPARQLConstraintComponent(SHACL.SPARQL_CONSTRAINT_COMPONENT, true); + SPARQLConstraintComponent(SHACL.SPARQL_CONSTRAINT_COMPONENT, ProducesValidationResultValue.SOMETIMES); private final IRI iri; - private final boolean producesValidationResultValue; + private final ProducesValidationResultValue producesValidationResultValue; - SourceConstraintComponent(IRI iri, boolean producesValidationResultValue) { + SourceConstraintComponent(IRI iri, ProducesValidationResultValue producesValidationResultValue) { this.iri = iri; this.producesValidationResultValue = producesValidationResultValue; } @@ -72,6 +72,16 @@ public IRI getIri() { } public boolean producesValidationResultValue() { - return producesValidationResultValue; + return producesValidationResultValue != ProducesValidationResultValue.NEVER; + } + + public boolean alwaysProducesValidationResultValue() { + return producesValidationResultValue == ProducesValidationResultValue.ALWAYS; + } + + private enum ProducesValidationResultValue { + ALWAYS, + NEVER, + SOMETIMES } } diff --git a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/ValidationQuery.java b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/ValidationQuery.java index 64fe604f64d..f3b6fdd26b6 100644 --- a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/ValidationQuery.java +++ b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/ValidationQuery.java @@ -83,7 +83,7 @@ public ValidationQuery(Collection namespaces, String query, List 1) { + allTargets = Unique.getInstance(allTargets, true); + } + return allTargets; } else { - return effectiveTarget.extend(overrideTargetPlanNode, connectionsGroup, + PlanNode extend = effectiveTarget.extend(overrideTargetPlanNode, connectionsGroup, validationSettings.getDataGraph(), scope, EffectiveTarget.Extend.right, false, p -> getFilterAttacherWithNegation(negatePlan, p) ); + if (effectiveTarget.size() > 1) { + extend = Unique.getInstance(extend, true); + } + + return extend; + } } else { @@ -184,7 +193,11 @@ private PlanNode getPlanNodeForOverrideTargetNode(ConnectionsGroup connectionsGr allTargets = getFilterAttacherWithNegation(negatePlan, allTargets); - return Unique.getInstance(allTargets, true); + if (effectiveTarget.size() > 1) { + allTargets = Unique.getInstance(allTargets, true); + } + + return allTargets; } else { @@ -192,6 +205,10 @@ private PlanNode getPlanNodeForOverrideTargetNode(ConnectionsGroup connectionsGr validationSettings.getDataGraph(), scope, EffectiveTarget.Extend.right, false, null); + if (effectiveTarget.size() > 1) { + overrideTargetPlanNode = Unique.getInstance(overrideTargetPlanNode, true); + } + planNode = new BulkedExternalInnerJoin(overrideTargetPlanNode, connectionsGroup.getBaseConnection(), validationSettings.getDataGraph(), path.get() @@ -314,13 +331,25 @@ String literalToString(Literal literal) { @Override public PlanNode getAllTargetsPlan(ConnectionsGroup connectionsGroup, Resource[] dataGraph, Scope scope, StatementMatcher.StableRandomVariableProvider stableRandomVariableProvider) { + if (scope == Scope.propertyShape) { - PlanNode allTargetsPlan = getTargetChain() - .getEffectiveTarget(Scope.nodeShape, connectionsGroup.getRdfsSubClassOfReasoner(), - stableRandomVariableProvider) - .getPlanNode(connectionsGroup, dataGraph, Scope.nodeShape, true, null); - return Unique.getInstance(new ShiftToPropertyShape(allTargetsPlan), true); + EffectiveTarget effectiveTarget = getTargetChain() + .getEffectiveTarget( + Scope.nodeShape, + connectionsGroup.getRdfsSubClassOfReasoner(), + stableRandomVariableProvider + ); + + PlanNode allTargetsPlan = effectiveTarget + .getPlanNode( + connectionsGroup, + dataGraph, Scope.nodeShape, + true, + null + ); + + return Unique.getInstance(new ShiftToPropertyShape(allTargetsPlan), effectiveTarget.size() > 1); } return EmptyNode.getInstance(); } diff --git a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/ClassConstraintComponent.java b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/ClassConstraintComponent.java index 94ea3e2be3c..368a86497cb 100644 --- a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/ClassConstraintComponent.java +++ b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/ClassConstraintComponent.java @@ -29,6 +29,7 @@ import org.eclipse.rdf4j.sail.shacl.ast.ValidationApproach; import org.eclipse.rdf4j.sail.shacl.ast.ValidationQuery; import org.eclipse.rdf4j.sail.shacl.ast.paths.Path; +import org.eclipse.rdf4j.sail.shacl.ast.planNodes.AllTargetsPlanNode; import org.eclipse.rdf4j.sail.shacl.ast.planNodes.BufferedSplitter; import org.eclipse.rdf4j.sail.shacl.ast.planNodes.BulkedExternalInnerJoin; import org.eclipse.rdf4j.sail.shacl.ast.planNodes.EmptyNode; @@ -85,10 +86,30 @@ public PlanNode generateTransactionalValidationPlan(ConnectionsGroup connections PlanNode addedTargets; if (overrideTargetNode != null) { - addedTargets = effectiveTarget.extend(overrideTargetNode.getPlanNode(), connectionsGroup, - validationSettings.getDataGraph(), scope, - EffectiveTarget.Extend.right, - false, null); + PlanNode planNode = overrideTargetNode.getPlanNode(); + if (planNode instanceof AllTargetsPlanNode) { + // We are cheating a bit here by retrieving all the targets and values at the same time by + // pretending to be in node shape scope and then shifting the results back to property shape scope + PlanNode allTargets = getTargetChain() + .getEffectiveTarget(Scope.nodeShape, + connectionsGroup.getRdfsSubClassOfReasoner(), stableRandomVariableProvider) + .getAllTargets(connectionsGroup, validationSettings.getDataGraph(), Scope.nodeShape); + allTargets = new ShiftToPropertyShape(allTargets); + + // filter by type against the base sail + allTargets = new FilterByPredicateObject( + connectionsGroup.getBaseConnection(), + validationSettings.getDataGraph(), RDF.TYPE, clazzSet, + allTargets, false, FilterByPredicateObject.FilterOn.value, true); + + return allTargets; + + } else { + addedTargets = effectiveTarget.extend(planNode, connectionsGroup, + validationSettings.getDataGraph(), scope, + EffectiveTarget.Extend.right, + false, null); + } } else { BufferedSplitter addedTargetsBufferedSplitter = new BufferedSplitter( @@ -98,7 +119,7 @@ public PlanNode generateTransactionalValidationPlan(ConnectionsGroup connections PlanNode addedByPath = path.getAllAdded(connectionsGroup, validationSettings.getDataGraph(), null); addedByPath = effectiveTarget.getTargetFilter(connectionsGroup, - validationSettings.getDataGraph(), Unique.getInstance(new TrimToTarget(addedByPath), false)); + validationSettings.getDataGraph(), Unique.getInstance(new TrimToTarget(addedByPath), true)); addedByPath = new ReduceTargets(addedByPath, addedTargetsBufferedSplitter.getPlanNode()); @@ -132,6 +153,12 @@ public PlanNode generateTransactionalValidationPlan(ConnectionsGroup connections addedTargets = Unique.getInstance(addedTargets, false); } + int size = effectiveTarget.size(); + + if (size > 1) { + addedTargets = Unique.getInstance(addedTargets, true); + } + PlanNode falseNode = new BulkedExternalInnerJoin( addedTargets, connectionsGroup.getBaseConnection(), diff --git a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/DatatypeConstraintComponent.java b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/DatatypeConstraintComponent.java index 8d6086edaad..60bbfb510ad 100644 --- a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/DatatypeConstraintComponent.java +++ b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/DatatypeConstraintComponent.java @@ -29,7 +29,7 @@ import org.eclipse.rdf4j.sail.shacl.ast.planNodes.FilterPlanNode; import org.eclipse.rdf4j.sail.shacl.ast.planNodes.PlanNode; -public class DatatypeConstraintComponent extends SimpleAbstractConstraintComponent { +public class DatatypeConstraintComponent extends AbstractSimpleConstraintComponent { private final CoreDatatype coreDatatype; private final IRI datatype; diff --git a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/InConstraintComponent.java b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/InConstraintComponent.java index 0b55203f2dc..7a1fa3d2943 100644 --- a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/InConstraintComponent.java +++ b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/InConstraintComponent.java @@ -31,7 +31,7 @@ import org.eclipse.rdf4j.sail.shacl.ast.planNodes.ValueInFilter; import org.eclipse.rdf4j.sail.shacl.wrapper.shape.ShapeSource; -public class InConstraintComponent extends SimpleAbstractConstraintComponent { +public class InConstraintComponent extends AbstractSimpleConstraintComponent { private final Set in; diff --git a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/LanguageInConstraintComponent.java b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/LanguageInConstraintComponent.java index 09e4b404844..34e2829d0fc 100644 --- a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/LanguageInConstraintComponent.java +++ b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/LanguageInConstraintComponent.java @@ -34,7 +34,7 @@ import org.eclipse.rdf4j.sail.shacl.ast.planNodes.PlanNode; import org.eclipse.rdf4j.sail.shacl.wrapper.shape.ShapeSource; -public class LanguageInConstraintComponent extends SimpleAbstractConstraintComponent { +public class LanguageInConstraintComponent extends AbstractSimpleConstraintComponent { private final List languageIn; private final ArrayList languageRanges; diff --git a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/MaxExclusiveConstraintComponent.java b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/MaxExclusiveConstraintComponent.java index 0fb7d81e6af..24b02279169 100644 --- a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/MaxExclusiveConstraintComponent.java +++ b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/MaxExclusiveConstraintComponent.java @@ -28,7 +28,7 @@ import org.eclipse.rdf4j.sail.shacl.ast.planNodes.LiteralComparatorFilter; import org.eclipse.rdf4j.sail.shacl.ast.planNodes.PlanNode; -public class MaxExclusiveConstraintComponent extends SimpleAbstractConstraintComponent { +public class MaxExclusiveConstraintComponent extends AbstractSimpleConstraintComponent { Literal maxExclusive; diff --git a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/MaxInclusiveConstraintComponent.java b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/MaxInclusiveConstraintComponent.java index 864e9c2b321..f29cacc1bc1 100644 --- a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/MaxInclusiveConstraintComponent.java +++ b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/MaxInclusiveConstraintComponent.java @@ -28,7 +28,7 @@ import org.eclipse.rdf4j.sail.shacl.ast.planNodes.LiteralComparatorFilter; import org.eclipse.rdf4j.sail.shacl.ast.planNodes.PlanNode; -public class MaxInclusiveConstraintComponent extends SimpleAbstractConstraintComponent { +public class MaxInclusiveConstraintComponent extends AbstractSimpleConstraintComponent { Literal maxInclusive; diff --git a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/MaxLengthConstraintComponent.java b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/MaxLengthConstraintComponent.java index 25259b05206..f5065ce7bea 100644 --- a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/MaxLengthConstraintComponent.java +++ b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/MaxLengthConstraintComponent.java @@ -30,7 +30,7 @@ import org.eclipse.rdf4j.sail.shacl.ast.planNodes.MaxLengthFilter; import org.eclipse.rdf4j.sail.shacl.ast.planNodes.PlanNode; -public class MaxLengthConstraintComponent extends SimpleAbstractConstraintComponent { +public class MaxLengthConstraintComponent extends AbstractSimpleConstraintComponent { long maxLength; diff --git a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/MinExclusiveConstraintComponent.java b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/MinExclusiveConstraintComponent.java index cd32c0e50ef..1c758b36f54 100644 --- a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/MinExclusiveConstraintComponent.java +++ b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/MinExclusiveConstraintComponent.java @@ -28,7 +28,7 @@ import org.eclipse.rdf4j.sail.shacl.ast.planNodes.LiteralComparatorFilter; import org.eclipse.rdf4j.sail.shacl.ast.planNodes.PlanNode; -public class MinExclusiveConstraintComponent extends SimpleAbstractConstraintComponent { +public class MinExclusiveConstraintComponent extends AbstractSimpleConstraintComponent { Literal minExclusive; diff --git a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/MinInclusiveConstraintComponent.java b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/MinInclusiveConstraintComponent.java index e366d90a7a4..59d6e7b6d27 100644 --- a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/MinInclusiveConstraintComponent.java +++ b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/MinInclusiveConstraintComponent.java @@ -28,7 +28,7 @@ import org.eclipse.rdf4j.sail.shacl.ast.planNodes.LiteralComparatorFilter; import org.eclipse.rdf4j.sail.shacl.ast.planNodes.PlanNode; -public class MinInclusiveConstraintComponent extends SimpleAbstractConstraintComponent { +public class MinInclusiveConstraintComponent extends AbstractSimpleConstraintComponent { Literal minInclusive; diff --git a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/MinLengthConstraintComponent.java b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/MinLengthConstraintComponent.java index 9b8ef2ce966..fed480fbd16 100644 --- a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/MinLengthConstraintComponent.java +++ b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/MinLengthConstraintComponent.java @@ -30,7 +30,7 @@ import org.eclipse.rdf4j.sail.shacl.ast.planNodes.MinLengthFilter; import org.eclipse.rdf4j.sail.shacl.ast.planNodes.PlanNode; -public class MinLengthConstraintComponent extends SimpleAbstractConstraintComponent { +public class MinLengthConstraintComponent extends AbstractSimpleConstraintComponent { long minLength; diff --git a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/NodeKindConstraintComponent.java b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/NodeKindConstraintComponent.java index d52274e7a20..c4635cd2089 100644 --- a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/NodeKindConstraintComponent.java +++ b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/NodeKindConstraintComponent.java @@ -23,11 +23,12 @@ import org.eclipse.rdf4j.model.vocabulary.SHACL; import org.eclipse.rdf4j.sail.shacl.SourceConstraintComponent; import org.eclipse.rdf4j.sail.shacl.ast.StatementMatcher.Variable; +import org.eclipse.rdf4j.sail.shacl.ast.ValidationApproach; import org.eclipse.rdf4j.sail.shacl.ast.planNodes.FilterPlanNode; import org.eclipse.rdf4j.sail.shacl.ast.planNodes.NodeKindFilter; import org.eclipse.rdf4j.sail.shacl.ast.planNodes.PlanNode; -public class NodeKindConstraintComponent extends SimpleAbstractConstraintComponent { +public class NodeKindConstraintComponent extends AbstractSimpleConstraintComponent { NodeKind nodeKind; diff --git a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/PatternConstraintComponent.java b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/PatternConstraintComponent.java index 1cec22276b1..213563d2648 100644 --- a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/PatternConstraintComponent.java +++ b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/PatternConstraintComponent.java @@ -30,7 +30,7 @@ import org.eclipse.rdf4j.sail.shacl.ast.planNodes.PatternFilter; import org.eclipse.rdf4j.sail.shacl.ast.planNodes.PlanNode; -public class PatternConstraintComponent extends SimpleAbstractConstraintComponent { +public class PatternConstraintComponent extends AbstractSimpleConstraintComponent { String pattern; String flags; @@ -67,7 +67,10 @@ String getSparqlFilterExpression(Variable variable, boolean negated) { } private static String escapeRegexForSparql(String pattern) { - return pattern.replace("\\", "\\\\").replace("\"", "\\\"").replace("\n", "\\n"); + pattern = pattern.replace("\\", "\\\\"); + pattern = pattern.replace("\"", "\\\""); + pattern = pattern.replace("\n", "\\n"); + return pattern; } @Override diff --git a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/SparqlConstraintComponent.java b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/SparqlConstraintComponent.java index 3d60e6f98a6..efb17d8df57 100644 --- a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/SparqlConstraintComponent.java +++ b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/constraintcomponents/SparqlConstraintComponent.java @@ -14,7 +14,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Objects; -import java.util.Optional; import java.util.Set; import java.util.stream.Stream; @@ -37,10 +36,8 @@ import org.eclipse.rdf4j.sail.shacl.ast.ValidationQuery; import org.eclipse.rdf4j.sail.shacl.ast.paths.Path; import org.eclipse.rdf4j.sail.shacl.ast.planNodes.AllTargetsPlanNode; -import org.eclipse.rdf4j.sail.shacl.ast.planNodes.BulkedExternalInnerJoin; import org.eclipse.rdf4j.sail.shacl.ast.planNodes.PlanNode; import org.eclipse.rdf4j.sail.shacl.ast.planNodes.PlanNodeProvider; -import org.eclipse.rdf4j.sail.shacl.ast.planNodes.ShiftToPropertyShape; import org.eclipse.rdf4j.sail.shacl.ast.planNodes.SparqlConstraintSelect; import org.eclipse.rdf4j.sail.shacl.ast.planNodes.Unique; import org.eclipse.rdf4j.sail.shacl.ast.targets.EffectiveTarget; @@ -162,13 +159,22 @@ public PlanNode generateTransactionalValidationPlan(ConnectionsGroup connections PlanNode allTargets; if (overrideTargetNode != null) { - allTargets = getPlanNodeForOverrideTargetNode(connectionsGroup, validationSettings, overrideTargetNode, + allTargets = getPlanNodeForOverrideTargetNode( + connectionsGroup, + validationSettings, + overrideTargetNode, scope, - stableRandomVariableProvider, effectiveTarget, getTargetChain().getPath()); + effectiveTarget + ); + } else { allTargets = effectiveTarget.getAllTargets(connectionsGroup, validationSettings.getDataGraph(), scope); } + if (effectiveTarget.size() > 1) { + allTargets = Unique.getInstance(allTargets, true); + } + return new SparqlConstraintSelect(connectionsGroup.getBaseConnection(), allTargets, select, scope, validationSettings.getDataGraph(), produceValidationReports, this, shape); @@ -176,21 +182,22 @@ public PlanNode generateTransactionalValidationPlan(ConnectionsGroup connections private PlanNode getPlanNodeForOverrideTargetNode(ConnectionsGroup connectionsGroup, ValidationSettings validationSettings, PlanNodeProvider overrideTargetNode, Scope scope, - StatementMatcher.StableRandomVariableProvider stableRandomVariableProvider, EffectiveTarget effectiveTarget, - Optional path) { + EffectiveTarget effectiveTarget) { PlanNode planNode; + assert scope != null; + + PlanNode overrideTargetPlanNode = overrideTargetNode.getPlanNode(); if (scope == Scope.nodeShape) { - PlanNode overrideTargetPlanNode = overrideTargetNode.getPlanNode(); if (overrideTargetPlanNode instanceof AllTargetsPlanNode) { - PlanNode allTargets = effectiveTarget.getAllTargets(connectionsGroup, - validationSettings.getDataGraph(), scope); - - return Unique.getInstance(allTargets, true); + return effectiveTarget.getAllTargets(connectionsGroup, validationSettings.getDataGraph(), scope); } else { - return effectiveTarget.extend(overrideTargetPlanNode, connectionsGroup, - validationSettings.getDataGraph(), scope, + return effectiveTarget.extend( + overrideTargetPlanNode, + connectionsGroup, + validationSettings.getDataGraph(), + scope, EffectiveTarget.Extend.right, false, null @@ -199,36 +206,16 @@ private PlanNode getPlanNodeForOverrideTargetNode(ConnectionsGroup connectionsGr } } else { - PlanNode overrideTargetPlanNode = overrideTargetNode.getPlanNode(); if (overrideTargetPlanNode instanceof AllTargetsPlanNode) { - // We are cheating a bit here by retrieving all the targets and values at the same time by - // pretending to be in node shape scope and then shifting the results back to property shape scope - PlanNode allTargets = getTargetChain() - .getEffectiveTarget(Scope.nodeShape, - connectionsGroup.getRdfsSubClassOfReasoner(), stableRandomVariableProvider) - .getAllTargets(connectionsGroup, validationSettings.getDataGraph(), Scope.nodeShape); - allTargets = new ShiftToPropertyShape(allTargets); - - return Unique.getInstance(allTargets, true); - + return effectiveTarget.getAllTargets(connectionsGroup, validationSettings.getDataGraph(), scope); } else { overrideTargetPlanNode = effectiveTarget.extend(overrideTargetPlanNode, connectionsGroup, validationSettings.getDataGraph(), scope, EffectiveTarget.Extend.right, false, null); - planNode = new BulkedExternalInnerJoin(overrideTargetPlanNode, - connectionsGroup.getBaseConnection(), - validationSettings.getDataGraph(), path.get() - .getTargetQueryFragment(new StatementMatcher.Variable("a"), - new StatementMatcher.Variable("c"), - connectionsGroup.getRdfsSubClassOfReasoner(), stableRandomVariableProvider, - Set.of()), - false, null, - BulkedExternalInnerJoin.getMapper("a", "c", scope, validationSettings.getDataGraph()) - ); - planNode = connectionsGroup.getCachedNodeFor(planNode); + planNode = connectionsGroup.getCachedNodeFor(overrideTargetPlanNode); } } 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 822703f9a71..c8f0873a8e8 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 @@ -21,6 +21,7 @@ import org.eclipse.rdf4j.query.BindingSet; import org.eclipse.rdf4j.query.Dataset; 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; @@ -93,14 +94,14 @@ public CloseableIteration iterator() { ArrayDeque left; ArrayDeque right; ArrayDeque joined; - private CloseableIteration leftNodeIterator; + private PeekMarkIterator leftNodeIterator; @Override protected void init() { left = new ArrayDeque<>(BULK_SIZE); right = new ArrayDeque<>(BULK_SIZE); joined = new ArrayDeque<>(BULK_SIZE); - leftNodeIterator = leftNode.iterator(); + leftNodeIterator = new PeekMarkIterator<>(leftNode.iterator()); } private void calculateNext() { @@ -112,6 +113,16 @@ private void calculateNext() { while (joined.isEmpty() && leftNodeIterator.hasNext()) { while (left.size() < BULK_SIZE && leftNodeIterator.hasNext()) { + if (!left.isEmpty()) { + ValidationTuple peek = leftNodeIterator.peek(); + if (peek.sameTargetAs(left.getFirst())) { + // stop if we detect a duplicate target since we only support distinct targets on the + // left side of the join + assert false + : "Current and next left target is the same: " + peek + " " + left.getFirst(); + break; + } + } left.addFirst(leftNodeIterator.next()); } 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 3035de45625..a1da130c6f4 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 @@ -21,6 +21,7 @@ import org.eclipse.rdf4j.query.BindingSet; import org.eclipse.rdf4j.query.Dataset; 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; @@ -64,13 +65,13 @@ public CloseableIteration iterator() { ArrayDeque left; ArrayDeque right; - private CloseableIteration leftNodeIterator; + private PeekMarkIterator leftNodeIterator; @Override protected void init() { left = new ArrayDeque<>(BULK_SIZE); right = new ArrayDeque<>(BULK_SIZE); - leftNodeIterator = leftNode.iterator(); + leftNodeIterator = new PeekMarkIterator<>(leftNode.iterator()); } private void calculateNext() { @@ -80,6 +81,15 @@ private void calculateNext() { } while (left.size() < BULK_SIZE && leftNodeIterator.hasNext()) { + if (!left.isEmpty()) { + ValidationTuple peek = leftNodeIterator.peek(); + if (peek.sameTargetAs(left.getFirst())) { + // stop if we detect a duplicate target since we only support distinct targets on the left + // side of the join + assert false : "Current and next left target is the same: " + peek + " " + left.getFirst(); + break; + } + } left.addFirst(leftNodeIterator.next()); } diff --git a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/FilterByPredicateObject.java b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/FilterByPredicateObject.java index 61efae71219..ee3372a53f6 100644 --- a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/FilterByPredicateObject.java +++ b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/FilterByPredicateObject.java @@ -14,6 +14,7 @@ import java.util.Arrays; import java.util.Objects; import java.util.Set; +import java.util.concurrent.ExecutionException; import org.apache.commons.text.StringEscapeUtils; import org.eclipse.rdf4j.common.iteration.CloseableIteration; @@ -22,8 +23,12 @@ import org.eclipse.rdf4j.model.Statement; import org.eclipse.rdf4j.model.Value; import org.eclipse.rdf4j.sail.SailConnection; +import org.eclipse.rdf4j.sail.SailException; import org.eclipse.rdf4j.sail.memory.MemoryStoreConnection; +import com.google.common.cache.Cache; +import com.google.common.cache.CacheBuilder; + /** * @author Håvard Ottestad */ @@ -41,6 +46,8 @@ public class FilterByPredicateObject implements PlanNode { private ValidationExecutionLogger validationExecutionLogger; private final Resource[] dataGraph; + private final Cache cache = CacheBuilder.newBuilder().maximumSize(1000).build(); + public FilterByPredicateObject(SailConnection connection, Resource[] dataGraph, IRI filterOnPredicate, Set filterOnObject, PlanNode parent, boolean returnMatching, FilterOn filterOn, boolean includeInferred) { @@ -195,12 +202,26 @@ private boolean matches(Value subject, IRI filterOnPredicate, Resource[] filterO } if (subject.isResource()) { - for (Resource object : filterOnObject) { - if (connection.hasStatement(((Resource) subject), filterOnPredicate, object, includeInferred, - dataGraph)) { - return true; + try { + return cache.get(((Resource) subject), () -> { + for (Resource object : filterOnObject) { + if (connection.hasStatement(((Resource) subject), filterOnPredicate, object, includeInferred, + dataGraph)) { + return true; + } + } + return false; + }); + } catch (ExecutionException e) { + if (e.getCause() != null) { + if (e.getCause() instanceof RuntimeException) { + throw ((RuntimeException) e.getCause()); + } + throw new SailException(e.getCause()); } + throw new SailException(e); } + } return false; } diff --git a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/PatternFilter.java b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/PatternFilter.java index ebef3b98ddc..ca3f76614fb 100644 --- a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/PatternFilter.java +++ b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/PatternFilter.java @@ -14,7 +14,13 @@ import java.util.Objects; import java.util.regex.Pattern; +import org.eclipse.rdf4j.model.IRI; +import org.eclipse.rdf4j.model.Literal; +import org.eclipse.rdf4j.model.Triple; import org.eclipse.rdf4j.model.Value; +import org.eclipse.rdf4j.model.ValueFactory; +import org.eclipse.rdf4j.model.impl.SimpleValueFactory; +import org.eclipse.rdf4j.query.algebra.evaluation.util.QueryEvaluationUtility; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -71,16 +77,49 @@ public PatternFilter(PlanNode parent, String pattern, String flags) { logger.trace("PatternFilter constructed with pattern: {} and flags: {}", pattern, flags); } else { - this.pattern = Pattern.compile(pattern); + this.pattern = Pattern.compile(pattern, 0b0); logger.trace("PatternFilter constructed with pattern: {} and no flags", pattern); } } + private static Literal str(Value argValue, ValueFactory valueFactory) { + if (argValue instanceof IRI || argValue instanceof Triple) { + return valueFactory.createLiteral(argValue.toString()); + } else if (argValue instanceof Literal) { + Literal literal = (Literal) argValue; + + if (QueryEvaluationUtility.isSimpleLiteral(literal)) { + return literal; + } else { + return valueFactory.createLiteral(literal.getLabel()); + } + } else { + return null; + } + } + @Override boolean checkTuple(Reference t) { Value literal = t.get().getValue(); + literal = str(literal, SimpleValueFactory.getInstance()); - return pattern.matcher(literal.stringValue()).matches(); + if (literal == null) + return false; + + if (QueryEvaluationUtility.isStringLiteral(literal)) { + boolean result = pattern.matcher(((Literal) literal).getLabel()).find(); + if (logger.isTraceEnabled()) { + logger.trace("PatternFilter value: \"{}\" with pattern: \"{}\" and result: {}", + ((Literal) literal).getLabel().replace("\n", "\\n").replace("\"", "\\\""), + pattern.toString().replace("\n", "\\n").replace("\"", "\\\""), result); + } + return result; + } + + if (logger.isTraceEnabled()) { + logger.trace("PatternFilter did not match value because value is not a string literal: {}", literal); + } + return false; } @Override diff --git a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/SparqlConstraintSelect.java b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/SparqlConstraintSelect.java index 0d8dacf53ed..9b244b4bc10 100644 --- a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/SparqlConstraintSelect.java +++ b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/SparqlConstraintSelect.java @@ -121,29 +121,42 @@ private void calculateNext() { } } - Value value = bindingSet.getValue("value"); + Value value1 = bindingSet.getValue("value"); + if (value1 == null) { + value1 = nextTarget.getValue(); + } + Value currentValue = value1; + Value path = bindingSet.getValue("path"); if (scope == ConstraintComponent.Scope.nodeShape) { next = nextTarget.addValidationResult(t -> { - ValidationResult validationResult = new ValidationResult(t.getActiveTarget(), value, + ValidationResult validationResult = new ValidationResult(t.getActiveTarget(), + currentValue, shape, constraintComponent, shape.getSeverity(), ConstraintComponent.Scope.nodeShape, t.getContexts(), shape.getContexts()); - validationResult.setPathIri(path); + if (path != null) { + validationResult.setPathIri(path); + } return validationResult; }); } else { - ValidationTuple validationTuple = new ValidationTuple(nextTarget.getActiveTarget(), value, - scope, true, nextTarget.getContexts()); + + ValidationTuple validationTuple = new ValidationTuple(nextTarget.getActiveTarget(), + currentValue, + scope, currentValue != null, nextTarget.getContexts()); next = ValidationTupleHelper.join(nextTarget, validationTuple).addValidationResult(t -> { - ValidationResult validationResult = new ValidationResult(t.getActiveTarget(), value, + ValidationResult validationResult = new ValidationResult(t.getActiveTarget(), + currentValue, shape, constraintComponent, shape.getSeverity(), ConstraintComponent.Scope.propertyShape, t.getContexts(), shape.getContexts()); - validationResult.setPathIri(path); + if (path != null) { + validationResult.setPathIri(path); + } return validationResult; }); } diff --git a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/ValidationTuple.java b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/ValidationTuple.java index 3bad814ab15..f208b619303 100644 --- a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/ValidationTuple.java +++ b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/ValidationTuple.java @@ -323,6 +323,7 @@ public List getTargetChain(boolean includePropertyShapeValues) { } public ValidationTuple setValue(Value value) { + assert value != null; if (value.equals(getValue())) { return this; } @@ -493,7 +494,9 @@ public ValidationTuple join(ValidationTuple right) { ValidationTuple validationTuple = new ValidationTuple(validationResults, chain, scope, propertyShapeScopeWithValue, compressedTuples, contexts); if (scope == ConstraintComponent.Scope.propertyShape) { - validationTuple = validationTuple.setValue(right.getValue()); + if (right.hasValue()) { + validationTuple = validationTuple.setValue(right.getValue()); + } } for (ValidationResult validationResult : right.getValidationResult()) { diff --git a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/targets/EffectiveTarget.java b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/targets/EffectiveTarget.java index 7a68228bc58..30c06c3f9d0 100644 --- a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/targets/EffectiveTarget.java +++ b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/targets/EffectiveTarget.java @@ -401,6 +401,10 @@ public Variable getOptionalVar() { return Objects.requireNonNull(optional, "Optional was null").var; } + public int size() { + return chain.size(); + } + public enum Extend { left, right 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 3ad450e7901..3e4e06116c6 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 @@ -66,6 +66,7 @@ private PlanNode getAddedRemovedInner(SailConnection connection, Resource[] data Resource clazz = targetClass.stream().findAny().get(); planNode = new UnorderedSelect(connection, null, RDF.TYPE, clazz, dataGraph, UnorderedSelect.Mapper.SubjectScopedMapper.getFunction(scope), null); + return planNode; } else { planNode = new Select(connection, SparqlFragment.bgp(Set.of(), diff --git a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/results/ValidationResult.java b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/results/ValidationResult.java index faf328d7917..600a8cd6ee8 100644 --- a/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/results/ValidationResult.java +++ b/core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/results/ValidationResult.java @@ -77,18 +77,16 @@ public ValidationResult(Value focusNode, Value value, Shape shape, this.shape = shape; if (sourceConstraintComponent.producesValidationResultValue()) { - assert value != null; + assert !sourceConstraintComponent.alwaysProducesValidationResultValue() || value != null; // value could be null if assertions are disabled // noinspection ConstantValue - if (value == null) { + if (value == null && sourceConstraintComponent.alwaysProducesValidationResultValue()) { logger.error( "Source constraint component {} was expected to produce a value, but value is null! Shape: {}", sourceConstraintComponent, shape); } - // value could be null if assertions are disabled - // noinspection OptionalOfNullableMisuse this.value = Optional.ofNullable(value); } else { assert scope != ConstraintComponent.Scope.propertyShape || value == null; 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 94a2667d6db..9392cbf043d 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 @@ -311,7 +311,7 @@ static void afterAll() throws IllegalAccessException { } @AfterEach - void tearDown() { + void afterEach() { fullLogging = false; } @@ -594,6 +594,12 @@ void referenceImplementationTestCaseValidation(TestCase testCase) { return; } + // the TopBraid SHACL API doesn't agree with other implementations on how multiple paths to the same target + // should work + if (testCase.testCasePath.startsWith("test-cases/nodeKind/simpleCompress/")) { + return; + } + printTestCase(testCase); Dataset shaclDataset = DatasetFactory.create(); diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ShaclTestWithoutSparqlValidationTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ShaclTestWithoutSparqlValidationTest.java new file mode 100644 index 00000000000..a3b4c123299 --- /dev/null +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ShaclTestWithoutSparqlValidationTest.java @@ -0,0 +1,74 @@ +/******************************************************************************* + * Copyright (c) 2024 Eclipse RDF4J contributors. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Distribution License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: BSD-3-Clause + *******************************************************************************/ + +package org.eclipse.rdf4j.sail.shacl; + +import org.eclipse.rdf4j.common.transaction.IsolationLevel; +import org.eclipse.rdf4j.repository.sail.SailRepository; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +/** + * @author Håvard Ottestad + */ +public class ShaclTestWithoutSparqlValidationTest extends AbstractShaclTest { + + @Override + SailRepository getShaclSail(TestCase testCase) { + SailRepository sail = super.getShaclSail(testCase); + ShaclSail shaclSail = (ShaclSail) sail.getSail(); + shaclSail.sparqlValidation = false; + return sail; + } + + @ParameterizedTest + @MethodSource("testsToRunWithIsolationLevel") + public void test(TestCase testCase, IsolationLevel isolationLevel) { + runWithAutomaticLogging(() -> runTestCase(testCase, isolationLevel, false)); + } + + @ParameterizedTest + @MethodSource("testCases") + public void testSingleTransaction(TestCase testCase) { + runWithAutomaticLogging(() -> runTestCaseSingleTransaction(testCase)); + } + + @ParameterizedTest + @MethodSource("testsToRunWithIsolationLevel") + public void testRevalidation(TestCase testCase, IsolationLevel isolationLevel) { + runWithAutomaticLogging(() -> runTestCaseRevalidate(testCase, isolationLevel)); + } + + @ParameterizedTest + @MethodSource("testsToRunWithIsolationLevel") + public void testNonEmpty(TestCase testCase, IsolationLevel isolationLevel) { + runWithAutomaticLogging(() -> runTestCase(testCase, isolationLevel, true)); + } + + @ParameterizedTest + @MethodSource("testCases") + public void testParsing(TestCase testCase) { + runWithAutomaticLogging(() -> runParsingTest(testCase)); + } + + @ParameterizedTest + @MethodSource("testCases") + public void testReferenceImplementation(TestCase testCase) { + runWithAutomaticLogging(() -> referenceImplementationTestCaseValidation(testCase)); + } + + @ParameterizedTest + @MethodSource("testCases") + public void testShaclValidator(TestCase testCase) { + runWithAutomaticLogging(() -> runWithShaclValidator(testCase)); + } + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/class/complexPath/invalid/case7/query1.rq b/core/sail/shacl/src/test/resources/test-cases/class/complexPath/invalid/case7/query1.rq new file mode 100644 index 00000000000..847fa1bfb04 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/class/complexPath/invalid/case7/query1.rq @@ -0,0 +1,12 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { +ex:validPerson1 a ex:AnyTarget, ex:Person, ex:SecondTarget ; + ex:knows1 [ ex:knows2 [ ex:knows3 [ ex:knows4 ex:peter ]]]. + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/class/complexPath/invalid/case7/report.ttl b/core/sail/shacl/src/test/resources/test-cases/class/complexPath/invalid/case7/report.ttl new file mode 100644 index 00000000000..63394b1bf68 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/class/complexPath/invalid/case7/report.ttl @@ -0,0 +1,27 @@ +@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 _:867c9670a0c541e184b71a3107a202a6598; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:ClassConstraintComponent; + sh:sourceShape [ a sh:PropertyShape; + sh:class ex:Person; + sh:path _:867c9670a0c541e184b71a3107a202a6598 + ]; + sh:value ex:peter + ] . + +_:867c9670a0c541e184b71a3107a202a6598 rdf:first ex:knows1; + rdf:rest (ex:knows2 ex:knows3 ex:knows4) . diff --git a/core/sail/shacl/src/test/resources/test-cases/class/complexPath/shacl.trig b/core/sail/shacl/src/test/resources/test-cases/class/complexPath/shacl.trig index 7a39648bd06..251283430ce 100644 --- a/core/sail/shacl/src/test/resources/test-cases/class/complexPath/shacl.trig +++ b/core/sail/shacl/src/test/resources/test-cases/class/complexPath/shacl.trig @@ -8,7 +8,7 @@ rdf4j:SHACLShapeGraph { ex:PersonShape a sh:NodeShape; - sh:targetClass ex:Person, ex:SecondTarget; + sh:targetClass ex:Person, ex:SecondTarget, ex:AnyTarget; sh:property [ sh:path (ex:knows1 ex:knows2 ex:knows3 ex:knows4); sh:class ex:Person diff --git a/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case1/query1.rq b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case1/query1.rq new file mode 100644 index 00000000000..69fc48d49a7 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case1/query1.rq @@ -0,0 +1,12 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { +ex:validPerson1 a ex:Person ; + ex:knows1 [ex:knows2 [ex:knows3 [ex:knows4 ex:p1]]]. + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case1/report.ttl b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case1/report.ttl new file mode 100644 index 00000000000..a41adf9d5ce --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case1/report.ttl @@ -0,0 +1,33 @@ +@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:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode []; + sh:resultPath ex:knows2; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeConstraintComponent; + sh:sourceShape [ a sh:PropertyShape; + sh:node [ a sh:NodeShape; + sh:property [ a sh:PropertyShape; + sh:path ex:knows3; + sh:property [ a sh:PropertyShape; + sh:datatype xsd:float; + sh:path ex:knows4 + ] + ] + ]; + sh:path ex:knows2 + ]; + sh:value [] + ] . diff --git a/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case2/query1.rq b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case2/query1.rq new file mode 100644 index 00000000000..7fd4a7dbe60 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case2/query1.rq @@ -0,0 +1,17 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { +ex:validPerson1 a ex:Person ; + ex:knows1 ex:p1. + +ex:p1 ex:knows2 ex:p2. +ex:p2 ex:knows3 ex:p3. +ex:p3 ex:knows4 ex:p4. + + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case2/report.ttl b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case2/report.ttl new file mode 100644 index 00000000000..49185f9ced7 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case2/report.ttl @@ -0,0 +1,33 @@ +@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:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode ex:p1; + sh:resultPath ex:knows2; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeConstraintComponent; + sh:sourceShape [ a sh:PropertyShape; + sh:node [ a sh:NodeShape; + sh:property [ a sh:PropertyShape; + sh:path ex:knows3; + sh:property [ a sh:PropertyShape; + sh:datatype xsd:float; + sh:path ex:knows4 + ] + ] + ]; + sh:path ex:knows2 + ]; + sh:value ex:p2 + ] . diff --git a/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case3/query1.rq b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case3/query1.rq new file mode 100644 index 00000000000..daef27ca19f --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case3/query1.rq @@ -0,0 +1,18 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { +ex:validPerson1 a ex:Person ; + ex:knows1 ex:p1, ex:p1_1. + +ex:p1 ex:knows2 ex:p2. +ex:p1_1 ex:knows2 ex:p2. + +ex:p2 ex:knows3 ex:p3. +ex:p3 ex:knows4 ex:p4. + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case3/report.ttl b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case3/report.ttl new file mode 100644 index 00000000000..b785f8d0007 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case3/report.ttl @@ -0,0 +1,43 @@ +@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:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode ex:p1; + sh:resultPath ex:knows2; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeConstraintComponent; + sh:sourceShape _:5089a376325a403b926b5c31d5e95e721475; + sh:value ex:p2 + ], [ a sh:ValidationResult; + rsx:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode ex:p1_1; + sh:resultPath ex:knows2; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeConstraintComponent; + sh:sourceShape _:5089a376325a403b926b5c31d5e95e721475; + sh:value ex:p2 + ] . + +_:5089a376325a403b926b5c31d5e95e721475 a sh:PropertyShape; + sh:node [ a sh:NodeShape; + sh:property [ a sh:PropertyShape; + sh:path ex:knows3; + sh:property [ a sh:PropertyShape; + sh:datatype xsd:float; + sh:path ex:knows4 + ] + ] + ]; + sh:path ex:knows2 . diff --git a/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case4/query1.rq b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case4/query1.rq new file mode 100644 index 00000000000..a870343cf8f --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case4/query1.rq @@ -0,0 +1,21 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { +ex:validPerson1 a ex:Person ; + ex:knows1 ex:p1. + +ex:p1 ex:knows2 ex:p2. +ex:p1 ex:knows2 ex:p2_1. + +ex:p2_1 ex:knows3 ex:p3. +ex:p2 ex:knows3 ex:p3. + +ex:p3 ex:knows4 ex:p4. + + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case4/report.ttl b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case4/report.ttl new file mode 100644 index 00000000000..08bb47f7b81 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case4/report.ttl @@ -0,0 +1,43 @@ +@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:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode ex:p1; + sh:resultPath ex:knows2; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeConstraintComponent; + sh:sourceShape _:5089a376325a403b926b5c31d5e95e721758; + sh:value ex:p2 + ], [ a sh:ValidationResult; + rsx:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode ex:p1; + sh:resultPath ex:knows2; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeConstraintComponent; + sh:sourceShape _:5089a376325a403b926b5c31d5e95e721758; + sh:value ex:p2_1 + ] . + +_:5089a376325a403b926b5c31d5e95e721758 a sh:PropertyShape; + sh:node [ a sh:NodeShape; + sh:property [ a sh:PropertyShape; + sh:path ex:knows3; + sh:property [ a sh:PropertyShape; + sh:datatype xsd:float; + sh:path ex:knows4 + ] + ] + ]; + sh:path ex:knows2 . diff --git a/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case5/query1.rq b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case5/query1.rq new file mode 100644 index 00000000000..604808ad27e --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case5/query1.rq @@ -0,0 +1,16 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { +ex:validPerson1 a ex:Person ; + ex:knows1 ex:p1. + +ex:p1 ex:knows2 ex:p2. +ex:p3 ex:knows4 ex:p4. + + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case5/query2.rq b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case5/query2.rq new file mode 100644 index 00000000000..76f7bb7430b --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case5/query2.rq @@ -0,0 +1,11 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { +ex:p2 ex:knows3 ex:p3. + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case5/report.ttl b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case5/report.ttl new file mode 100644 index 00000000000..49185f9ced7 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case5/report.ttl @@ -0,0 +1,33 @@ +@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:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode ex:p1; + sh:resultPath ex:knows2; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeConstraintComponent; + sh:sourceShape [ a sh:PropertyShape; + sh:node [ a sh:NodeShape; + sh:property [ a sh:PropertyShape; + sh:path ex:knows3; + sh:property [ a sh:PropertyShape; + sh:datatype xsd:float; + sh:path ex:knows4 + ] + ] + ]; + sh:path ex:knows2 + ]; + sh:value ex:p2 + ] . diff --git a/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case6/query1.rq b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case6/query1.rq new file mode 100644 index 00000000000..e26a99534fa --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case6/query1.rq @@ -0,0 +1,16 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { +ex:validPerson1 a ex:Person ; + ex:knows1 ex:p1. + +ex:p2 ex:knows3 ex:p3. +ex:p3 ex:knows4 ex:p4. + + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case6/query2.rq b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case6/query2.rq new file mode 100644 index 00000000000..712a06afa9c --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case6/query2.rq @@ -0,0 +1,11 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { +ex:p1 ex:knows2 ex:p2. + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case6/report.ttl b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case6/report.ttl new file mode 100644 index 00000000000..49185f9ced7 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/invalid/case6/report.ttl @@ -0,0 +1,33 @@ +@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:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode ex:p1; + sh:resultPath ex:knows2; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeConstraintComponent; + sh:sourceShape [ a sh:PropertyShape; + sh:node [ a sh:NodeShape; + sh:property [ a sh:PropertyShape; + sh:path ex:knows3; + sh:property [ a sh:PropertyShape; + sh:datatype xsd:float; + sh:path ex:knows4 + ] + ] + ]; + sh:path ex:knows2 + ]; + sh:value ex:p2 + ] . diff --git a/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/shacl.trig b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/shacl.trig new file mode 100644 index 00000000000..e9ac07826c3 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/shacl.trig @@ -0,0 +1,29 @@ +@prefix ex: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@prefix sh: . +@prefix xsd: . +@prefix rdf4j: . + + { + ex:PersonShape a sh:NodeShape; + sh:targetClass ex:Person, ex:SecondTarget; + sh:property [ + sh:path ex:knows1; + sh:property [ + sh:path ex:knows2; + sh:node [ + sh:property [ + sh:path ex:knows3; + sh:property [ + sh:path ex:knows4; + sh:datatype xsd:float + ] + ] + ] + ] + ] . + rdf4j:nil sh:shapesGraph rdf4j:nil. + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/valid/case1/query1.rq b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/valid/case1/query1.rq new file mode 100644 index 00000000000..4bb7b4132df --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/valid/case1/query1.rq @@ -0,0 +1,12 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { +ex:validPerson1 a ex:Person ; + ex:knows1 [ex:knows2 [ex:knows3 [ex:knows4 "1.1"^^xsd:float]]]. + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/valid/case1/report.ttl b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/valid/case1/report.ttl new file mode 100644 index 00000000000..c0518dc88b5 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/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/datatype/nestedNode/valid/case2/query1.rq b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/valid/case2/query1.rq new file mode 100644 index 00000000000..62b8e5dbf4e --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/valid/case2/query1.rq @@ -0,0 +1,11 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + ex:p1 ex:knows4 "1.1"^^xsd:float. + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/valid/case2/query2.rq b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/valid/case2/query2.rq new file mode 100644 index 00000000000..4b39e525467 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/valid/case2/query2.rq @@ -0,0 +1,13 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { +ex:validPerson1 a ex:Person ; + ex:knows1 [ex:knows2 [ex:knows3 ex:p1]]. + + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/valid/case2/report.ttl b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/valid/case2/report.ttl new file mode 100644 index 00000000000..c0518dc88b5 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/datatype/nestedNode/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/nodeKind/simpleCompress/invalid/case1/query1.rq b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case1/query1.rq new file mode 100644 index 00000000000..2e90364ff92 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case1/query1.rq @@ -0,0 +1,32 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + +ex:p1 a ex:Person. +ex:p1 ex:knows1 ex:p2, ex:p22, ex:p222. + +ex:p2 ex:knows2 ex:p3, ex:p33, ex:p333. +ex:p2 ex:knows3 ex:p4, ex:p44. + +ex:p22 ex:knows2 ex:p33. +ex:p222 ex:knows2 ex:p2. + +ex:p3 ex:knows3 ex:p4, ex:p44, ex:p444. +ex:p33 ex:knows3 ex:p4, ex:p44. +ex:p333 ex:knows3 ex:p44, ex:p444. + +ex:p4 ex:knows4 _:bnode2, _:bnode3. +ex:p44 ex:knows4 _:bnode2, _:bnode3, _:bnode4. +ex:p444 ex:knows4 _:bnode2, _:bnode3. + +_:bnode4 ex:knows5 _:bnode2, _:bnode3. +_:bnode3 ex:knows5 _:bnode2, _:bnode3, _:bnode4. +_:bnode2 ex:knows5 _:bnode2, _:bnode3. + + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case1/report.ttl b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case1/report.ttl new file mode 100644 index 00000000000..976df3ca3a2 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case1/report.ttl @@ -0,0 +1,80 @@ +@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:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode _:genid-6c6ac473daf740429803e3d85c951cdb95432-bnode2; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:fa5cdbe46be94176b45ae82a1f1013ef11208; + sh:value _:genid-6c6ac473daf740429803e3d85c951cdb95432-bnode2 + ], [ a sh:ValidationResult; + rsx:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode _:genid-6c6ac473daf740429803e3d85c951cdb95432-bnode3; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:fa5cdbe46be94176b45ae82a1f1013ef11208; + sh:value _:genid-6c6ac473daf740429803e3d85c951cdb95432-bnode2 + ], [ a sh:ValidationResult; + rsx:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode _:genid-6c6ac473daf740429803e3d85c951cdb95432-bnode4; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:fa5cdbe46be94176b45ae82a1f1013ef11208; + sh:value _:genid-6c6ac473daf740429803e3d85c951cdb95432-bnode2 + ], [ a sh:ValidationResult; + rsx:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode _:genid-6c6ac473daf740429803e3d85c951cdb95432-bnode3; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:fa5cdbe46be94176b45ae82a1f1013ef11208; + sh:value _:genid-6c6ac473daf740429803e3d85c951cdb95432-bnode3 + ], [ a sh:ValidationResult; + rsx:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode _:genid-6c6ac473daf740429803e3d85c951cdb95432-bnode4; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:fa5cdbe46be94176b45ae82a1f1013ef11208; + sh:value _:genid-6c6ac473daf740429803e3d85c951cdb95432-bnode3 + ], [ a sh:ValidationResult; + rsx:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode _:genid-6c6ac473daf740429803e3d85c951cdb95432-bnode2; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:fa5cdbe46be94176b45ae82a1f1013ef11208; + sh:value _:genid-6c6ac473daf740429803e3d85c951cdb95432-bnode3 + ], [ a sh:ValidationResult; + rsx:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode _:genid-6c6ac473daf740429803e3d85c951cdb95432-bnode3; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:fa5cdbe46be94176b45ae82a1f1013ef11208; + sh:value _:genid-6c6ac473daf740429803e3d85c951cdb95432-bnode4 + ] . + +_:fa5cdbe46be94176b45ae82a1f1013ef11208 a sh:PropertyShape; + sh:nodeKind sh:IRI; + sh:path ex:knows5 . diff --git a/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case2/query1.rq b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case2/query1.rq new file mode 100644 index 00000000000..f2becc436cd --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case2/query1.rq @@ -0,0 +1,31 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + +ex:p1 a ex:Person. +ex:p1 ex:knows1 ex:p2, ex:p22, ex:p222. + +ex:p2 ex:knows2 ex:p3, ex:p33, ex:p333. +ex:p2 ex:knows3 ex:p4, ex:p44. + +ex:p22 ex:knows2 ex:p33. +ex:p222 ex:knows2 ex:p2. + +ex:p3 ex:knows3 ex:p4, ex:p44, ex:p444. +ex:p33 ex:knows3 ex:p4, ex:p44. +ex:p333 ex:knows3 ex:p44, ex:p444. + +ex:p4 ex:knows4 ex:p5, ex:p55. +ex:p44 ex:knows4 ex:p5, ex:p55, ex:p555. +ex:p444 ex:knows4 ex:p5, ex:p55. + +ex:p5 ex:knows5 _:bnode2, _:bnode3. +ex:p55 ex:knows5 _:bnode2, _:bnode3, _:bnode4. +ex:p555 ex:knows5 _:bnode2, _:bnode3. + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case2/report.ttl b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case2/report.ttl new file mode 100644 index 00000000000..ad3642b21cd --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case2/report.ttl @@ -0,0 +1,80 @@ +@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:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode ex:p5; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:a799f05443e446b3a8e6afeb817a09a914840; + sh:value _:genid-f80a96476e0b4c59a8735fcc49f77ef718064-bnode2 + ], [ a sh:ValidationResult; + rsx:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode ex:p555; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:a799f05443e446b3a8e6afeb817a09a914840; + sh:value _:genid-f80a96476e0b4c59a8735fcc49f77ef718064-bnode3 + ], [ a sh:ValidationResult; + rsx:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode ex:p55; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:a799f05443e446b3a8e6afeb817a09a914840; + sh:value _:genid-f80a96476e0b4c59a8735fcc49f77ef718064-bnode2 + ], [ a sh:ValidationResult; + rsx:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode ex:p55; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:a799f05443e446b3a8e6afeb817a09a914840; + sh:value [] + ], [ a sh:ValidationResult; + rsx:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode ex:p55; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:a799f05443e446b3a8e6afeb817a09a914840; + sh:value _:genid-f80a96476e0b4c59a8735fcc49f77ef718064-bnode3 + ], [ a sh:ValidationResult; + rsx:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode ex:p555; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:a799f05443e446b3a8e6afeb817a09a914840; + sh:value _:genid-f80a96476e0b4c59a8735fcc49f77ef718064-bnode2 + ], [ a sh:ValidationResult; + rsx:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode ex:p5; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:a799f05443e446b3a8e6afeb817a09a914840; + sh:value _:genid-f80a96476e0b4c59a8735fcc49f77ef718064-bnode3 + ] . + +_:a799f05443e446b3a8e6afeb817a09a914840 a sh:PropertyShape; + sh:nodeKind sh:IRI; + sh:path ex:knows5 . diff --git a/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case3/query1.rq b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case3/query1.rq new file mode 100644 index 00000000000..f5625206772 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case3/query1.rq @@ -0,0 +1,31 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + +ex:p1 a ex:Person2. +ex:p1 ex:knows1 ex:p2, ex:p22, ex:p222. + +ex:p2 ex:knows2 ex:p3, ex:p33, ex:p333. +ex:p2 ex:knows3 ex:p4, ex:p44. + +ex:p22 ex:knows2 ex:p33. +ex:p222 ex:knows2 ex:p2. + +ex:p3 ex:knows3 ex:p4, ex:p44, ex:p444. +ex:p33 ex:knows3 ex:p4, ex:p44. +ex:p333 ex:knows3 ex:p44, ex:p444. + +ex:p4 ex:knows4 ex:p5, ex:p55. +ex:p44 ex:knows4 ex:p5, ex:p55, ex:p555. +ex:p444 ex:knows4 ex:p5, ex:p55. + +ex:p5 ex:knows5 ex:invalid1, ex:invalid2. +ex:p55 ex:knows5 ex:invalid1, ex:invalid2, ex:invalid3. +ex:p555 ex:knows5 ex:invalid1, ex:invalid2. + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case3/report.ttl b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case3/report.ttl new file mode 100644 index 00000000000..b4efd2e4c28 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case3/report.ttl @@ -0,0 +1,80 @@ +@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:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode ex:p555; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:732466f613c34468a12927308efb81a914840; + sh:value ex:invalid1 + ], [ a sh:ValidationResult; + rsx:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode ex:p55; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:732466f613c34468a12927308efb81a914840; + sh:value ex:invalid3 + ], [ a sh:ValidationResult; + rsx:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode ex:p55; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:732466f613c34468a12927308efb81a914840; + sh:value ex:invalid1 + ], [ a sh:ValidationResult; + rsx:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode ex:p5; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:732466f613c34468a12927308efb81a914840; + sh:value ex:invalid1 + ], [ a sh:ValidationResult; + rsx:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode ex:p555; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:732466f613c34468a12927308efb81a914840; + sh:value ex:invalid2 + ], [ a sh:ValidationResult; + rsx:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode ex:p5; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:732466f613c34468a12927308efb81a914840; + sh:value ex:invalid2 + ], [ a sh:ValidationResult; + rsx:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode ex:p55; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:732466f613c34468a12927308efb81a914840; + sh:value ex:invalid2 + ] . + +_:732466f613c34468a12927308efb81a914840 a sh:PropertyShape; + sh:nodeKind sh:BlankNode; + sh:path ex:knows5 . diff --git a/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case4/query1.rq b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case4/query1.rq new file mode 100644 index 00000000000..8a5bb709732 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case4/query1.rq @@ -0,0 +1,26 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + +ex:p1 a ex:Person2. +ex:p1 ex:knows1 ex:p2, ex:p22, ex:p222. + +ex:p2 ex:knows2 ex:p3, ex:p33, ex:p333. + +ex:p22 ex:knows2 ex:p33. +ex:p222 ex:knows2 ex:p2. + +ex:p4 ex:knows4 ex:p5, ex:p55. +ex:p44 ex:knows4 ex:p5, ex:p55, ex:p555. +ex:p444 ex:knows4 ex:p5, ex:p55. + +ex:p5 ex:knows5 ex:invalid1, ex:invalid2. +ex:p55 ex:knows5 ex:invalid1, ex:invalid2, ex:invalid3. +ex:p555 ex:knows5 ex:invalid1, ex:invalid2. + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case4/query2.rq b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case4/query2.rq new file mode 100644 index 00000000000..14079d1e9da --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case4/query2.rq @@ -0,0 +1,15 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { +ex:p2 ex:knows3 ex:p4, ex:p44. + +ex:p3 ex:knows3 ex:p4, ex:p44, ex:p444. +ex:p33 ex:knows3 ex:p4, ex:p44. +ex:p333 ex:knows3 ex:p44, ex:p444. + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case4/report.ttl b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case4/report.ttl new file mode 100644 index 00000000000..b4efd2e4c28 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case4/report.ttl @@ -0,0 +1,80 @@ +@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:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode ex:p555; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:732466f613c34468a12927308efb81a914840; + sh:value ex:invalid1 + ], [ a sh:ValidationResult; + rsx:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode ex:p55; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:732466f613c34468a12927308efb81a914840; + sh:value ex:invalid3 + ], [ a sh:ValidationResult; + rsx:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode ex:p55; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:732466f613c34468a12927308efb81a914840; + sh:value ex:invalid1 + ], [ a sh:ValidationResult; + rsx:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode ex:p5; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:732466f613c34468a12927308efb81a914840; + sh:value ex:invalid1 + ], [ a sh:ValidationResult; + rsx:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode ex:p555; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:732466f613c34468a12927308efb81a914840; + sh:value ex:invalid2 + ], [ a sh:ValidationResult; + rsx:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode ex:p5; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:732466f613c34468a12927308efb81a914840; + sh:value ex:invalid2 + ], [ a sh:ValidationResult; + rsx:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode ex:p55; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:732466f613c34468a12927308efb81a914840; + sh:value ex:invalid2 + ] . + +_:732466f613c34468a12927308efb81a914840 a sh:PropertyShape; + sh:nodeKind sh:BlankNode; + sh:path ex:knows5 . diff --git a/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case5/query1.rq b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case5/query1.rq new file mode 100644 index 00000000000..10d85f9bc45 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case5/query1.rq @@ -0,0 +1,30 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + +ex:p1 a ex:Person. +ex:p1 ex:knows1 ex:p2, ex:p22, ex:p222. + +ex:p2 ex:knows2 ex:p3, ex:p33, ex:p333. +ex:p2 ex:knows3 ex:p4, ex:p44. + +ex:p22 ex:knows2 ex:p33. +ex:p222 ex:knows2 ex:p2. + +ex:p3 ex:knows3 ex:p4, ex:p44, ex:p444. +ex:p33 ex:knows3 ex:p4, ex:p44. +ex:p333 ex:knows3 ex:p44, ex:p444. + +ex:p4 ex:knows4 _:bnode2. +ex:p44 ex:knows4 _:bnode2. +ex:p444 ex:knows4 _:bnode2. + +_:bnode2 ex:knows5 _:bnode2, _:bnode3. + + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case5/report.ttl b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case5/report.ttl new file mode 100644 index 00000000000..2d80b44b6fb --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case5/report.ttl @@ -0,0 +1,35 @@ +@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:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode _:genid-bb83388cb99e4e1e887ebc772122a9ca57103-bnode2; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:333910f927574097a749f6b0d7ac2bbd21356; + sh:value _:genid-bb83388cb99e4e1e887ebc772122a9ca57103-bnode2 + ], [ a sh:ValidationResult; + rsx:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode _:genid-bb83388cb99e4e1e887ebc772122a9ca57103-bnode2; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:333910f927574097a749f6b0d7ac2bbd21356; + sh:value [] + ] . + +_:333910f927574097a749f6b0d7ac2bbd21356 a sh:PropertyShape; + sh:nodeKind sh:IRI; + sh:path ex:knows5 . diff --git a/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case6/query1.rq b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case6/query1.rq new file mode 100644 index 00000000000..c990b4f67f7 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case6/query1.rq @@ -0,0 +1,29 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { + +ex:p1 a ex:Person2. +ex:p1 ex:knows1 ex:p2, ex:p22, ex:p222. + +ex:p2 ex:knows2 ex:p3, ex:p33, ex:p333. +ex:p2 ex:knows3 ex:p4. + +ex:p22 ex:knows2 ex:p33. +ex:p222 ex:knows2 ex:p2. + +ex:p3 ex:knows3 ex:p4. +ex:p33 ex:knows3 ex:p4. +ex:p333 ex:knows3 ex:p4. + +ex:p4 ex:knows4 ex:p5, ex:p55, ex:p555. + +ex:p5 ex:knows5 ex:invalid1, ex:invalid2. +ex:p55 ex:knows5 ex:invalid1, ex:invalid2, ex:invalid3. +ex:p555 ex:knows5 ex:invalid1, ex:invalid2. + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case6/report.ttl b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case6/report.ttl new file mode 100644 index 00000000000..b4efd2e4c28 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/invalid/case6/report.ttl @@ -0,0 +1,80 @@ +@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:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode ex:p555; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:732466f613c34468a12927308efb81a914840; + sh:value ex:invalid1 + ], [ a sh:ValidationResult; + rsx:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode ex:p55; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:732466f613c34468a12927308efb81a914840; + sh:value ex:invalid3 + ], [ a sh:ValidationResult; + rsx:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode ex:p55; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:732466f613c34468a12927308efb81a914840; + sh:value ex:invalid1 + ], [ a sh:ValidationResult; + rsx:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode ex:p5; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:732466f613c34468a12927308efb81a914840; + sh:value ex:invalid1 + ], [ a sh:ValidationResult; + rsx:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode ex:p555; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:732466f613c34468a12927308efb81a914840; + sh:value ex:invalid2 + ], [ a sh:ValidationResult; + rsx:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode ex:p5; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:732466f613c34468a12927308efb81a914840; + sh:value ex:invalid2 + ], [ a sh:ValidationResult; + rsx:dataGraph rdf4j:nil; + rsx:shapesGraph rdf4j:nil; + sh:focusNode ex:p55; + sh:resultPath ex:knows5; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent; + sh:sourceShape _:732466f613c34468a12927308efb81a914840; + sh:value ex:invalid2 + ] . + +_:732466f613c34468a12927308efb81a914840 a sh:PropertyShape; + sh:nodeKind sh:BlankNode; + sh:path ex:knows5 . diff --git a/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/shacl.trig b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/shacl.trig new file mode 100644 index 00000000000..9a73b080955 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/shacl.trig @@ -0,0 +1,73 @@ +@prefix : . +@prefix ont: . +@prefix vocsh: . +@prefix so: . +@prefix affected: . +@prefix res: . +@prefix dct: . +@prefix gn: . +@prefix owl: . +@prefix puml: . +@prefix rdf: . +@prefix rdfs: . +@prefix skos: . +@prefix void: . +@prefix wgs84: . +@prefix xsd: . +@prefix sh: . +@prefix dash: . +@prefix rsx: . +@prefix ec: . +@prefix ecinst: . +@prefix rdf4j: . +@prefix ex: . + + + +{ + + + ex:NodeKindCompressPropertyShapeIRI + a sh:PropertyShape ; + sh:targetClass ex:Person ; + sh:path ex:knows1 ; + sh:property [ + sh:path ex:knows2 ; + sh:property [ + sh:path ex:knows3 ; + sh:property [ + sh:path ex:knows4 ; + sh:property [ + sh:path ex:knows5 ; + sh:nodeKind sh:IRI; + + ] + ] + ] + ] + . + + ex:NodeKindCompressPropertyShapeBnode + a sh:PropertyShape ; + sh:targetClass ex:Person2 ; + sh:path ex:knows1 ; + sh:property [ + sh:path ex:knows2 ; + sh:property [ + sh:path ex:knows3 ; + sh:property [ + sh:path ex:knows4 ; + sh:property [ + sh:path ex:knows5 ; + sh:nodeKind sh:BlankNode; + + ] + ] + ] + ] + . + + + rdf4j:nil sh:shapesGraph rdf4j:nil. + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/valid/case1/query1.rq b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/valid/case1/query1.rq new file mode 100644 index 00000000000..31e86f76b8c --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/valid/case1/query1.rq @@ -0,0 +1,17 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { +ex:p1 a ex:Person. +ex:p1 ex:knows1 ex:p2. +ex:p2 ex:knows2 ex:p3. +ex:p2 ex:knows2 ex:p33. +ex:p3 ex:knows3 ex:node1. +ex:p33 ex:knows3 ex:node1. + + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/valid/case1/report.ttl b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/valid/case1/report.ttl new file mode 100644 index 00000000000..c0518dc88b5 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/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/nodeKind/simpleCompress/valid/case2/query1.rq b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/valid/case2/query1.rq new file mode 100644 index 00000000000..efb78741e71 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/valid/case2/query1.rq @@ -0,0 +1,16 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { +ex:p1 a ex:Person. +ex:p2 ex:knows2 ex:p3. +ex:p2 ex:knows2 ex:p33. +ex:p3 ex:knows3 ex:node1. +ex:p33 ex:knows3 ex:node1. + + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/valid/case2/query2.rq b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/valid/case2/query2.rq new file mode 100644 index 00000000000..655d1f8801a --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/valid/case2/query2.rq @@ -0,0 +1,13 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { +ex:p1 ex:knows1 ex:p2. + + +} + diff --git a/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/valid/case2/report.ttl b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/valid/case2/report.ttl new file mode 100644 index 00000000000..c0518dc88b5 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/nodeKind/simpleCompress/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/sparql/constraintsNodeShapeNoValue/invalid/case1/query1.rq b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsNodeShapeNoValue/invalid/case1/query1.rq new file mode 100644 index 00000000000..ccfa5521b0e --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsNodeShapeNoValue/invalid/case1/query1.rq @@ -0,0 +1,14 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { +ex:ValidCountry a ex:Country ; + ex:germanLabel "Spanien"@de . + +ex:InvalidCountry a ex:Country ; + ex:germanLabel "Spain"@en . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsNodeShapeNoValue/invalid/case1/report.ttl b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsNodeShapeNoValue/invalid/case1/report.ttl new file mode 100644 index 00000000000..6626e1eaeff --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsNodeShapeNoValue/invalid/case1/report.ttl @@ -0,0 +1,46 @@ +@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:InvalidCountry; + sh:resultMessage "Values are literals with German language tag."; + sh:resultSeverity sh:Violation; + sh:sourceConstraint _:5089a376325a403b926b5c31d5e95e7218012; + sh:sourceConstraintComponent sh:SPARQLConstraintComponent; + sh:sourceShape ex:LanguageExampleShape; + sh:value ex:InvalidCountry + ] . + +ex:LanguageExampleShape a sh:NodeShape; + sh:sparql _:5089a376325a403b926b5c31d5e95e7218012; + sh:targetClass ex:Country . + +_:5089a376325a403b926b5c31d5e95e7218012 a sh:SPARQLConstraint; + sh:deactivated false; + sh:message "Values are literals with German language tag."; + sh:prefixes ; + sh:select """ + SELECT ?this + WHERE { + $this ex:germanLabel ?value . + FILTER (isLiteral(?value) && !langMatches(lang(?value), \"de\")) + } + """ . + + sh:declare [ + sh:namespace "http://example.com/ns#"^^xsd:anyURI; + sh:prefix "ex" + ], [ + sh:namespace "http://schema.org/"^^xsd:anyURI; + sh:prefix "schema" + ] . diff --git a/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsNodeShapeNoValue/invalid/case2/query1.rq b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsNodeShapeNoValue/invalid/case2/query1.rq new file mode 100644 index 00000000000..4da878976ec --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsNodeShapeNoValue/invalid/case2/query1.rq @@ -0,0 +1,10 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { +ex:InvalidCountry ex:germanLabel "Spain"@en . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsNodeShapeNoValue/invalid/case2/query2.rq b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsNodeShapeNoValue/invalid/case2/query2.rq new file mode 100644 index 00000000000..1c82510cff8 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsNodeShapeNoValue/invalid/case2/query2.rq @@ -0,0 +1,13 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { +ex:ValidCountry a ex:Country ; + ex:germanLabel "Spanien"@de . + +ex:InvalidCountry a ex:Country . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsNodeShapeNoValue/invalid/case2/report.ttl b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsNodeShapeNoValue/invalid/case2/report.ttl new file mode 100644 index 00000000000..7568a39b4af --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsNodeShapeNoValue/invalid/case2/report.ttl @@ -0,0 +1,46 @@ +@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:InvalidCountry; + sh:resultMessage "Values are literals with German language tag."; + sh:resultSeverity sh:Violation; + sh:sourceConstraint _:5089a376325a403b926b5c31d5e95e7218023; + sh:sourceConstraintComponent sh:SPARQLConstraintComponent; + sh:sourceShape ex:LanguageExampleShape; + sh:value ex:InvalidCountry + ] . + +ex:LanguageExampleShape a sh:NodeShape; + sh:sparql _:5089a376325a403b926b5c31d5e95e7218023; + sh:targetClass ex:Country . + +_:5089a376325a403b926b5c31d5e95e7218023 a sh:SPARQLConstraint; + sh:deactivated false; + sh:message "Values are literals with German language tag."; + sh:prefixes ; + sh:select """ + SELECT ?this + WHERE { + $this ex:germanLabel ?value . + FILTER (isLiteral(?value) && !langMatches(lang(?value), \"de\")) + } + """ . + + sh:declare [ + sh:namespace "http://example.com/ns#"^^xsd:anyURI; + sh:prefix "ex" + ], [ + sh:namespace "http://schema.org/"^^xsd:anyURI; + sh:prefix "schema" + ] . diff --git a/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsNodeShapeNoValue/shacl.trig b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsNodeShapeNoValue/shacl.trig new file mode 100644 index 00000000000..b121fc44b22 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsNodeShapeNoValue/shacl.trig @@ -0,0 +1,53 @@ +@prefix : . +@prefix ont: . +@prefix vocsh: . +@prefix so: . +@prefix affected: . +@prefix res: . +@prefix dct: . +@prefix gn: . +@prefix owl: . +@prefix puml: . +@prefix rdf: . +@prefix rdfs: . +@prefix skos: . +@prefix void: . +@prefix wgs84: . +@prefix xsd: . +@prefix sh: . +@prefix dash: . +@prefix rsx: . +@prefix ec: . +@prefix ecinst: . +@prefix rdf4j: . +@prefix ex: . + +rdf4j:SHACLShapeGraph { + +ex: + sh:declare [ + sh:prefix "ex" ; + sh:namespace "http://example.com/ns#"^^xsd:anyURI ; + ] ; + sh:declare [ + sh:prefix "schema" ; + sh:namespace "http://schema.org/"^^xsd:anyURI ; + ] . + + ex:LanguageExampleShape + a sh:NodeShape ; + sh:targetClass ex:Country ; + sh:sparql [ + a sh:SPARQLConstraint ; # This triple is optional + sh:message "Values are literals with German language tag." ; + sh:prefixes ex: ; + sh:deactivated false ; + sh:select """ + SELECT ?this + WHERE { + $this ex:germanLabel ?value . + FILTER (isLiteral(?value) && !langMatches(lang(?value), "de")) + } + """ ; + ] . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsNodeShapeNoValue/valid/case1/query1.rq b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsNodeShapeNoValue/valid/case1/query1.rq new file mode 100644 index 00000000000..93cd8becf3a --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsNodeShapeNoValue/valid/case1/query1.rq @@ -0,0 +1,28 @@ +PREFIX ex: +PREFIX : +PREFIX affected: +PREFIX dash: +PREFIX dct: +PREFIX fn: +PREFIX gn: +PREFIX ont: +PREFIX owl: +PREFIX puml: +PREFIX rdf: +PREFIX rdfs: +PREFIX res: +PREFIX sesame: +PREFIX sh: +PREFIX skos: +PREFIX so: +PREFIX vocsh: +PREFIX void: +PREFIX wgs: +PREFIX xsd: + +INSERT DATA { + +ex:ValidCountry a ex:Country ; + ex:germanLabel "Spanien"@de . + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsNodeShapeNoValue/valid/case1/report.ttl b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsNodeShapeNoValue/valid/case1/report.ttl new file mode 100644 index 00000000000..c0518dc88b5 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsNodeShapeNoValue/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/sparql/constraintsNodeShapeNoValue/valid/case2/query1.rq b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsNodeShapeNoValue/valid/case2/query1.rq new file mode 100644 index 00000000000..fa058a146a2 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsNodeShapeNoValue/valid/case2/query1.rq @@ -0,0 +1,32 @@ +PREFIX ex: +PREFIX : +PREFIX affected: +PREFIX dash: +PREFIX dct: +PREFIX fn: +PREFIX gn: +PREFIX ont: +PREFIX owl: +PREFIX puml: +PREFIX rdf: +PREFIX rdfs: +PREFIX res: +PREFIX sesame: +PREFIX sh: +PREFIX skos: +PREFIX so: +PREFIX vocsh: +PREFIX void: +PREFIX wgs: +PREFIX xsd: + +INSERT DATA { + + +ex:ValidCountry a ex:Country ; + ex:germanLabel "Spain"@de . + +ex:InvalidCountry a ex:Country ; + ex:germanLabel [], ex:a . + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsNodeShapeNoValue/valid/case2/report.ttl b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsNodeShapeNoValue/valid/case2/report.ttl new file mode 100644 index 00000000000..c0518dc88b5 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsNodeShapeNoValue/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/sparql/constraintsPropertyShapeNoValue/invalid/case1/query1.rq b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsPropertyShapeNoValue/invalid/case1/query1.rq new file mode 100644 index 00000000000..ccfa5521b0e --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsPropertyShapeNoValue/invalid/case1/query1.rq @@ -0,0 +1,14 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { +ex:ValidCountry a ex:Country ; + ex:germanLabel "Spanien"@de . + +ex:InvalidCountry a ex:Country ; + ex:germanLabel "Spain"@en . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsPropertyShapeNoValue/invalid/case1/report.ttl b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsPropertyShapeNoValue/invalid/case1/report.ttl new file mode 100644 index 00000000000..c720586c8e9 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsPropertyShapeNoValue/invalid/case1/report.ttl @@ -0,0 +1,46 @@ +@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:InvalidCountry; + sh:resultMessage "Values are literals with German language tag."; + sh:resultPath ex:germanLabel; + sh:resultSeverity sh:Violation; + sh:sourceConstraint _:5089a376325a403b926b5c31d5e95e7218178; + sh:sourceConstraintComponent sh:SPARQLConstraintComponent; + sh:sourceShape ex:LanguageExamplePropertyShape; + ] . + +ex:LanguageExamplePropertyShape a sh:PropertyShape; + sh:path ex:germanLabel; + sh:sparql _:5089a376325a403b926b5c31d5e95e7218178; + sh:targetClass ex:Country . + +_:5089a376325a403b926b5c31d5e95e7218178 a sh:SPARQLConstraint; + sh:message "Values are literals with German language tag."; + sh:prefixes ; + sh:select """ + SELECT $this + WHERE { + $this $PATH ?temp . + FILTER (isLiteral(?temp) && !langMatches(lang(?temp), \"de\")) + } + """ . + + sh:declare [ + sh:namespace "http://example.com/ns#"^^xsd:anyURI; + sh:prefix "ex" + ], [ + sh:namespace "http://schema.org/"^^xsd:anyURI; + sh:prefix "schema" + ] . diff --git a/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsPropertyShapeNoValue/invalid/case2/query1.rq b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsPropertyShapeNoValue/invalid/case2/query1.rq new file mode 100644 index 00000000000..4da878976ec --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsPropertyShapeNoValue/invalid/case2/query1.rq @@ -0,0 +1,10 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { +ex:InvalidCountry ex:germanLabel "Spain"@en . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsPropertyShapeNoValue/invalid/case2/query2.rq b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsPropertyShapeNoValue/invalid/case2/query2.rq new file mode 100644 index 00000000000..1c82510cff8 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsPropertyShapeNoValue/invalid/case2/query2.rq @@ -0,0 +1,13 @@ +PREFIX ex: +PREFIX owl: +PREFIX rdf: +PREFIX rdfs: +PREFIX sh: +PREFIX xsd: + +INSERT DATA { +ex:ValidCountry a ex:Country ; + ex:germanLabel "Spanien"@de . + +ex:InvalidCountry a ex:Country . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsPropertyShapeNoValue/invalid/case2/report.ttl b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsPropertyShapeNoValue/invalid/case2/report.ttl new file mode 100644 index 00000000000..99ef607b7ff --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsPropertyShapeNoValue/invalid/case2/report.ttl @@ -0,0 +1,46 @@ +@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:InvalidCountry; + sh:resultMessage "Values are literals with German language tag."; + sh:resultPath ex:germanLabel; + sh:resultSeverity sh:Violation; + sh:sourceConstraint _:5089a376325a403b926b5c31d5e95e7218429; + sh:sourceConstraintComponent sh:SPARQLConstraintComponent; + sh:sourceShape ex:LanguageExamplePropertyShape; + ] . + +ex:LanguageExamplePropertyShape a sh:PropertyShape; + sh:path ex:germanLabel; + sh:sparql _:5089a376325a403b926b5c31d5e95e7218429; + sh:targetClass ex:Country . + +_:5089a376325a403b926b5c31d5e95e7218429 a sh:SPARQLConstraint; + sh:message "Values are literals with German language tag."; + sh:prefixes ; + sh:select """ + SELECT $this + WHERE { + $this $PATH ?temp . + FILTER (isLiteral(?temp) && !langMatches(lang(?temp), \"de\")) + } + """ . + + sh:declare [ + sh:namespace "http://example.com/ns#"^^xsd:anyURI; + sh:prefix "ex" + ], [ + sh:namespace "http://schema.org/"^^xsd:anyURI; + sh:prefix "schema" + ] . diff --git a/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsPropertyShapeNoValue/shacl.trig b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsPropertyShapeNoValue/shacl.trig new file mode 100644 index 00000000000..88f7855a8cb --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsPropertyShapeNoValue/shacl.trig @@ -0,0 +1,53 @@ +@prefix : . +@prefix ont: . +@prefix vocsh: . +@prefix so: . +@prefix affected: . +@prefix res: . +@prefix dct: . +@prefix gn: . +@prefix owl: . +@prefix puml: . +@prefix rdf: . +@prefix rdfs: . +@prefix skos: . +@prefix void: . +@prefix wgs84: . +@prefix xsd: . +@prefix sh: . +@prefix dash: . +@prefix rsx: . +@prefix ec: . +@prefix ecinst: . +@prefix rdf4j: . +@prefix ex: . + +rdf4j:SHACLShapeGraph { + +ex: + sh:declare [ + sh:prefix "ex" ; + sh:namespace "http://example.com/ns#"^^xsd:anyURI ; + ] ; + sh:declare [ + sh:prefix "schema" ; + sh:namespace "http://schema.org/"^^xsd:anyURI ; + ] . + + ex:LanguageExamplePropertyShape + a sh:PropertyShape ; + sh:targetClass ex:Country ; + sh:path ex:germanLabel ; + sh:sparql [ + a sh:SPARQLConstraint ; # This triple is optional + sh:message "Values are literals with German language tag." ; + sh:prefixes ex: ; + sh:select """ + SELECT $this + WHERE { + $this $PATH ?temp . + FILTER (isLiteral(?temp) && !langMatches(lang(?temp), "de")) + } + """ ; + ] . +} diff --git a/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsPropertyShapeNoValue/valid/case1/query1.rq b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsPropertyShapeNoValue/valid/case1/query1.rq new file mode 100644 index 00000000000..93cd8becf3a --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsPropertyShapeNoValue/valid/case1/query1.rq @@ -0,0 +1,28 @@ +PREFIX ex: +PREFIX : +PREFIX affected: +PREFIX dash: +PREFIX dct: +PREFIX fn: +PREFIX gn: +PREFIX ont: +PREFIX owl: +PREFIX puml: +PREFIX rdf: +PREFIX rdfs: +PREFIX res: +PREFIX sesame: +PREFIX sh: +PREFIX skos: +PREFIX so: +PREFIX vocsh: +PREFIX void: +PREFIX wgs: +PREFIX xsd: + +INSERT DATA { + +ex:ValidCountry a ex:Country ; + ex:germanLabel "Spanien"@de . + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsPropertyShapeNoValue/valid/case1/report.ttl b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsPropertyShapeNoValue/valid/case1/report.ttl new file mode 100644 index 00000000000..c0518dc88b5 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsPropertyShapeNoValue/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/sparql/constraintsPropertyShapeNoValue/valid/case2/query1.rq b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsPropertyShapeNoValue/valid/case2/query1.rq new file mode 100644 index 00000000000..fa058a146a2 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsPropertyShapeNoValue/valid/case2/query1.rq @@ -0,0 +1,32 @@ +PREFIX ex: +PREFIX : +PREFIX affected: +PREFIX dash: +PREFIX dct: +PREFIX fn: +PREFIX gn: +PREFIX ont: +PREFIX owl: +PREFIX puml: +PREFIX rdf: +PREFIX rdfs: +PREFIX res: +PREFIX sesame: +PREFIX sh: +PREFIX skos: +PREFIX so: +PREFIX vocsh: +PREFIX void: +PREFIX wgs: +PREFIX xsd: + +INSERT DATA { + + +ex:ValidCountry a ex:Country ; + ex:germanLabel "Spain"@de . + +ex:InvalidCountry a ex:Country ; + ex:germanLabel [], ex:a . + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsPropertyShapeNoValue/valid/case2/report.ttl b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsPropertyShapeNoValue/valid/case2/report.ttl new file mode 100644 index 00000000000..c0518dc88b5 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsPropertyShapeNoValue/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/sparql/constraintsPropertyShapeNoValue/valid/case3/query1.rq b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsPropertyShapeNoValue/valid/case3/query1.rq new file mode 100644 index 00000000000..9fccdddff1e --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsPropertyShapeNoValue/valid/case3/query1.rq @@ -0,0 +1,28 @@ +PREFIX ex: +PREFIX : +PREFIX affected: +PREFIX dash: +PREFIX dct: +PREFIX fn: +PREFIX gn: +PREFIX ont: +PREFIX owl: +PREFIX puml: +PREFIX rdf: +PREFIX rdfs: +PREFIX res: +PREFIX sesame: +PREFIX sh: +PREFIX skos: +PREFIX so: +PREFIX vocsh: +PREFIX void: +PREFIX wgs: +PREFIX xsd: + +INSERT DATA { + +ex:ValidCountry a ex:Country ; + ex:notGermanLabel "Spain"@en . + +} diff --git a/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsPropertyShapeNoValue/valid/case3/report.ttl b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsPropertyShapeNoValue/valid/case3/report.ttl new file mode 100644 index 00000000000..c0518dc88b5 --- /dev/null +++ b/core/sail/shacl/src/test/resources/test-cases/sparql/constraintsPropertyShapeNoValue/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 .