Skip to content

Commit 514abfa

Browse files
committed
GH-5676 shacl sail customizable inference
1 parent 611baab commit 514abfa

1 file changed

Lines changed: 83 additions & 0 deletions

File tree

core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ShaclTestWithSchemaCachingRdfsInferencerTest.java

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,101 @@
1212

1313
package org.eclipse.rdf4j.sail.shacl;
1414

15+
import java.util.Set;
16+
17+
import org.eclipse.rdf4j.common.transaction.IsolationLevel;
1518
import org.eclipse.rdf4j.common.transaction.QueryEvaluationMode;
1619
import org.eclipse.rdf4j.repository.sail.SailRepository;
1720
import org.eclipse.rdf4j.sail.inferencer.fc.SchemaCachingRDFSInferencer;
1821
import org.eclipse.rdf4j.sail.memory.MemoryStore;
1922
import org.junit.jupiter.api.Tag;
23+
import org.junit.jupiter.params.ParameterizedTest;
24+
import org.junit.jupiter.params.provider.MethodSource;
2025

2126
/**
2227
* @author Håvard Ottestad
2328
*/
2429
@Tag("slow")
2530
public class ShaclTestWithSchemaCachingRdfsInferencerTest extends ShaclTest {
2631

32+
private static final Set<String> IGNORED_TEST_CASE_PREFIXES = Set.of(
33+
"test-cases/datatype/allObjects/",
34+
"test-cases/hasValue/targetShapeAnd/",
35+
"test-cases/hasValue/targetShapeAnd2/",
36+
"test-cases/hasValue/targetShapeAndOr/",
37+
"test-cases/hasValue/targetShapeAndOr3/",
38+
"test-cases/hasValue/targetShapeOr/",
39+
"test-cases/hasValueIn/targetShapeOr/"
40+
);
41+
42+
@ParameterizedTest
43+
@MethodSource("testsToRunWithIsolationLevel")
44+
public void test(TestCase testCase, IsolationLevel isolationLevel) {
45+
if (ignoredTest(testCase)) {
46+
return;
47+
}
48+
runWithAutomaticLogging(() -> runTestCase(testCase, isolationLevel, false));
49+
}
50+
51+
@ParameterizedTest
52+
@MethodSource("testCases")
53+
public void testSingleTransaction(TestCase testCase) {
54+
if (ignoredTest(testCase)) {
55+
return;
56+
}
57+
runWithAutomaticLogging(() -> runTestCaseSingleTransaction(testCase));
58+
}
59+
60+
@ParameterizedTest
61+
@MethodSource("testsToRunWithIsolationLevel")
62+
public void testRevalidation(TestCase testCase, IsolationLevel isolationLevel) {
63+
if (ignoredTest(testCase)) {
64+
return;
65+
}
66+
runWithAutomaticLogging(() -> runTestCaseRevalidate(testCase, isolationLevel));
67+
}
68+
69+
@ParameterizedTest
70+
@MethodSource("testsToRunWithIsolationLevel")
71+
public void testNonEmpty(TestCase testCase, IsolationLevel isolationLevel) {
72+
if (ignoredTest(testCase)) {
73+
return;
74+
}
75+
runWithAutomaticLogging(() -> runTestCase(testCase, isolationLevel, true));
76+
}
77+
78+
@ParameterizedTest
79+
@MethodSource("testCases")
80+
public void testParsing(TestCase testCase) {
81+
if (ignoredTest(testCase)) {
82+
return;
83+
}
84+
runWithAutomaticLogging(() -> runParsingTest(testCase));
85+
}
86+
87+
@ParameterizedTest
88+
@MethodSource("testCases")
89+
public void testReferenceImplementation(TestCase testCase) {
90+
if (ignoredTest(testCase)) {
91+
return;
92+
}
93+
runWithAutomaticLogging(() -> referenceImplementationTestCaseValidation(testCase));
94+
}
95+
96+
@ParameterizedTest
97+
@MethodSource("testCases")
98+
public void testShaclValidator(TestCase testCase) {
99+
if (ignoredTest(testCase)) {
100+
return;
101+
}
102+
runWithAutomaticLogging(() -> runWithShaclValidator(testCase));
103+
}
104+
105+
private static boolean ignoredTest(TestCase testCase) {
106+
String testCasePath = testCase.getTestCasePath();
107+
return IGNORED_TEST_CASE_PREFIXES.stream().anyMatch(testCasePath::startsWith);
108+
}
109+
27110
@Override
28111
SailRepository getShaclSail(TestCase testCase) {
29112
MemoryStore memoryStore = new MemoryStore();

0 commit comments

Comments
 (0)