Package org.semanticweb.owlapi.model

Examples of org.semanticweb.owlapi.model.OWLDocumentFormat


     */
    public OWLOntology roundTripOntology(@Nonnull OWLOntology ont,
            @Nonnull OWLDocumentFormat format)
            throws OWLOntologyStorageException, OWLOntologyCreationException {
        StringDocumentTarget target = new StringDocumentTarget();
        OWLDocumentFormat fromFormat = m.getOntologyFormat(ont);
        if (fromFormat.isPrefixOWLOntologyFormat()
                && format.isPrefixOWLOntologyFormat()) {
            PrefixDocumentFormat fromPrefixFormat = fromFormat
                    .asPrefixOWLOntologyFormat();
            PrefixDocumentFormat toPrefixFormat = format
                    .asPrefixOWLOntologyFormat();
            toPrefixFormat.copyPrefixesFrom(fromPrefixFormat);
        }
View Full Code Here


                    // Junk from a previous parse. We should clear the ont
                    manager.removeOntology(ont);
                    ont = createOWLOntology(manager, ontologyID,
                            documentSource.getDocumentIRI(), handler);
                }
                OWLDocumentFormat format = parser.parse(documentSource, ont,
                        configuration);
                handler.setOntologyFormat(ont, format);
                return ont;
            } catch (IOException e) {
                // For input/output exceptions, we assume that it means the
View Full Code Here

                && !documentSource.isMIMETypeKnown()) {
            return parsers;
        }
        PriorityCollection<OWLParserFactory> candidateParsers = parsers;
        if (documentSource.isFormatKnown()) {
            OWLDocumentFormat format = documentSource.getFormat();
            assert format != null;
            candidateParsers = getParsersByFormat(format, parsers);
        }
        if (candidateParsers.isEmpty() && documentSource.isMIMETypeKnown()) {
            String mimeType = documentSource.getMIMEType();
View Full Code Here

     */
    @Test
    public void testParse() throws Exception {
        OWLOntology owlapiOntologyPrimer = m.createOntology();
        RDFXMLParser owlapiParser = new RDFXMLParser();
        OWLDocumentFormat owlapiOntologyFormat = owlapiParser.parse(
                getStream("/koala.owl"), owlapiOntologyPrimer, config);
        assertEquals(70, owlapiOntologyPrimer.getAxiomCount());
        assertEquals(new RDFXMLDocumentFormat(), owlapiOntologyFormat);
        RioParserImpl rioParser = new RioParserImpl(
                new RioRDFXMLDocumentFormatFactory());
        // OWLOntology ontology = OWLOntologyManagerFactoryRegistry
        // .createOWLOntologyManager().createOntology(
        OWLOntology ontology = m1
                .createOntology(IRI
                        .create("http://protege.stanford.edu/plugins/owl/owl-library/koala.owl"));
        OWLDocumentFormat rioOntologyFormat = rioParser.parse(
                getStream("/koala.owl"), ontology, config);
        assertEquals(new RioRDFXMLDocumentFormat(), rioOntologyFormat);
        equal(owlapiOntologyPrimer, ontology);
        assertEquals(70, ontology.getAxiomCount());
    }
View Full Code Here

     */
    @Test
    public void testParsePrimer() throws Exception {
        OWLOntology owlapiOntologyPrimer = m.createOntology();
        RDFXMLParser owlapiParser = new RDFXMLParser();
        OWLDocumentFormat owlapiOntologyFormat = owlapiParser.parse(
                getStream("/primer.rdfxml.xml"), owlapiOntologyPrimer, config);
        assertEquals(93, owlapiOntologyPrimer.getAxiomCount());
        assertEquals(new RDFXMLDocumentFormat(), owlapiOntologyFormat);
        RioParserImpl rioParser = new RioParserImpl(
                new RioRDFXMLDocumentFormatFactory());
        // OWLOntology rioOntologyPrimer = OWLOntologyManagerFactoryRegistry
        // .createOWLOntologyManager()
        OWLOntology rioOntologyPrimer = m1.createOntology(IRI
                .create("http://example.com/owl/families"));
        OWLDocumentFormat rioOntologyFormat = rioParser.parse(
                getStream("/primer.rdfxml.xml"), rioOntologyPrimer, config);
        assertEquals(new RioRDFXMLDocumentFormat(), rioOntologyFormat);
        equal(owlapiOntologyPrimer, rioOntologyPrimer);
        assertEquals(93, rioOntologyPrimer.getAxiomCount());
    }
View Full Code Here

        // DatatypeDefinition(<http://example.com/owl/families/majorAge>
        // DataIntersectionOf(<http://example.com/owl/families/personAge>
        // DataComplementOf(<http://example.com/owl/families/minorAge>) ))]
        OWLOntology owlapiOntologyPrimer = m.createOntology();
        RDFXMLParser owlapiParser = new RDFXMLParser();
        OWLDocumentFormat owlapiOntologyFormat = owlapiParser.parse(
                getStream("/rioParserTest1-minimal.rdf"), owlapiOntologyPrimer,
                config);
        assertEquals(4, owlapiOntologyPrimer.getAxiomCount());
        assertEquals(new RDFXMLDocumentFormat(), owlapiOntologyFormat);
        RioParserImpl rioParser = new RioParserImpl(
                new RioRDFXMLDocumentFormatFactory());
        // OWLOntology rioOntologyPrimer = OWLOntologyManagerFactoryRegistry
        // .createOWLOntologyManager().createOntology(
        OWLOntology rioOntologyPrimer = OWLManager.createOWLOntologyManager()
                .createOntology(IRI.create("http://example.com/owl/families"));
        OWLDocumentFormat rioOntologyFormat = rioParser.parse(
                getStream("/rioParserTest1-minimal.rdf"), rioOntologyPrimer,
                config);
        assertEquals(new RioRDFXMLDocumentFormat(), rioOntologyFormat);
        equal(owlapiOntologyPrimer, rioOntologyPrimer);
        assertEquals(4, rioOntologyPrimer.getAxiomCount());
View Full Code Here

     */
    @Test
    public void testParsePrimerMinimalSubset() throws Exception {
        OWLOntology owlapiOntologyPrimer = m.createOntology();
        RDFXMLParser owlapiParser = new RDFXMLParser();
        OWLDocumentFormat owlapiOntologyFormat = owlapiParser.parse(
                getStream("/rioParserTest1-minimal.rdf"), owlapiOntologyPrimer,
                config);
        assertEquals(4, owlapiOntologyPrimer.getAxiomCount());
        assertEquals(new RDFXMLDocumentFormat(), owlapiOntologyFormat);
        RioParserImpl rioParser = new RioParserImpl(
                new RioRDFXMLDocumentFormatFactory());
        // OWLOntology rioOntologyPrimer = OWLOntologyManagerFactoryRegistry
        // .createOWLOntologyManager().createOntology(
        OWLOntology rioOntologyPrimer = m1.createOntology(IRI
                .create("http://example.com/owl/families"));
        OWLDocumentFormat rioOntologyFormat = rioParser.parse(
                getStream("/rioParserTest1-minimal.rdf"), rioOntologyPrimer,
                config);
        assertEquals(new RioRDFXMLDocumentFormat(), rioOntologyFormat);
        equal(owlapiOntologyPrimer, rioOntologyPrimer);
        assertEquals(4, rioOntologyPrimer.getAxiomCount());
View Full Code Here

    @Override
    public OWLOntology roundTripOntology(OWLOntology ont,
            OWLDocumentFormat format) throws OWLOntologyStorageException,
            OWLOntologyCreationException {
        OWLOntology ont2 = super.roundTripOntology(ont, format);
        OWLDocumentFormat ont2Format = ont2.getOWLOntologyManager()
                .getOntologyFormat(ont2);
        if (format instanceof PrefixDocumentFormat
                && ont2Format instanceof PrefixDocumentFormat) {
            PrefixDocumentFormat prefixFormat = (PrefixDocumentFormat) format;
            prefixFormat.getPrefixName2PrefixMap();
View Full Code Here

TOP

Related Classes of org.semanticweb.owlapi.model.OWLDocumentFormat

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.