Skip to content

Commit

Permalink
GH-5130 disable ZeroOrMorePath and OneOrMorePath for the time being
Browse files Browse the repository at this point in the history
  • Loading branch information
hmottestad committed Nov 21, 2024
1 parent dbc9b50 commit fa55005
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ public static List<IRI> getSupportedShaclPredicates() {
SHACL.TARGET_PROP,
SHACL.INVERSE_PATH,
SHACL.ALTERNATIVE_PATH,
SHACL.ONE_OR_MORE_PATH,
SHACL.ZERO_OR_MORE_PATH,
// SHACL.ONE_OR_MORE_PATH,
// SHACL.ZERO_OR_MORE_PATH,
SHACL.NODE,
SHACL.QUALIFIED_MAX_COUNT,
SHACL.QUALIFIED_MIN_COUNT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public PlanNode getAnyAdded(ConnectionsGroup connectionsGroup, Resource[] dataGr

@Override
public boolean isSupported() {
return true;
return false;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public PlanNode getAnyAdded(ConnectionsGroup connectionsGroup, Resource[] dataGr

@Override
public boolean isSupported() {
return true;
return false;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public DatatypeFilter(PlanNode parent, IRI datatype, ConnectionsGroup connection
super(parent, connectionsGroup);
this.datatype = datatype;
this.xsdDatatype = CoreDatatype.from(datatype).asXSDDatatype().orElse(null);
// stackTrace = Thread.currentThread().getStackTrace();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public DebugPlanNode(PlanNode parent, String message, Consumer<ValidationTuple>
public DebugPlanNode(PlanNode parent, String message) {
this.parent = parent;
this.message = message;
// this.stackTrace = Thread.currentThread().getStackTrace();
this.stackTrace = Thread.currentThread().getStackTrace();

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@
import org.apache.commons.text.StringEscapeUtils;
import org.eclipse.rdf4j.common.iteration.CloseableIteration;
import org.eclipse.rdf4j.sail.shacl.wrapper.data.ConnectionsGroup;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class EqualsJoinValue implements PlanNode {

static private final Logger logger = LoggerFactory.getLogger(EqualsJoinValue.class);

private final PlanNode left;
private final PlanNode right;
private final boolean useAsFilter;
Expand All @@ -29,8 +34,9 @@ public EqualsJoinValue(PlanNode left, PlanNode right, boolean useAsFilter, Conne
this.right = PlanNodeHelper.handleSorting(this, right, connectionsGroup);

this.useAsFilter = useAsFilter;
// this.stackTrace = Thread.currentThread().getStackTrace();

if (logger.isDebugEnabled()) {
this.stackTrace = Thread.currentThread().getStackTrace();
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import org.eclipse.rdf4j.sail.SailException;
import org.eclipse.rdf4j.sail.memory.MemoryStoreConnection;
import org.eclipse.rdf4j.sail.shacl.wrapper.data.ConnectionsGroup;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
Expand All @@ -35,6 +37,8 @@
*/
public class FilterByPredicateObject implements PlanNode {

static private final Logger logger = LoggerFactory.getLogger(FilterByPredicateObject.class);

private final SailConnection connection;
private final boolean includeInferred;
private final Set<Resource> filterOnObject;
Expand All @@ -54,6 +58,7 @@ public class FilterByPredicateObject implements PlanNode {
public FilterByPredicateObject(SailConnection connection, Resource[] dataGraph, IRI filterOnPredicate,
Set<Resource> filterOnObject, PlanNode parent, boolean returnMatching, FilterOn filterOn,
boolean includeInferred, ConnectionsGroup connectionsGroup) {

this.dataGraph = dataGraph;
this.parent = PlanNodeHelper.handleSorting(this, parent, connectionsGroup);
this.connection = connection;
Expand All @@ -75,7 +80,9 @@ public FilterByPredicateObject(SailConnection connection, Resource[] dataGraph,
&& RDF.TYPE.equals(filterOnPredicate)) {
typeFilterWithInference = true;
}
// this.stackTrace = Thread.currentThread().getStackTrace();
if (logger.isDebugEnabled()) {
this.stackTrace = Thread.currentThread().getStackTrace();
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ public abstract class FilterPlanNode implements MultiStreamPlanNode, PlanNode {
private CloseableIteration<ValidationTuple> iterator;
private ValidationExecutionLogger validationExecutionLogger;
private boolean closed;
StackTraceElement[] stackTrace;

abstract boolean checkTuple(Reference t);

public FilterPlanNode(PlanNode parent, ConnectionsGroup connectionsGroup) {
this.parent = PlanNodeHelper.handleSorting(this, parent, connectionsGroup);
// this.stackTrace = Thread.currentThread().getStackTrace();
}

public PlanNode getTrueNode(Class<? extends PushablePlanNode> type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@
import org.apache.commons.text.StringEscapeUtils;
import org.eclipse.rdf4j.common.iteration.CloseableIteration;
import org.eclipse.rdf4j.sail.shacl.wrapper.data.ConnectionsGroup;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* @author Håvard Ottestad
*/
public class ShiftToNodeShape implements PlanNode {
static private final Logger logger = LoggerFactory.getLogger(ShiftToNodeShape.class);

private StackTraceElement[] stackTrace;
PlanNode parent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@
import org.apache.commons.text.StringEscapeUtils;
import org.eclipse.rdf4j.common.iteration.CloseableIteration;
import org.eclipse.rdf4j.sail.shacl.wrapper.data.ConnectionsGroup;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* @author Håvard Ottestad
*/
public class ShiftToPropertyShape implements PlanNode {
static private final Logger logger = LoggerFactory.getLogger(ShiftToPropertyShape.class);

private StackTraceElement[] stackTrace;
PlanNode parent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,12 @@ abstract public class AbstractShaclTest {

private static final Set<String> ignoredTestCases = Set.of(
"test-cases/path/oneOrMorePath",
"test-cases/nodeKind/oneOrMorePathComplex",
"test-cases/nodeKind/zeroOrMorePathComplex",
"test-cases/nodeKind/oneOrMorePathSimple",
"test-cases/minCount/oneOrMorePath",
"test-cases/path/zeroOrMorePath",
"test-cases/minCount/zeroOrMorePath",
"test-cases/path/zeroOrOnePath"

);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
package org.eclipse.rdf4j.sail.shacl;

import java.io.IOException;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -104,12 +105,20 @@ public void testComplexPath() throws IOException {
}
}

Set<String> relevantLog = getRelevantLog(1);
Set<String> relevantLog = getRelevantLog(4).stream()
.sorted()
.collect(Collectors.toCollection(LinkedHashSet::new));

Set<String> expected = Set.of(
"Unsupported SHACL feature detected: AlternativePath{ [SimplePath{ <http://example.com/ns#father> }, ZeroOrOnePath{ SimplePath{ <http://example.com/ns#parent> } }, SimplePath{ <http://example.com/ns#mother> }] }. Shape ignored! <http://example.com/ns#alternativePathZeroOrOne> a sh:PropertyShape; sh:path [ sh:alternativePath (<http://example.com/ns#father> [ sh:zeroOrOnePath <http://example.com/ns#parent> ] <http://example.com/ns#mother>) ]; sh:nodeKind sh:BlankNodeOrIRI ."
"Unsupported SHACL feature detected: AlternativePath{ [SimplePath{ <http://example.com/ns#father> }, OneOrMorePath{ SimplePath{ <http://example.com/ns#parent> } }, SimplePath{ <http://example.com/ns#mother> }] }. Shape ignored! <http://example.com/ns#alternativePathOneOrMore> a sh:PropertyShape; sh:path [ sh:alternativePath (<http://example.com/ns#father> [ sh:oneOrMorePath <http://example.com/ns#parent> ] <http://example.com/ns#mother>) ]; sh:nodeKind sh:BlankNodeOrIRI .",
"Unsupported SHACL feature detected: AlternativePath{ [SimplePath{ <http://example.com/ns#father> }, ZeroOrMorePath{ SimplePath{ <http://example.com/ns#parent> } }, SimplePath{ <http://example.com/ns#mother> }] }. Shape ignored! <http://example.com/ns#alternativePathZeroOrMore> a sh:PropertyShape; sh:path [ sh:alternativePath (<http://example.com/ns#father> [ sh:zeroOrMorePath <http://example.com/ns#parent> ] <http://example.com/ns#mother>) ]; sh:nodeKind sh:BlankNodeOrIRI .",
"Unsupported SHACL feature detected: AlternativePath{ [SimplePath{ <http://example.com/ns#father> }, ZeroOrOnePath{ SimplePath{ <http://example.com/ns#parent> } }, SimplePath{ <http://example.com/ns#mother> }] }. Shape ignored! <http://example.com/ns#alternativePathZeroOrOne> a sh:PropertyShape; sh:path [ sh:alternativePath (<http://example.com/ns#father> [ sh:zeroOrOnePath <http://example.com/ns#parent> ] <http://example.com/ns#mother>) ]; sh:nodeKind sh:BlankNodeOrIRI .",
"Unsupported SHACL feature detected: InversePath{ ZeroOrMorePath{ SimplePath{ <http://example.com/ns#inverseThis> } } }. Shape ignored! <http://example.com/ns#inverseOfWithComplex> a sh:PropertyShape; sh:path [ sh:inversePath [ sh:zeroOrMorePath <http://example.com/ns#inverseThis> ] ]; sh:datatype xsd:int .",
"Unsupported SHACL feature detected: InversePath{ ZeroOrMorePath{ SimplePath{ <http://example.com/ns#inverseThis> } } }. Shape ignored! <http://example.com/ns#inverseOfWithComplex> a sh:PropertyShape; sh:path [ sh:inversePath [ sh:zeroOrMorePath <http://example.com/ns#inverseThis> ] ]; sh:minCount 1 ."
);

expected = expected.stream().sorted().collect(Collectors.toCollection(LinkedHashSet::new));

Assertions.assertEquals(expected, relevantLog);

shaclRepository.shutDown();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ public class W3cComplianceTest {
private final static Set<String> TESTS_FAILING_DUE_TO_MISSING_FEATURES_FROM_THE_SPEC = Set.of(
"/core/node/xone-001.ttl",
"/core/node/xone-duplicate.ttl",
"/core/path/path-complex-001.ttl",
"/core/path/path-oneOrMore-001.ttl",
"/core/path/path-zeroOrMore-001.ttl",
"/core/path/path-zeroOrOne-001.ttl",
"/core/property/qualifiedMinCountDisjoint-001.ttl",
"/core/property/qualifiedValueShapesDisjoint-001.ttl",
Expand Down

0 comments on commit fa55005

Please sign in to comment.