Problème de Lecture d'un fichier en Java/jena
Bonjour, je travaille en web sémantique sous java et Jena (Librairie Apache pour le web sémantique) et j'ai un soucis sur la lecture de mon fichier rdf
Mon code
Code:
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
|
public class Tuto extends Object {
static final String inputFileName ="vc-db-1.rdf";
public static void main (String args[]) {
// create an empty model
BasicConfigurator.configure();
Model model = ModelFactory.createDefaultModel();
// use the FileManager to find the input file
InputStream in = FileManager.get().open(inputFileName);
if (in == null) {
throw new IllegalArgumentException( "File: " + inputFileName + " not found");
}
System.out.println("After open file");
// read the RDF/XML file
model.read( in, "");
// select all the resources with a VCARD.FN property
ResIterator iter = model.listResourcesWithProperty(VCARD.FN);
if (iter.hasNext()) {
System.out.println("The database contains vcards for:");
while (iter.hasNext()) {
System.out.println(" " + iter.nextResource()
.getRequiredProperty(VCARD.FN)
.getString() );
}
} else {
System.out.println("No vcards were found in the database");
}
}
} |
il affiche ceci comme erreur : Exception in thread "main" java.lang.IllegalArgumentException: File: vc-db-1.rdf not found
Alors que j'ai pris soin de mettre le fichier dans le même package
Si j'aurai besoin d'aide stp 8-)8O