Looks like you need to include an additional library for 
org.apache.commons.logging.LogFactory class.

Regards,
Milorad





>________________________________
> From: aarthi <aarthirajara...@gmail.com>
>To: Milorad Tosic <mbto...@yahoo.com>; users <users@jena.apache.org> 
>Sent: Saturday, March 30, 2013 1:56 PM
>Subject: 
> 
>hi..
>  i'm doing my project with ontology. i need to retrieve the class and
>properties names in order to compare them for equality. to retrieve
>the class an property names i'm using a
>java code. i have attached that code with this mail. but i got some
>error, I don't know how to resolve that. for that i had import
>com.hp.hpl.jena package. i dont get the classpath files and javadoc
>files. is it enough if i add only the source package? pls help me....
>
>this is my code:
>
>
>//package testejena;
>import com.hp.hpl.jena.ontology.OntClass;
>import com.hp.hpl.jena.ontology.OntModel;
>import com.hp.hpl.jena.ontology.OntModelSpec;
>import com.hp.hpl.jena.rdf.model.ModelFactory;
>import com.hp.hpl.jena.util.FileManager;
>import com.hp.hpl.jena.util.iterator.ExtendedIterator;
>import java.io.InputStream;
>import java.util.Iterator;
>
>public class testeProp {
>    static final String inputFileName = "newspaper.owl";
>    public static void main(String args[]) {
>        try {
>            //create the reasoning model using the base
>            OntModel inf =
>ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM);
>
>            // use the FileManager to find the input file
>            InputStream in = FileManager.get().open(inputFileName);
>            if (in == null) {
>                throw new IllegalArgumentException("File: " +
>inputFileName + " not found");
>            }
>
>            inf.read(in, "");
>
>            String URI =
>"http://www.owl-ontologies.com/Ontology1363337688.owl#";;
>
>            ExtendedIterator classes = inf.listClasses();
>            while (classes.hasNext()) {
>                OntClass essaClasse = (OntClass) classes.next();
>
>                String vClasse = essaClasse.getLocalName().toString();
>
>                if (essaClasse.hasSubClass()) {
>                    System.out.println("Classe: " + vClasse);
>                    OntClass cla = inf.getOntClass(URI + vClasse);
>                    for (Iterator i = cla.listSubClasses(); i.hasNext();) {
>                        OntClass c = (OntClass) i.next();
>                        System.out.print("   " + c.getLocalName() + " " + 
>"\n");
>                    }
>                }
>            }
>        } catch (Exception e) {
>            System.out.println("there may be error");
>            System.out.println(e.getMessage());
>        }
>    }
>}
>
>
>--------------------------------------------------------------------------------------------------
>if i run my program i got the following error:
>
>
>Exception in thread "main" java.lang.NoClassDefFoundError:
>org/apache/commons/logging/LogFactory
>        at 
>com.hp.hpl.jena.rdf.model.impl.PropertyImpl.<clinit>(PropertyImpl.java:58)
>        at 
>com.hp.hpl.jena.enhanced.BuiltinPersonalities.<clinit>(BuiltinPersonalities.java:28)
>        at com.hp.hpl.jena.rdf.model.impl.ModelCom.<init>(ModelCom.java:51)
>        at 
>com.hp.hpl.jena.rdf.model.ModelFactory.createDefaultModel(ModelFactory.java:119)
>        at 
>com.hp.hpl.jena.rdf.model.ModelFactory.createDefaultModel(ModelFactory.java:113)
>        at 
>com.hp.hpl.jena.rdf.model.impl.ModelSpecImpl.<clinit>(ModelSpecImpl.java:56)
>        at testeProp.main(testeProp.java:16)
>Caused by: java.lang.ClassNotFoundException:
>org.apache.commons.logging.LogFactory
>        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>        at java.security.AccessController.doPrivileged(Native Method)
>        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
>        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>        ... 7 more
>Java Result: 1
>BUILD SUCCESSFUL (total time: 0 seconds)
>
>
>
>
>
>
>please anyone help me...
>
>
>
  • Re: Milorad Tosic
    • RE: John A. Fereira

Reply via email to