Package org.apache.stanbol.ontologymanager.ontonet.api.io

Examples of org.apache.stanbol.ontologymanager.ontonet.api.io.ParentPathInputSource


    private static OntologyInputSource<?,?> getLocalSource(String resourcePath, OWLOntologyManager mgr) throws OWLOntologyCreationException,
                                                                                                       URISyntaxException {
        URL url = TestOntologySpaces.class.getResource(resourcePath);
        File f = new File(url.toURI());
        return new ParentPathInputSource(f, mgr != null ? mgr
                : OWLOntologyManagerFactory.createOWLOntologyManager(offline.getOntologySourceLocations()
                        .toArray(new IRI[0])));
    }
View Full Code Here


        });

        mgr.addIRIMapper(new PhonyIRIMapper(null));

        File f = new File(url.toURI());
        OntologyInputSource<OWLOntology,?> src = new ParentPathInputSource(f, mgr);
        // OntologyInputSource<OWLOntology> src = new RootOntologyIRISource(IRI.create(f), mgr);

        // OntologyInputSource<OWLOntology> src = new OntologyContentInputSource(content,mgr);

        OWLOntology original = src.getRootOntology();

        OntologySpace spc = new CustomOntologySpaceImpl("Test", scopeNs, ontologyProvider);
        spc.addOntology(src);

    }
View Full Code Here

    private static OntologyInputSource<OWLOntology,?> getLocalSource(String resourcePath,
                                                                     OWLOntologyManager mgr) throws OWLOntologyCreationException,
                                                                                            URISyntaxException {
        URL url = TestOntologySpaces.class.getResource(resourcePath);
        File f = new File(url.toURI());
        return new ParentPathInputSource(f, mgr != null ? mgr
                : OWLOntologyManagerFactory.createOWLOntologyManager(onManager.getOfflineConfiguration()
                        .getOntologySourceLocations().toArray(new IRI[0])));
    }
View Full Code Here

    public void testOfflineImport() throws Exception {
        URL url = getClass().getResource("/ontologies/maincharacters.owl");
        assertNotNull(url);
        File f = new File(url.toURI());
        assertNotNull(f);
        OntologyInputSource<OWLOntology,?> coreSource = new ParentPathInputSource(f);

        // Check that all the imports closure is made of local files
        Set<OWLOntology> closure = coreSource.getImports(true);
        for (OWLOntology o : closure)
            assertEquals("file", o.getOWLOntologyManager().getOntologyDocumentIRI(o).getScheme());

        assertEquals(coreSource.getRootOntology().getOntologyID().getOntologyIRI(),
            IRI.create(Constants.PEANUTS_MAIN_BASE));
        // Linus is stated to be a foaf:Person
        OWLNamedIndividual iLinus = df.getOWLNamedIndividual(IRI.create(Constants.PEANUTS_MAIN_BASE
                                                                        + "#Linus"));
        // Lucy is stated to be a foaf:Perzon
        OWLNamedIndividual iLucy = df
                .getOWLNamedIndividual(IRI.create(Constants.PEANUTS_MAIN_BASE + "#Lucy"));
        OWLClass cPerzon = df.getOWLClass(IRI.create("http://xmlns.com/foaf/0.1/Perzon"));

        Set<OWLIndividual> instances = cPerzon.getIndividuals(coreSource.getRootOntology());
        assertTrue(!instances.contains(iLinus) && instances.contains(iLucy));
    }
View Full Code Here

TOP

Related Classes of org.apache.stanbol.ontologymanager.ontonet.api.io.ParentPathInputSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.