Examples of OWLDocumentFormat


Examples of org.semanticweb.owlapi.model.OWLDocumentFormat

        OWLAPIObo2Owl bridge = new OWLAPIObo2Owl(manager);
        OBOFormatParser p = new OBOFormatParser();
        OBODoc obodoc = p.parse(new URL(iri));
        OWLOntology ontology = bridge.convert(obodoc);
        IRI outputStream = IRI.create(outFile);
        OWLDocumentFormat format = new RDFXMLDocumentFormat();
        LOG.info("saving to {} fmt={}", outputStream, format);
        manager.saveOntology(ontology, format, outputStream);
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLDocumentFormat

        OBOFormatParser p = new OBOFormatParser();
        OBODoc obodoc = p.parse(new URL(iri));
        obodoc.addDefaultOntologyHeader(defaultOnt);
        OWLOntology ontology = bridge.convert(obodoc);
        IRI outputStream = IRI.create(outFile);
        OWLDocumentFormat format = new RDFXMLDocumentFormat();
        LOG.info("saving to {} fmt={}", outputStream, format);
        manager.saveOntology(ontology, format, outputStream);
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLDocumentFormat

        @Nonnull
        private final PrefixManager delegate;

        LabelPrefixManager(@Nonnull OWLOntology ontology) {
            this.ontology = ontology;
            OWLDocumentFormat ontologyFormat = ontology.getOWLOntologyManager()
                    .getOntologyFormat(ontology);
            if (ontologyFormat instanceof PrefixManager) {
                delegate = (PrefixManager) ontologyFormat;
            } else {
                delegate = new DefaultPrefixManager();
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLDocumentFormat

            declared.remove(ax.getEntity());
        }
        // any undeclared entities?
        if (!declared.isEmpty()) {
            boolean addMissing = true;
            OWLDocumentFormat format = ontology.getOWLOntologyManager()
                    .getOntologyFormat(ontology);
            if (format != null) {
                addMissing = format.isAddMissingTypes();
            }
            if (addMissing) {
                Collection<IRI> illegalPunnings = OWLDocumentFormatImpl
                        .determineIllegalPunnings(addMissing,
                                ontology.getSignature(),
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLDocumentFormat

                if (!importedOntology.equals(ontology)) {
                    copyPrefixes(manager.getOntologyFormat(importedOntology));
                }
            }
        }
        OWLDocumentFormat format = manager.getOntologyFormat(ontology);
        copyPrefixes(format);
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLDocumentFormat

        return owlFormat;
    }

    @Override
    public void parse(InputStream in, String baseURI) throws IOException {
        OWLDocumentFormat nextFormat = getRDFFormat().getOWLFormat();
        StreamDocumentSource source = new StreamDocumentSource(checkNotNull(in,
                "in cannot be null"), IRI.create(checkNotNull(baseURI,
                "baseURI cannot be null")), nextFormat, getRDFFormat()
                .getDefaultMIMEType());
        render(source);
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLDocumentFormat

        }
    }

    @Override
    public void parse(Reader reader, String baseURI) throws IOException {
        OWLDocumentFormat nextFormat = getRDFFormat().getOWLFormat();
        ReaderDocumentSource source = new ReaderDocumentSource(checkNotNull(
                reader, "reader cannot be null"), IRI.create(checkNotNull(
                baseURI, "baseURI cannot be null")), nextFormat, getRDFFormat()
                .getDefaultMIMEType());
        render(source);
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLDocumentFormat

        File file = folder.newFile("owlapiexamples_saving.owl");
        manager.saveOntology(pizzaOntology, IRI.create(file.toURI()));
        // By default ontologies are saved in the format from which they were
        // loaded. In this case the ontology was loaded from an rdf/xml file We
        // can get information about the format of an ontology from its manager
        OWLDocumentFormat format = manager.getOntologyFormat(pizzaOntology);
        // We can save the ontology in a different format Lets save the ontology
        // in owl/xml format
        OWLXMLDocumentFormat owlxmlFormat = new OWLXMLDocumentFormat();
        // Some ontology formats support prefix names and prefix IRIs. In our
        // case we loaded the pizza ontology from an rdf/xml format, which
        // supports prefixes. When we save the ontology in the new format we
        // will copy the prefixes over so that we have nicely abbreviated IRIs
        // in the new ontology document
        if (format.isPrefixOWLOntologyFormat()) {
            owlxmlFormat.copyPrefixesFrom(format.asPrefixOWLOntologyFormat());
        }
        manager.saveOntology(pizzaOntology, owlxmlFormat,
                IRI.create(file.toURI()));
        // We can also dump an ontology to System.out by specifying a different
        // OWLOntologyOutputTarget Note that we can write an ontology to a
        // stream in a similar way using the StreamOutputTarget class
        // OWLOntologyDocumentTarget documentTarget = new
        // SystemOutDocumentTarget();
        // Try another format - The Manchester OWL Syntax
        ManchesterSyntaxDocumentFormat manSyntaxFormat = new ManchesterSyntaxDocumentFormat();
        if (format.isPrefixOWLOntologyFormat()) {
            manSyntaxFormat
                    .copyPrefixesFrom(format.asPrefixOWLOntologyFormat());
        }
        manager.saveOntology(pizzaOntology, manSyntaxFormat,
                new StreamDocumentTarget(new ByteArrayOutputStream()));
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLDocumentFormat

        // toReturn now initialized
        assert toReturn != null;
        OWLOntologyManager m = toCopy.getOWLOntologyManager();
        if (settings == OntologyCopy.MOVE || settings == OntologyCopy.DEEP) {
            setOntologyDocumentIRI(toReturn, m.getOntologyDocumentIRI(toCopy));
            OWLDocumentFormat f = m.getOntologyFormat(toCopy);
            if (f != null) {
                setOntologyFormat(toReturn, f);
            }
        }
        if (settings == OntologyCopy.MOVE) {
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLDocumentFormat

    // Methods to save ontologies
    @Override
    public void saveOntology(OWLOntology ontology)
            throws OWLOntologyStorageException {
        OWLDocumentFormat format = getOntologyFormat(ontology);
        saveOntology(ontology, format);
    }
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.