/** * <p>Set the default option settings.</p> */ protected void setDefaults() { setCacheModels( true ); setProcessImports( true ); setDefaultPrefixMappings(); }
/** * Constructs a new SADIActivity. */ public SADIActivity() { OntDocumentManager.getInstance().setCacheModels(false); inputPortMapping = new HashMap<String, SADIActivityInputPort>(); outputPortMapping = new HashMap<String, SADIActivityOutputPort>(); inputPortClassMapping = new HashMap<OntClass, Set<SADIActivityInputPort>>(); outputPortClassMapping = new HashMap<OntClass, Set<SADIActivityOutputPort>>(); }
/** Tests may subclass and override to supply testable objects. */ protected OntDocumentManager createDocumentManager() { return new OntDocumentManager( "" ); } }
/** * <p>Reset all state in this document manager back to the default * values it would have had when the object was created. Optionally * reload the profile metadata from the search path. <strong>Note</strong> * that the metadata search path is not changed by this reset.</p> * @param reload If true, reload the configuration file from the * search path. */ public void reset( boolean reload ) { // first check if we are using the global file manager, or a local one if (m_usingGlobalFileMgr) { // we can do a general reset by throwing away the old FM and creating a new one setFileManager(); } else { // not using the global default FM, so we reset to best effort getFileManager().resetCache(); } m_ignoreImports.clear(); m_prefixMap = new PrefixMappingImpl(); setDefaults(); if (reload) { initialiseMetadata( m_searchPath ); } }
getFileManager().getLocationMapper().processConfig( metadata ); setCacheModels( s.getBoolean() ); setProcessImports( s.getBoolean() ); addIgnoreImport( s.getResource().getURI() ); if (s != null) addAltEntry( publicURI, s.getResource().getURI() );
/** * {@inheritDoc} */ @Override public void setIgnoreImports(boolean ignoreImports) { model.getDocumentManager().setProcessImports( !ignoreImports ); }
public OntologyHandler() { OntDocumentManager mgr = new OntDocumentManager(); mgr.setProcessImports(false); OntModelSpec s = new OntModelSpec( OntModelSpec.OWL_MEM ); s.setDocumentManager( mgr ); ontModel = ModelFactory.createOntologyModel(s); ontModel.setStrictMode(false); }
/** * <p> * Answer the URL of the alternative copy of the ontology document with the given URI, if known, * or the URI unchanged if no alternative is known. * </p> * * @param uri The ontology document to lookup * @return The resolvable location of the alternative copy, if known, or <code>uri</code> otherwise */ public String doAltURLMapping( String uri ) { return getFileManager().mapURI( uri ); }
public TestValidator() { NdlCommons.init(); OntDocumentManager dm = OntDocumentManager.getInstance(); dm.getFileManager().addLocator(new NdlModel.LocatorJarURL()); PrintUtil.registerPrefix("dom", "http://geni-orca.renci.org/owl/domain.owl#"); PrintUtil.registerPrefix("comp", "http://geni-orca.renci.org/owl/compute.owl#"); PrintUtil.registerPrefix("req", "http://geni-orca.renci.org/owl/request.owl#"); PrintUtil.registerPrefix("orca", "http://geni-orca.renci.org/owl/orca.owl#"); PrintUtil.registerPrefix("storage", "http://geni-orca.renci.org/owl/storage.owl#"); PrintUtil.registerPrefix("col", "http://geni-orca.renci.org/owl/collections.owl#"); PrintUtil.registerPrefix("topo", "http://geni-orca.renci.org/owl/topology.owl#"); }
if (getFileManager().hasCachedModel( uri )) { Model cached = getFileManager().getFromCache( uri ); if (cached instanceof OntModel) { return (OntModel) cached; read( m, uri, true ); addModel( uri, m ); return m;
/** * <p>Answer the document manager for this model specification. Defaults to * a standard instance of {@link OntDocumentManager}</p> * @return The document manager to be used by models matching this specification */ public OntDocumentManager getDocumentManager() { if (m_docManager == null) { // need to set the default document manager m_docManager = OntDocumentManager.getInstance(); } return m_docManager; }
getFileManager().readModel( model, source ); if (getReadFailureHandler() != null) { getReadFailureHandler().handleFailedRead( uri, model, e );
public RDFModel read(String uri, boolean loadImports) { RDFModel m = new RDFModel(); OntModel model = ModelFactory.createOntologyModel( OntModelSpec.OWL_MEM ); model.getDocumentManager().setProcessImports( loadImports ); FileManager.get().readModel( model, uri ); StmtIterator stmtIter = model.listStatements(); while( stmtIter.hasNext() ) { Statement stmt = stmtIter.nextStatement(); m.addStatement( stmt ); } return m; } }
/** * <p> * Remove all entries from the model cache * </p> */ public void clearCache() { getFileManager().resetCache(); }
public RDFModel read(String uri, boolean loadImports) { RDFModel m = new RDFModel(); OntModel model = ModelFactory.createOntologyModel( OntModelSpec.OWL_MEM ); model.getDocumentManager().setProcessImports( loadImports ); FileManager.get().readModel( model, uri ); StmtIterator stmtIter = model.listStatements(); while( stmtIter.hasNext() ) { Statement stmt = stmtIter.nextStatement(); m.addStatement( stmt ); } return m; } }
/** * <p> * Answer true if the models loaded by this document manager from a given * URI will be cached, so that they can be re-used in other compound * ontology models. * </p> * * @return If true, a cache is maintained of loaded models from their URI's. */ public boolean getCacheModels() { return getFileManager().isCachingModels(); }
/** * <p> * OntDocumentManager is not a singleton, but a global default instance is available * for applications where a single shared document manager is sufficient. * </p> * * @return The default, global instance of a document manager */ public static OntDocumentManager getInstance() { if (s_instance == null) { s_instance = new OntDocumentManager(); } return s_instance; }
/** Create the source model after determining which input language */ protected void determineLanguage() { OntModelSpec s = null; if (m_options.hasLangRdfsOption()) { // RDFS language specified if (m_options.hasUseInfOption()) { s = OntModelSpec.RDFS_MEM_RDFS_INF; } else { s = OntModelSpec.RDFS_MEM; } } else { // owl is the default // s = OntModelSpec.getDefaultSpec( ProfileRegistry.OWL_LANG ); if (m_options.hasUseInfOption()) { s = OntModelSpec.OWL_MEM_RULE_INF; } else { s = OntModelSpec.OWL_MEM; } } m_source = ModelFactory.createOntologyModel( s, null ); m_source.getDocumentManager().setProcessImports( false ); // turn off strict checking on request if (m_options.hasNoStrictOption()) { m_source.setStrictMode( false ); } }
/** * <p> * Set the policy flag that indicates whether loaded models are cached by URI * </p> * * @param cacheModels If true, models will be cached by URI * @see #getCacheModels() */ public void setCacheModels( boolean cacheModels ) { getFileManager().setModelCaching( cacheModels ); }
/** * <p> * Add an entry that <code>model</code> is the appropriate model to use * for the given ontology document * </p> * * @param docURI The public URI of the ontology document * @param model A model containing the triples from the document * @param replace If true, replace any existing entry with this one. */ public void addModel( String docURI, Model model, boolean replace ) { if (getFileManager().isCachingModels() && (replace || !getFileManager().hasCachedModel( docURI ))) { getFileManager().addCacheModel( docURI, model ); } }