Hi,
you probably should check explicitly whether the second ontology was
actually imported.
Have a look at
OntModel.hasLoadedImport(String uri)
or
OntModel.listSubModels(boolean withImports)
I suppose there is a problem importing the second ontology since the URL
seems not to be resolvable.
~ Andreas
On 12.01.2017 16:30, Jos Lehmann wrote:
Hi there
SITUATION
-- A
I am working with ontology L (denoted as Ontology_input_file in Code below)
with URI:
http://www.b-l.net/ontologies/2016/L_Ontology.owl#
-- B
This ontology imports an ontology PS with URI:
http://www.b-l.net/ontologies/2016/PS_Ontology.owl#
Note that I have added a number of indivuduals to L, as individuals of classes
coming from import ontology PS. I.e. these individuals have L's URI but are of
types defined in PS.
PROBLEM
In order to get the complete list of individuals I use the following code:
OntModel model = ModelFactory.createOntologyModel();
model.read(Ontology_input_file);
ExtendedIterator individuals = model.listIndividuals();
while (individuals.hasNext()) {
Individual thisIndividual = (Individual) individuals.next();
System.out.println(thisIndividual.toString())
}
With this code I only get individuals defined in L as instances of classes that
have L's URI.
How do I get the entire list of individuals, including those described in B
above?
Thanks, Jos