/** * Check the annotations for cardinality violations. Try to resolve * conflicts with the default handler. * * @param ontology the target ontology * @throws AnnotationCardinalityException throws exception in case a conflict cannot be resolved * by the handler * @see #DEFAULT_HANDLER */ public static void checkAnnotationCardinality(OWLOntology ontology) { checkAnnotationCardinality(ontology, null, DEFAULT_HANDLER); }
OWLOntologyManager manager = ontology.getOWLOntologyManager(); OWLDataFactory factory = manager.getOWLDataFactory(); Set<OWLAnnotationProperty> headerProperties = getProperties(factory, TAG_ONTOLOGY, TAG_FORMAT_VERSION, TAG_DATE, TAG_DEFAULT_NAMESPACE, TAG_SAVED_BY, TAG_AUTO_GENERATED_BY); checkOntologyAnnotations(headerProperties, ontology, reporter, handler, manager); Set<OWLAnnotationProperty> properties = getProperties(factory, TAG_IS_ANONYMOUS, TAG_NAME, TAG_NAMESPACE, TAG_DEF, TAG_COMMENT, TAG_DOMAIN, TAG_RANGE, TAG_IS_ANTI_SYMMETRIC, TAG_IS_CYCLIC, TAG_CREATED_BY, TAG_CREATION_DATE); ontology.classesInSignature(INCLUDED) .forEach(c -> checkOwlEntity(c, properties, ontology, reporter, handler)); ontology.objectPropertiesInSignature(INCLUDED) .forEach(p -> checkOwlEntity(p, properties, ontology, reporter, handler));
@Override public List<OWLAnnotation> handleConflict(OWLAnnotationProperty property, Collection<OWLAnnotation> ontologyAnnotations) { if (ontologyAnnotations.size() > 1) { String tag = OWLAPIOwl2Obo.owlObjectToTag(property); if (tag == null) { tag = property.getIRI().toString(); } // take the first one in the collection // (may be random) LOGGER.info("Fixing multiple ontolgy annotations with, tag: {}", tag); return listOfFirst(ontologyAnnotations); } throw new AnnotationCardinalityException( "Could not resolve conflict for property: " + property); } };
OWLOntologyManager manager = ontology.getOWLOntologyManager(); OWLDataFactory factory = manager.getOWLDataFactory(); Set<OWLAnnotationProperty> headerProperties = getProperties(factory, TAG_ONTOLOGY, TAG_FORMAT_VERSION, TAG_DATE, TAG_DEFAULT_NAMESPACE, TAG_SAVED_BY, TAG_AUTO_GENERATED_BY); checkOntologyAnnotations(headerProperties, ontology, reporter, handler, manager); Set<OWLAnnotationProperty> properties = getProperties(factory, TAG_IS_ANONYMOUS, TAG_NAME, TAG_NAMESPACE, TAG_DEF, TAG_COMMENT, TAG_DOMAIN, TAG_RANGE, TAG_IS_ANTI_SYMMETRIC, TAG_IS_CYCLIC, TAG_CREATED_BY, TAG_CREATION_DATE); ontology.classesInSignature(INCLUDED) .forEach(c -> checkOwlEntity(c, properties, ontology, reporter, handler)); ontology.objectPropertiesInSignature(INCLUDED) .forEach(p -> checkOwlEntity(p, properties, ontology, reporter, handler));
@Override public List<OWLAnnotation> handleConflict(OWLAnnotationProperty property, Collection<OWLAnnotation> ontologyAnnotations) { if (ontologyAnnotations.size() > 1) { String tag = OWLAPIOwl2Obo.owlObjectToTag(property); if (tag == null) { tag = property.getIRI().toString(); } // take the first one in the collection // (may be random) LOGGER.info("Fixing multiple ontolgy annotations with, tag: {}", tag); return listOfFirst(ontologyAnnotations); } throw new AnnotationCardinalityException( "Could not resolve conflict for property: " + property); } };
OWLOntologyManager manager = ontology.getOWLOntologyManager(); OWLDataFactory factory = manager.getOWLDataFactory(); Set<OWLAnnotationProperty> headerProperties = getProperties(factory, TAG_ONTOLOGY, TAG_FORMAT_VERSION, TAG_DATE, TAG_DEFAULT_NAMESPACE, TAG_SAVED_BY, TAG_AUTO_GENERATED_BY); checkOntologyAnnotations(headerProperties, ontology, reporter, handler, manager); Set<OWLAnnotationProperty> properties = getProperties(factory, TAG_IS_ANONYMOUS, TAG_NAME, TAG_NAMESPACE, TAG_DEF, TAG_COMMENT, TAG_DOMAIN, TAG_RANGE, TAG_IS_ANTI_SYMMETRIC, TAG_IS_CYCLIC, TAG_CREATED_BY, TAG_CREATION_DATE); ontology.classesInSignature(INCLUDED) .forEach(c -> checkOwlEntity(c, properties, ontology, reporter, handler)); ontology.objectPropertiesInSignature(INCLUDED) .forEach(p -> checkOwlEntity(p, properties, ontology, reporter, handler));
/** * Check the annotations for cardinality violations. Try to resolve * conflicts with the default handler. * * @param ontology the target ontology * @throws AnnotationCardinalityException throws exception in case a conflict cannot be resolved * by the handler * @see #DEFAULT_HANDLER */ public static void checkAnnotationCardinality(OWLOntology ontology) { checkAnnotationCardinality(ontology, null, DEFAULT_HANDLER); }
@Override public List<OWLAnnotation> handleConflict(OWLAnnotationProperty property, Collection<OWLAnnotation> ontologyAnnotations) { if (ontologyAnnotations.size() > 1) { String tag = OWLAPIOwl2Obo.owlObjectToTag(property); if (tag == null) { tag = property.getIRI().toString(); } // take the first one in the collection // (may be random) LOGGER.info("Fixing multiple ontolgy annotations with, tag: {}", tag); return listOfFirst(ontologyAnnotations); } throw new AnnotationCardinalityException( "Could not resolve conflict for property: " + property); } };
OWLOntologyManager manager = ontology.getOWLOntologyManager(); OWLDataFactory factory = manager.getOWLDataFactory(); Set<OWLAnnotationProperty> headerProperties = getProperties(factory, TAG_ONTOLOGY, TAG_FORMAT_VERSION, TAG_DATE, TAG_DEFAULT_NAMESPACE, TAG_SAVED_BY, TAG_AUTO_GENERATED_BY); checkOntologyAnnotations(headerProperties, ontology, reporter, handler, manager); Set<OWLAnnotationProperty> properties = getProperties(factory, TAG_IS_ANONYMOUS, TAG_NAME, TAG_NAMESPACE, TAG_DEF, TAG_COMMENT, TAG_DOMAIN, TAG_RANGE, TAG_IS_ANTI_SYMMETRIC, TAG_IS_CYCLIC, TAG_CREATED_BY, TAG_CREATION_DATE); ontology.classesInSignature(INCLUDED) .forEach(c -> checkOwlEntity(c, properties, ontology, reporter, handler)); ontology.objectPropertiesInSignature(INCLUDED) .forEach(p -> checkOwlEntity(p, properties, ontology, reporter, handler));
/** * Check the annotations for cardinality violations. Try to resolve * conflicts with the default handler. * * @param ontology the target ontology * @throws AnnotationCardinalityException throws exception in case a conflict cannot be resolved * by the handler * @see #DEFAULT_HANDLER */ public static void checkAnnotationCardinality(OWLOntology ontology) { checkAnnotationCardinality(ontology, null, DEFAULT_HANDLER); }
@Override public List<OWLAnnotation> handleConflict(OWLAnnotationProperty property, Collection<OWLAnnotation> ontologyAnnotations) { if (ontologyAnnotations.size() > 1) { String tag = OWLAPIOwl2Obo.owlObjectToTag(property); if (tag == null) { tag = property.getIRI().toString(); } // take the first one in the collection // (may be random) LOGGER.info("Fixing multiple ontolgy annotations with, tag: {}", tag); return listOfFirst(ontologyAnnotations); } throw new AnnotationCardinalityException( "Could not resolve conflict for property: " + property); } };
final OWLDataFactory factory = manager.getOWLDataFactory(); Set<OWLAnnotationProperty> headerProperties = getProperties(factory, OboFormatTag.TAG_ONTOLOGY, OboFormatTag.TAG_FORMAT_VERSION, OboFormatTag.TAG_AUTO_GENERATED_BY); checkOntologyAnnotations(headerProperties, ontology, reporter, handler, manager); Set<OWLAnnotationProperty> properties = getProperties(factory, OboFormatTag.TAG_IS_ANONYMOUS, OboFormatTag.TAG_NAME, checkOwlEntity(owlClass, properties, ontology, reporter, handler, manager); checkOwlEntity(owlProperty, properties, ontology, reporter, handler, manager);
/** * Check the annotations for cardinality violations. Try to resolve * conflicts with the default handler. * * @param ontology the target ontology * @throws AnnotationCardinalityException throws exception in case a conflict cannot be resolved * by the handler * @see #DEFAULT_HANDLER */ public static void checkAnnotationCardinality(OWLOntology ontology) { checkAnnotationCardinality(ontology, null, DEFAULT_HANDLER); }
@Override public List<OWLAnnotationAssertionAxiom> handleConflict(OWLEntity entity, OWLAnnotationProperty property, Collection<OWLAnnotationAssertionAxiom> axioms) { if (axioms.size() > 1) { String tag = OWLAPIOwl2Obo.owlObjectToTag(property); if (tag == null) { tag = property.getIRI().toString(); } // take the first one in the collection // (may be random) LOGGER.info("Fixing multiple {} tags for entity: {}", tag, entity.getIRI()); return listOfFirst(axioms); } throw new AnnotationCardinalityException( "Could not resolve conflict for property: " + property); }
/** * Check the annotations for cardinality violations. * Try to resolve conflicts with the default handler. * * @param ontology the target ontology * @throws AnnotationCardinalityException throws exception in case a conflict cannot be resolved by the handler * @see #DEFAULT_HANDLER */ public static void checkAnnotationCardinality(OWLOntology ontology) throws AnnotationCardinalityException { checkAnnotationCardinality(ontology, null, DEFAULT_HANDLER); }
@Override public List<OWLAnnotationAssertionAxiom> handleConflict(OWLEntity entity, OWLAnnotationProperty property, Collection<OWLAnnotationAssertionAxiom> axioms) { if (axioms.size() > 1) { String tag = OWLAPIOwl2Obo.owlObjectToTag(property); if (tag == null) { tag = property.getIRI().toString(); } // take the first one in the collection // (may be random) LOGGER.info("Fixing multiple {} tags for entity: {}", tag, entity.getIRI()); return listOfFirst(axioms); } throw new AnnotationCardinalityException( "Could not resolve conflict for property: " + property); }
/** * Check the annotations for cardinality violations. Only report violations * via the given reporter * * @param ontology the target ontology * @param reporter used to report violations */ public static void checkAnnotationCardinality(OWLOntology ontology, AnnotationCardinalityReporter reporter) { try { checkAnnotationCardinality(ontology, reporter, null); } catch (AnnotationCardinalityException e) { // this will not happen as no handler is registered LOGGER.error("Cardinality exception during report: This isn't supposed to happen.", e); } }
@Override public List<OWLAnnotationAssertionAxiom> handleConflict(OWLEntity entity, OWLAnnotationProperty property, Collection<OWLAnnotationAssertionAxiom> axioms) { if (axioms.size() > 1) { String tag = OWLAPIOwl2Obo.owlObjectToTag(property); if (tag == null) { tag = property.getIRI().toString(); } // take the first one in the collection // (may be random) LOGGER.info("Fixing multiple {} tags for entity: {}", tag, entity.getIRI()); return listOfFirst(axioms); } throw new AnnotationCardinalityException( "Could not resolve conflict for property: " + property); }
/** * Check the annotations for cardinality violations. Only report violations * via the given reporter * * @param ontology the target ontology * @param reporter used to report violations */ public static void checkAnnotationCardinality(OWLOntology ontology, AnnotationCardinalityReporter reporter) { try { checkAnnotationCardinality(ontology, reporter, null); } catch (AnnotationCardinalityException e) { // this will not happen as no handler is registered LOGGER.error("Cardinality exception during report: This isn't supposed to happen.", e); } }
@Override public List<OWLAnnotationAssertionAxiom> handleConflict(OWLEntity entity, OWLAnnotationProperty property, Collection<OWLAnnotationAssertionAxiom> axioms) { if (axioms.size() > 1) { String tag = OWLAPIOwl2Obo.owlObjectToTag(property); if (tag == null) { tag = property.getIRI().toString(); } // take the first one in the collection // (may be random) LOGGER.info("Fixing multiple {} tags for entity: {}", tag, entity.getIRI()); return listOfFirst(axioms); } throw new AnnotationCardinalityException( "Could not resolve conflict for property: " + property); }