Package org.semanticweb.owlapi.util

Examples of org.semanticweb.owlapi.util.OWLOntologyMerger


        m.addAxiom(
                o2,
                df.getOWLDeclarationAxiom(df.getOWLClass(IRI.create(EXAMPLE_IRI
                        + "#Weasel"))));
        // Create our ontology merger
        OWLOntologyMerger merger = new OWLOntologyMerger(m);
        // We merge all of the loaded ontologies. Since an OWLOntologyManager is
        // an OWLOntologySetProvider we
        // just pass this in. We also need to specify the URI of the new
        // ontology that will be created.
        IRI mergedOntologyIRI = IRI
                .create("http://www.semanticweb.com/mymergedont");
        OWLOntology merged = merger.createMergedOntology(m, mergedOntologyIRI);
        assertTrue(merged.getAxiomCount() > o1.getAxiomCount());
        assertTrue(merged.getAxiomCount() > o2.getAxiomCount());
    }
View Full Code Here


                o,
                man.getOWLDataFactory().getOWLDeclarationAxiom(
                        man.getOWLDataFactory().getOWLClass(
                                IRI.create("urn:testclass"))));
        // Create our ontology merger
        OWLOntologyMerger merger = new OWLOntologyMerger(man);
        // We merge all of the loaded ontologies. Since an OWLOntologyManager is
        // an OWLOntologySetProvider we just pass this in. We also need to
        // specify the URI of the new ontology that will be created.
        IRI mergedOntologyIRI = IRI
                .create("http://www.semanticweb.com/mymergedont");
        OWLOntology merged = merger
                .createMergedOntology(man, mergedOntologyIRI);
        // Print out the axioms in the merged ontology.
        // for (OWLAxiom ax : merged.getAxioms()) {
        // System.out.println(ax);
        // }
View Full Code Here

                    @Override
                    public Set<OWLOntology> getOntologies() {
                        return set;
                    }
                };
                OWLOntologyMerger merger = new OWLOntologyMerger(provider);
                try {
                    o = merger.createMergedOntology(OWLManager.createOWLOntologyManager(), iri);
                } catch (OWLOntologyCreationException e) {
                    log.error("Failed to merge imports for ontology " + iri, e);
                    o = null;
                }
View Full Code Here

                    @Override
                    public Set<OWLOntology> getOntologies() {
                        return set;
                    }
                };
                OWLOntologyMerger merger = new OWLOntologyMerger(provider);
                try {
                    ont = merger.createMergedOntology(OWLManager.createOWLOntologyManager(),
                        IRI.create(getDefaultNamespace() + getID()));
                } catch (OWLOntologyCreationException e) {
                    log.error("Failed to merge imports for ontology.", e);
                    ont = null;
                }
View Full Code Here

            if (session == null) log.warn("Session {} cannot be retrieved. Ignoring.", this.sessionId);
            final Set<OWLOntology> set = new HashSet<OWLOntology>();
            set.add(scope.export(OWLOntology.class, true));
            if (session != null) set.add(session.export(OWLOntology.class, true));
            if (set.size() == 1) return set.iterator().next();
            OWLOntologyMerger merger = new OWLOntologyMerger(new OWLOntologySetProvider() {
                @Override
                public Set<OWLOntology> getOntologies() {
                    return set;
                }
            });
            return merger.createMergedOntology(createOWLOntologyManager(),
                IRI.create("reasoners:input-" + System.currentTimeMillis()));
        } catch (OWLOntologyCreationException e) {
            String message = "The network for scope/session cannot be retrieved";
            log.error(message + ":", e);
            throw new IllegalArgumentException(message);
View Full Code Here

                    @Override
                    public Set<OWLOntology> getOntologies() {
                        return set;
                    }
                };
                OWLOntologyMerger merger = new OWLOntologyMerger(provider);
                try {
                    root = merger.createMergedOntology(OWLManager.createOWLOntologyManager(), iri);

                } catch (OWLOntologyCreationException e) {
                    log.error("Failed to merge imports for ontology " + iri, e);
                    root = null;
                }
View Full Code Here

                @Override
                public Set<OWLOntology> getOntologies() {
                    return set;
                }
            };
            OWLOntologyMerger merger = new OWLOntologyMerger(provider);
            try {
                o = merger.createMergedOntology(OWLManager.createOWLOntologyManager(),
                    ontologyId.getOntologyIRI());
            } catch (OWLOntologyCreationException e) {
                log.error("Failed to merge imports for ontology " + ontologyId, e);
                // do not reassign the root ontology
            }
View Full Code Here

                OWLOntologyManager owlmanager = OWLManager.createOWLOntologyManager();

                owlmanager.loadOntologyFromOntologyDocument(new ByteArrayInputStream(out.toByteArray()));

                OWLOntologyMerger merger = new OWLOntologyMerger(owlmanager);

                OWLOntology ontology = merger.createMergedOntology(owlmanager, ontologyIRI);

                availablemain = true;
                notifyAll();
                return ontology;
            }
View Full Code Here

        OWLOntologyManager man = OWLManager.createOWLOntologyManager();
        man.loadOntologyFromOntologyDocument(new File(firstOntPath));
        man.loadOntologyFromOntologyDocument(new File(secondOntPath));
       
        // Create our ontology merger
        OWLOntologyMerger merger = new OWLOntologyMerger(man);
        // We merge all of the loaded ontologies. Since an OWLOntologyManager is an OWLOntologySetProvider we just pass this in.
        //We also need to specify the URI of the new ontology that will be created.
        IRI mergedOntologyIRI = IRI.create(outputPath);
        OWLOntology merged = merger.createMergedOntology(man, mergedOntologyIRI);
        // Print out the axioms in the merged ontology.

        // Save to RDF/XML
        man.saveOntology(merged, new RDFXMLOntologyFormat(), IRI.create("file:" + outputPath));
  }
View Full Code Here

                owlManager.loadOntologyFromOntologyDocument(ontologyStream);
            } catch (OWLOntologyCreationException e) {
                logger.debug("Failed to load ontology for object " + currentObjectReader.GetObjectPID(), e);
            }
        }
        OWLOntologyMerger merger = new OWLOntologyMerger(owlManager);
        IRI mergedOntologyIRI = IRI.create("http://www.semanticweb.com/mymergedont");
        OWLOntology mergedOntology = null;
        try {
            mergedOntology = merger.createMergedOntology(owlManager, mergedOntologyIRI);
        } catch (OWLOntologyCreationException e) {
            logger.debug("Failed to load ontology for object " + currentObjectReader.GetObjectPID(), e);
        }

View Full Code Here

TOP

Related Classes of org.semanticweb.owlapi.util.OWLOntologyMerger

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.