Skip to content

Commit 8f754f4

Browse files
authored
GH-4834 remove code used for debugging (#4835)
2 parents 00e6099 + 4dc801a commit 8f754f4

2 files changed

Lines changed: 19 additions & 38 deletions

File tree

core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/wrapper/shape/Rdf4jShaclShapeGraphShapeSource.java

Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
import java.util.stream.Collectors;
1919
import java.util.stream.Stream;
2020

21+
import org.eclipse.rdf4j.common.exception.RDF4JException;
22+
import org.eclipse.rdf4j.common.iteration.CloseableIteration;
2123
import org.eclipse.rdf4j.common.transaction.IsolationLevels;
2224
import org.eclipse.rdf4j.model.IRI;
2325
import org.eclipse.rdf4j.model.Model;
@@ -82,48 +84,34 @@ private Rdf4jShaclShapeGraphShapeSource(Repository repository, RepositoryConnect
8284

8385
private SailRepository forwardChain(RepositoryConnection shapesRepoConnection) {
8486
try (var statements = shapesRepoConnection.getStatements(null, null, null, false, RDF4J.SHACL_SHAPE_GRAPH)) {
85-
if (!statements.hasNext()) {
86-
return new SailRepository(new MemoryStore());
87-
}
88-
89-
SailRepository shapesRepoWithReasoning = new SailRepository(
90-
SchemaCachingRDFSInferencer.fastInstantiateFrom(shaclVocabulary, new MemoryStore(), false));
91-
92-
try (var shapesRepoWithReasoningConnection = shapesRepoWithReasoning.getConnection()) {
93-
shapesRepoWithReasoningConnection.begin(IsolationLevels.NONE);
94-
95-
shapesRepoWithReasoningConnection.add(statements);
96-
enrichShapes(shapesRepoWithReasoningConnection);
97-
98-
shapesRepoWithReasoningConnection.commit();
99-
}
100-
101-
return shapesRepoWithReasoning;
102-
87+
return forwardChain(statements);
10388
}
10489
}
10590

10691
private SailRepository forwardChain(SailConnection shapesSailConnection) {
10792
try (var statements = shapesSailConnection.getStatements(null, null, null, false, RDF4J.SHACL_SHAPE_GRAPH)) {
108-
if (!statements.hasNext()) {
109-
return new SailRepository(new MemoryStore());
110-
}
111-
112-
SailRepository shapesRepoWithReasoning = new SailRepository(
113-
SchemaCachingRDFSInferencer.fastInstantiateFrom(shaclVocabulary, new MemoryStore(), false));
93+
return forwardChain(statements);
94+
}
95+
}
11496

115-
try (var shapesRepoWithReasoningConnection = shapesRepoWithReasoning.getConnection()) {
116-
shapesRepoWithReasoningConnection.begin(IsolationLevels.NONE);
97+
private SailRepository forwardChain(CloseableIteration<? extends Statement, ? extends RDF4JException> statements) {
98+
if (!statements.hasNext()) {
99+
return new SailRepository(new MemoryStore());
100+
}
117101

118-
shapesRepoWithReasoningConnection.add(statements);
119-
enrichShapes(shapesRepoWithReasoningConnection);
102+
SailRepository shapesRepoWithReasoning = new SailRepository(
103+
SchemaCachingRDFSInferencer.fastInstantiateFrom(shaclVocabulary, new MemoryStore(), false));
120104

121-
shapesRepoWithReasoningConnection.commit();
122-
}
105+
try (var shapesRepoWithReasoningConnection = shapesRepoWithReasoning.getConnection()) {
106+
shapesRepoWithReasoningConnection.begin(IsolationLevels.NONE);
123107

124-
return shapesRepoWithReasoning;
108+
shapesRepoWithReasoningConnection.add(statements);
109+
enrichShapes(shapesRepoWithReasoningConnection);
125110

111+
shapesRepoWithReasoningConnection.commit();
126112
}
113+
114+
return shapesRepoWithReasoning;
127115
}
128116

129117
private static SchemaCachingRDFSInferencer createShaclVocabulary() {

core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/wrapper/shape/ShapeSource.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@ private static Model resourceAsModel(String filename) {
4747
static Stream<ShapesGraph> getRsxDataAndShapesGraphLink(SailConnection connection, Resource[] context) {
4848
Stream<ShapesGraph> rsxDataAndShapesGraphLink;
4949

50-
List<? extends Statement> collect1 = connection.getStatements(null, null, null, false)
51-
.stream()
52-
.collect(Collectors.toList());
53-
5450
try (var stream = connection.getStatements(null, RDF.TYPE, RSX.DataAndShapesGraphLink, false, context)
5551
.stream()) {
5652

@@ -108,9 +104,6 @@ static Stream<ShapesGraph> getRsxDataAndShapesGraphLink(SailConnection connectio
108104
}
109105

110106
static Stream<ShapesGraph> getRsxDataAndShapesGraphLink(RepositoryConnection connection, Resource[] context) {
111-
List<? extends Statement> collect1 = connection.getStatements(null, null, null, false)
112-
.stream()
113-
.collect(Collectors.toList());
114107

115108
Stream<ShapesGraph> rsxDataAndShapesGraphLink;
116109
try (var stream = connection.getStatements(null, RDF.TYPE, RSX.DataAndShapesGraphLink, false, context)

0 commit comments

Comments
 (0)