OWLKnowledgeBaseImpl.java revision 2
/*
* Created on Dec 12, 2004
*/
/**
* @author Evren Sirin
*/
public class OWLKnowledgeBaseImpl extends OWLModelImpl implements OWLKnowledgeBase, org.mindswap.owls.OWLSKnowledgeBase {
protected Set ontologies;
// private Map modelMap;
private Map importDependencies;
protected Set notImported;
private QNameProvider qnames;
private boolean autoConsistency;
private OWLSVersionTranslator translator;
private OWLKnowledgeBase translationSource;
public OWLKnowledgeBaseImpl() {
super( ModelFactory.createDefaultModel() );
setAutoTranslate( false );
translationSource = this;
ontologies = new HashSet();
// modelMap = new HashMap();
importDependencies = new HashMap();
notImported = new HashSet();
qnames = new QNameProvider();
autoConsistency = false;
}
protected void createBaseOntology() {
}
public Set getOntologies() {
return getOntologies( true );
}
if( all )
return new HashSet( ontologies );
else
return new HashSet( notImported );
}
}
if( load )
return createOntology();
else
}
public OWLOntology createOntology() {
}
}
}
}
return ont;
}
}
}
if( getAutoConsistency() ) {
if(!isConsistent()) {
"which causes the KB to be inconsistent!");
}
}
// System.out.println( "Loaded " + this + " " + reasoner + " " + ont + " " + ontologies.size());
// ontModel.write(System.out, "RDF/XML-ABBREV");
return loadedOnt;
}
if(getAutoTranslate()) {
if(translationSource == this) {
translationSource.setAutoTranslate(false);
}
}
// modelMap.put(model, loadedOnt);
if(withImports) {
}
}
}
}
return loadedOnt;
}
}
else
}
if( !removed ) {
msg += " but there is another ontology with the same URI in the KB";
msg += "!";
throw new IllegalArgumentException( msg );
}
// modelMap.remove( m );
}
}
}
}
}
}
}
}
return reader;
}
public QNameProvider getQNames() {
return qnames;
}
return new OWLDataValueImpl(l);
}
return new OWLIndividualImpl(ont, r);
return new OWLIndividualImpl(ont, r);
}
return new OWLIndividualImpl(baseOntology, r);
}
// OWLOntology ont = (OWLOntology) modelMap.get(r.getModel());
ont = baseOntology;
return new OWLClassImpl(ont, r);
}
// OWLOntology ont = (OWLOntology) modelMap.get(p.getModel());
ont = baseOntology;
return new OWLObjectPropertyImpl(ont, p);
}
// OWLOntology ont = (OWLOntology) modelMap.get(p.getModel());
ont = baseOntology;
return new OWLDataPropertyImpl(ont, p);
}
}
}
}
}
return baseOntology.createInstance(c);
}
}
}
}
}
}
}
public void refresh() {
}
}
}
}
}
}
}
}
}
}
}
}
}
}
/* (non-Javadoc)
* @see org.mindswap.owl.OWLKnowledgeBase#getAutoConsistency()
*/
public boolean getAutoConsistency() {
return autoConsistency;
}
/* (non-Javadoc)
* @see org.mindswap.owl.OWLKnowledgeBase#setAutoConsistency(boolean)
*/
public void setAutoConsistency(boolean auto) {
}
public boolean getAutoTranslate() {
return (translator != null);
}
public void setAutoTranslate(boolean auto) {
if(auto)
else
translator = null;
}
public OWLKnowledgeBase getTranslationSource() {
return translationSource;
}
}
}
}
}
}
}
}
}
/*
* Michael Daenzer, 03-24-2006
* pulled down from OWLModelImpl and added support for subclasses of Service:service
*/
public List getServices() {
}
/**
* Returns the service from the given List indicated by the given URI. If a concrete
* resource is referenced (i.e. a fragment is given), only this is returned. If no concrete
* resource is referenced by the given URI, the first service matching the given URI in its
* full URI is returned.
*
* @param list A list containing services
* @param uri The URI of the service to return
* @return the service from the given List indicated by the given URI
* @author Michael Daenzer
*/
boolean strictSearch = false;
// search if fragment is available
if (fragmentSignPos > -1) {
strictSearch = true;
}
// search now the list
return service;
return service;
}
}
/**
* @deprecated Use createOntology() instead
*/
}
/**
* @deprecated Use createOntology(URI) instead
*/
}
}
}