Question about protegé API

Hi,

I created a project with Protegé and Protegé saved my project in a .owl
file:

<?xml version="1.0"?>
<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:protege="http://protege.stanford.edu/plugins/owl/protege#"
    xmlns:xsp="http://www.owl-ontologies.com/2005/08/07/xsp.owl#"
    xmlns="http://www.cmf.com/Ontology.owl#"
    xmlns:owl="http://www.w3.org/2002/07/owl#"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
    xmlns:swrl="http://www.w3.org/2003/11/swrl#"
    xmlns:swrlb="http://www.w3.org/2003/11/swrlb#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
  *xml:base="http://www.cmf.com/Ontology.owl">*
  <owl:Ontology rdf:about=""/>
  <owl:Class rdf:ID="device"/>
</rdf:RDF>

<!-- Created with Protege (with OWL Plugin 3.4.2, Build 562)
http://protege.stanford.edu -->

And I tried to access to this file in eclipse so I wrote these code:

import java.io.File;
import java.io.InputStream;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;
import com.hp.hpl.jena.util.FileManager;
import com.hp.hpl.jena.util.FileUtils;
import edu.stanford.smi.protegex.owl.jena.JenaOWLModel;
import edu.stanford.smi.protegex.owl.ProtegeOWL;

public class Main {
    public static void main(String[] args) {

      String inputFileName = "C:\\Program
Files\\Protege_3.4.2\\Ontology.owl";

      JenaOWLModel owlModel;
        InputStream in = FileManager.get().open( inputFileName );
     if (in == null) {
        throw new IllegalArgumentException(
                                     "File: " + inputFileName + " not
found");
     }

try {
URI fileURI;
 owlModel = ProtegeOWL.createJenaOWLModelFromInputStream(in);



        // save the .owl file
        Collection errors = new ArrayList();
        owlModel.save(new File(inputFileName).toURI(),
FileUtils.langXMLAbbrev, errors);
        System.out.println("File saved with " + errors.size() + " errors.");


} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
    }
}
These code just access to the .owl created by Protegé and to nothing execpt
saved in the same file
But when I go to see the .owl saved, it changed:

<?xml version="1.0"?>
<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:protege="http://protege.stanford.edu/plugins/owl/protege#"
    xmlns:xsp="http://www.owl-ontologies.com/2005/08/07/xsp.owl#"
    xmlns="http://www.cmf.com/Ontology.owl#"
    xmlns:owl="http://www.w3.org/2002/07/owl#"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
    xmlns:swrl="http://www.w3.org/2003/11/swrl#"
    xmlns:swrlb="http://www.w3.org/2003/11/swrlb#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
  <owl:Ontology rdf:about=""/>
  <owl:Class rdf:ID="device"/>
</rdf:RDF>

<!-- Created with Protege (with OWL Plugin 3.4.2, Build 562)
http://protege.stanford.edu -->

*xml:base="http://www.cmf.com/Ontology.owl"> is missing!!*

So how can I add this missed linein my code.

Thank you

Received on Tuesday, 16 March 2010 21:41:57 UTC