Search Mailing List Archives


Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[protege-owl] How to save owl ontology into URI?

zooo doush zunzunzunlast at yahoo.com
Thu May 29 14:05:21 PDT 2008


I loaded an ontology from a URI and I want to update the information in that ontology and save it again in the URI.
The loading of the ontology from the URI works correctly, but saving it again after updating the ontology with some information (adding subclass) is not working.

mainly it is this part of the code:

 owlModel.createOWLNamedSubclass("quiz1", owlClass);
                      Project p=owlModel.getProject();
                      p.setProjectURI(projectFile);
                      p.save(errors);



Any help would be appreciated.


The source code:


public static void loadOntology(URI  projectFile){
        try {
           Collection errors = new ArrayList();
           Project prj =Project.loadProjectFromURI(projectFile, errors);    
           
        OWLModel owlModel = (OWLModel)prj.getKnowledgeBase();
        
        Iterator it = owlModel.getUserDefinedOWLNamedClasses().iterator();
        
         while(it.hasNext())
         {
            
             OWLNamedClass owlClass=(OWLNamedClass)it.next();
             String strClass=owlClass.getBrowserText();
             
            
             if (strClass.equals("Quiz")){            

 owlModel.createOWLNamedSubclass("quiz1", owlClass);
                     Project p=owlModel.getProject();
                     p.setProjectURI(projectFile);
                     p.save(errors);
             }
         }
        }catch (Exception e) {
             e.printStackTrace();
        }
        
    }

    public static void main(String[] args) {

        URI url=URI.create("http://www.cs.nmsu.edu/~idoush/ontology/moodle.pprj");
        loadOntology(url);        
        
    }
}


 Thanks,

   Iyad

       
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/protege-owl/attachments/20080529/6c45a9a0/attachment.html>


More information about the protege-owl mailing list