Skip to content

Commit

Permalink
[New] Logs computed model if isReplace=false
Browse files Browse the repository at this point in the history
  • Loading branch information
blcham committed Nov 21, 2021
1 parent 908b708 commit 559c528
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import cz.cvut.spipes.engine.ExecutionContextFactory;
import cz.cvut.spipes.engine.VariablesBinding;
import cz.cvut.spipes.exception.ValidationConstraintFailed;
import cz.cvut.spipes.util.JenaUtils;
import org.apache.jena.atlas.lib.NotImplemented;
import org.apache.jena.query.Query;
import org.apache.jena.query.QueryExecution;
Expand Down Expand Up @@ -350,6 +351,17 @@ protected RDFNode getEffectiveValue(@NotNull Property valueProperty) {
}
}

protected ExecutionContext createOutputContext(boolean isReplace, Model inputModel, Model computedModel) {
if (isReplace) {
return ExecutionContextFactory.createContext(computedModel);
} else {
if (AuditConfig.isEnabled() || isInDebugMode) {
LOG.debug("Saving module computed output to file {}.", saveModelToTemporaryFile(outputContext.getDefaultModel()));
}
return ExecutionContextFactory.createContext(JenaUtils.createUnion(inputModel, computedModel));
}
}

// @Override
// public String toString() {
// String resourceId = (resource != null) ? ( " (" + resource.getId() + ")") : "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import cz.cvut.spipes.constants.KBSS_MODULE;
import cz.cvut.spipes.constants.SML;
import cz.cvut.spipes.engine.ExecutionContext;
import cz.cvut.spipes.engine.ExecutionContextFactory;
import cz.cvut.spipes.util.JenaUtils;
import cz.cvut.spipes.util.QueryUtils;
import org.apache.jena.query.Query;
Expand Down Expand Up @@ -144,20 +143,9 @@ public ExecutionContext executeSelf() {
nNew = inferredInSingleIterationModel.size();
}

if (isReplace) {
return ExecutionContextFactory.createContext(inferredModel);
} else {
return ExecutionContextFactory.createContext(JenaUtils.createUnion(defaultModel, inferredModel));
}
return this.createOutputContext(isReplace, defaultModel, inferredModel);
}

// TODO move this to external utils






@Override
public String getTypeURI() {
return SML.ApplyConstruct.getURI();
Expand Down

This file was deleted.

0 comments on commit 559c528

Please sign in to comment.