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-discussion] accessing an OWL file with Java and dom4j

Vishal Sharma vishalsharmals8 at yahoo.com
Fri Apr 13 07:30:05 PDT 2007


Hello,

I hope this is the right mailing list, apologies if not.

I created a ontology with Protege Frames, and used the built in export function to export the ontology to OWL.

I am currently using dom4j with Java to search the ontology, and I am having two problems:

1)  It seems that not all instances are displayed, for example it only displays 8 instances of the class convenor (lecturer), when it has 29 instances.

The code is:
public Document printConvenor() {
    try {
     //System.out.println("inside parse methods try block");
      SAXReader reader = new SAXReader();
      Document document = reader.read(new File("Modules.owl"));
      
      Element root = document.getRootElement();
      //System.out.println("outside for loop");
      int counter = 0;
      for (Iterator i = root.elementIterator(); i.hasNext();){
       Element element = (Element)i.next();
       //System.out.println(element.getQualifiedName());
       //System.out.println(element.getTextTrim());
       
       
       if ((element.elementText("first_name")) != null){
         
        //Print out module details
        System.out.print("First Name: ");
        System.out.println(element.elementText("first_name"));
        System.out.print("Surname: ");
        System.out.println(element.elementText("surname"));
        System.out.print("Room Number: ");
        System.out.println(element.elementText("room_number"));
        System.out.print("Website: ");
        System.out.println(element.elementText("website_address"));
        System.out.print("User ID: ");
        System.out.println(element.elementText("user_id"));
        
        counter++;
        System.out.println("convenor: " + counter);
        System.out.println();
       }else{
       
        //Do Nothing
       
       }//end if else if
       
      }//end for loop


How do I print all the instances?

2) I have relationships between classes, and in the exported OWL file this is shown as: "modulesFramesNEW_Instance_10045"  how can I access that using Java?

Thank you,

Vishal


      ___________________________________________________________ 
Yahoo! Mail is the world's favourite email. Don't settle for less, sign up for
your free account today http://uk.rd.yahoo.com/evt=44106/*http://uk.docs.yahoo.com/mail/winter07.html 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/protege-discussion/attachments/20070413/2a3412b3/attachment.html>


More information about the protege-discussion mailing list