/** * @return all data properties with its domains. */ public Map<OWLDataProperty, OWLClassExpression> getDataPropertyDomains() { Map<OWLDataProperty, OWLClassExpression> result = new HashMap<>(); for (OWLDataProperty dp : getDatatypeProperties()) { OWLClassExpression domain = getDomain(dp); result.put(dp, domain); } return result; }
@Override public OWLDataProperty getOWLDataProperty(String name) { return find(name, rc.getDatatypeProperties()); }
@Override public Set<OWLDataProperty> getDataProperties() { Set<OWLDataProperty> dataProperties = new HashSet<>(); for (OWLDataProperty dp : reasoner.getDatatypeProperties()) { OWLDatatype datatype = reasoner.getDatatype(dp); if(datatype != null && getDatatypes().contains(datatype)) { dataProperties.add(dp); } } return dataProperties; }
public static <T extends OWLEntity> Set<T> computeEntitiesUsingIgnoreList(AbstractReasonerComponent rs, EntityType<T> entityType, Set<T> ignoredEntites) { Set<T> entities; if (entityType == EntityType.CLASS) { entities = (Set<T>) rs.getClasses(); } else if (entityType == EntityType.OBJECT_PROPERTY) { entities = (Set<T>) rs.getObjectProperties(); } else if (entityType == EntityType.DATA_PROPERTY) { entities = (Set<T>) rs.getDatatypeProperties(); } else { throw new UnsupportedOperationException("Entity type " + entityType + " currently not supported."); } entities = new TreeSet<>(entities); for (T entity : ignoredEntites) { boolean success = entities.remove(entity); if (!success) { logger.warn("Warning: Ignored entity " + entity + " does not exist in knowledge base."); } } return entities; }
/** * Compute the set of applicable data properties for a * given description. * * @param index The index is a OWLClassExpression which determines * which of the properties are applicable. Exactly those which * where the index and property domain are not disjoint are * applicable, where disjoint is defined by {@link #isDisjoint(OWLClassExpression, OWLClassExpression)}. * */ public SortedSet<OWLDataProperty> computeApplicableDatatypeProperties(OWLClassExpression index) { // use a cache, because large ontologies can have many data properties SortedSet<OWLDataProperty> applicableDatatypeProperties = appDPCache.get(index); if(applicableDatatypeProperties == null) { Set<OWLDataProperty> datatypeProperties = reasoner.getDatatypeProperties(); applicableDatatypeProperties = new TreeSet<>(); for(OWLDataProperty op : datatypeProperties) { OWLClassExpression domain = dpDomains.get(op); if(!isDisjoint(index,domain)) { applicableDatatypeProperties.add(op); } } appDPCache.put(index, applicableDatatypeProperties); } return applicableDatatypeProperties; }
public static <T extends OWLEntity> Set<T> computeEntities(AbstractReasonerComponent rs, EntityType<T> entityType) { // if there is no ignore or allowed list, we just ignore the concepts // of uninteresting namespaces if (entityType == EntityType.CLASS) { return (Set<T>) rs.getClasses(); } else if (entityType == EntityType.OBJECT_PROPERTY) { return (Set<T>) rs.getObjectProperties(); } else if (entityType == EntityType.DATA_PROPERTY) { return (Set<T>) rs.getDatatypeProperties(); } return null; }
/** * Creates the data property hierarchy. Invoking this method is optional (if * not called explicitly, it is called the first time, it is needed). * * @return The data property hierarchy. * @throws ReasoningMethodUnsupportedException * Thrown if data property hierarchy creation is not supported * by the reasoner. */ public DatatypePropertyHierarchy prepareDatatypePropertyHierarchy() throws ReasoningMethodUnsupportedException { TreeMap<OWLDataProperty, SortedSet<OWLDataProperty>> datatypePropertyHierarchyUp = new TreeMap<>( ); TreeMap<OWLDataProperty, SortedSet<OWLDataProperty>> datatypePropertyHierarchyDown = new TreeMap<>( ); Set<OWLDataProperty> datatypeProperties = getDatatypeProperties(); for (OWLDataProperty role : datatypeProperties) { datatypePropertyHierarchyDown.put(role, getSubPropertiesImpl(role)); datatypePropertyHierarchyUp.put(role, getSuperPropertiesImpl(role)); } return new DatatypePropertyHierarchy(datatypePropertyHierarchyUp, datatypePropertyHierarchyDown); }
opRanges.put(op, rs.getRange(op)); for(OWLDataProperty dp : rs.getDatatypeProperties()) { dpDomains.put(dp, rs.getDomain(dp)); dpRanges.put(dp, rs.getRange(dp));
!getReasoner().getDatatypeProperties().containsAll(classExpressionToDescribe.getDataPropertiesInSignature())) { throw new ComponentInitException("Some entities in \"" + classExpressionToDescribe + "\" do not exist. Make sure you spelled it correctly.");