Martin says:
> Model tmpModel = ModelFactory.createDefaultModel();
> tmpModel.read(ontologyURL);
> ontModel.add(tmpModel);
>
> Now ontModel doesn't have the prefixes contained in tmpModel. Am I do
> doing something wrong or do I just have to transfer prefix mapping
> explicitly?
You have to copy the prefixes explicitly.
The reason why is that when there are clashing prefixes ("spoo" maps
to different things in the two model, or the same URI has different
prefixes in the model) it's not clear what the right behaviour is.
You can use
ontModel.withDefaultPrefixes(tmpModel)
if you want the prefixes in tmpModel to be applied if they're not defined
in ontModel, or
ontModel.setNsPrefixes(tmpModel)
if you want prefixes in tmpModel to overwrite those in ontModel.
Or you could
ontModel.read(ontologyURL)
or
ontModel.getBaseModel().read(ontologyURL)
and not bother with tmpModel at all (the incoming prefixes will
overwrite existing ones if I recall correctly).
Chris
--
"It is seldom good news." ~Crystal Ball~, /The Tough Guide to Fantasyland/
Epimorphics Ltd, http://www.epimorphics.com
Registered address: Court Lodge, 105 High Street, Portishead, Bristol BS20 6PT
Epimorphics Ltd. is a limited company registered in England (number 7016688)