FaCT++.Java/src/main/java/uk/ac/manchester/cs/factplusplus/protege/FaCTPlusPlusFactory.java
raw symbols SCIP| 1 | package uk.ac.manchester.cs.factplusplus.protege; |
| 2 | |
| 3 | /* |
| 4 | * Copyright (C) 2007, University of Manchester |
| 5 | * |
| 6 | * Modifications to the initial code base are copyright of their |
| 7 | * respective authors, or their employers as appropriate. Authorship |
| 8 | * of the modifications may be determined from the ChangeLog placed at |
| 9 | * the end of this file. |
| 10 | * |
| 11 | * This library is free software; you can redistribute it and/or |
| 12 | * modify it under the terms of the GNU Lesser General Public |
| 13 | * License as published by the Free Software Foundation; either |
| 14 | * version 2.1 of the License, or (at your option) any later version. |
| 15 | |
| 16 | * This library is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 19 | * Lesser General Public License for more details. |
| 20 | |
| 21 | * You should have received a copy of the GNU Lesser General Public |
| 22 | * License along with this library; if not, write to the Free Software |
| 23 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 24 | */ |
| 25 | import javax.swing.JOptionPane; |
| 26 | |
| 27 | import org.protege.editor.owl.model.inference.AbstractProtegeOWLReasonerInfo; |
| 28 | |
| 29 | import org.semanticweb.owlapi.model.OWLRuntimeException; |
| 30 | import org.semanticweb.owlapi.reasoner.BufferingMode; |
| 31 | import org.semanticweb.owlapi.reasoner.OWLReasonerFactory; |
| 32 | |
| 33 | import uk.ac.manchester.cs.factplusplus.FaCTPlusPlus; |
| 34 | import uk.ac.manchester.cs.factplusplus.owlapiv3.FaCTPlusPlusReasonerFactory; |
| 35 | |
| 36 | /** |
| 37 | * Author: Matthew Horridge<br> |
| 38 | * The University Of Manchester<br> |
| 39 | * Bio-Health Informatics Group<br> |
| 40 | * Date: 11-May-2007<br> |
| 41 | * <br> |
| 42 | */ |
| 43 | public class FaCTPlusPlusFactory extends AbstractProtegeOWLReasonerInfo { |
| 44 | |
| 45 | private FaCTPlusPlusReasonerFactory fac; |
| 46 | |
| 47 | /** |
| 48 | * initialize factory |
| 49 | */ |
| 50 | public void initialise() { |
| 51 | fac = new FaCTPlusPlusReasonerFactory(); |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * Dispose factory. |
| 56 | */ |
| 57 | public void dispose() { |
| 58 | fac = null; |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * @return buffering mode |
| 63 | */ |
| 64 | public BufferingMode getRecommendedBuffering() { |
| 65 | return BufferingMode.BUFFERING; |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * @return reasoner factory |
| 70 | */ |
| 71 | public OWLReasonerFactory getReasonerFactory() { |
| 72 | try { |
| 73 | // refer to the FaCTPlusPlus class so the static block that loads |
| 74 | // the native library is loaded |
| 75 | FaCTPlusPlus.test(); |
| 76 | } catch (UnsatisfiedLinkError e) { |
| 77 | JOptionPane |
| 78 | .showMessageDialog( |
| 79 | null, |
| 80 | "FaCT++ requires platform specific libraries which cannot be found.\n" |
| 81 | + "Supported platforms are OS X, Windows and Linux.", |
| 82 | "Missing libraries or platform not supported", |
| 83 | JOptionPane.ERROR_MESSAGE); |
| 84 | throw new OWLRuntimeException(e); |
| 85 | } |
| 86 | return fac; |
| 87 | } |
| 88 | } |