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] problem with the creation of jena model

Timothy Redmond tredmond at stanford.edu
Mon Apr 2 11:26:00 PDT 2007



I think that the problem is that Protege OWL is not finding some of its 
initialization files.  When I ran your code with the jvm option

    -Dprotege.dir=`path to protege installation`

your code ran fine except for a class cast exception at the line

        OWLIndividual individual = (OWLIndividual) jt.next();

When I ran it without this option I got lots of errors related to the 
fact that Protege could not find its default repository files and was 
thus unable to lookup with swrl import.

-Timothy


chandu wrote:
> To create a model and print the instances created by user-->
>
> import java.util.*;
> import java.io.*;
> import edu.stanford.smi.protegex.owl.*;
> import edu.stanford.smi.protegex.owl.model.*;
> //import edu.stanford.smi.protegex.owl.jena.* ;
>
>
> class First
> {
>     public static void main(String[] args) throws Exception
>     {
>         File file = new File("thesis.owl");
>        
>         String uri = (file.toURI()).toString();
>         System.out.println(uri);
>        
>         OWLModel owlModel = ProtegeOWL.createJenaOWLModelFromURI(uri);
>         //JenaOWLModel owlModel = ProtegeOWL.createJenaOWLModel();
>        
>         System.out.println (uri);
>        
>         Collection classes = owlModel.getUserDefinedOWLNamedClasses();
>         for (Iterator it = classes.iterator(); it.hasNext();) {
>             OWLNamedClass cls = (OWLNamedClass) it.next();
>             Collection instances = cls.getInstances(false);
>             System.out.println("Class " + cls.getBrowserText() + " (" 
> + instances.size() + ")");
>             for (Iterator jt = instances.iterator(); jt.hasNext();) {
>                 OWLIndividual individual = (OWLIndividual) jt.next();
>                 System.out.println(" - " + individual.getBrowserText());
>             }
>         }
>        
>     }
>    
> }
>
>
>
> This code when run using pizaa.owl or family.swrl.owl files is working 
> giving me the model output. But when i use the thesis.owl created by a 
> fellow student over here, i am not finding any output.
> And the warning goes like this : the system cannot find the ontology 
> http://www.w3.org/2003/11/swrl
>
> and the same for swrlb import also.
> It is asking to create the repository but its just a warning and if 
> ignored the rest of the code works fine with other OWL files but when 
> I use the thesis.owl file which i attached with this mail, i am unable 
> to get any output. I cannot make head or tail out of anything right 
> now. Is there any problem with the creation of OWL file I wonder?
>
> I am working on eclipse. I am trying to create a browser so that users 
> can browse through the ontologies. (not an editor)
> ------------------------------------------------------------------------
>
> _______________________________________________
> protege-owl mailing list
> protege-owl at lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/protege-owl
>
> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03 
>   




More information about the protege-owl mailing list