1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| String URIB="http://www.semanticweb.org/SEVEN7/ontologies/2012/2/Ontology1331977184905.owl";
OntModel model = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_MICRO_RULE_INF);
String inputFileName ="C:\\Users\\sarah\\Desktop\\onto.owl";
// use the FileManager to find the input file
InputStream in = FileManager.get().open(inputFileName );
if (in == null) {
model.read(in, " ", inputFileName);
throw new IllegalArgumentException("File: " + inputFileName + " not found");}
OntModel mod = ModelFactory.createOntologyModel();
OntClass Chercheur = mod.getOntClass(URIB+"Chercheur");
DatatypeProperty nomProp = mod.getDatatypeProperty("http://www.semanticweb.org/SEVEN7/ontologies/2012/2/Ontology1331977184905.owl#Nom");
Individual c = mod.createIndividual("http://www.semanticweb.org/SEVEN7/ontologies/2012/2/Ontology1331977184905.owl#Chercheur",Chercheur);
// on peut éventuellement mettre un langageTag:
Literal n = mod.createLiteral("sarah");
mod.createLiteralStatement(c, nomProp, n); |
Partager