Skip to content

Commit

Permalink
Merge branch 'master' into issue_1163
Browse files Browse the repository at this point in the history
  • Loading branch information
hkir-dev authored Dec 4, 2023
2 parents f412fb7 + 182046b commit 04a0052
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- '--annotate-with-source true' does not work with extract --method subset [#1160]
- Fix how Template adds entities to the QuotedEntityChecker [#1104]
- [`merge`] and 'annotate' operations '--annotate-defined-by' excludes reserved OWL 2 vocabularies [#1171]
- Handle IRIs that are not entities in export [#1168]

## [1.9.5] - 2023-09-20

Expand Down Expand Up @@ -382,6 +383,7 @@ First official release of ROBOT!
[`validate`]: http://robot.obolibrary.org/validate

[#1171]: https://github.com/ontodev/robot/pull/1171
[#1168]: https://github.com/ontodev/robot/pull/1168
[#1160]: https://github.com/ontodev/robot/pull/1160
[#1148]: https://github.com/ontodev/robot/pull/1148
[#1135]: https://github.com/ontodev/robot/pull/1135
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,12 @@ private static List<String> getPropertyValues(
IRI iri = a.getValue().asIRI().orNull();
if (iri != null) {
Set<OWLEntity> entities = ontology.getEntitiesInSignature(iri);
for (OWLEntity e : entities) {
values.add(OntologyHelper.renderManchester(e, provider, rt));
if (entities.size() > 0) {
for (OWLEntity e : entities) {
values.add(OntologyHelper.renderManchester(e, provider, rt));
}
} else {
values.add(iri.toString());
}
}
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package org.obolibrary.robot;

import static org.junit.Assert.assertEquals;

import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
Expand Down Expand Up @@ -29,6 +32,23 @@
*/
public class ExportOperationTest extends CoreTest {

/**
* Utility method to write XLSX file for debugging.
*
* @param workbook Workfbook to write
* @param path Path (string) to save to, under `robot-core/`
*/
void writeXLSX(Workbook workbook, String path) {
try {
System.out.println("Writing result to robot-core/" + path);
FileOutputStream out = new FileOutputStream(path);
workbook.write(out);
out.close();
} catch (Exception ex) {
System.out.println("Error writing workbook: " + ex);
}
}

/**
* Test exporting simple.owl to XLSX.
*
Expand Down Expand Up @@ -121,7 +141,7 @@ public void testLargeExcelExport() throws Exception {
*/
@Test
public void testExportNamedHeadingsSimple() throws Exception {
OWLOntology ontology = loadOntology("/simple.owl");
OWLOntology ontology = loadOntology("/simple_defined_by.owl");
IOHelper ioHelper = new IOHelper();
ioHelper.addPrefix(
"simple", "https://github.com/ontodev/robot/robot-core/src/test/resources/simple.owl#");
Expand All @@ -135,6 +155,7 @@ public void testExportNamedHeadingsSimple() throws Exception {
"CURIE",
"Type",
"SYNONYMS",
"rdfs:isDefinedBy",
"SUBCLASSES",
"SubClass Of",
"SubProperty Of",
Expand All @@ -153,8 +174,7 @@ public void testExportNamedHeadingsSimple() throws Exception {
Workbook wb = t.asWorkbook("|");

Sheet s = wb.getSheetAt(0);
// There should be three rows (0, 1, 2)
assert (s.getLastRowNum() == 3);
assertEquals(s.getLastRowNum(), 4);

// Validate header
// should match size and label
Expand All @@ -176,6 +196,11 @@ public void testExportNamedHeadingsSimple() throws Exception {
String expectedHeader = columns.get(colIx);
assert (foundHeader.equals(expectedHeader));
}

// rdfs:isDefinedBy should work
assertEquals(
s.getRow(4).getCell(6).getStringCellValue(),
"https://github.com/ontodev/robot/robot-core/src/test/resources/simple.owl");
}

/**
Expand Down

0 comments on commit 04a0052

Please sign in to comment.