Hi Ian,
Thanks for the tip with respect to absolute paths. Will keep that in mind.
Even though the solution you mentioned, still does not work. :(
OntModelSpec spec = OntModelSpec.OWL_DL_MEM;*
>
> spec.getDocumentManager().**addAltEntry("http://www.example.com/**A.owl<http://www.example.com/A.owl>
> ",*
> "file:D:/ontology/A.owl");*
>
> spec.getDocumentManager().**addAltEntry("http://www.example.com/**B.owl<http://www.example.com/B.owl>
> ",
> "file:D:/ontology/B.owl");*
>
And yes, the owl:import exists in my ontology. To create an ontology I am
using Protege and I used OWL Functional Syntax to create the ontologies.
Thanks,
Ashish
On Tue, Nov 6, 2012 at 5:56 PM, Ian Dickinson <[email protected]> wrote:
> Hi Ahsish,
>
>
> On 06/11/12 11:47, ashish nijhara wrote:
>
>> I am a novice to the Jena API. I would like to read an ontology as
>> depicted
>> in the code below:
>>
>> The problem is the following:
>> 1. the ontology is not hosted on the web currently and have a local
>> copy.
>> I added the alt entry as depicted in the code below to address this.
>> This is A.owl in the below code.
>> 2. Ontology "A" has a direct import to Ontology "B". I also added the alt
>> entry for that.
>>
>> * OntModelSpec spec = OntModelSpec.OWL_DL_MEM;*
>> *
>> spec.getDocumentManager().**addAltEntry("www.example.com/**A.owl<http://www.example.com/A.owl>
>> ",*
>> * "file:D:/ontology/A.owl");*
>> *
>> spec.getDocumentManager().**addAltEntry("www.example.com/**B.owl<http://www.example.com/B.owl>
>> ",
>> "file:D:/ontology/B.owl");*
>>
>
> This should be the full URI, *exactly* as it appears in the source code
> that you are reading. So I would have expected:
>
> .addAltEntry( "http://www.example.com/B.owl"**,
> "file:D:/ontology/B.owl");
>
> assuming that you have in your source code:
>
> <>
> a owl:Ontology ;
> owl:imports "http://www.example.com/B.owl" .
>
>
> By the way, I don't use Windows, but I think you'll find that the
> alternate file URL will be more robust if you make it an absolute URL, not
> relative. So:
>
> "file://D:/ontology/B.owl"
>
> Ian
>
>