Bonjour,
J'ai implémenté le code suivant sous eclipse et même j'ai inséré dans la classe path jena.jar, mais l'erreur se pose sur l'instruction:
OntModel ont = ModelFactory.createOntologyModel();
Le code complet est :
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
| import java.io.File;
import java.io.FileOutputStream;
import com.hp.hpl.jena.ontology.* ;
import com.hp.hpl.jena.rdf.model.* ;
public class SimpleOntoCreation {
public static void main(String[] args) throws Exception {
//Création de l'ontologie
OntModel ont = ModelFactory.createOntologyModel();
String namespace = "http://www.ontologie.fr/monOntologie#";
ont.createOntology (namespace);
//Création de la classe Voiture
OntClass voiture = ont.createClass (namespace + "#Voiture");
FileOutputStream fichierSortie = new FileOutputStream (new File ("ontologie.owl"));
ont.write (fichierSortie);
}
} |
Partager