Open jamesamcl opened 1 year ago
There are two. The comment meant there was either a collection or a stream argument; the arguments for these methods are Iterable instances.
/**
* Obtains the annotations on e where the annotation has the specified annotation property. This
* includes the annotations on annotation assertion axioms with matching annotation property.
*
* @param e entity
* @param ontologies The ontologies to examine for annotation axioms
* @param annotationProperty The annotation property
* @return A set of {@code OWLAnnotation} objects that have the specified URI.
*/
@Nonnull
public static Collection<OWLAnnotation> getAnnotations(@Nonnull OWLAnnotationSubject e,
@Nonnull Iterable<OWLOntology> ontologies,
@Nonnull OWLAnnotationProperty annotationProperty) {
Set<OWLAnnotation> toReturn = new HashSet<>();
for (OWLOntology o : ontologies) {
assert o != null;
toReturn.addAll(getAnnotations(e, o, annotationProperty));
}
return toReturn;
}
/**
* Obtains the annotations on e where the annotation has the specified annotation property. This
* includes the annotations on annotation assertion axioms with matching annotation property.
*
* @param e entity
* @param ontologies The ontologies to examine for annotation axioms
* @param annotationProperty The annotation property
* @return A set of {@code OWLAnnotation} objects that have the specified URI.
*/
@Nonnull
public static Collection<OWLAnnotation> getAnnotations(@Nonnull OWLEntity e,
@Nonnull Iterable<OWLOntology> ontologies,
@Nonnull OWLAnnotationProperty annotationProperty) {
Set<OWLAnnotation> toReturn = new HashSet<>();
for (OWLOntology o : ontologies) {
assert o != null;
toReturn.addAll(getAnnotations(e, o, annotationProperty));
}
return toReturn;
}
There is a closed issue https://github.com/owlcs/owlapi/issues/745 which asks about using getAnnotations to retrieve all annotations in the import closure for a given class. The answer before closing says "all methods are overloaded to accept a single ontology or a collection/stream of ontologies" but this does not seem to be the case for
getAnnotations
.https://github.com/owlcs/owlapi/blob/b683b03cbe7587fbc8a19c4a44360cfa27a97320/api/src/main/java/org/semanticweb/owlapi/search/EntitySearcher.java#L64-L105
There is no overload which accepts a stream of ontologies, as far as I can see.