public List<OWLObjectProperty> getAtomicRolesList() { if (atomicRolesList == null) atomicRolesList = new LinkedList<>(getObjectProperties()); return atomicRolesList; }
/** * Checks whether the roles exist in background knowledge * @param roles The roles to check. * @return The first non-existing role or null if they are all in the * background knowledge. */ // public static OWLObjectProperty checkRoles(AbstractReasonerComponent rs, Set<OWLObjectProperty> roles) { Set<OWLObjectProperty> existingRoles = rs.getObjectProperties(); for (OWLObjectProperty ar : roles) { if(!existingRoles.contains(ar)) return ar; } return null; }
/** * @return all object properties with its domains. */ public Map<OWLObjectProperty, OWLClassExpression> getObjectPropertyDomains() { Map<OWLObjectProperty, OWLClassExpression> result = new HashMap<>(); for (OWLObjectProperty op : getObjectProperties()) { OWLClassExpression domain = getDomain(op); result.put(op, domain); } return result; }
public DLTreesRefinementOperator(PosNegLP lp, AbstractReasonerComponent reasoner, int beam) { super(); // TODO Auto-generated constructor stub this.reasoner=reasoner; //System.out.println("is Reasoner null? "+reasoner==null); allConcepts= new ArrayList<>(reasoner.getClasses()); //System.out.println("all+ Concepts: "+allConcepts.size()); allRoles= new ArrayList<>(reasoner.getObjectProperties()); //this.beam=beam; // set the maximum number of candidates that can be generated this.lp=lp; generator= new Random(2); }
/** * @return all object properties with its range. */ public Map<OWLObjectProperty, OWLClassExpression> getObjectPropertyRanges() { Map<OWLObjectProperty, OWLClassExpression> result = new HashMap<>(); for (OWLObjectProperty op : getObjectProperties()) { OWLClassExpression range = getRange(op); result.put(op, range); } return result; }
public void setReasoner(AbstractReasonerComponent reasoner) { // TODO Auto-generated method stub this.reasoner= reasoner; if (allConcepts==null) allConcepts= new ArrayList<>(reasoner.getClasses()); //System.out.println("all+ Concepts: "+allConcepts.size()); if (allRoles==null) allRoles= new ArrayList<>(reasoner.getObjectProperties()); }
@Override public OWLObjectProperty getOWLObjectProperty(String name) { return find(name, rc.getObjectProperties()); }
/** * Compute the set of applicable object properties for a * given description. * * @param index The index is a class expression 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<OWLObjectProperty> computeApplicableObjectProperties(OWLClassExpression index) { // use a cache, because large ontologies can have many object properties SortedSet<OWLObjectProperty> applicableObjectProperties = appOPCache.get(index); if(applicableObjectProperties == null) { Set<OWLObjectProperty> objectProperties = reasoner.getObjectProperties(); applicableObjectProperties = new TreeSet<>(); for(OWLObjectProperty op : objectProperties) { OWLClassExpression domain = opDomains.get(op); if(!isDisjoint(index,domain)) { applicableObjectProperties.add(op); } } appOPCache.put(index, applicableObjectProperties); } return applicableObjectProperties; }
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; }
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; }
@WebMethod public String[] getAtomicRoles(int id) throws ClientNotKnownException { ClientState state = getState(id); Set<OWLObjectProperty> roles = state.getReasonerComponent().getObjectProperties(); return Datastructures.sortedSet2StringListRoles(roles); }
/** * Creates the object property hierarchy. Invoking this method is optional * (if not called explicitly, it is called the first time, it is needed). * * @return The object property hierarchy. * @throws ReasoningMethodUnsupportedException * Thrown if a reasoning method for object property * hierarchy creation is not supported by the reasoner. */ public ObjectPropertyHierarchy prepareObjectPropertyHierarchy() throws ReasoningMethodUnsupportedException { TreeMap<OWLObjectProperty, SortedSet<OWLObjectProperty>> roleHierarchyUp = new TreeMap<>( ); TreeMap<OWLObjectProperty, SortedSet<OWLObjectProperty>> roleHierarchyDown = new TreeMap<>( ); Set<OWLObjectProperty> atomicRoles = getObjectProperties(); for (OWLObjectProperty role : atomicRoles) { roleHierarchyDown.put(role, getSubPropertiesImpl(role)); roleHierarchyUp.put(role, getSuperPropertiesImpl(role)); } roleHierarchy = new ObjectPropertyHierarchy(roleHierarchyUp, roleHierarchyDown); return roleHierarchy; }
private void createTopSet() { topSet = new TreeSet<>(); // TOP OR TOP => Was soll mit Refinements passieren, die immer improper sind? List<OWLClassExpression> operands = Lists.<OWLClassExpression>newArrayList(df.getOWLThing(), df.getOWLThing()); OWLObjectUnionOf md = new OWLObjectUnionOfImplExt(operands); topSet.add(md); // allgemeinste Konzepte topSet.addAll(reasoningService.getSubClasses(df.getOWLThing())); // negierte speziellste Konzepte Set<OWLClassExpression> tmp = reasoningService.getSuperClasses(df.getOWLNothing()); for(OWLClassExpression c : tmp) topSet.add(df.getOWLObjectComplementOf(c)); // EXISTS r.TOP und ALL r.TOP für alle r for(OWLObjectProperty r : reasoningService.getObjectProperties()) { topSet.add(df.getOWLObjectAllValuesFrom(r, df.getOWLThing())); topSet.add(df.getOWLObjectSomeValuesFrom(r, df.getOWLThing())); } }
private void createBottomSet() { bottomSet = new TreeSet<>(); // BOTTOM AND BOTTOM List<OWLClassExpression> operands = Lists.<OWLClassExpression>newArrayList(df.getOWLNothing(), df.getOWLNothing()); OWLObjectIntersectionOf mc = new OWLObjectIntersectionOfImplExt(operands); bottomSet.add(mc); // speziellste Konzepte bottomSet.addAll(reasoningService.getSuperClasses(df.getOWLNothing())); // negierte allgemeinste Konzepte Set<OWLClassExpression> tmp = reasoningService.getSubClasses(df.getOWLThing()); for(OWLClassExpression c : tmp) bottomSet.add(df.getOWLObjectComplementOf(c)); // EXISTS r.BOTTOM und ALL r.BOTTOM für alle r for(OWLObjectProperty r : reasoningService.getObjectProperties()) { bottomSet.add(df.getOWLObjectAllValuesFrom(r, df.getOWLNothing())); bottomSet.add(df.getOWLObjectSomeValuesFrom(r, df.getOWLNothing())); } }
for (OWLObjectProperty prop : reasoner.getObjectProperties()) { thisLenDescriptions.add(dataFactory.getOWLObjectSomeValuesFrom(prop, OWL_THING)); thisLenDescriptions.add(dataFactory.getOWLObjectAllValuesFrom(prop, OWL_THING)); for (OWLObjectProperty objProp : reasoner.getObjectProperties()) { for (OWLClassExpression description : generatedDescriptions.get(length-2)) { thisLenDescriptions.add(dataFactory.getOWLObjectAllValuesFrom(objProp, description));
for(OWLObjectProperty op : rs.getObjectProperties()) { opDomains.put(op, rs.getDomain(op)); opRanges.put(op, rs.getRange(op));
logger.debug("object properties: " + reasoner.getObjectProperties());
!getReasoner().getObjectProperties().containsAll(classExpressionToDescribe.getObjectPropertiesInSignature()) || !getReasoner().getDatatypeProperties().containsAll(classExpressionToDescribe.getDataPropertiesInSignature())) { throw new ComponentInitException("Some entities in \"" + classExpressionToDescribe + "\" do not exist. Make sure you spelled it correctly.");