Salut,
je créé une ontologie avec protégé. Je cherche un code pour remplir ma base de données (Mysql)

Le code de l'ontologie est
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
101
102
103
104
105
106
107
108
109
110
111
package Jena1;
 
import com.hp.hpl.jena.ontology.Individual;
import com.hp.hpl.jena.ontology.ObjectProperty;
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.ontology.OntProperty;
import com.hp.hpl.jena.rdf.model.*;
import com.hp.hpl.jena.query.*;
import com.hp.hpl.jena.util.FileManager;
import com.hp.hpl.jena.vocabulary.RDF;
import com.hp.hpl.jena.vocabulary.VCARD;
import com.hp.hpl.jena.ontology.DatatypeProperty;
 
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.io.StringWriter;
import java.util.Iterator;
import java.util.Collections;
import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.io.PrintWriter;
 
import org.apache.jena.atlas.logging.Log;
import org.apache.jena.iri.impl.Main;
import org.openjena.atlas.io.IndentedWriter;
 
import java.math.*;
import java.sql.*;
import java.sql.Statement;
import java.sql.ResultSet;
 
 
 
public class Hellojena {
 
    //private static final OntClass Personne = null;
 
    //private static Scanner kB;
 
    public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, SQLException, FileNotFoundException {
 
 
        Statement stmt;
        int mode;
        Class.forName("com.mysql.jdbc.Driver").newInstance();
        String url=new String("jdbc:mysql://localhost:3306/ontocl");
        Connection conn=DriverManager.getConnection(url, "root",null);
        System.out.println("connexion etablir...");
        stmt=conn.createStatement();
 
      OntModel model = ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM);
        //model.read(reader,null);
 
 
      FileInputStream in = null;
      try 
      {
         in=new FileInputStream("C:/Users/ontologies/exemple.owl");
      } 
      catch (FileNotFoundException ex) 
      {
         Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
      }
      model.read(in,null,null);
 
 
 
 
        Iterator classIter = model.listClasses();
 
      while (classIter.hasNext()) {
 
        OntClass ontClass = (OntClass) classIter.next();
        String uri = ontClass.getLocalName();
         if(uri != null)
        System.out.println(uri);
 
 
 
 
        ///////////// l'ajout des classes et ses sous classes     //////////////////////////
     if(ontClass.hasSubClass())
          {
            Iterator s = (Iterator) ontClass.listSubClasses();
 
            for (Iterator i = ontClass.listSubClasses(); i.hasNext();) {
                        OntClass c = (OntClass) i.next();
                        System.out.print("   " + c.getLocalName() + " " + "\n");
 
               String req="INSERT INTO `ontocl`.`Tp` ( `Subject` , `Property` , `Object` )"+
                          "VALUES ( '"+uri+"', 'subClassOf', '"+c.getLocalName()+"');";
 
                    mode=stmt.executeUpdate(req);
                      System.out.println(req);
 
                    }
          }  
 
        }
J'obtiens l'erreur suivante :
log4j:WARN No appenders could be found for logger (org.apache.jena.riot.system.stream.JenaIOEnvironment).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Enseignant
grade
Exception in thread "main" java.sql.SQLException: Champ 'Subject' inconnu dans field list
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2847)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1531)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1622)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2370)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2297)
at com.mysql.jdbc.Statement.executeUpdate(Statement.java:1289)
at Jena1.Hellojena.main(Hellojena.java:115)
Merci d'avance pour votre aide