hi thanks.. it worked correctly. because i didn't add the jena files
correctly.sorry for that. and  i need to retrieve the class and
properties names from an ontology. if i execute my previous code i
just got the triple format. is there anyway to store the class and
properties names in a separate file or in a database? if its possible
please guide me.....








On 3/30/13, Andy Seaborne <[email protected]> wrote:
> Which version of Jena is this?
>
> Jena doesn't use Apache commons logging (it did a long time ago, I
> think).  For some libraries we use, there is a Apache commons logging
> dependency, which is met via jcl-over-slf4j in the POMs.
>
> But that's nowhere near PropertyImpl, which has a reference to SLF4J
> nowadays.
>
>       Andy
>
>  >>> 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)
>
>
> On 30/03/13 13:38, John A. Fereira wrote:
>> Specifically, you'll need to include the commons-logging jar file in your
>> classpath.  Typically that would mean specifying a directory which
>> includes that jar file as well as the jar files for the jena library and
>> any other dependency library.  You'll probably also need to include one
>> for log4j or simple logging (slf4j) library.
>>
>>> -----Original Message-----
>>> From: Milorad Tosic [mailto:[email protected]]
>>> Sent: Saturday, March 30, 2013 9:07 AM
>>> To: aarthi; users
>>> Subject: Re:
>>>
>>> Looks like you need to include an additional library for
>>> org.apache.commons.logging.LogFactory class.
>>>
>>> Regards,
>>> Milorad
>>>
>>>
>>>
>>>
>>>
>>>> ________________________________
>>>> From: aarthi <[email protected]>
>>>> To: Milorad Tosic <[email protected]>; users <[email protected]>
>>>> 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;
>>>>PropertyImpl
>>>> 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>(BuiltinPersonal
>>> i
>>>> ties.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.ja
>>> v
>>>> a: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
      • Re: Andy Seaborne
        • Re: aarthi
          • Re: aarthi
            • Re: Mark Fischer
            • Re: Milorad Tosic

Reply via email to