2ronwalf/*
2ronwalf * Created on Nov 20, 2004
2ronwalf */
2ronwalfpackage org.mindswap.owl;
2ronwalf
2ronwalfimport java.io.FileNotFoundException;
2ronwalfimport java.io.InputStream;
2ronwalfimport java.io.Reader;
2ronwalfimport java.net.URI;
2ronwalfimport java.net.URISyntaxException;
2ronwalfimport java.util.List;
2ronwalfimport java.util.Set;
2ronwalf
2ronwalfimport org.mindswap.owls.service.Service;
2ronwalfimport org.mindswap.utils.QNameProvider;
2ronwalf
2ronwalf/**
2ronwalf * @author Evren Sirin
2ronwalf */
2ronwalfpublic interface OWLKnowledgeBase extends OWLModel {
2ronwalf /**
2ronwalf * Return the set of loaded ontologies including the imported ones.
2ronwalf * @return
2ronwalf */
2ronwalf public Set getOntologies();
2ronwalf
2ronwalf /**
2ronwalf * Return the set of ontologies loaded to this KB with the optino to include/exclude
2ronwalf * imported ones. An ontology <code>ont</code> is considered to be imported if there
2ronwalf * was no explicit function call to load the ontology, i.e load(ont) or read(ont.getURI(),
2ronwalf * but <code>ont</code> was imported by one of the loaded ontologies.
2ronwalf *
2ronwalf * @param all If true return all onotlogies, otherwise return only the explcicitly loaded
2ronwalf * ones
2ronwalf * @return
2ronwalf */
2ronwalf public Set getOntologies(boolean all);
2ronwalf
2ronwalf /**
2ronwalf * Return the loaded ontology associated with this URI. Return null if there is not ontology
2ronwalf * with this URI.
2ronwalf *
2ronwalf * @param uri URI of the ontology
2ronwalf * @return Ontology with the given URI
2ronwalf */
2ronwalf public OWLOntology getOntology(URI uri);
2ronwalf
2ronwalf /**
2ronwalf * Return the base ontology of this KB. At the creation time of each KB an empty ontology is
2ronwalf * created to be the base onotlogy of this KB. Any function that adds data to the underlying
2ronwalf * RDF model (addProperty, setProperty, etc.) will actually add the data to this base ontology.
2ronwalf */
2ronwalf public OWLOntology getBaseOntology();
2ronwalf
2ronwalf /**
2ronwalf * Create an empty ontology which is automatically loaded to the KB.
2ronwalf *
2ronwalf * @return An empty ontology
2ronwalf */
2ronwalf public OWLOntology createOntology();
2ronwalf
2ronwalf public OWLOntology createOntology(boolean load);
2ronwalf
2ronwalf /**
2ronwalf * Create an empty ontology with the given logical URI (xml:base). Ontology is automatically
2ronwalf * loaded to the KB.
2ronwalf *
2ronwalf * @param uri
2ronwalf * @return An empty ontology
2ronwalf */
2ronwalf public OWLOntology createOntology(URI uri);
2ronwalf
2ronwalf /**
2ronwalf * Create an empty ontology with the given logical URI (xml:base) and physical URI. Ontology
2ronwalf * is automatically loaded to the KB.
2ronwalf *
2ronwalf * @param uri Logical URI of the onotlogy
2ronwalf * @param fileURI Physical URI of the onotlogy
2ronwalf * @return An empty ontology
2ronwalf */
2ronwalf public OWLOntology createOntology(URI uri, URI fileURI);
2ronwalf
2ronwalf /**
2ronwalf * Create an empty ontology with the given logical URI (xml:base), physical URI and an
2ronwalf * implementation specific data (Jena Model or OWL-API OWLOntology). Ontology
2ronwalf * is automatically loaded to the KB.
2ronwalf *
2ronwalf * @param uri
2ronwalf * @param fileURI
2ronwalf * @param implementation
2ronwalf * @return The loaded ontology
2ronwalf */
2ronwalf public OWLOntology createOntology(URI uri, URI fileURI, Object implementation);
2ronwalf
2ronwalf /**
2ronwalf * @deprecated Please use {@link load(OWLOntology)} instead
2ronwalf *
2ronwalf */
2ronwalf public OWLOntology loadOntology(OWLOntology ontology);
2ronwalf
2ronwalf /**
2ronwalf * Load the ontology to the KB. If the ontology is created using another KB a copy will be
2ronwalf * created before load. The imports will automatically be loaded. It is guaranteed that the
2ronwalf * getKB() function on the returned OWLOntology (and any of its import ontologies) will
2ronwalf * return a reference to this KB.
2ronwalf *
2ronwalf * @param ontology
2ronwalf * @return The loaded ontology
2ronwalf */
2ronwalf public OWLOntology load(OWLOntology ontology);
2ronwalf
2ronwalf /**
2ronwalf * Load the ontology to the KB. If the ontology is created using another KB a copy will be
2ronwalf * created before load. The imports will automatically be loaded if the second parameter is
2ronwalf * true. It is guaranteed that the getKB() function on the returned OWLOntology (and any of
2ronwalf * its import ontologies) will return a reference to this KB.
2ronwalf *
2ronwalf * @param ontology
2ronwalf * @param withImports
2ronwalf * @return The loaded ontology
2ronwalf */
2ronwalf public OWLOntology load(OWLOntology ontology, boolean withImports);
2ronwalf
2ronwalf /**
2ronwalf * Unload the ontology from the KB. The imports of the ontology will automatically be unloaded
2ronwalf * if there are no other ontologies importing them. Note that ontologies loaded explicitly
2ronwalf * using the loadOntology will not be unloaded. This function does nothing if the ontology is
2ronwalf * not loaded in this KB.
2ronwalf *
2ronwalf * @param ontology
2ronwalf */
2ronwalf public void unload(OWLOntology ontology);
2ronwalf
2ronwalf /**
2ronwalf * Unload the ontology with the given URI from the KB. The imports of the ontology will
2ronwalf * automatically be unloaded if there are no other ontologies importing them. Note that
2ronwalf * ontologies loaded explicitly using the loadOntology will not be unloaded.
2ronwalf *
2ronwalf * @param uri
2ronwalf */
2ronwalf public void unload(URI uri);
2ronwalf
2ronwalf /**
2ronwalf * Return the reader assocaited with this KB.
2ronwalf *
2ronwalf * @return
2ronwalf */
2ronwalf public OWLReader getReader();
2ronwalf
2ronwalf /**
2ronwalf * Set the reader assocaited with this KB.
2ronwalf *
2ronwalf * @param reader
2ronwalf */
2ronwalf public void setReader(OWLReader reader);
2ronwalf
2ronwalf /**
2ronwalf * Read the ontology from the given URI, load it to this KB and return a reference to the
2ronwalf * ontology object created. Note that ontologies imported by the given ontology are also
2ronwalf * loaded to the KB.
2ronwalf *
2ronwalf * <p>This function is equivalent to kb.read(new URI(uri)). For loading local files use
2ronwalf * kb.read(file.toURI()) instead. If the input string is known to be a URI the
2ronwalf * function call kb.read(URI.create(uri)) can be used to avoid URISyntaxException.
2ronwalf *
2ronwalf * @param uri
2ronwalf * @return The loaded ontology
2ronwalf * @throws URISyntaxException When the given string is not a well-formed URI
2ronwalf * @throws FileNotFoundException
2ronwalf */
2ronwalf public OWLOntology read(String uri) throws URISyntaxException, FileNotFoundException;
2ronwalf
2ronwalf /**
2ronwalf * Read the ontology from the given URI, load it to this KB and return a reference to the
2ronwalf * ontology object created. Note that ontologies imported by the given ontology are also
2ronwalf * loaded to the KB.
2ronwalf *
2ronwalf * For loading local files use kb.read(file.toURI())
2ronwalf *
2ronwalf * @param uri
2ronwalf * @return The loaded ontology
2ronwalf * @throws FileNotFoundException
2ronwalf */
2ronwalf public OWLOntology read(URI uri) throws FileNotFoundException;
2ronwalf
2ronwalf /**
2ronwalf * Read the ontology using the given Reader and the base URI, load it to this KB and return
2ronwalf * a reference to the ontology object created. Note that ontologies imported by the given
2ronwalf * ontology are also loaded to the KB.
2ronwalf *
2ronwalf * @param in
2ronwalf * @param baseURI
2ronwalf * @return The loaded ontology
2ronwalf */
2ronwalf public OWLOntology read(Reader in, URI baseURI);
2ronwalf
2ronwalf /**
2ronwalf * Read the ontology using the given InputStream and the base URI, load it to this KB and return
2ronwalf * a reference to the ontology object created. Note that ontologies imported by the given
2ronwalf * ontology are also loaded to the KB.
2ronwalf *
2ronwalf * @param in
2ronwalf * @param baseURI
2ronwalf * @return The loaded ontology
2ronwalf */
2ronwalf public OWLOntology read(InputStream in, URI baseURI);
2ronwalf
2ronwalf /**
2ronwalf * @return
2ronwalf */
2ronwalf public QNameProvider getQNames();
2ronwalf
2ronwalf /**
2ronwalf * Returns true if the KB checks consistency automatically after each ontology is loaded and
2ronwalf * rejects to load the ontology if it causes inconsistency.
2ronwalf */
2ronwalf public boolean getAutoConsistency();
2ronwalf
2ronwalf /**
2ronwalf * Set/clear the behavior to check consistency automatically after each ontology is loaded.
2ronwalf * When AutoConsistency is turned on an ontology that causes inconsistency will not be loaded.
2ronwalf * If turned off no consistency check will be done automatically.
2ronwalf */
2ronwalf public void setAutoConsistency(boolean auto);
2ronwalf
2ronwalf public boolean getAutoTranslate();
2ronwalf public void setAutoTranslate(boolean auto);
2ronwalf
2ronwalf public OWLKnowledgeBase getTranslationSource();
2ronwalf
2ronwalf /**
2ronwalf * @deprecated Use createOntology() instead
2ronwalf */
2ronwalf public org.mindswap.owls.OWLSOntology createOWLSOntology();
2ronwalf
2ronwalf /**
2ronwalf * @deprecated Use createOntology(URI) instead
2ronwalf */
2ronwalf public org.mindswap.owls.OWLSOntology createOWLSOntology(URI uri);
2ronwalf
2ronwalf public Service readService(String uri) throws URISyntaxException, FileNotFoundException;
2ronwalf public Service readService(URI uri) throws FileNotFoundException;
2ronwalf public Service readService(Reader in, URI baseURI);
2ronwalf public Service readService(InputStream in, URI baseURI);
2ronwalf
2ronwalf public List readAllServices(String uri) throws URISyntaxException, FileNotFoundException;
2ronwalf public List readAllServices(URI uri) throws FileNotFoundException;
2ronwalf public List readAllServices(Reader in, URI baseURI);
2ronwalf public List readAllServices(InputStream in, URI baseURI);
2ronwalf}