Skip to content

Commit

Permalink
Merge pull request #767 from ontodev/bnode-report
Browse files Browse the repository at this point in the history
Workaround for blank nodes
  • Loading branch information
jamesaoverton authored Nov 18, 2020
2 parents 8a93134 + def1a22 commit f31323e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix reported row number in [`validate`] error tables in [#727]
- Fix equivalent class rendering for [`template`] in [#728]
- Fix ontology IRI rendering for [`report`] in [#739]
- Fix blank node subjects in [`report`] in [#767]

## [1.7.0] - 2020-07-31

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,7 @@ public static boolean compare(
return false;
}

/**
* OWLOntologySetProvider for two (left and right) ontologies.
*/
/** OWLOntologySetProvider for two (left and right) ontologies. */
private static class DualOntologySetProvider implements OWLOntologySetProvider {

private static final long serialVersionUID = -8942374248162307075L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,6 @@ public static boolean processReport(Report report, String outputPath, Map<String

case "tsv":
default:
System.out.print("tsv!");
rows = reportTable.toList("");
if (outputPath != null) {
if (print > 0) {
Expand Down Expand Up @@ -906,7 +905,15 @@ private static List<Violation> getViolationsFromResults(
continue;
}

Violation violation = new Violation(dataFactory.getOWLClass(ioHelper.createIRI(entity)));
Violation violation;
try {
OWLClass cls = dataFactory.getOWLClass(ioHelper.createIRI(entity));
violation = new Violation(cls);
} catch (Exception e) {
// Blank node, use the string bnode ID
violation = new Violation("blank node");
}

// try and get a property and value from the query
String property = getQueryResultOrNull(qs, "property");
String value = getQueryResultOrNull(qs, "value");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,12 @@ private void addToTable(
Cell ruleCell = new Cell(columns.get(1), ruleName);
for (Violation v : vs.getValue()) {
// Subject of the violation for the following rows
String subject = OntologyHelper.renderManchester(v.entity, provider, displayRenderer);
String subject;
if (v.entity != null) {
subject = OntologyHelper.renderManchester(v.entity, provider, displayRenderer);
} else {
subject = v.subject;
}
Cell subjectCell = new Cell(columns.get(2), subject);
for (Entry<OWLEntity, List<OWLObject>> statement : v.entityStatements.entrySet()) {
// Property of the violation for the following rows
Expand Down

0 comments on commit f31323e

Please sign in to comment.