Bonjour, j'ai un problème avec le code suivant:

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
package recupInstance;
 
import java.io.InputStream;
import com.hp.hpl.jena.query.Query;
import com.hp.hpl.jena.query.QueryExecution;
import com.hp.hpl.jena.query.QueryExecutionFactory;
import com.hp.hpl.jena.query.QueryFactory;
import com.hp.hpl.jena.query.QuerySolution;
import com.hp.hpl.jena.query.ResultSet;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.shared.NotFoundException;
import com.hp.hpl.jena.sparql.util.IndentedWriter;
import com.hp.hpl.jena.util.FileManager;
import com.hp.hpl.jena.vocabulary.RDF;
 
public class RecupInstanceServer {
    public static final String inputFileName="C:/Program20%Files/Protege_3.4.7/examples/Krs1.owl";
    public static final String NL      = System.getProperty("line.separator") ;
    private static final Model model = null;
 
    public static void main( String[] args ) {
//      try {
 
//  InputStream in=null;
//  in=new FileInputStream(new File("C:/Program Files/Protege_3.4.8/examples/rdf/fichier.rdf"));
 
      // Creation d'un modele d'ontologie pour une ontologie OWL-DL avec un resonneur RDFS
//      Model m = ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM_RDFS_INF);
      Model model =ModelFactory.createMemModelMaker().createModel(null);
      // Lecture du fichier OWL. Le Namespace de notre ontologie doit etre specifié
      //InputStream in = (InputStream) FileManager.get().readModel( m, inputFileName );
      //if ( in == null )
          //        throw new NotFoundException("Not found: "+inputFileName) ;
            //  return load(in, "RDF/XML") ;
          }
    InputStream in = (InputStream)FileManager.get().readModel(  model, inputFileName );
 
 
 
    //    model.read(in, "RDF/XML");
 
 
 
//  
          String myOntologyName = "ProjetHela";
//    
       String uri="file:/C:/Program20%Files/Protege_3.4.7/examples/Krs1.owl";
       // Définition de prefixe pour simplifier l'utilisation de SPARQL
       String reuses        = "reuses: <"+RDF.getURI()+">" ;
//       String myOntologyPrefix = "PREFIX "+myOntologyName+": <"+myOntologyNS+">" ;
         String myOntologyPrefix = "PREFIX "+myOntologyName+": <"+uri+">" ;
 
 
 
       // Construction de la requete
//       String queryString =  myOntologyPrefix + NL 
//                            + reuses + NL 
 
   //  "SELECT ?hasnamefonctioncontrainte ?hasnamefonctionprincipale WHERE 
         //{{ ?Fonction_contrainte reuses:hasnamefonctioncontrainte ?hasnamefonctioncontrainte}UNION" +
    // " { ?Fonction_principale reuses:hasnamefonctionprincipale ?hasnamefonctionprincipale}}")
         String queryString= 
                 "PREFIX reuses: <http://www.owl-ontologies.com/reuses.owl#>"
                  + "SELECT ?hasnameactivite"
                  + " WHERE "
                 + "{"
                 + "{"
                 + " ?Activite reuses:hasnameactivite" 
 
             //    + " ?name had:nameactivite ?ac."
                 + " } "
                 + " } ";
 
 
               Query query = QueryFactory.create(queryString) ;
 
//       // Affichage de la requete sur la sortie standard.
       query.serialize(new IndentedWriter(System.out,true)) ;
       System.out.println();
 
       // Create a single execution of this query, apply to a model
       // which is wrapped up as a Dataset
     QueryExecution qexec = QueryExecutionFactory.create(query, model);
 
       // Execution de la requete
       try {
               // Pour l'instant nous nous limitons a des requetes de type SELECT
               ResultSet rs = qexec.execSelect() ;
 
               // Affichage des resultats
               for ( ; rs.hasNext() ; ){
                   System.out.print("");
                       QuerySolution rb = rs.nextSolution() ;
                       String y = rb.getLiteral("hasnameactivite").getString();
                       System.out.print("uri : "+y.toString()+"--- ");
 
}
       }
       finally{
         qexec.close() ;
} 
}
}
j'ai des erreur au niveau des lignes 80, 81 et 85
je sollicite votre aide.