affichage d'un fichier RDF avec API jena
j'ai ce code là mail il ne fonctionne pas sur l'eclipse je sais pas pourquoi :( :( :( svp j'ai besoin de vous
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
| package test;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.Property;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.rdf.model.Statement;
import com.hp.hpl.jena.rdf.model.StmtIterator;
import com.hp.hpl.jena.util.FileManager;
public class test {
public static void main(String[] args) {
Model m = FileManager.get().loadModel( "/rdf/structure.example.txt" );
String NS = "http://www.dmoz.org/rdf/structure.example#";
Resource title2 = m.getResource( NS + "title2" );
for (StmtIterator i = title2.listProperties(); i.hasNext(); ) {
Statement s = i.next();
System.out.println( "title2 has property " + s.getPredicate() +
" with value " + s.getObject() );
}
Property contains = m.getProperty( NS + "contains" );
System.out.println( "title2.contains = " + title2.getProperty( contains )
.getObject());
}
} |
il m'affiche ce message :
Erreur : impossible de trouver ou charger la classe principale