Examples of OWLImportsDeclaration


Examples of org.semanticweb.owl.model.OWLImportsDeclaration

    public void handleTriple(URI subject, URI predicate, URI object) throws OWLException {
        consumeTriple(subject, predicate, object);
        getConsumer().addOntology(subject);
        getConsumer().addOntology(object);
        if (!schemaImportsURIs.contains(object)) {
            OWLImportsDeclaration importsDeclaration = getDataFactory().getOWLImportsDeclarationAxiom(getConsumer().getOntology(),
                                                                                                      object);
            addAxiom(importsDeclaration);
            OWLOntologyManager man = getConsumer().getOWLOntologyManager();
            man.makeLoadImportRequest(importsDeclaration);
            getConsumer().importsClosureChanged();
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLImportsDeclaration

    final public void Ontology() throws ParseException, OWLParserException,
            UnloadableImportException {
        OWLAnnotation anno;
        OWLAxiom ax;
        OWLImportsDeclaration decl;
        int count = 0;
        IRI versionIRI = null;
        jj_consume_token(ONTOLOGY);
        jj_consume_token(OPENPAR);
        switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLImportsDeclaration

        IRI iri;
        jj_consume_token(IMPORT);
        jj_consume_token(OPENPAR);
        iri = IRI();
        jj_consume_token(CLOSEPAR);
        OWLImportsDeclaration importsDeclaration = dataFactory
                .getOWLImportsDeclaration(iri);
        {
            if ("" != null) {
                return importsDeclaration;
            }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLImportsDeclaration

            } else if (ANNOTATION_PROPERTY.matches(section)) {
                axioms.addAll(parseAnnotationPropertyFrame());
            } else if (VALUE_PARTITION.matches(section)) {
                axioms.addAll(parseValuePartitionFrame());
            } else if (IMPORT.matches(section)) {
                OWLImportsDeclaration decl = parseImportsDeclaration();
                ont.getOWLOntologyManager().makeLoadImportRequest(decl,
                        getOntologyLoaderConfiguration());
                imports.add(new AddImport(ont, decl));
                OWLOntology imported = ont.getOWLOntologyManager().getOntology(
                        decl.getIRI());
                assert imported != null;
                for (OWLDeclarationAxiom declaration : imported
                        .getAxioms(AxiomType.DECLARATION)) {
                    processDeclaredEntities(declaration);
                }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLImportsDeclaration

    }

    @Test
    public void shouldBuildImportsDeclarationProperty() {
        // given
        OWLImportsDeclaration expected = df.getOWLImportsDeclaration(iri);
        BuilderImportsDeclaration builder = new BuilderImportsDeclaration(
                expected, df);
        // when
        OWLImportsDeclaration built = builder.buildObject();
        // then
        assertEquals(expected, built);
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLImportsDeclaration

    public void testImports() throws OWLOntologyCreationException {
        OWLOntology ontA = manager.createOntology(OWLOntologyDocumentSourceBase
                .getNextDocumentIRI("urn:testontology"));
        OWLOntology ontB = manager.createOntology(OWLOntologyDocumentSourceBase
                .getNextDocumentIRI("urn:testontology"));
        OWLImportsDeclaration decl = manager.getOWLDataFactory()
                .getOWLImportsDeclaration(
                        ontB.getOntologyID().getOntologyIRI().get());
        manager.applyChange(new AddImport(ontA, decl));
        assertTrue(manager.getDirectImports(ontA).contains(ontB));
        manager.removeOntology(ontB);
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLImportsDeclaration

                .getNextDocumentIRI("urn:testontology"));
        OWLOntology ontB = manager.createOntology(OWLOntologyDocumentSourceBase
                .getNextDocumentIRI("urn:testontology"));
        OWLOntology ontC = manager.createOntology(OWLOntologyDocumentSourceBase
                .getNextDocumentIRI("urn:testontology"));
        OWLImportsDeclaration declA = manager.getOWLDataFactory()
                .getOWLImportsDeclaration(
                        ontB.getOntologyID().getOntologyIRI().get());
        OWLImportsDeclaration declB = manager.getOWLDataFactory()
                .getOWLImportsDeclaration(
                        ontC.getOntologyID().getOntologyIRI().get());
        manager.applyChange(new AddImport(ontA, declA));
        manager.applyChange(new AddImport(ontB, declB));
        assertTrue(manager.getImportsClosure(ontA).contains(ontA));
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLImportsDeclaration

    @Test
    public void testImportsLoad() throws OWLException {
        OWLOntology ontA = manager.createOntology(IRI.create("a"));
        assertTrue(ontA.getDirectImports().size() == 0);
        IRI b = IRI.create("b");
        OWLImportsDeclaration declB = manager.getOWLDataFactory()
                .getOWLImportsDeclaration(b);
        manager.applyChange(new AddImport(ontA, declB));
        Set<IRI> directImportsDocuments = ontA.getDirectImportsDocuments();
        assertEquals(1, directImportsDocuments.size());
        assertTrue(directImportsDocuments.contains(b));
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLImportsDeclaration

        OWLOntology ontA = m.createOntology(OWLOntologyDocumentSourceBase
                .getNextDocumentIRI("urn:testontology"));
        OWLOntology ontB = m.createOntology(OWLOntologyDocumentSourceBase
                .getNextDocumentIRI("urn:testontology"));
        assertTrue(m.getImportsClosure(ontA).contains(ontA));
        @SuppressWarnings("null")
        OWLImportsDeclaration importsDeclaration = ImportsDeclaration(ontB
                .getOntologyID().getOntologyIRI().get());
        m.applyChange(new AddImport(ontA, importsDeclaration));
        assertTrue(m.getImportsClosure(ontA).contains(ontB));
        m.applyChange(new RemoveImport(ontA, importsDeclaration));
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLImportsDeclaration

    private void checkForImportsChange(OWLOntologyChange change) {
        if (change.isImportChange()) {
            resetImportsClosureCache();
            if (change instanceof AddImport) {
                OWLImportsDeclaration addImportDeclaration = ((AddImport) change)
                        .getImportDeclaration();
                boolean found = false;
                IRI iri = addImportDeclaration.getIRI();
                for (OWLOntologyID id : ontologiesByID.keySet()) {
                    if (iri.equals(id.getDefaultDocumentIRI().orNull())
                            || iri.equals(id.getOntologyIRI().orNull())
                            || iri.equals(id.getVersionIRI().orNull())) {
                        found = true;
                        ontologyIDsByImportsDeclaration.put(
                                addImportDeclaration, id);
                    }
                }
                if (!found) {
                    // then the import does not refer to a known IRI for
                    // ontologies; check for a document IRI
                    for (Map.Entry<OWLOntologyID, IRI> e : documentIRIsByID
                            .entrySet()) {
                        if (e.getValue().equals(iri)) {
                            // found the ontology id corresponding to the file
                            // location
                            ontologyIDsByImportsDeclaration.put(
                                    addImportDeclaration, e.getKey());
                        }
                    }
                }
            } else {
                // Remove the mapping from declaration to ontology
                OWLImportsDeclaration importDeclaration = ((RemoveImport) change)
                        .getImportDeclaration();
                ontologyIDsByImportsDeclaration.remove(importDeclaration);
                importedIRIs.remove(importDeclaration.getIRI());
            }
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.