Package org.semanticweb.owlapi.io

Examples of org.semanticweb.owlapi.io.OWLXMLOntologyFormat


* Date: 07-Jan-2007<br><br>
*/
public class OWLXMLOntologyStorer extends AbstractOWLOntologyStorer {

    public boolean canStoreOntology(OWLOntologyFormat ontologyFormat) {
        return ontologyFormat.equals(new OWLXMLOntologyFormat());
    }
View Full Code Here


 
  public void write(OutputStream out, int format) throws IOntologyException {
    OWLOntologyFormat ontologyFormat = manager.getOntologyFormat(ontology);
    switch(format){
    case OWL_FORMAT:
      ontologyFormat = new OWLXMLOntologyFormat();break;
    case RDF_FORMAT:
      ontologyFormat = new RDFXMLOntologyFormat();break;
    case NTRIPLE_FORMAT:
      throw new IOntologyException("Unsupported export format");
    case OBO_FORMAT:
View Full Code Here

 
  public void write(OutputStream out, int format) throws IOntologyException {
    OWLOntologyFormat ontologyFormat = manager.getOntologyFormat(ontology);
    switch(format){
    case OWL_FORMAT:
      ontologyFormat = new OWLXMLOntologyFormat();break;
    case RDF_FORMAT:
      ontologyFormat = new RDFXMLOntologyFormat();break;
    case NTRIPLE_FORMAT:
      throw new IOntologyException("Unsupported export format");
    case OBO_FORMAT:
View Full Code Here

                } catch (OWLOntologyStorageException e) {
                    log.error("Failed to store ontology for rendering.", e);
                }
            } else if (mediaType.toString().equals(KRFormat.OWL_XML)) {
                try {
                    manager.saveOntology(ontology, new OWLXMLOntologyFormat(), out);
                } catch (OWLOntologyStorageException e) {
                    log.error("Failed to store ontology for rendering.", e);
                }
            } else if (mediaType.toString().equals(KRFormat.MANCHESTER_OWL)) {
                try {
View Full Code Here

                    } catch (OWLOntologyStorageException e) {
                        log.error("Failed to store ontology for rendering.", e);
                    }
                } else if (mediaType.toString().equals(KRFormat.OWL_XML)) {
                    try {
                        manager.saveOntology(ontology, new OWLXMLOntologyFormat(), out);
                    } catch (OWLOntologyStorageException e) {
                        log.error("Failed to store ontology for rendering.", e);
                    }
                } else if (mediaType.toString().equals(KRFormat.MANCHESTER_OWL)) {
                    try {
View Full Code Here

                } catch (OWLOntologyStorageException e) {
                    log.error("Failed to store ontology for rendering.", e);
                }
            } else if (mediaType.toString().equals(KRFormat.OWL_XML)) {
                try {
                    manager.saveOntology(ontology, new OWLXMLOntologyFormat(), out);
                } catch (OWLOntologyStorageException e) {
                    log.error("Failed to store ontology for rendering.", e);
                }
            } else if (mediaType.toString().equals(KRFormat.MANCHESTER_OWL)) {
                try {
View Full Code Here

            || MANCHESTER_OWL_TYPE.equals(mediaType) || FUNCTIONAL_OWL_TYPE.equals(mediaType)
            || TURTLE_TYPE.equals(mediaType) || X_TURTLE_TYPE.equals(mediaType)) {

            OWLOntologyFormat format = null;
            if (RDF_XML_TYPE.equals(mediaType)) format = new RDFXMLOntologyFormat();
            else if (OWL_XML_TYPE.equals(mediaType)) format = new OWLXMLOntologyFormat();
            else if (MANCHESTER_OWL_TYPE.equals(mediaType)) format = new ManchesterOWLSyntaxOntologyFormat();
            else if (FUNCTIONAL_OWL_TYPE.equals(mediaType)) format = new OWLFunctionalSyntaxOntologyFormat();
            else if (TURTLE_TYPE.equals(mediaType) || X_TURTLE_TYPE.equals(mediaType)) format = new TurtleOntologyFormat();

            if (format != null) try {
View Full Code Here

* Date: 07-Jan-2007<br><br>
*/
public class OWLXMLOntologyStorer extends AbstractOWLOntologyStorer {

    public boolean canStoreOntology(OWLOntologyFormat ontologyFormat) {
        return ontologyFormat.equals(new OWLXMLOntologyFormat());
    }
View Full Code Here

    public OWLOntologyFormat parse(OWLOntologyDocumentSource documentSource, OWLOntology ontology, OWLOntologyLoaderConfiguration configuration) throws OWLParserException, IOException, OWLOntologyChangeException, UnloadableImportException {
      InputSource isrc = null;
      try {
            System.setProperty("entityExpansionLimit", "100000000");
            OWLXMLOntologyFormat format = new OWLXMLOntologyFormat();
            SAXParserFactory factory = SAXParserFactory.newInstance();
            factory.setNamespaceAware(true);
            SAXParser parser = factory.newSAXParser();
            isrc = getInputSource(documentSource);
            OWLXMLParserHandler handler = new OWLXMLParserHandler(ontology, configuration);
            parser.parse(isrc, handler);
            Map<String, String> prefix2NamespaceMap = handler.getPrefixName2PrefixMap();
            for(String prefix : prefix2NamespaceMap.keySet()) {
                format.setPrefix(prefix, prefix2NamespaceMap.get(prefix));
            }
            return format;
        }
        catch (ParserConfigurationException e) {
            // What the hell should be do here?  In serious trouble if this happens
View Full Code Here

        // By default ontologies are saved in the format from which they were loaded.

        OWLOntologyFormat format = manager.getOntologyFormat(ontology);
      
        // We can save the ontology in a different format Lets save the ontology in owl/xml format
        OWLXMLOntologyFormat owlxmlFormat = new OWLXMLOntologyFormat();
        //or in the rdf/xml format
        RDFXMLOntologyFormat rdfxmlFormat = new RDFXMLOntologyFormat();
       
        // Some ontology formats support prefix names and prefix IRIs.  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(ontology, owlxmlFormat, IRI.create(file.toURI()));  //uses the owl ontology format
//        manager.saveOntology(ontology, IRI.create(file.toURI()));   //uses...some type of RDF format, but not the same as SWEET
        manager.saveOntology(ontology, rdfxmlFormat, IRI.create(file.toURI()));
View Full Code Here

TOP

Related Classes of org.semanticweb.owlapi.io.OWLXMLOntologyFormat

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.