/* (non-Javadoc) * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.NamedClass) */ public void visit(NamedClass description) { logger.trace("NamedClass"); if (description.getName().equals("http://dbpedia.org/class/yago/Entity100001740")) { if (query.endsWith("which is ")) query = query.substring(0, query.length() - 10); if (query.endsWith("are ")) query = query.substring(0, query.length() - 5); if (query.endsWith("and ")) query = query.substring(0, query.length() - 5); if (query.endsWith("or ")) query = query.substring(0, query.length() - 4); } // SortedSet<String> label=tasks.queryAsSet("SELECT ?label WHERE {<"+description.getName()+"> // <http://www.w3.org/2000/01/rdf-schema#label> ?label}", "label"); String l = getLabelFromReasoner(description); String l2 = description .getName() .substring(description.getName().lastIndexOf("/") + 1, description.getName().length()) .replace('_', ' '); if ((l.length() == 0) || (l.length() + 5 < l2.length() && !l2.matches(".*[0-9]"))) l = l2; // replacements l = l.replaceAll("Cities", "City"); l = l.replaceAll("Players", "Player"); l = l.replaceAll("([^-\040])([A-Z])([^A-Z])", "$1 $2$3"); if (l.toLowerCase().startsWith("a") || l.toLowerCase().startsWith("e") || l.toLowerCase().startsWith("i") || l.toLowerCase().startsWith("o") || l.toLowerCase().startsWith("u")) query += "an " + l; else query += "a " + l; }
public List<NamedClass> getAtomicConceptsList(boolean removeOWLThing) { if (!removeOWLThing) { return getAtomicConceptsList(); } else { List<NamedClass> l = new LinkedList<NamedClass>(); for (NamedClass class1 : getAtomicConceptsList()) { if (class1.compareTo(new NamedClass(OWLVocabulary.OWL_NOTHING)) == 0 || class1.compareTo(new NamedClass(OWLVocabulary.OWL_THING)) == 0) {; // do nothing } else { l.add(class1); } } return l; } }