IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Frameworks Discussion :

Erreurs de compilation d'une ontologie [Jena]


Sujet :

Frameworks

  1. #1
    Membre confirmé
    Inscrit en
    Octobre 2007
    Messages
    99
    Détails du profil
    Informations forums :
    Inscription : Octobre 2007
    Messages : 99
    Par défaut Erreurs de compilation d'une ontologie
    Bonjour à tous,

    J'ai crée un programme pour manipuler une ontologie (sur les relations Famille)

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    import java.util.*;
     
    import com.hp.hpl.jena.rdf.model.*;
     
    /**
     * A small family tree held in a Jena Model
     */
    public class FamilyModel {
     
      // Namespace declarations
      static final String familyUri = "http://family/";
      static final String relationshipUri = "http://purl.org/vocab/relationship/";
     
      // Jena model representing the family
      private Model model;
     
      /**
       * Creates a model and populates it with family members and their
       * relationships
       */
      private FamilyModel() {
     
        // Create an empty Model
        model = ModelFactory.createDefaultModel();
     
        // Create the types of Property we need to describe relationships
        // in the model
        Property childOf = model.createProperty(relationshipUri,"childOf");
        Property parentOf = model.createProperty(relationshipUri,"parentOf");
        Property siblingOf = model.createProperty(relationshipUri,"siblingOf");
        Property spouseOf = model.createProperty(relationshipUri,"spouseOf");
     
        // Create resources representing the people in our model
        Resource adam = model.createResource(familyUri+"adam");
        Resource beth = model.createResource(familyUri+"beth");
        Resource chuck = model.createResource(familyUri+"chuck");
        Resource dotty = model.createResource(familyUri+"dotty");
        Resource edward = model.createResource(familyUri+"edward");
        Resource fran = model.createResource(familyUri+"fran");
        Resource greg = model.createResource(familyUri+"greg");
        Resource harriet = model.createResource(familyUri+"harriet");
     
        // Add properties to describing the relationships between them
        adam.addProperty(siblingOf,beth);
        adam.addProperty(spouseOf,dotty);
        adam.addProperty(parentOf,edward);
        adam.addProperty(parentOf,fran);
     
        beth.addProperty(siblingOf,adam);
        beth.addProperty(spouseOf,chuck);
     
        chuck.addProperty(spouseOf,beth);
     
        dotty.addProperty(spouseOf,adam);
        dotty.addProperty(parentOf,edward);
        dotty.addProperty(parentOf,fran);
     
        // Statements can also be directly created ...
        Statement statement1 = model.createStatement(edward,childOf,adam);
        Statement statement2 = model.createStatement(edward,childOf,dotty);
        Statement statement3 = model.createStatement(edward,siblingOf,fran);
     
        // ... then added to the model:
        model.add(statement1);
        model.add(statement2);
        model.add(statement3);
     
        // Arrays of Statements can also be added to a Model:
        Statement statements[] = new Statement[5];
        statements[0] = model.createStatement(fran,childOf,adam);
        statements[1] = model.createStatement(fran,childOf,dotty);
        statements[2] = model.createStatement(fran,siblingOf,edward);
        statements[3] = model.createStatement(fran,spouseOf,greg);
        statements[4] = model.createStatement(fran,parentOf,harriet);
        model.add(statements);
     
        // A List of Statements can also be added
        List list = new ArrayList();
     
        list.add(model.createStatement(greg,spouseOf,fran));
        list.add(model.createStatement(greg,parentOf,harriet));
     
        list.add(model.createStatement(harriet,childOf,fran));
        list.add(model.createStatement(harriet,childOf,greg));
     
        model.add(list);
      }
     
      /**
       * Creates a FamilyModel and dumps the content of its RDF representation
       */
      public static void main(String args[]) {
     
        // Create a model representing the family
        FamilyModel theFamily = new FamilyModel();
     
        // Dump out a String representation of the model
        System.out.println(theFamily.model);
      }
    }
    Je n'ai aucune fautes dans ce programme, cependant quand je compile (sous Eclipse ou Commande) on m'affiche plein d'erreurs

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
    	at com.hp.hpl.jena.rdf.model.impl.PropertyImpl.<clinit>(PropertyImpl.java:61)
    	at com.hp.hpl.jena.enhanced.BuiltinPersonalities.<clinit>(BuiltinPersonalities.java:27)
    	at com.hp.hpl.jena.rdf.model.impl.ModelCom.<init>(ModelCom.java:51)
    	at com.hp.hpl.jena.rdf.model.ModelFactory.createDefaultModel(ModelFactory.java:125)
    	at com.hp.hpl.jena.rdf.model.ModelFactory.createDefaultModel(ModelFactory.java:119)
    	at FamilyModel.<init>(FamilyModel.java:25)
    	at FamilyModel.main(FamilyModel.java:96)
    Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
    	at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    	... 7 more
    MERCI d'avance pour vos réactions, car je ne comprend pourquoi il y a tant d'erreurs !!

  2. #2
    Membre Expert
    Avatar de CheryBen
    Inscrit en
    Mai 2005
    Messages
    1 599
    Détails du profil
    Informations personnelles :
    Âge : 43

    Informations forums :
    Inscription : Mai 2005
    Messages : 1 599
    Par défaut
    Bonjour, c'est parce que la librairie common-logging.jar n'est pas dans ton classpath. Si tu l'as quelque part il suffit de modifier ta variable classpath, sinon tu peux la télécharger ici.

  3. #3
    Membre confirmé
    Inscrit en
    Octobre 2007
    Messages
    99
    Détails du profil
    Informations forums :
    Inscription : Octobre 2007
    Messages : 99
    Par défaut
    Merci pour ta réaction,

    En faite j'ai bien installé l'API JENA avec toute sa "lib", et moi dans mon programme j'ai seulement ajouré dans "Add external JArs" : jena.jar.

    C'est sûrement pas le bon, mais lequel prendre pour exécuter mon programme?? ça je ne sais pas...

    Merci
    ++

  4. #4
    Membre Expert
    Avatar de CheryBen
    Inscrit en
    Mai 2005
    Messages
    1 599
    Détails du profil
    Informations personnelles :
    Âge : 43

    Informations forums :
    Inscription : Mai 2005
    Messages : 1 599
    Par défaut
    Citation Envoyé par morph41 Voir le message
    Bonjour, c'est parce que la librairie common-logging.jar n'est pas dans ton classpath.
    Tu dois aussi ajouter le répertoire lib de Jena qui doit contenir ce fichier.

  5. #5
    Membre confirmé
    Inscrit en
    Octobre 2007
    Messages
    99
    Détails du profil
    Informations forums :
    Inscription : Octobre 2007
    Messages : 99
    Par défaut
    Re,

    J'ai bien trouvé dans la librairie JENA, common-logging-1.1.1.jar. Je l'ai ajouté.

    Et mon programme ne compile toujours pas...

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xerces/util/XMLChar
    	at com.hp.hpl.jena.rdf.model.impl.Util.notNameChar(Util.java:87)
    	at com.hp.hpl.jena.rdf.model.impl.Util.splitNamespace(Util.java:67)
    	at com.hp.hpl.jena.graph.Node_URI.getLocalName(Node_URI.java:55)
    	at com.hp.hpl.jena.rdf.model.impl.ResourceImpl.getLocalName(ResourceImpl.java:126)
    	at com.hp.hpl.jena.rdf.model.impl.PropertyImpl.checkLocalName(PropertyImpl.java:78)
    	at com.hp.hpl.jena.rdf.model.impl.PropertyImpl.<init>(PropertyImpl.java:86)
    	at com.hp.hpl.jena.rdf.model.ResourceFactory$Impl.createProperty(ResourceFactory.java:244)
    	at com.hp.hpl.jena.rdf.model.ResourceFactory.createProperty(ResourceFactory.java:120)
    	at com.hp.hpl.jena.vocabulary.RDF.property(RDF.java:32)
    	at com.hp.hpl.jena.vocabulary.RDF.<clinit>(RDF.java:45)
    	at com.hp.hpl.jena.ontology.impl.OntResourceImpl.<clinit>(OntResourceImpl.java:63)
    	at com.hp.hpl.jena.enhanced.BuiltinPersonalities.<clinit>(BuiltinPersonalities.java:27)
    	at com.hp.hpl.jena.rdf.model.impl.ModelCom.<init>(ModelCom.java:51)
    	at com.hp.hpl.jena.rdf.model.ModelFactory.createDefaultModel(ModelFactory.java:125)
    	at com.hp.hpl.jena.rdf.model.ModelFactory.createDefaultModel(ModelFactory.java:119)
    	at FamilyModel.<init>(FamilyModel.java:25)
    	at FamilyModel.main(FamilyModel.java:96)
    Caused by: java.lang.ClassNotFoundException: org.apache.xerces.util.XMLChar
    	at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    	... 17 more
    Je ne sais plus quoi faire : J'ai le bon .jar dans la lib JENA, et ca ne fonctionne pas...AAAaaa

    Merci pour d'autres commentaires...

  6. #6
    Expert éminent
    Avatar de adiGuba
    Homme Profil pro
    Développeur Java/Web
    Inscrit en
    Avril 2002
    Messages
    13 938
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur Java/Web
    Secteur : Transports

    Informations forums :
    Inscription : Avril 2002
    Messages : 13 938
    Billets dans le blog
    1
    Par défaut
    Salut,


    Maintenant il te manque la librairie de Xerces : http://xml.apache.org/xerces2-j/


    Regarde dans la doc de Jena la liste des librairies requises ca ira plus vite !


    a++

  7. #7
    Membre confirmé
    Inscrit en
    Octobre 2007
    Messages
    99
    Détails du profil
    Informations forums :
    Inscription : Octobre 2007
    Messages : 99
    Par défaut
    Merci...J'ai ajouté dans la lib JENA le .jar : xerceslmpl.jar

    Il m'indique AUCUNE Erreurs !!! Encore merci pour vos réactions, ca m'a beaucoup aidé...
    Cependant dernière interrogation ; En compilant il m'inscrit ceci :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <ModelCom   {http://family/greg @http://purl.org/vocab/relationship/parentOf http://family/harriet; http://family/greg @http://purl.org/vocab/relationship/spouseOf http://family/fran; http://family/beth @http://purl.org/vocab/relationship/spouseOf http://family/chuck; http://family/beth @http://purl.org/vocab/relationship/siblingOf http://family/adam; http://family/fran @http://purl.org/vocab/relationship/parentOf http://family/harriet; http://family/fran @http://purl.org/vocab/relationship/spouseOf http://family/greg; http://family/fran @http://purl.org/vocab/relationship/siblingOf http://family/edward; http://family/fran @http://purl.org/vocab/relationship/childOf http://family/dotty; http://family/fran @http://purl.org/vocab/relationship/childOf http://family/adam; http://family/adam @http://purl.org/vocab/relationship/parentOf http://family/fran; http://family/adam @http://purl.org/vocab/relationship/parentOf http://family/edward; http://family/adam @http://purl.org/vocab/relationship/spouseOf http://family/dotty; http://family/adam @http://purl.org/vocab/relationship/siblingOf http://family/beth; http://family/harriet @http://purl.org/vocab/relationship/childOf http://family/greg; http://family/harriet @http://purl.org/vocab/relationship/childOf http://family/fran; http://family/edward @http://purl.org/vocab/relationship/siblingOf http://family/fran; http://family/edward @http://purl.org/vocab/relationship/childOf http://family/dotty; http://family/edward @http://purl.org/vocab/relationship/childOf http://family/adam; http://family/dotty @http://purl.org/vocab/relationship/parentOf http://family/fran; http://family/dotty @http://purl.org/vocab/relationship/parentOf http://family/edward; http://family/dotty @http://purl.org/vocab/relationship/spouseOf http://family/adam; http://family/chuck @http://purl.org/vocab/relationship/spouseOf http://family/beth} | >
    Est-ce bien normal??

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [Compiler] Erreur dans compilation avec une toolbox independante
    Par ImagingAllthe dans le forum MATLAB
    Réponses: 4
    Dernier message: 25/03/2008, 16h42
  2. erreur de compilation d'une servlet sous unix
    Par schrodinger dans le forum Servlets/JSP
    Réponses: 4
    Dernier message: 07/11/2007, 19h57
  3. erreur de compilation d'une fonction
    Par Jeff_p dans le forum GTK+ avec C & C++
    Réponses: 2
    Dernier message: 31/07/2007, 20h06
  4. Erreur de compilation d'une JSP
    Par casho dans le forum Servlets/JSP
    Réponses: 4
    Dernier message: 17/10/2006, 14h50
  5. Erreur de compilation sur une librairie en mode debug
    Par bakaneko dans le forum C++Builder
    Réponses: 2
    Dernier message: 18/05/2006, 16h32

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo