OWLFactory.java revision 2
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen// The MIT License
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen// Copyright (c) 2004 Evren Sirin
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen// Permission is hereby granted, free of charge, to any person obtaining a copy
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen// of this software and associated documentation files (the "Software"), to
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen// deal in the Software without restriction, including without limitation the
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen// sell copies of the Software, and to permit persons to whom the Software is
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen// furnished to do so, subject to the following conditions:
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen// The above copyright notice and this permission notice shall be included in
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen// all copies or substantial portions of the Software.
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen// IN THE SOFTWARE.
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen * Created on Dec 29, 2003
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen * @author Evren Sirin
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen public interface Interface {
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen public Object getReasoner(String reasonerName);
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen public OWLDataValueList createDataValueList();
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen public OWLIndividualList createIndividualList();
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen public ABoxQueryParser createRDQLParser(OWLModel model);
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen private static String[] implementations = {"impl.jena.JenaOWLFactory"};
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen private static OWLFactory.Interface factory = createFactory();
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen private static OWLFactory.Interface createFactory() {
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen for(int i = 0; (factory == null) && (i < implementations.length); i++) {
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen Class impl = Class.forName(implementations[i]);
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen factory = (OWLFactory.Interface) impl.newInstance();
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen System.err.println("Cannot create OWLFactory!");
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen public static OWLOntology createOntology(URI uri) {
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen * Create an empty OWL ontology and optionally import the
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen * OWL-S ontologies (Service, Profile, Process and Grounding
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen * ontologies).
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen * @param importOWLS
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen public static OWLOntology createOntology( boolean importOWLS ) {
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen * Create an empty OWL ontology with the given logical URI
b2024fa4e6ed39f9b5b6bb6c051f6d535fc0e011Timo Sirainen * and optionally import the OWL-S ontologies (Service, Profile, Process
b2024fa4e6ed39f9b5b6bb6c051f6d535fc0e011Timo Sirainen * and Grounding ontologies)
b2024fa4e6ed39f9b5b6bb6c051f6d535fc0e011Timo Sirainen * @param importOWLS
b2024fa4e6ed39f9b5b6bb6c051f6d535fc0e011Timo Sirainen public static OWLOntology createOntology( URI uri, boolean importOWLS ) {
b2024fa4e6ed39f9b5b6bb6c051f6d535fc0e011Timo Sirainen OWLOntology ont = factory.createOntology(uri);
b2024fa4e6ed39f9b5b6bb6c051f6d535fc0e011Timo Sirainen * Import the OWL-S ontologies (Service, Profile, Process
b2024fa4e6ed39f9b5b6bb6c051f6d535fc0e011Timo Sirainen * and Grounding ontologies) in the given ontology
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen public static void addOWLSImports( OWLOntology ont ) {
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen private static void loadOWLSOntologies() {
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen owlsGrounding = kb.read( OWLS.Grounding.URI );
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen owlsService = kb.createOntology( URI.create( OWLS.Service.URI ) );
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen owlsProfile = kb.createOntology( URI.create( OWLS.Profile.URI ) );
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen owlsProcess = kb.createOntology( URI.create( OWLS.Process.URI ) );
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen owlsGrounding = kb.createOntology( URI.create( OWLS.Grounding.URI ) );
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen public static OWLDataValueList createDataValueList() {
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen public static OWLIndividualList createIndividualList() {
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen public static Object getReasoner(String reasonerName) {