hi

2 messages Options
Embed this post
Permalink
vinay gautam

hi

Reply Threaded More More options
Print post
Permalink
hi
I am new to Protege OWL-API wrote this. but giving lots of erro. I have uplaod all library files  but still showing error.  Plz resolve it give me some suggestion.
 
thankx
 
 
import
edu.stanford.smi.protegex.owl.model.OWLModel;

import edu.stanford.smi.protegex.owl.model.OWLNamedClass;

import edu.stanford.smi.protegex.owl.ProtegeOWL;

import edu.stanford.smi.protegex.owl.model.OWLIndividual;

import edu.stanford.smi.protegex.owl.inference.util.*;

import java.util.Collections;

import java.util.*;

public class vinay {

public static void main(String[] args) {

try

{

String uri =

"file:///C:/Documents and Settings/vinay/Desktop/Data Warhouse Gernalize Ontology/DataWH.owl";

OWLModel owlModel = ProtegeOWL.createJenaOWLModelFromURI(uri);

Collection classes = owlModel.getUserDefinedOWLNamedClasses();

for (Iterator it = classes.iterator(); it.hasNext();) {

OWLNamedClass cls = (edu.stanford.smi.protegex.owl.model.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();

}

}

}

catch(Exception e)

{

System.out.println(

"Exception");

}

}

}
 
Errors:
 

Exception in thread "main" java.lang.Error: Unresolved compilation problems:

The type

edu.stanford.smi.protege.exception.OntologyLoadException
cannot be resolved. It is indirectly referenced from required .class files

The method createJenaOWLModelFromURI(String) from the type ProtegeOWL refers to the missing type

OntologyLoadException

The type edu.stanford.smi.protege.model.Cls cannot be resolved. It is indirectly referenced from required .class files

The type edu.stanford.smi.protege.model.Instance cannot be resolved. It is indirectly referenced from required .class files

The type edu.stanford.smi.protege.model.SimpleInstance cannot be resolved. It is indirectly referenced from required .class files

Syntax error, insert ")" to complete Expression


_______________________________________________
protege-owl mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-owl

Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03
Anja Le Blanc

Re: hi

Reply Threaded More More options
Print post
Permalink
createJenaOWLModelFromURI(uri) throws the OntologyLoadException - you
should resolve the compilation problems first (import
edu.stanford.smi.protege.exception.OntologyLoadException this class
should be in a protage.jar)

Regards,
Anja


vinay gautam wrote:

> *
> hi
> I am new to Protege OWL-API wrote this. but giving lots of erro. I have
> uplaod all library files  but still showing error.  Plz resolve it give
> me some suggestion.
>  
> thankx
>  
>  
> import
> * edu.stanford.smi.protegex.owl.model.OWLModel;
>
> *import* edu.stanford.smi.protegex.owl.model.OWLNamedClass;
>
> *import* edu.stanford.smi.protegex.owl.ProtegeOWL;
>
> *import* edu.stanford.smi.protegex.owl.model.OWLIndividual;
>
> *import* edu.stanford.smi.protegex.owl.inference.util.*;
>
> *import* java.util.Collections;
>
> *import* java.util.*;
>
> *public* *class* vinay {
>
> *public* *static* *void* main(String[] args) {
>
> *try*
>
> {
>
> String uri =
>
> "file:///C:/Documents and Settings/vinay/Desktop/Data Warhouse Gernalize
> Ontology/DataWH.owl";
>
> OWLModel owlModel = _ProtegeOWL.createJenaOWLModelFromURI(uri)_;
>
> _Collection_ classes = owlModel.getUserDefinedOWLNamedClasses();
>
> *for* (_Iterator_ it = classes.iterator(); it.hasNext();) {
>
> OWLNamedClass cls = (edu.stanford.smi.protegex.owl.model.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()_;
>
> }
>
> }
>
> }
>
> *catch*(Exception e)
>
> {
>
> System.out.println(
>
> "Exception");
>
> }
>
> }
>
> }
>  
> Errors:
>  
>
> Exception in thread "main" java.lang.Error: Unresolved compilation
> problems:
>
> The type
>
> _edu.stanford.smi.protege.exception.OntologyLoadException_
> cannot be resolved. It is indirectly referenced from required .class files
>
> The method createJenaOWLModelFromURI(String) from the type ProtegeOWL
> refers to the missing type
>
> _OntologyLoadException_
>
> The type edu.stanford.smi.protege.model.Cls cannot be resolved. It is
> indirectly referenced from required .class files
>
> The type edu.stanford.smi.protege.model.Instance cannot be resolved. It
> is indirectly referenced from required .class files
>
> The type edu.stanford.smi.protege.model.SimpleInstance cannot be
> resolved. It is indirectly referenced from required .class files
>
> Syntax error, insert ")" to complete Expression
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> protege-owl mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/protege-owl
>
> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03
_______________________________________________
protege-owl mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-owl

Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03