Skip to content

Commit

Permalink
GH-4834 remove code used for debugging (#4835)
Browse files Browse the repository at this point in the history
  • Loading branch information
hmottestad authored Nov 7, 2023
2 parents 00e6099 + 4dc801a commit 8f754f4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.eclipse.rdf4j.common.exception.RDF4JException;
import org.eclipse.rdf4j.common.iteration.CloseableIteration;
import org.eclipse.rdf4j.common.transaction.IsolationLevels;
import org.eclipse.rdf4j.model.IRI;
import org.eclipse.rdf4j.model.Model;
Expand Down Expand Up @@ -82,48 +84,34 @@ private Rdf4jShaclShapeGraphShapeSource(Repository repository, RepositoryConnect

private SailRepository forwardChain(RepositoryConnection shapesRepoConnection) {
try (var statements = shapesRepoConnection.getStatements(null, null, null, false, RDF4J.SHACL_SHAPE_GRAPH)) {
if (!statements.hasNext()) {
return new SailRepository(new MemoryStore());
}

SailRepository shapesRepoWithReasoning = new SailRepository(
SchemaCachingRDFSInferencer.fastInstantiateFrom(shaclVocabulary, new MemoryStore(), false));

try (var shapesRepoWithReasoningConnection = shapesRepoWithReasoning.getConnection()) {
shapesRepoWithReasoningConnection.begin(IsolationLevels.NONE);

shapesRepoWithReasoningConnection.add(statements);
enrichShapes(shapesRepoWithReasoningConnection);

shapesRepoWithReasoningConnection.commit();
}

return shapesRepoWithReasoning;

return forwardChain(statements);
}
}

private SailRepository forwardChain(SailConnection shapesSailConnection) {
try (var statements = shapesSailConnection.getStatements(null, null, null, false, RDF4J.SHACL_SHAPE_GRAPH)) {
if (!statements.hasNext()) {
return new SailRepository(new MemoryStore());
}

SailRepository shapesRepoWithReasoning = new SailRepository(
SchemaCachingRDFSInferencer.fastInstantiateFrom(shaclVocabulary, new MemoryStore(), false));
return forwardChain(statements);
}
}

try (var shapesRepoWithReasoningConnection = shapesRepoWithReasoning.getConnection()) {
shapesRepoWithReasoningConnection.begin(IsolationLevels.NONE);
private SailRepository forwardChain(CloseableIteration<? extends Statement, ? extends RDF4JException> statements) {
if (!statements.hasNext()) {
return new SailRepository(new MemoryStore());
}

shapesRepoWithReasoningConnection.add(statements);
enrichShapes(shapesRepoWithReasoningConnection);
SailRepository shapesRepoWithReasoning = new SailRepository(
SchemaCachingRDFSInferencer.fastInstantiateFrom(shaclVocabulary, new MemoryStore(), false));

shapesRepoWithReasoningConnection.commit();
}
try (var shapesRepoWithReasoningConnection = shapesRepoWithReasoning.getConnection()) {
shapesRepoWithReasoningConnection.begin(IsolationLevels.NONE);

return shapesRepoWithReasoning;
shapesRepoWithReasoningConnection.add(statements);
enrichShapes(shapesRepoWithReasoningConnection);

shapesRepoWithReasoningConnection.commit();
}

return shapesRepoWithReasoning;
}

private static SchemaCachingRDFSInferencer createShaclVocabulary() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ private static Model resourceAsModel(String filename) {
static Stream<ShapesGraph> getRsxDataAndShapesGraphLink(SailConnection connection, Resource[] context) {
Stream<ShapesGraph> rsxDataAndShapesGraphLink;

List<? extends Statement> collect1 = connection.getStatements(null, null, null, false)
.stream()
.collect(Collectors.toList());

try (var stream = connection.getStatements(null, RDF.TYPE, RSX.DataAndShapesGraphLink, false, context)
.stream()) {

Expand Down Expand Up @@ -108,9 +104,6 @@ static Stream<ShapesGraph> getRsxDataAndShapesGraphLink(SailConnection connectio
}

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

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

0 comments on commit 8f754f4

Please sign in to comment.