Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always render full ontology IRI in report outputs #739

Merged
merged 3 commits into from
Dec 18, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions robot-core/src/main/java/org/obolibrary/robot/checks/Report.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ public class Report {
private final List<String> header =
Lists.newArrayList("Level", "Rule Name", "Subject", "Property", "Value");

private IRI ontologyIRI = null;

/**
* Create a new report object without an ontology or predefined IOHelper.
*
Expand All @@ -88,6 +90,7 @@ public Report() throws IOException {
public Report(OWLOntology ontology, boolean useLabels) throws IOException {
if (ontology != null) {
manager = ontology.getOWLOntologyManager();
ontologyIRI = ontology.getOntologyID().getOntologyIRI().orNull();
} else {
manager = OWLManager.createOWLOntologyManager();
}
Expand Down Expand Up @@ -140,6 +143,7 @@ public Report(Map<IRI, String> labelMap) throws IOException {
public Report(OWLOntology ontology, IOHelper ioHelper, boolean useLabels) {
if (ontology != null) {
manager = ontology.getOWLOntologyManager();
ontologyIRI = ontology.getOntologyID().getOntologyIRI().orNull();
} else {
manager = OWLManager.createOWLOntologyManager();
}
Expand Down Expand Up @@ -353,10 +357,19 @@ private void addToTable(
for (Violation v : vs.getValue()) {
// Subject of the violation for the following rows
String subject;
if (v.entity != null) {
subject = OntologyHelper.renderManchester(v.entity, provider, displayRenderer);
if (ontologyIRI != null
&& v.entity != null
&& !v.entity.isAnonymous()
&& v.entity.getIRI().toString().equals(ontologyIRI.toString())) {
// If the IRI is the ontology IRI, keep this as the full string
subject = ontologyIRI.toString();
} else {
subject = v.subject;
// Otherwise, render the subject based on the display renderer
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()) {
Expand Down