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
Fri Apr 13 07:30:05 PDT 2007


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 = 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);
       if ((element.elementText("first_name")) != null){
        //Print out module details
        System.out.print("First Name: ");
        System.out.print("Surname: ");
        System.out.print("Room Number: ");
        System.out.print("Website: ");
        System.out.print("User ID: ");
        System.out.println("convenor: " + counter);
        //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,


Yahoo! Mail is the world's favourite email. Don't settle for less, sign up for
your free account today* 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the protege-discussion mailing list