Package org.semanticweb.owlapi.model

Examples of org.semanticweb.owlapi.model.OWLOntologyManager.saveOntology()


    public void testWriteReadConvertedOWL() throws Exception {
        OBODoc oboDoc = parseOBOFile("namespace-id-rule.obo");
        OWLOntology owlOntology = convert(oboDoc);
        OWLOntologyManager manager = owlOntology.getOWLOntologyManager();
        StringDocumentTarget documentTarget = new StringDocumentTarget();
        manager.saveOntology(owlOntology, new OWLXMLDocumentFormat(),
                documentTarget);
        String owlString = documentTarget.toString();
        OWLOntologyDocumentSource documentSource = new StringDocumentSource(
                owlString);
        OWLOntology reloadedOwl = OWLManager.createOWLOntologyManager()
View Full Code Here


        OWLOntologyManager m = create();
        OWLOntology o = loadPizzaOntology(m);
        assertNotNull(o);
        // save an ontology to a document target which holds all data in memory
        StringDocumentTarget target = new StringDocumentTarget();
        m.saveOntology(o, target);
        // remove the ontology from the manager, so it can be loaded again
        m.removeOntology(o);
        // create a document source from a string
        StringDocumentSource documentSource = new StringDocumentSource(target);
        // load the ontology from a document source
View Full Code Here

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

        // 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);
        // Remove the ontology from the manager
        m.removeOntology(o);
View Full Code Here

        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);
        // Remove the ontology from the manager
        m.removeOntology(o);
    }

    @Test
View Full Code Here

        // localFolder first for a local copy, checking its subfolders as well
        m.getIRIMappers().add(new AutoIRIMapper(localFolder, true));
        // Create the ontology - we use the ontology IRI (not the physical URI)
        OWLOntology o = m.createOntology(EXAMPLE_SAVE_IRI);
        // save the ontology to its physical location - documentIRI
        m.saveOntology(o);
        assertNotNull(o);
    }

    @Test
    public void testAddAxioms() throws OWLException {
View Full Code Here

        // Add the class assertion
        m.addAxiom(o, classAssertion);
        // Dump the ontology
        StreamDocumentTarget target = new StreamDocumentTarget(
                new ByteArrayOutputStream());
        m.saveOntology(o, target);
    }

    @SuppressWarnings("unused")
    @Test
    public void testDataRanges() throws OWLException {
View Full Code Here

        // Add the definition to our ontology
        m.addAxiom(o, datatypeDef);
        // Dump our ontology
        StreamDocumentTarget target = new StreamDocumentTarget(
                new ByteArrayOutputStream());
        m.saveOntology(o, target);
    }

    @Test
    public void testPropertyAssertions() throws OWLException {
        // how to specify various property assertions for individuals
View Full Code Here

        // Register the ontology storer with the manager
        m.getOntologyStorers().add(new TutorialSyntaxStorerFactory());
        // Save using a different format
        StreamDocumentTarget target = new StreamDocumentTarget(
                new ByteArrayOutputStream());
        m.saveOntology(o, new OWLTutorialSyntaxOntologyFormat(), target);
    }

    @Test
    public void testCheckProfile() throws OWLException {
        OWLOntologyManager m = create();
View Full Code Here

        // Create the property assertion and add it to the ontology
        OWLAxiom ax = factory.getOWLDataPropertyAssertionAxiom(hasAge, john,
                literal);
        manager.addAxiom(ontology, ax);
        // Dump the ontology to System.out
        manager.saveOntology(ontology, new StreamDocumentTarget(
                new ByteArrayOutputStream()));
    }

    /**
     * @throws Exception
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.