private void addEntailedKBSuccessors(OWLObjectSomeValuesFrom some) { TRACKER.start(StaticValues.TIME_KB_SUCCESSORS, BlockOutputMode.COMPLETE, true); // add all role-successors entailed by the TBox addEntailedTBoxSuccessors(some, m_normalize); // for KB mode only normalize TBox contained roles DomainNode<?> toNode = getDomainElement(some.getFiller()); OWLClass someClass = m_ontologyOperator.getFlatteningTransformer().getIntermediary(some); long start = System.currentTimeMillis(); // StatStore.getInstance().enterValue("instance accessing", 1.0); NodeSet<OWLNamedIndividual> instances = m_ontologyOperator.getReasoner().getInstances(someClass, false); sum += System.currentTimeMillis() - start; // NodeSet<OWLNamedIndividual> instances = // m_ontologyOperator.getReasoner().getInstances(getClassRepresentation(some), false); // LOG.fine(" creating successors to " + some + " from instances: " + instances.toString()); Iterator<Node<OWLNamedIndividual>> it1 = instances.iterator(); while (it1.hasNext()) { Iterator<OWLNamedIndividual> it2 = it1.next().iterator(); while (it2.hasNext()) { DomainNode<?> from = m_domain.getDomainNode(it2.next()); if (from != null) { // if(!isSuccessorRepresented(from, getDomainElement(some.getFiller()), // (OWLObjectProperty)some.getProperty())){ from.addSuccessor((OWLObjectProperty) some.getProperty(), toNode); // } } } } TRACKER.stop(StaticValues.TIME_KB_SUCCESSORS); }
private void addEntailedTBoxSuccessors(OWLObjectSomeValuesFrom some, boolean doNormalizing) { // StatStore.getInstance().enterValue("lookup " + some.getFiller(), 1.0); // StatStore.getInstance().enterValue("restrictions handled", 1.0); TRACKER.start(StaticValues.TIME_TBOX_SUCCESSORS, BlockOutputMode.COMPLETE, true); // TRACKER.start("fetch domain element and intermediary", BlockOutputMode.COMPLETE, true); DomainNode<?> toNode = getDomainElement(some.getFiller()); // the super class, intermediary stands for (some r B) OWLClass superClass = m_ontologyOperator.getFlatteningTransformer().getIntermediary(some); // TRACKER.stop("fetch domain element and intermediary"); // add successors from all // TRACKER.start("query elk", BlockOutputMode.COMPLETE, true); // StatStore.getInstance().enterValue("subclass accessing", 1.0); NodeSet<OWLClass> classes = m_ontologyOperator.getReasoner().getSubClasses(superClass, false); // fill current class relations from Id // StatStore.getInstance().enterValue("subclass accessing", 1.0); currentIdSubClasses = m_ontologyOperator.getReasoner().getSubClasses(some.getFiller(), false); // StatStore.getInstance().enterValue("superclass accessing", 1.0); currentIdSuperClasses = m_ontologyOperator.getReasoner().getSuperClasses(some.getFiller(), false); // StatStore.getInstance().enterValue("equivalent classes accessing", 1.0); currentIdEqClasses = m_ontologyOperator.getReasoner().getEquivalentClasses(some.getFiller()); // TRACKER.stop("query elk"); // LOG.fine(" creating successors to " + some + ": " + classes.toString()); Iterator<Node<OWLClass>> nodeIt = classes.iterator(); while (nodeIt.hasNext()) { Iterator<OWLClass> it = nodeIt.next().iterator(); while (it.hasNext()) { DomainNode<?> node = m_domain.getDomainNode(it.next()); // if it.next() yields no domain node, there exists an ABox identity for it // and this case is covered by addEntailedKBSuccessors if (node != null) { if (doNormalizing) { // if(!isSuccessorRepresented(node, (OWLObjectProperty)some.getProperty(), // some.getFiller())){ TRACKER.start("normalizing and adding", BlockOutputMode.COMPLETE, true); if (!isSuccessorRepresented(node, toNode, (OWLObjectProperty) some.getProperty())) { removeIncludedSuccessors( (OWLObjectProperty) some.getProperty(), node, some.getFiller()); node.addSuccessor((OWLObjectProperty) some.getProperty(), toNode); } TRACKER.stop("normalizing and adding"); } else { node.addSuccessor((OWLObjectProperty) some.getProperty(), toNode); } } } } // add all equivalent class successors // TRACKER.start("query elk", BlockOutputMode.COMPLETE, true); Iterator<OWLClass> cIt = m_ontologyOperator.getReasoner().getEquivalentClasses(superClass).iterator(); // TRACKER.stop("query elk"); while (cIt.hasNext()) { DomainNode<?> node = m_domain.getDomainNode(cIt.next()); if (node != null) { if (doNormalizing) { // if(!isSuccessorRepresented(node, (OWLObjectProperty)some.getProperty(), // some.getFiller())){ TRACKER.start("normalizing and adding", BlockOutputMode.COMPLETE, true); if (!isSuccessorRepresented(node, toNode, (OWLObjectProperty) some.getProperty())) { removeIncludedSuccessors( (OWLObjectProperty) some.getProperty(), node, some.getFiller()); node.addSuccessor((OWLObjectProperty) some.getProperty(), toNode); } TRACKER.stop("normalizing and adding"); } else { node.addSuccessor((OWLObjectProperty) some.getProperty(), toNode); } } } TRACKER.stop(StaticValues.TIME_TBOX_SUCCESSORS); }