Skip to content

Commit

Permalink
Merge pull request #272 from kbss-cvut/271-columns-list
Browse files Browse the repository at this point in the history
Include columns to the ErrorValidationResponse
  • Loading branch information
blcham authored Sep 12, 2024
2 parents 9cb033f + 10fb645 commit c08f264
Showing 1 changed file with 23 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@
import org.apache.jena.vocabulary.RDFS;
import java.io.IOException;
import java.io.StringWriter;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;

@Getter
Expand Down Expand Up @@ -90,6 +87,10 @@ private String generateFrame() {
"@id": "http://onto.fel.cvut.cz/ontologies/s-pipes/constraintFailureEvidences",
"@container": "@list"
},
"columns": {
"@id": "http://onto.fel.cvut.cz/ontologies/s-pipes/columns",
"@container": "@list"
},
%s
"constraintQuery": "http://onto.fel.cvut.cz/ontologies/s-pipes/constraintQuery"
},
Expand All @@ -114,16 +115,27 @@ private Model createModel() {
evidences.forEach(e -> {
Resource r = model.createResource();
e.forEach((key, value) -> {
if(value != null){
model.add(
r,
getP(key),
value);
}
});
if (value != null) {
model.add(
r,
getP(key),
value);
}
});
evidenceResources.add(r);
});

List<RDFNode> columns = new ArrayList<>();
evidences.stream()
.findAny()
.ifPresent(m -> m.keySet()
.stream()
.map(model::createLiteral)
.forEach(columns::add));
Resource listOfColumns = model.createList(columns.iterator());
model.add(getP("columns"), RDFS.range, RDF.List);
model.add(validationError, getP("columns"), listOfColumns);

model.add(validationError, getP("module"), module);
Resource listOfEvidences = model.createList(evidenceResources.toArray(RDFNode[]::new));
model.add(getP("constraintFailureEvidences"), RDFS.range, RDF.List);
Expand Down

0 comments on commit c08f264

Please sign in to comment.