Skip to content
Draft
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import org.obolibrary.robot.providers.CURIEShortFormProvider;
import org.semanticweb.owlapi.metrics.AbstractOWLMetric;
import org.semanticweb.owlapi.metrics.AverageAssertedNamedSuperclassCount;
import org.semanticweb.owlapi.metrics.DLExpressivity;
import org.semanticweb.owlapi.metrics.GCICount;
import org.semanticweb.owlapi.metrics.HiddenGCICount;
import org.semanticweb.owlapi.metrics.MaximumNumberOfNamedSuperclasses;
Expand Down Expand Up @@ -48,6 +47,7 @@
import org.semanticweb.owlapi.reasoner.OWLReasoner;
import org.semanticweb.owlapi.util.Construct;
import org.semanticweb.owlapi.util.DLExpressivityChecker;
import org.semanticweb.owlapi.util.Languages;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import uk.ac.manchester.cs.owl.owlapi.OWLObjectOneOfImpl;
Expand Down Expand Up @@ -991,10 +991,24 @@ private String getOntologyVersionId() {
}

private String getExpressivity(boolean included) {
DLExpressivity dl = new DLExpressivity(getOntology());
dl.setImportsClosureUsed(included);
dl.setOntology(getOntology());
return dl.getValue();
Set<OWLOntology> onts = new HashSet<>();
if (included) {
onts.addAll(getOntology().getImportsClosure());
} else {
onts.add(getOntology());
}
DLExpressivityChecker checker = new DLExpressivityChecker(onts);
Collection<Languages> languages = checker.expressibleInLanguages();

if (languages == null || languages.isEmpty()) {
LOGGER.warn("No language found for this ontology.. ");
} else {
Languages[] array = languages.toArray(new Languages[languages.size()]);
Arrays.sort(array);
return array[0].toString();
}

return "";
}

// this is highly unpleasant and I wish we had a NoSQL DB or even just a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void testExtendedMetrics() throws IOException {
MeasureResult result =
MeasureOperation.getMetrics(
ontology, "extended", new CURIEShortFormProvider(new IOHelper().getPrefixes()));
assertEquals("RRESTRUCINTE+I(D)", result.getSimpleMetricValue(MetricsLabels.EXPRESSIVITY));
assertEquals("SID", result.getSimpleMetricValue(MetricsLabels.EXPRESSIVITY));
}

/**
Expand Down