Skip to content

Commit

Permalink
[#269] Use toString from the RDFNodeUtils for converting RDFNode to t…
Browse files Browse the repository at this point in the history
…he string
  • Loading branch information
palagdan committed Sep 2, 2024
1 parent 38fd135 commit 3f9b695
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions doc/examples/constraint-validation/constraint-validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,10 @@ Validation of constraint failed for the constraint: More than one person matches
.
}
Evidences:
| person | firstName | lastName |
+-------------------------------------------------------------------------------------------+-----------+----------+
| http://onto.fel.cvut.cz/ontologies/s-pipes/examples/constraint-validation/people/person-2 | Peter | Hnizdo |
| http://onto.fel.cvut.cz/ontologies/s-pipes/examples/constraint-validation/people/person-1 | Pavel | Hnizdo |
| person | firstName | lastName |
+---------------------------------------------------------------------------------------------+-----------+----------+
| <http://onto.fel.cvut.cz/ontologies/s-pipes/examples/constraint-validation/people/person-2> | "Peter" | "Hnizdo" |
| <http://onto.fel.cvut.cz/ontologies/s-pipes/examples/constraint-validation/people/person-1> | "Pavel" | "Hnizdo" |
```

If `execution.exitOnError` is set to `true` in `config-core.properties` , the pipeline will not proceed with execution, and an error validation response in JSON-LD will be retrieved:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cz.cvut.spipes.exception;

import cz.cvut.spipes.modules.Module;
import cz.cvut.spipes.util.RDFNodeUtils;
import org.apache.jena.rdf.model.RDFNode;
import org.apache.jena.rdf.model.Resource;
import org.jetbrains.annotations.NonNls;
Expand Down Expand Up @@ -80,7 +81,7 @@ private Map<String, Integer> determineColumnWidths() {
for (Map<String, RDFNode> row : evidences) {
for (Map.Entry<String, RDFNode> entry : row.entrySet()) {
int currentWidth = columnWidths.get(entry.getKey());
int dataWidth = entry.getValue().toString().length();
int dataWidth = RDFNodeUtils.toString(entry.getValue()).length();
columnWidths.put(entry.getKey(), Math.max(currentWidth, dataWidth));
}
}
Expand All @@ -107,7 +108,7 @@ private void buildRows(StringBuilder tableBuilder, String format) {
for (Map<String, RDFNode> row : evidences) {
List<String> values = new ArrayList<>();
for (String key : row.keySet()) {
values.add(row.get(key).toString());
values.add(RDFNodeUtils.toString(row.get(key)));
}
tableBuilder.append(String.format(format, values.toArray()));
}
Expand Down

0 comments on commit 3f9b695

Please sign in to comment.