test de l' emballage;
importation java.io.FileInputStream;
importation java.io.IOException;
importation java.io.UnsupportedEncodingException;
importation java.util.Iterator;
importation com.hp.hpl.jena.ontology.OntClass;
importation com.hp.hpl.jena.ontology.OntModel;
importation com.hp.hpl.jena.ontology.OntModelSpec;
importation com.hp.hpl.jena.rdf.model.ModelFactory;
importer com.hp.hpl.jena.ontology *.
public class {testjena
public static void main (String [] args) throws UnsupportedEncodingException {
Chaîne owlPath = "e: // bis cible London ontologie .owl";
// Création d'une instance de corps
OntModel ontModel = ModelFactory
.createOntologyModel (OntModelSpec.OWL_MEM);
// Charger le corps du document
ontModel.read ( "file:" + owlPath, "RDF / XML");
Chaîne temp = "";
// Itérer lire tous les noeuds dans le corps
for (i = itérateur ontModel.listClasses (); i.hasNext ();) {
OntClass c = (OntClass) i.next ();
c.listSuperClasses ();
if (! c.isAnon ()) {
Chaîne tmp = c.getLocalName () toString ().
// Récupère le corps de noeud, comme une chaîne de caractères stockée dans la variable temp
tmp = new String (tmp.getBytes ( "UTF-8"), "UTF-8");
Temp + = tmp + "\ r \ n";
System.out.println (temp);
}
}
// créer le modèle et le fichier owl d'importation
}}
importation java.io.FileInputStream;
importation java.io.IOException;
importation java.io.UnsupportedEncodingException;
importation java.util.Iterator;
importation com.hp.hpl.jena.ontology.OntClass;
importation com.hp.hpl.jena.ontology.OntModel;
importation com.hp.hpl.jena.ontology.OntModelSpec;
importation com.hp.hpl.jena.rdf.model.ModelFactory;
importer com.hp.hpl.jena.ontology *.
public class {testjena
public static void main (String [] args) throws UnsupportedEncodingException {
Chaîne owlPath = "e: // bis cible London ontologie .owl";
// Création d'une instance de corps
OntModel ontModel = ModelFactory
.createOntologyModel (OntModelSpec.OWL_MEM);
// Charger le corps du document
ontModel.read ( "file:" + owlPath, "RDF / XML");
Chaîne temp = "";
// Itérer lire tous les noeuds dans le corps
for (i = itérateur ontModel.listClasses (); i.hasNext ();) {
OntClass c = (OntClass) i.next ();
c.listSuperClasses ();
if (! c.isAnon ()) {
Chaîne tmp = c.getLocalName () toString ().
// Récupère le corps de noeud, comme une chaîne de caractères stockée dans la variable temp
tmp = new String (tmp.getBytes ( "UTF-8"), "UTF-8");
Temp + = tmp + "\ r \ n";
System.out.println (temp);
}
}
// créer le modèle et le fichier owl d'importation
}}