/** * <p>Determine which models this model imports (by looking for, for example, * <code>owl:imports</code> statements, and load each of those models as an * import. A check is made to determine if a model has already been imported, * if so, the import is ignored. Thus this method is safe against circular * sets of import statements. Note that actual implementation is delegated to * the associated {@link OntDocumentManager}. */ @Override public void loadImports() { // load the imports closure, according to the policies in my document manager getDocumentManager().loadImports( this ); }
/** * <p>Determine which models this model imports (by looking for, for example, * <code>owl:imports</code> statements, and load each of those models as an * import. A check is made to determine if a model has already been imported, * if so, the import is ignored. Thus this method is safe against circular * sets of import statements. Note that actual implementation is delegated to * the associated {@link OntDocumentManager}. */ @Override public void loadImports() { // load the imports closure, according to the policies in my document manager getDocumentManager().loadImports( this ); }
/** * <p>Answer an <code>OntModel</code> representing the imported ontology * with the given URI. If an ontology with that URI has not been imported, * answer null.</p> * @param uri The URI of an ontology that may have been imported into the * ontology represented by this model * @return A model representing the imported ontology with the given URI, or * null. */ @Override public OntModel getImportedModel( String uri ) { if (listImportedOntologyURIs( true ).contains( uri )) { Model mi = getDocumentManager().getModel( uri ); if (mi != null) { if (mi instanceof OntModel) { // already a suitable ont model return (OntModel) mi; } else { // not in ont-model clothing yet, so re-wrap return ModelFactory.createOntologyModel( m_spec, mi ); } } } return null; }
/** * <p>Answer an <code>OntModel</code> representing the imported ontology * with the given URI. If an ontology with that URI has not been imported, * answer null.</p> * @param uri The URI of an ontology that may have been imported into the * ontology represented by this model * @return A model representing the imported ontology with the given URI, or * null. */ @Override public OntModel getImportedModel( String uri ) { if (listImportedOntologyURIs( true ).contains( uri )) { Model mi = getDocumentManager().getModel( uri ); if (mi != null) { if (mi instanceof OntModel) { // already a suitable ont model return (OntModel) mi; } else { // not in ont-model clothing yet, so re-wrap return ModelFactory.createOntologyModel( m_spec, mi ); } } } return null; }
@Override public void addedStatement( Statement added ) { if (added.getPredicate().equals( getProfile().IMPORTS() )) { getDocumentManager().loadImport( OntModelImpl.this, added.getResource().getURI() ); } }
@Override public void addedStatement( Statement added ) { if (added.getPredicate().equals( getProfile().IMPORTS() )) { getDocumentManager().loadImport( OntModelImpl.this, added.getResource().getURI() ); } }
@Override public void removedStatement( Statement removed ) { if (removed.getPredicate().equals( getProfile().IMPORTS() )) { getDocumentManager().unloadImport( OntModelImpl.this, removed.getResource().getURI() ); } } }
@Override public void removedStatement( Statement removed ) { if (removed.getPredicate().equals( getProfile().IMPORTS() )) { getDocumentManager().unloadImport( OntModelImpl.this, removed.getResource().getURI() ); } } }
Model mi = getDocumentManager().getModel( uri ); if (closure && mi != null && !queue.contains( mi )) { queue.add( mi );
Model mi = getDocumentManager().getModel( uri ); if (closure && mi != null && !queue.contains( mi )) { queue.add( mi );
OntDocumentManager odm = getDocumentManager(); getDocumentManager().addModel( uri, this );
OntDocumentManager odm = getDocumentManager(); getDocumentManager().addModel( uri, this );