Examples of OWLXMLDocumentFormat


Examples of org.semanticweb.owlapi.formats.OWLXMLDocumentFormat

        // Output will be deleted on exit; to keep temporary file replace
        // previous line with the following
        // File output = File.createTempFile("saved_pizza", ".owl");
        IRI documentIRI2 = IRI.create(output);
        // save in OWL/XML format
        m.saveOntology(o, new OWLXMLDocumentFormat(), documentIRI2);
        // save in RDF/XML
        m.saveOntology(o, documentIRI2);
        // print out the ontology
        StringDocumentTarget target = new StringDocumentTarget();
        m.saveOntology(o, target);
View Full Code Here

Examples of org.semanticweb.owlapi.formats.OWLXMLDocumentFormat

    public OWLDocumentFormat parse(OWLOntologyDocumentSource documentSource,
            OWLOntology ontology, OWLOntologyLoaderConfiguration configuration)
            throws IOException {
        InputSource isrc = null;
        try {
            OWLXMLDocumentFormat format = new OWLXMLDocumentFormat();
            SAXParserFactory factory = SAXParsers.initFactory();
            SAXParser parser = factory.newSAXParser();
            isrc = getInputSource(documentSource, configuration);
            OWLXMLParserHandler handler = new OWLXMLParserHandler(ontology,
                    configuration);
            parser.parse(isrc, handler);
            format.copyPrefixesFrom(handler.getPrefixName2PrefixMap());
            return format;
        } catch (ParserConfigurationException e) {
            throw new OWLRuntimeException(e);
        } catch (SAXException e) {
            // General exception
View Full Code Here

Examples of org.semanticweb.owlapi.formats.OWLXMLDocumentFormat

        roundTripOntology(ont, new RDFJsonDocumentFormat());
    }

    @Test
    public void testOWLXML() throws Exception {
        roundTripOntology(ont, new OWLXMLDocumentFormat());
    }
View Full Code Here

Examples of org.semanticweb.owlapi.formats.OWLXMLDocumentFormat

        return format;
    }

    @Test
    public void testOntologyContainsAxiomsForOWLXML1() throws Exception {
        runTestOntologyContainsAxioms1(new OWLXMLDocumentFormat());
    }
View Full Code Here

Examples of org.semanticweb.owlapi.formats.OWLXMLDocumentFormat

        runTestOntologyContainsAxioms2(createRDFXMLFormat());
    }

    @Test
    public void testOntologyContainsAxiomsForOWLXML2() throws Exception {
        runTestOntologyContainsAxioms2(new OWLXMLDocumentFormat());
    }
View Full Code Here

Examples of org.semanticweb.owlapi.formats.OWLXMLDocumentFormat

        OWLAnnotationProperty myComment = AnnotationProperty(IRI("http://ont.com#myComment"));
        OWLSubAnnotationPropertyOfAxiom annoAx4 = df
                .getOWLSubAnnotationPropertyOfAxiom(myComment, rdfsComment);
        m.addAxiom(ont, annoAx4);
        reload(ont, new RDFXMLDocumentFormat());
        reload(ont, new OWLXMLDocumentFormat());
        reload(ont, new TurtleDocumentFormat());
        reload(ont, new FunctionalSyntaxDocumentFormat());
    }
View Full Code Here

Examples of org.semanticweb.owlapi.formats.OWLXMLDocumentFormat

        OWLAxiom classAssj = df.getOWLClassAssertionAxiom(cheese, j);
        m.addAxiom(ontology, classAssj);
        OWLAxiom objAss = df.getOWLObjectPropertyAssertionAxiom(hasTopping, i,
                j);
        m.addAxiom(ontology, objAss);
        roundTrip(ontology, new OWLXMLDocumentFormat());
    }
View Full Code Here

Examples of org.semanticweb.owlapi.formats.OWLXMLDocumentFormat

        OWLObjectProperty p = df.getOWLObjectProperty(IRI.create("urn:p"));
        OWLAnonymousIndividual i = df.getOWLAnonymousIndividual();
        OWLSubClassOfAxiom sub = df.getOWLSubClassOfAxiom(c,
                df.getOWLObjectHasValue(p, i));
        o.getOWLOntologyManager().addAxiom(o, sub);
        OWLOntology roundtrip = roundTrip(o, new OWLXMLDocumentFormat());
        equal(o, roundtrip);
    }
View Full Code Here

Examples of org.semanticweb.owlapi.formats.OWLXMLDocumentFormat

    }

    @Test
    public void shouldOWLXMLBeEquivalent() {
        OWLOntology owl = loadOntologyFromString(OWLXML,
                IRI.create("urn:primer#owlxml"), new OWLXMLDocumentFormat());
        assertTrue(profile.checkOntology(owl).getViolations().isEmpty());
        equal(func, owl);
    }
View Full Code Here

Examples of org.semanticweb.owlapi.formats.OWLXMLDocumentFormat

        // 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
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.