/** * Finds all individuals where more than one type is asserted, which is disallowed by Cirm team * convention. Except: Protected is allowed as second class, but will still be returned from this * method. * * @return */ public List<Pair<OWLNamedIndividual, Set<OWLClassExpression>>> getIndividualsWithMoreThanOneTypeAsserted() { List<Pair<OWLNamedIndividual, Set<OWLClassExpression>>> errors = new LinkedList<Pair<OWLNamedIndividual, Set<OWLClassExpression>>>(); if (DBG) System.out.println("Start CirmOntologyValidator::getIndividualsWithMoreThanOneTypeAsserted"); Set<OWLOntology> owlOntologies = OWL.ontologies(); for (OWLOntology owlOntology : owlOntologies) { if (DBG) System.out.println("Getting individuals in signature of Ontology " + owlOntology); Set<OWLNamedIndividual> s = owlOntology.getIndividualsInSignature(false); if (DBG) System.out.println("...done."); for (OWLNamedIndividual owlNamedIndividual : s) { Set<OWLClassExpression> types = owlNamedIndividual.getTypes(owlOntologies); if (types.size() > 1) { Pair<OWLNamedIndividual, Set<OWLClassExpression>> error = new Pair<OWLNamedIndividual, Set<OWLClassExpression>>(owlNamedIndividual, types); errors.add(error); if (DBG) { System.out.println("Found " + types.size() + " types for " + owlNamedIndividual); for (OWLClassExpression owlClassExpression : types) { System.out.println(owlClassExpression); } } } } // for (OWLNamedIndividual } // for (OWLOntology if (DBG) System.out.println("Total Individuals not passing validation: " + errors.size()); return errors; }