public static OWLReasoner createReasoner(OWLOntology ontology, ProtegeOWLReasonerInfo info, ReasonerProgressMonitor monitor) { OWLReasonerFactory factory = info.getReasonerFactory(); OWLReasonerConfiguration configuration = info.getConfiguration(monitor); switch (info.getRecommendedBuffering()) { case BUFFERING: return factory.createReasoner(ontology, configuration); case NON_BUFFERING: return factory.createNonBufferingReasoner(ontology, configuration); default: throw new UnsupportedOperationException("Programmer error: missed a case " + info.getRecommendedBuffering()); } }
public String getCurrentReasonerFactoryId() { return getCurrentReasonerFactory().getReasonerId(); }
public int compare(ProtegeOWLReasonerInfo ri1, ProtegeOWLReasonerInfo ri2) { boolean nullReasoner1 = ri1.getReasonerFactory() instanceof NoOpReasonerFactory; boolean nullReasoner2 = ri2.getReasonerFactory() instanceof NoOpReasonerFactory; if (nullReasoner1 && nullReasoner2) { return 0; } else if (nullReasoner1) { return 1; } else if (nullReasoner2) { return -1; } else { return ri1.getReasonerName().compareTo(ri2.getReasonerName()); } }
/** * Creates an instance of the plugin. It is expected that * this instance will be "setup", but the instance's * initialise method will not have been called in the instantiation * process. */ public ProtegeOWLReasonerInfo newInstance() throws ClassNotFoundException, IllegalAccessException, InstantiationException { ProtegeOWLReasonerInfo reasoner = super.newInstance(); reasoner.setup(owlModelManager.getOWLOntologyManager(), getId(), getName()); reasoner.setOWLModelManager(owlModelManager); return reasoner; } }
Collections.sort(factoriesList, new ReasonerInfoComparator()); for (final ProtegeOWLReasonerInfo plugin : factoriesList) { JRadioButtonMenuItem item = new JRadioButtonMenuItem(plugin.getReasonerName()); item.setSelected(mngr.getOWLReasonerManager().getCurrentReasonerFactoryId().equals(plugin.getReasonerId())); reasonerMenu.add(item); bg.add(item); item.addActionListener(e -> { mngr.getOWLReasonerManager().setCurrentReasonerFactoryId(plugin.getReasonerId()); });
public ProtegeOWLReasonerFactoryWrapper(ProtegeOWLReasonerInfo info) { this.info = info; this.reasonerFactory = info.getReasonerFactory(); }
public void addReasonerFactories(Set<ProtegeOWLReasonerPlugin> plugins) { for (ProtegeOWLReasonerPlugin plugin : plugins) { try { ProtegeOWLReasonerInfo factory = plugin.newInstance(); factory.initialise(); reasonerFactories.add(factory); } catch (Throwable t) { logger.warn("An error occurred whilst instantiating the '{}' reasoner. Error: {}", plugin.getName(), t); } } }
public void run() { boolean inconsistencyFound = false; boolean reasonerChanged = false; try { long start = System.currentTimeMillis(); reasonerChanged = ensureRunningReasonerInitialized(); precompute(); logger.info(currentReasonerFactory.getReasonerName() + " classified in " + (System.currentTimeMillis()-start) + "ms"); } catch (InconsistentOntologyException ioe) { inconsistencyFound = true; } finally{ installRunningReasoner(inconsistencyFound, reasonerChanged); } }
/** * Creates an instance of the plugin. It is expected that * this instance will be "setup", but the instance's * initialise method will not have been called in the instantiation * process. */ public ProtegeOWLReasonerInfo newInstance() throws ClassNotFoundException, IllegalAccessException, InstantiationException { ProtegeOWLReasonerInfo reasoner = super.newInstance(); reasoner.setup(owlModelManager.getOWLOntologyManager(), getId(), getName()); reasoner.setOWLModelManager(owlModelManager); return reasoner; } }
Collections.sort(factoriesList, new ReasonerInfoComparator()); for (final ProtegeOWLReasonerInfo plugin : factoriesList) { JRadioButtonMenuItem item = new JRadioButtonMenuItem(plugin.getReasonerName()); item.setSelected(mngr.getOWLReasonerManager().getCurrentReasonerFactoryId().equals(plugin.getReasonerId())); reasonerMenu.add(item); bg.add(item); item.addActionListener(e -> { mngr.getOWLReasonerManager().setCurrentReasonerFactoryId(plugin.getReasonerId()); });
public ReasonerStatus getReasonerStatus() { synchronized (reasonerMap) { if (classificationInProgress) { return ReasonerStatus.INITIALIZATION_IN_PROGRESS; } if (currentReasonerFactory.getReasonerFactory() instanceof NoOpReasonerFactory) { return ReasonerStatus.NO_REASONER_FACTORY_CHOSEN; } else { OWLReasoner reasoner = getCurrentReasoner(); if (reasoner instanceof NoOpReasoner) { return ReasonerStatus.REASONER_NOT_INITIALIZED; } else if (!reasoner.isConsistent()) { return ReasonerStatus.INCONSISTENT; } else if (reasoner.getPendingChanges().isEmpty()) { return ReasonerStatus.INITIALIZED; } else { return ReasonerStatus.OUT_OF_SYNC; } } } }
public void addReasonerFactories(Set<ProtegeOWLReasonerPlugin> plugins) { for (ProtegeOWLReasonerPlugin plugin : plugins) { try { ProtegeOWLReasonerInfo factory = plugin.newInstance(); factory.initialise(); reasonerFactories.add(factory); } catch (Throwable t) { logger.warn("An error occurred whilst instantiating the '{}' reasoner. Error: {}", plugin.getName(), t); } } }
if (runningReasoner != null) { precompute(); logger.info(currentReasonerFactory.getReasonerName() + " classified in " + (System.currentTimeMillis()-start) + "ms");
public static OWLReasoner createReasoner(OWLOntology ontology, ProtegeOWLReasonerInfo info, ReasonerProgressMonitor monitor) { OWLReasonerFactory factory = info.getReasonerFactory(); OWLReasonerConfiguration configuration = info.getConfiguration(monitor); switch (info.getRecommendedBuffering()) { case BUFFERING: return factory.createReasoner(ontology, configuration); case NON_BUFFERING: return factory.createNonBufferingReasoner(ontology, configuration); default: throw new UnsupportedOperationException("Programmer error: missed a case " + info.getRecommendedBuffering()); } }
public int compare(ProtegeOWLReasonerInfo ri1, ProtegeOWLReasonerInfo ri2) { boolean nullReasoner1 = ri1.getReasonerFactory() instanceof NoOpReasonerFactory; boolean nullReasoner2 = ri2.getReasonerFactory() instanceof NoOpReasonerFactory; if (nullReasoner1 && nullReasoner2) { return 0; } else if (nullReasoner1) { return 1; } else if (nullReasoner2) { return -1; } else { return ri1.getReasonerName().compareTo(ri2.getReasonerName()); } }
/** * Creates an instance of the plugin. It is expected that * this instance will be "setup", but the instance's * initialise method will not have been called in the instantiation * process. */ public ProtegeOWLReasonerInfo newInstance() throws ClassNotFoundException, IllegalAccessException, InstantiationException { ProtegeOWLReasonerInfo reasoner = super.newInstance(); reasoner.setup(owlModelManager.getOWLOntologyManager(), getId(), getName()); reasoner.setOWLModelManager(owlModelManager); return reasoner; } }
Collections.sort(factoriesList, new ReasonerInfoComparator()); for (final ProtegeOWLReasonerInfo plugin : factoriesList) { JRadioButtonMenuItem item = new JRadioButtonMenuItem(plugin.getReasonerName()); item.setSelected(mngr.getOWLReasonerManager().getCurrentReasonerFactoryId().equals(plugin.getReasonerId())); reasonerMenu.add(item); bg.add(item);
return ReasonerStatus.INITIALIZATION_IN_PROGRESS; if (currentReasonerFactory.getReasonerFactory() instanceof NoOpReasonerFactory) { return ReasonerStatus.NO_REASONER_FACTORY_CHOSEN;
public String getCurrentReasonerFactoryId() { return getCurrentReasonerFactory().getReasonerId(); }
public void addReasonerFactories(Set<ProtegeOWLReasonerPlugin> plugins) { for (ProtegeOWLReasonerPlugin plugin : plugins) { try { ProtegeOWLReasonerInfo factory = plugin.newInstance(); factory.initialise(); reasonerFactories.add(factory); } catch (Throwable t) { ProtegeApplication.getErrorLog().logError(t); } } }