Skip to content

Commit

Permalink
bug fix: SPLIT fails with owl:NamedIndividual #924
Browse files Browse the repository at this point in the history
  • Loading branch information
hkir-dev committed Nov 8, 2021
1 parent 587e856 commit 262853f
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions robot-core/src/test/java/org/obolibrary/robot/TemplateTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,28 +157,33 @@ public void testParseClass() throws Exception {
TemplateHelper.tryParse("test", checker, parser, label, 0, 0).asOWLClass();
assert actualClass.getIRI().toString().equals(expectedClass.getIRI().toString());
}

/**
* Test named individual with split property.
*
* @throws Exception if entities cannot be found
*/
@Test
public void testNamedIndividualSplit() throws Exception {
Map<String, String> options = TemplateOperation.getDefaultOptions();
IOHelper ioHelper = new IOHelper();
ioHelper.addPrefix("ex", "http://example.com/");
Map<String, List<List<String>>> tables = new LinkedHashMap<>();
Map<String, String> options = TemplateOperation.getDefaultOptions();
IOHelper ioHelper = new IOHelper();
ioHelper.addPrefix("ex", "http://example.com/");

Map<String, List<List<String>>> tables = new LinkedHashMap<>();
String path = "/template-individual-split.csv";
tables.put(path, TemplateHelper.readCSV(this.getClass().getResourceAsStream(path)));

OWLOntology ontology = TemplateOperation.template(null, ioHelper, tables, options);

assertEquals("Count individuals", 1, ontology.getIndividualsInSignature().size());
OWLNamedIndividual namedIndividual = ontology.getIndividualsInSignature().iterator().next();
assertEquals("Count annotation properties", 1, ontology.getAnnotationPropertiesInSignature().size());
OWLAnnotationProperty annotationProperty = ontology.getAnnotationPropertiesInSignature().iterator().next();
assertEquals("Count data properties of individual", 2, EntitySearcher.getAnnotationObjects(namedIndividual, ontology, annotationProperty).size());
assertEquals(
"Count annotation properties", 1, ontology.getAnnotationPropertiesInSignature().size());
OWLAnnotationProperty annotationProperty =
ontology.getAnnotationPropertiesInSignature().iterator().next();
assertEquals(
"Count annotation properties of individual",
2,
EntitySearcher.getAnnotationObjects(namedIndividual, ontology, annotationProperty).size());
}
}

0 comments on commit 262853f

Please sign in to comment.