From dbc62d5561868680136fac603ff8bd04ca0774ee Mon Sep 17 00:00:00 2001 From: Egon Willighagen Date: Sun, 25 Oct 2020 21:07:30 +0100 Subject: [PATCH] Only handle upper OWL classes --- src/main/java/com/github/enanomapper/Slimmer.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/github/enanomapper/Slimmer.java b/src/main/java/com/github/enanomapper/Slimmer.java index 28eb247..43d6d5c 100644 --- a/src/main/java/com/github/enanomapper/Slimmer.java +++ b/src/main/java/com/github/enanomapper/Slimmer.java @@ -466,11 +466,13 @@ private Set allSuperClasses(OWLClass clazz, Set allSuperClasses = new HashSet(); Stream superClasses = Searcher.sup(onto.subClassAxiomsForSubClass(clazz)); superClasses.forEach(superClass -> { - OWLClass superOwlClass = superClass.asOWLClass(); - String superIri = superOwlClass.getIRI().toString(); - allSuperClasses.add(superIri); - // recurse - allSuperClasses.addAll(allSuperClasses(superOwlClass, onto)); + if (superClass.isOWLClass()) { + OWLClass superOwlClass = superClass.asOWLClass(); + String superIri = superOwlClass.getIRI().toString(); + allSuperClasses.add(superIri); + // recurse + allSuperClasses.addAll(allSuperClasses(superOwlClass, onto)); + } }); return allSuperClasses; } @@ -517,4 +519,4 @@ private void addMappings(OWLOntologyManager m, String root) { } } -} \ No newline at end of file +}