Java 类org.semanticweb.owlapi.model.OWLOntologyLoaderConfiguration 实例源码

项目:Widoco    文件:WidocoUtils.java   
/**
     * Method that will download the ontology to document with Widoco.
     * @param c Widoco configuration object.
     * @throws java.lang.Exception
     */
    public static void loadModelToDocument(Configuration c) throws Exception{
        if(!c.isFromFile()){
            String newOntologyPath = c.getTmpFile().getAbsolutePath()+File.separator+"Ontology";
            downloadOntology(c.getOntologyURI(), newOntologyPath);
            c.setFromFile(true);
            c.setOntologyPath(newOntologyPath);
        }
        //reding the model with Jena (deprecated)
//        OntModel model = ModelFactory.createOntologyModel();//ModelFactory.createDefaultModel();        
//        readOntModel(model, c);
//        c.getMainOntology().setMainModel(model);

        OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
        OWLOntologyLoaderConfiguration loadingConfig = new OWLOntologyLoaderConfiguration();
        loadingConfig = loadingConfig.setMissingImportHandlingStrategy(MissingImportHandlingStrategy.SILENT);
        OWLOntology ontology= manager.loadOntologyFromOntologyDocument(new FileDocumentSource(new File(c.getOntologyPath())),loadingConfig);
        c.getMainOntology().setMainOntology(ontology);
        c.getMainOntology().setMainOntologyManager(manager);
    }
项目:uel    文件:ProcessorTest.java   
static OWLOntology loadKRSSOntology(String input) throws OWLOntologyCreationException, IOException {
    OWLOntologyManager ontologyManager = OWLManager.createOWLOntologyManager();
    OWLOntology ontology = ontologyManager.createOntology();
    KRSS2OWLParser parser = new KRSS2OWLParser();
    parser.parse(new StreamDocumentSource(new FileInputStream(input)), ontology,
            new OWLOntologyLoaderConfiguration());
    return ontology;
}
项目:minerva    文件:CoreMolecularModelManager.java   
private static OWLOntology loadOWLOntologyDocumentSource(final OWLOntologyDocumentSource source, final OWLOntologyManager manager) throws OWLOntologyCreationException {
    final OWLOntology ontology;
    if (source instanceof RioMemoryTripleSource) {
        RioParserImpl parser = new RioParserImpl(new RioRDFXMLDocumentFormatFactory());
        ontology = manager.createOntology();
        try {
            parser.parse(source, ontology, new OWLOntologyLoaderConfiguration());
        } catch (IOException e) {
            throw new OWLOntologyCreationException(e);
        }
    } else {
        ontology = manager.loadOntologyFromOntologyDocument(source);
    }
    return ontology;
}
项目:ecco    文件:OntologyLoader.java   
public OntologyLoader(OWLOntologyManager man, OWLOntologyLoaderConfiguration config, 
        int ontNr, String filepath, boolean processImports, boolean ignoreAbox, boolean localFile) {
    this.man = man;
    this.config = config;
    this.ontNr = ontNr;
    this.filepath = filepath;
    this.processImports = processImports;
    this.ignoreAbox = ignoreAbox;
    this.localFile = localFile;
}
项目:ecco    文件:EccoRunner.java   
/**
 * Constructor
 * @param settings  ecco settings
 */
public EccoRunner(EccoSettings settings) {
    this.settings = settings;
    config = new OWLOntologyLoaderConfiguration();
    config = config.setLoadAnnotationAxioms(false);
    if(!settings.isProcessingImports()) {
        config = config.setMissingImportHandlingStrategy(MissingImportHandlingStrategy.SILENT);
        config = config.setFollowRedirects(false);
    }
}
项目:darceo    文件:OntologyManager.java   
/**
 * Creates new ontology manager and loads base ontologies into it.
 * 
 * @return new ontology manager.
 */
private static OWLOntologyManager createOWLOntologyManager() {
    OWLOntologyManager ontologyManager = OWLManager.createOWLOntologyManager();
    OWLOntologyLoaderConfiguration configuration = new OWLOntologyLoaderConfiguration();
    configuration = configuration.addIgnoredImport(IRI.create("http://localhost/OntoWiki/Config/"))
            .addIgnoredImport(IRI.create("http://www.udfr.org/onto/onto.rdf"));
    ClassLoader cl = OntologyManager.class.getClassLoader();
    try {
        List<String> ontologies = new ArrayList<String>(17);
        ontologies.add("ontologies/Expression.owl");
        ontologies.add("ontologies/ObjectList.owl");
        ontologies.add("ontologies/Service.owl");
        ontologies.add("ontologies/Process.owl");
        ontologies.add("ontologies/Profile.owl");
        ontologies.add("ontologies/Grounding.owl");
        ontologies.add("ontologies/dArceoUnit.owl");
        ontologies.add("ontologies/dArceoFile.owl");
        ontologies.add("ontologies/dArceoText.owl");
        ontologies.add("ontologies/dArceoDocument.owl");
        ontologies.add("ontologies/dArceoImage.owl");
        ontologies.add("ontologies/dArceoAudio.owl");
        ontologies.add("ontologies/dArceoVideo.owl");
        ontologies.add("ontologies/dArceoService.owl");
        ontologies.add("ontologies/dArceoProcess.owl");
        ontologies.add("ontologies/dArceoProfile.owl");
        ontologies.add("ontologies/RESTfulGrounding.owl");

        for (String ontology : ontologies) {
            InputStream stream = null;
            try {
                stream = cl.getResourceAsStream(ontology);
                ontologyManager.loadOntologyFromOntologyDocument(new StreamDocumentSource(stream), configuration);
            } finally {
                IOUtils.closeQuietly(stream);
            }
        }

    } catch (OWLOntologyCreationException e) {
        throw new WrdzRuntimeException("Could not initialize ontology manager properly.", e);
    }
    return ontologyManager;
}