private InstanceTaxonomy<ElkClass,ElkNamedIndividual> loadAndClassify(String resource) throws IOException, Owl2ParseException, ElkInconsistentOntologyException, ElkException { Reasoner reasoner = TestReasonerUtils.createTestReasoner( getClass().getClassLoader().getResourceAsStream(resource), 1); return reasoner.getInstanceTaxonomy(); }
@Override public InstanceTaxonomy<ElkClass, ElkNamedIndividual> getTaxonomy(final String resource) throws ElkException { final Reasoner reasoner = TestReasonerUtils.createTestReasoner( getClass().getClassLoader().getResourceAsStream(resource), 1); return reasoner.getInstanceTaxonomy(); } @Override
/** * Helper method to get a {@link TypeNode} from the taxonomy. * * @param elkClass * @return the {@link TypeNode} for the given {@link ElkClass} * @throws ElkException * if the result cannot be computed */ protected TypeNode<ElkClass, ElkNamedIndividual> getTypeNode( ElkClass elkClass) throws ElkException { final InstanceTaxonomy<ElkClass, ElkNamedIndividual> instanceTaxonomy = getInstanceTaxonomy(); final TypeNode<ElkClass, ElkNamedIndividual> node = instanceTaxonomy .getNode(elkClass); if (node != null) return node; // else if (allowFreshEntities) return new FreshTypeNode<ElkClass, ElkNamedIndividual>(elkClass, instanceTaxonomy); // else throw new ElkFreshEntitiesException(elkClass); }
/** * Helper method to get an {@link InstanceNode} from the taxonomy. * * @param elkNamedIndividual * @return the {@link InstanceNode} for the given {@link ElkNamedIndividual} * @throws ElkException * if the result cannot be computed */ protected InstanceNode<ElkClass, ElkNamedIndividual> getInstanceNode( ElkNamedIndividual elkNamedIndividual) throws ElkException { final InstanceTaxonomy<ElkClass, ElkNamedIndividual> instanceTaxonomy = getInstanceTaxonomy(); final InstanceNode<ElkClass, ElkNamedIndividual> node = instanceTaxonomy .getInstanceNode(elkNamedIndividual); if (node != null) return node; // else if (allowFreshEntities) return new FreshInstanceNode<ElkClass, ElkNamedIndividual>( elkNamedIndividual, instanceTaxonomy); // else throw new ElkFreshEntitiesException(elkNamedIndividual); }
/** * Helper method to get a {@link TypeNode} from the taxonomy. * * @param elkClass * @return the {@link TypeNode} for the given {@link ElkClass} * @throws ElkException * if the result cannot be computed */ protected TypeNode<ElkClass, ElkNamedIndividual> getTypeNode( ElkClass elkClass) throws ElkException { final InstanceTaxonomy<ElkClass, ElkNamedIndividual> instanceTaxonomy = getInstanceTaxonomy(); final TypeNode<ElkClass, ElkNamedIndividual> node = instanceTaxonomy .getNode(elkClass); if (node != null) return node; // else if (allowFreshEntities) return new FreshTypeNode<ElkClass, ElkNamedIndividual>(elkClass, instanceTaxonomy); // else throw new ElkFreshEntitiesException(elkClass); }
/** * Helper method to get an {@link InstanceNode} from the taxonomy. * * @param elkNamedIndividual * @return the {@link InstanceNode} for the given {@link ElkNamedIndividual} * @throws ElkException * if the result cannot be computed */ protected InstanceNode<ElkClass, ElkNamedIndividual> getInstanceNode( ElkNamedIndividual elkNamedIndividual) throws ElkException { final InstanceTaxonomy<ElkClass, ElkNamedIndividual> instanceTaxonomy = getInstanceTaxonomy(); final InstanceNode<ElkClass, ElkNamedIndividual> node = instanceTaxonomy .getInstanceNode(elkNamedIndividual); if (node != null) return node; // else if (allowFreshEntities) return new FreshInstanceNode<ElkClass, ElkNamedIndividual>( elkNamedIndividual, instanceTaxonomy); // else throw new ElkFreshEntitiesException(elkNamedIndividual); }
/** * Helper method to get an {@link InstanceNode} from the taxonomy. * * @param elkNamedIndividual * @return the {@link InstanceNode} for the given {@link ElkNamedIndividual} * @throws ElkException * if the result cannot be computed */ protected InstanceNode<ElkClass, ElkNamedIndividual> getInstanceNode( ElkNamedIndividual elkNamedIndividual) throws ElkException { final InstanceTaxonomy<ElkClass, ElkNamedIndividual> instanceTaxonomy = getInstanceTaxonomy(); final InstanceNode<ElkClass, ElkNamedIndividual> node = instanceTaxonomy .getInstanceNode(elkNamedIndividual); if (node != null) return node; // else if (allowFreshEntities) return new FreshInstanceNode<ElkClass, ElkNamedIndividual>( elkNamedIndividual, instanceTaxonomy); // else throw new ElkFreshEntitiesException(elkNamedIndividual); }
/** * Helper method to get a {@link TypeNode} from the taxonomy. * * @param elkClass * @return the {@link TypeNode} for the given {@link ElkClass} * @throws ElkException * if the result cannot be computed */ protected TypeNode<ElkClass, ElkNamedIndividual> getTypeNode( ElkClass elkClass) throws ElkException { final InstanceTaxonomy<ElkClass, ElkNamedIndividual> instanceTaxonomy = getInstanceTaxonomy(); final TypeNode<ElkClass, ElkNamedIndividual> node = instanceTaxonomy .getNode(elkClass); if (node != null) return node; // else if (allowFreshEntities) return new FreshTypeNode<ElkClass, ElkNamedIndividual>(elkClass, instanceTaxonomy); // else throw new ElkFreshEntitiesException(elkClass); }
@Override public void precomputeInferences(InferenceType... inferenceTypes) throws ReasonerInterruptedException, TimeOutException, InconsistentOntologyException { LOGGER_.trace("precomputeInferences(InferenceType...)"); checkInterrupted(); // we use the main progress monitor only here this.reasoner_.setProgressMonitor(this.mainProgressMonitor_); try { for (InferenceType inferenceType : inferenceTypes) { if (inferenceType.equals(InferenceType.CLASS_HIERARCHY)) reasoner_.getTaxonomy(); else if (inferenceType.equals(InferenceType.CLASS_ASSERTIONS)) reasoner_.getInstanceTaxonomy(); else if (inferenceType .equals(InferenceType.OBJECT_PROPERTY_HIERARCHY)) { reasoner_.getObjectPropertyTaxonomy(); } } } catch (ElkUnsupportedReasoningTaskException e) { throw unsupportedOwlApiMethod( "precomputeInferences(inferenceTypes)", e.getMessage()); } catch (ElkException e) { throw elkConverter_.convert(e); } catch (ElkRuntimeException e) { throw elkConverter_.convert(e); } finally { this.reasoner_.setProgressMonitor(this.secondaryProgressMonitor_); } }
@Override public void precomputeInferences(InferenceType... inferenceTypes) throws ReasonerInterruptedException, TimeOutException, InconsistentOntologyException { LOGGER_.trace("precomputeInferences(InferenceType...)"); checkInterrupted(); // we use the main progress monitor only here this.reasoner_.setProgressMonitor(this.mainProgressMonitor_); try { for (InferenceType inferenceType : inferenceTypes) { if (inferenceType.equals(InferenceType.CLASS_HIERARCHY)) reasoner_.getTaxonomy(); else if (inferenceType.equals(InferenceType.CLASS_ASSERTIONS)) reasoner_.getInstanceTaxonomy(); else if (inferenceType .equals(InferenceType.OBJECT_PROPERTY_HIERARCHY)) { reasoner_.getObjectPropertyTaxonomy(); } } } catch (ElkUnsupportedReasoningTaskException e) { throw unsupportedOwlApiMethod( "precomputeInferences(inferenceTypes)", e.getMessage()); } catch (ElkException e) { throw elkConverter_.convert(e); } catch (ElkRuntimeException e) { throw elkConverter_.convert(e); } finally { this.reasoner_.setProgressMonitor(this.secondaryProgressMonitor_); } }
@Override public void precomputeInferences(InferenceType... inferenceTypes) throws ReasonerInterruptedException, TimeOutException, InconsistentOntologyException { LOGGER_.trace("precomputeInferences(InferenceType...)"); checkInterrupted(); // we use the main progress monitor only here this.reasoner_.setProgressMonitor(this.mainProgressMonitor_); try { for (InferenceType inferenceType : inferenceTypes) { if (inferenceType.equals(InferenceType.CLASS_HIERARCHY)) reasoner_.getTaxonomy(); else if (inferenceType.equals(InferenceType.CLASS_ASSERTIONS)) reasoner_.getInstanceTaxonomy(); else if (inferenceType .equals(InferenceType.OBJECT_PROPERTY_HIERARCHY)) { reasoner_.getObjectPropertyTaxonomy(); } } } catch (ElkUnsupportedReasoningTaskException e) { throw unsupportedOwlApiMethod( "precomputeInferences(inferenceTypes)", e.getMessage()); } catch (ElkException e) { throw elkConverter_.convert(e); } catch (ElkRuntimeException e) { throw elkConverter_.convert(e); } finally { this.reasoner_.setProgressMonitor(this.secondaryProgressMonitor_); } }