diff --git a/s-pipes-web/src/main/java/cz/cvut/spipes/rest/handler/ErrorValidationResponse.java b/s-pipes-web/src/main/java/cz/cvut/spipes/rest/handler/ErrorValidationResponse.java index 1eba9acc..0047b3f3 100644 --- a/s-pipes-web/src/main/java/cz/cvut/spipes/rest/handler/ErrorValidationResponse.java +++ b/s-pipes-web/src/main/java/cz/cvut/spipes/rest/handler/ErrorValidationResponse.java @@ -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 @@ -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" }, @@ -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 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);