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

Ontologies Discussion :

Ontology Load Exception


Sujet :

Ontologies

  1. #1
    Membre à l'essai
    Femme Profil pro
    Étudiant
    Inscrit en
    Mai 2012
    Messages
    31
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Mai 2012
    Messages : 31
    Points : 19
    Points
    19
    Par défaut Ontology Load Exception
    Je suis débutante en ontologie. J'essaie de manipuler une ontologie à travers Eclipse mais je trouve des problèmes malgré que j'ai installé tous les JAR nécessaires de Protégé.
    Voici mon code:
    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
    import java.util.Collection;
    import java.util.Iterator;
     
     
    import edu.stanford.smi.protegex.owl.ProtegeOWL;
    import edu.stanford.smi.protegex.owl.inference.dig.DefaultProtegeDIGReasoner;
    import edu.stanford.smi.protegex.owl.inference.pellet.ProtegePelletJenaReasoner;
    import edu.stanford.smi.protegex.owl.inference.pellet.ProtegePelletOWLAPIReasoner;
    import edu.stanford.smi.protegex.owl.inference.protegeowl.ReasonerManager;
    import edu.stanford.smi.protegex.owl.inference.reasoner.ProtegeReasoner;
    import edu.stanford.smi.protegex.owl.model.OWLModel;
    import edu.stanford.smi.protegex.owl.model.OWLNamedClass;
     
     
    public class Onto{ 
     
        public static void main(String[] args) { 
     
     String ONTOLOGY_URL = "fille:///C:/Program_Files/Protege_3.4.7/examples/krs1.owl";
     
            try {
                // Load the ontology from the specified URL
        OWLModel owlModel = ProtegeOWL.createJenaOWLModelFromURI(ONTOLOGY_URL);
     
     
            } catch (Exception e) {    
                e.printStackTrace();
            }         
        }
    }
    et le résultat du run est:




    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 at conn.Onto.main(Onto.java:26)

  2. #2
    Membre actif
    Avatar de April Fool
    Homme Profil pro
    Fou d'avril
    Inscrit en
    Février 2012
    Messages
    99
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Fou d'avril

    Informations forums :
    Inscription : Février 2012
    Messages : 99
    Points : 215
    Points
    215
    Par défaut
    Une chose est sûre : il faudrait corriger l'URL de l'ontologie.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    String ONTOLOGY_URL = "fille:///C:/Program_Files/Protege_3.4.7/examples/krs1.owl";
    Mettre "file" au lieu de "fille" et probablement "Program Files" au lieu de "Program_Files".
    7susd bl'ham owsql wuul pô!

  3. #3
    Membre éprouvé
    Avatar de Sapience
    Homme Profil pro
    Consultant sémantique & data à sparna.fr
    Inscrit en
    Avril 2005
    Messages
    305
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Indre et Loire (Centre)

    Informations professionnelles :
    Activité : Consultant sémantique & data à sparna.fr
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2005
    Messages : 305
    Points : 915
    Points
    915
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Unresolved compilation problems:      The type edu.stanford.smi.protege.exception.OntologyLoadException cannot be resolved
    Ce message d'erreur indique qu'il manque un jar dans ton classpath. En l'occurrence il s'agit du jar "protege.jar" qui est à la racine de Protege 3.
    Si tu as ensuite d'autres messages d'erreurs similaires il faudra trouver dans quel jar est la classe manquante, et les ajouter à ton classpath.

  4. #4
    Membre à l'essai
    Femme Profil pro
    Étudiant
    Inscrit en
    Mai 2012
    Messages
    31
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Mai 2012
    Messages : 31
    Points : 19
    Points
    19
    Par défaut
    Merci pour vos réponses Sapience et April Fool.
    Le problème est que j'ai ajouté tous les JAR qui existent dans le répertoire de protégé 3.4.7.(plugins).
    Pouvez-vous m'aider?

  5. #5
    Membre éprouvé
    Avatar de Sapience
    Homme Profil pro
    Consultant sémantique & data à sparna.fr
    Inscrit en
    Avril 2005
    Messages
    305
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Indre et Loire (Centre)

    Informations professionnelles :
    Activité : Consultant sémantique & data à sparna.fr
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2005
    Messages : 305
    Points : 915
    Points
    915
    Par défaut
    Vérifie que tu as ajouté "protege.jar", qui n'est pas dans le répertoire plugins, mais à la racine du répertoire Protégé.

  6. #6
    Membre à l'essai
    Femme Profil pro
    Étudiant
    Inscrit en
    Mai 2012
    Messages
    31
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Mai 2012
    Messages : 31
    Points : 19
    Points
    19
    Par défaut
    Merci Sapience pour votre réponse.
    Ca marche mais j'ai trouvé d'autres fautes :


    WARNING: [Local Folder Repository] The specified file must be a directory. (C:\Users\utilisateur\connect\plugins\edu.stanford.smi.protegex.owl) -- LocalFolderRepository.update()
    SEVERE: Error at loading file file:/C:/Program_Files/Protege_3.4.8/examples/examples/Krs1.owl -- Could not get input stream for file:/C:/Program_Files/Protege_3.4.8/examples/examples/Krs1.owl
    at edu.stanford.smi.protegex.owl.jena.parser.ProtegeOWLParser.getInputStream(Unknown Source)
    at edu.stanford.smi.protegex.owl.repository.util.XMLBaseExtractor.getXMLBase(Unknown Source)
    at edu.stanford.smi.protegex.owl.jena.parser.ProtegeOWLParser.run(Unknown Source)
    at edu.stanford.smi.protegex.owl.jena.JenaKnowledgeBaseFactory.loadKnowledgeBase(Unknown Source)
    at edu.stanford.smi.protege.model.Project.loadDomainKB(Unknown Source)
    at edu.stanford.smi.protege.model.Project.createDomainKnowledgeBase(Unknown Source)
    at edu.stanford.smi.protegex.owl.jena.creator.OwlProjectFromUriCreator.create(Unknown Source)
    at edu.stanford.smi.protegex.owl.ProtegeOWL.createJenaOWLModelFromURI(Unknown Source)
    at conn.Onto.main(Onto.java:24)
    Caused by: java.io.FileNotFoundException: C:\Program_Files\Protege_3.4.8\examples\examples\Krs1.owl (Le chemin d'accès spécifié est introuvable)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(Unknown Source)
    at java.io.FileInputStream.<init>(Unknown Source)
    at sun.net.http://www.protocol.file.FileURLConn...onnect(Unknown Source)
    at sun.net.http://www.protocol.file.FileURLConn...Stream(Unknown Source)
    at java.net.URL.openStream(Unknown Source)
    at edu.stanford.smi.protegex.owl.jena.parser.ProtegeOWLParser.getInputStream(Unknown Source)
    ... 8 more

    WARNING: Error found WARNING: java.io.FileNotFoundException: C:\Program_Files\Protege_3.4.8\examples\examples\Krs1.owl (Le chemin d'accès spécifié est introuvable) -- ProtegeOWL.handleErrors()
    WARNING: Error found WARNING: Errors at loading OWL file from file:/C:/Program_Files/Protege_3.4.8/examples/examples/Krs1.owl

    Please consider running the file through an RDF or OWL validation service such as:
    - RDF Validator: http://www.w3.org/RDF/Validator
    - OWL Validator: http://phoebus.cs.man.ac.uk:9999/OWL/Validator -- ProtegeOWL.handleErrors()
    .

  7. #7
    Membre à l'essai
    Femme Profil pro
    Étudiant
    Inscrit en
    Mai 2012
    Messages
    31
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Mai 2012
    Messages : 31
    Points : 19
    Points
    19
    Par défaut
    J'ai vérifié les plugins et j'ai trouvé ces warning :


    WARNING: [Local Folder Repository] The specified file must be a directory. (C:\Users\utilisateur\connect\plugins\edu.stanford.smi.protegex.owl) -- LocalFolderRepository.update()
    SEVERE: Exception caught -- java.net.URISyntaxException: Illegal character in path at index 18: file:///C:/Program Files/Protege_3.4.7/examples/Krs1.owl
    at java.net.URI$Parser.fail(Unknown Source)
    at java.net.URI$Parser.checkChars(Unknown Source)
    at java.net.URI$Parser.parseHierarchical(Unknown Source)
    at java.net.URI$Parser.parse(Unknown Source)
    at java.net.URI.<init>(Unknown Source)
    at edu.stanford.smi.protegex.owl.jena.JenaKnowledgeBaseFactory.getFileURI(Unknown Source)
    at edu.stanford.smi.protegex.owl.jena.JenaKnowledgeBaseFactory.loadKnowledgeBase(Unknown Source)
    at edu.stanford.smi.protege.model.Project.loadDomainKB(Unknown Source)
    at edu.stanford.smi.protege.model.Project.createDomainKnowledgeBase(Unknown Source)
    at edu.stanford.smi.protegex.owl.jena.creator.OwlProjectFromUriCreator.create(Unknown Source)
    at edu.stanford.smi.protegex.owl.ProtegeOWL.createJenaOWLModelFromURI(Unknown Source)
    at conn.Onto.main(Onto.java:24)

    java.lang.NullPointerException
    at edu.stanford.smi.protegex.owl.jena.JenaKnowledgeBaseFactory.loadKnowledgeBase(Unknown Source)
    at edu.stanford.smi.protege.model.Project.loadDomainKB(Unknown Source)
    at edu.stanford.smi.protege.model.Project.createDomainKnowledgeBase(Unknown Source)
    at edu.stanford.smi.protegex.owl.jena.creator.OwlProjectFromUriCreator.create(Unknown Source)
    at edu.stanford.smi.protegex.owl.ProtegeOWL.createJenaOWLModelFromURI(Unknown Source)
    at conn.Onto.main(Onto.java:24)

    Merci pour votre réponse.

  8. #8
    Membre éprouvé
    Avatar de Sapience
    Homme Profil pro
    Consultant sémantique & data à sparna.fr
    Inscrit en
    Avril 2005
    Messages
    305
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Indre et Loire (Centre)

    Informations professionnelles :
    Activité : Consultant sémantique & data à sparna.fr
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2005
    Messages : 305
    Points : 915
    Points
    915
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Caused by: java.io.FileNotFoundException:  C:\Program_Files\Protege_3.4.8\examples\examples\Krs1.owl (Le chemin  d'accès spécifié est introuvable)
    C'est explicite, non ? vérifie le chemin de ton fichier, voir la réponse d'April Fool précédemment.

  9. #9
    Membre à l'essai
    Femme Profil pro
    Étudiant
    Inscrit en
    Mai 2012
    Messages
    31
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Mai 2012
    Messages : 31
    Points : 19
    Points
    19
    Par défaut
    j'ai vérifié le chemin et j'ai corrigé le chemin.
    aprés run:

    WARNING: [Local Folder Repository] The specified file must be a directory. (C:\Users\utilisateur\connect\plugins\edu.stanford.smi.protegex.owl) -- LocalFolderRepository.update()
    SEVERE: Exception caught -- java.net.URISyntaxException: Illegal character in path at index 18: file:///C:/Program Files/Protege_3.4.7/examples/Krs1.owl
    at java.net.URI$Parser.fail(Unknown Source)
    at java.net.URI$Parser.checkChars(Unknown Source)
    at java.net.URI$Parser.parseHierarchical(Unknown Source)
    at java.net.URI$Parser.parse(Unknown Source)
    at java.net.URI.<init>(Unknown Source)
    at edu.stanford.smi.protegex.owl.jena.JenaKnowledgeBaseFactory.getFileURI(Unknown Source)
    at edu.stanford.smi.protegex.owl.jena.JenaKnowledgeBaseFactory.loadKnowledgeBase(Unknown Source)
    at edu.stanford.smi.protege.model.Project.loadDomainKB(Unknown Source)
    at edu.stanford.smi.protege.model.Project.createDomainKnowledgeBase(Unknown Source)
    at edu.stanford.smi.protegex.owl.jena.creator.OwlProjectFromUriCreator.create(Unknown Source)
    at edu.stanford.smi.protegex.owl.ProtegeOWL.createJenaOWLModelFromURI(Unknown Source)
    at conn.Onto.main(Onto.java:19)

    java.lang.NullPointerException
    at edu.stanford.smi.protegex.owl.jena.JenaKnowledgeBaseFactory.loadKnowledgeBase(Unknown Source)
    at edu.stanford.smi.protege.model.Project.loadDomainKB(Unknown Source)
    at edu.stanford.smi.protege.model.Project.createDomainKnowledgeBase(Unknown Source)
    at edu.stanford.smi.protegex.owl.jena.creator.OwlProjectFromUriCreator.create(Unknown Source)
    at edu.stanford.smi.protegex.owl.ProtegeOWL.createJenaOWLModelFromURI(Unknown Source)
    at conn.Onto.main(Onto.java:19)

  10. #10
    Membre à l'essai
    Femme Profil pro
    Étudiant
    Inscrit en
    Mai 2012
    Messages
    31
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Mai 2012
    Messages : 31
    Points : 19
    Points
    19
    Par défaut
    qu'est ce ça veut dire:
    "java.lang.NullPointerException"
    Merci de vos réponse

  11. #11
    Membre éprouvé
    Avatar de Sapience
    Homme Profil pro
    Consultant sémantique & data à sparna.fr
    Inscrit en
    Avril 2005
    Messages
    305
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Indre et Loire (Centre)

    Informations professionnelles :
    Activité : Consultant sémantique & data à sparna.fr
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2005
    Messages : 305
    Points : 915
    Points
    915
    Par défaut
    c'est dans le forum sur Java qu'il faudrait poser ta question...

  12. #12
    Membre à l'essai
    Femme Profil pro
    Étudiant
    Inscrit en
    Mai 2012
    Messages
    31
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Mai 2012
    Messages : 31
    Points : 19
    Points
    19
    Par défaut
    ok, merci Sapience.

  13. #13
    Membre à l'essai
    Femme Profil pro
    Étudiant
    Inscrit en
    Mai 2012
    Messages
    31
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Mai 2012
    Messages : 31
    Points : 19
    Points
    19
    Par défaut
    j'ai corrigé des fautes mais il reste une autre malheureusement
    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
    import java.net.URLEncoder;
     
    import edu.stanford.smi.protegex.owl.ProtegeOWL;
     
    import edu.stanford.smi.protegex.owl.model.OWLModel;
     
     
    public class Onto{ 
     
        public static void main(String[] args)throws Exception
        { 
     
             String url = "file:/C:/Program Files/Protege_3.4.7/Krs1.owl";
             url = URLEncoder.encode(url, "UTF-8"); 
            try {
                // Load the ontology from the specified URL
        OWLModel owlmodel = ProtegeOWL.createJenaOWLModelFromURI(url);
     
     
            } catch (Exception e) {    
            e.printStackTrace();
            }         
        }
    }
    voici le code qui pose problème
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    OWLModel owlmodel = ProtegeOWL.createJenaOWLModelFromURI(url);
    et resultat est:
    java.lang.IllegalArgumentException: URI is not absolute
    at java.net.URI.toURL(Unknown Source)
    at edu.stanford.smi.protegex.owl.jena.parser.ProtegeOWLParser.run(Unknown Source)
    at edu.stanford.smi.protegex.owl.jena.JenaKnowledgeBaseFactory.loadKnowledgeBase(Unknown Source)
    at edu.stanford.smi.protege.model.Project.loadDomainKB(Unknown Source)
    at edu.stanford.smi.protege.model.Project.createDomainKnowledgeBase(Unknown Source)
    at edu.stanford.smi.protegex.owl.jena.creator.OwlProjectFromUriCreator.create(Unknown Source)
    at edu.stanford.smi.protegex.owl.ProtegeOWL.createJenaOWLModelFromURI(Unknown Source)
    at conn.Onto.main(Onto.java:20)
    merci de vos réponses

  14. #14
    Membre actif
    Avatar de April Fool
    Homme Profil pro
    Fou d'avril
    Inscrit en
    Février 2012
    Messages
    99
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Fou d'avril

    Informations forums :
    Inscription : Février 2012
    Messages : 99
    Points : 215
    Points
    215
    Par défaut
    Essaie plutôt :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    String uri = new File("C:/Program Files/Protege_3.4.7/Krs1.owl").toURI();
    au lieu de :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    String url = "file:/C:/Program Files/Protege_3.4.7/Krs1.owl";
    url = URLEncoder.encode(url, "UTF-8");
    7susd bl'ham owsql wuul pô!

  15. #15
    Membre à l'essai
    Femme Profil pro
    Étudiant
    Inscrit en
    Mai 2012
    Messages
    31
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Mai 2012
    Messages : 31
    Points : 19
    Points
    19
    Par défaut
    Merci de votre réponse April Fool mais il y a un autre problème
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    Exception in thread "main" java.lang.Error: Unresolved compilation problem: 
    	Type mismatch: cannot convert from URI to String
     
    	at conn.Onto.main(Onto.java:20)

Discussions similaires

  1. Réponses: 0
    Dernier message: 30/08/2011, 10h12
  2. File Load Exception
    Par meryDev dans le forum Windows Forms
    Réponses: 2
    Dernier message: 07/07/2009, 16h21
  3. fichier properties load exception
    Par friedamichelle dans le forum Entrée/Sortie
    Réponses: 8
    Dernier message: 18/02/2009, 15h14
  4. [Lazy Loading] Exception à la lecture d une collection
    Par julienOriano dans le forum Hibernate
    Réponses: 4
    Dernier message: 04/06/2007, 12h56
  5. [System.load] Exception java.lang.UnsatisfiedLinkError avec unknown file type
    Par jemini_fr dans le forum API standards et tierces
    Réponses: 6
    Dernier message: 05/02/2007, 14h52

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