Hi There

as my own memory-aid & for anybody keen on answering query below: the reason I 
am doing line 10. below is that, when doing line 2., while the imports of 
Ontology_input_file are correctly read, the individuals of those imports 
created in Ontology_input_file are not read. In order to recover those 
individuals I do 10. and it works. 

But to do 10., I would like not to point to a specific file but be able to get 
to that file via Import_uri in Ontology_import_list (line 4.)

Thanks, Jos

-----Ursprüngliche Nachricht-----
Von: Jos Lehmann 
Gesendet: Freitag, 27. Januar 2017 17:02
An: [email protected]
Betreff: How to read imports given their URIs

Hi there

I am trying to read in an ontology imports.

Here is what I am doing at the moment:

1.  OntModel model = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM);
2.                      model.read(Ontology_input_file);
3.  
4.  Ontology_import_list = model.listImportedOntologyURIs(); 5.  
6.  
7.  Ontology_import_list.stream().forEach(Import_uri -> { 8.  
9.                      ont2.addImport(model2.createResource(Import_uri));
10.                     model.read(Ontology_input_file2);
11.                     Import_uri = Import_uri.concat("#");
12.                     String prefix = model.getNsURIPrefix(Import_uri);
13.                     PrefixMapping prefixMapping = 
model2.setNsPrefix(prefix, Import_uri);                   
15.             });


In line 10. I would like to change Ontology_input_file2 (which a string to 
points to a specific file in the directory of Ontology_input_file) with the 
file that, in the directory of Ontology_input_file, has Import_uri as uri.

Thanks, Jos  

Reply via email to