You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Chris Tomlinson <ch...@gmail.com> on 2020/06/25 01:59:04 UTC

OntDocumentManager and LocatorClassLoader

Hi,

I've got a problem with OntDocumentManager when fetching resources from an element of the classpath via relative urls like   <altURL rdf:resource="adm/admin.ttl"/> .

When I use:

    OntDocumentManager odm = new OntDocumentManager("A/B/C/ont-policy.rdf")

or

    OntDocumentManager odm = new OntDocumentManager("https://xxxxx/a/b/c/ont-policy.rdf")

all works as expected. The relative urls are retrieved using the path to the ont-policy.rdf either file or url. Part of making this work is

    xmlns:base =""

in the policy file.

However, trying

    OntDocumentManager odm = new OntDocumentManager("plop/ont-policy.rdf")

finds the policy resource via the LocatorClassLoader - seen with TRACE enabled - as expected; but then all the relative urls are prepended with the path to the app.jar:

    java -jar /path/to/where/to/find/app.jar

I figure I'm missing some config or a uri scheme or something like that. I'm currently using 3.15.

Thank you for your help,
Chris

Re: OntDocumentManager and LocatorClassLoader

Posted by Andy Seaborne <an...@apache.org>.

On 25/06/2020 21:03, Chris Tomlinson wrote:
> Hi,
> 
> Today I’ve tried 3.16.0-SNAPSHOT and it is working the same as 3.15.0 and 3.14.0.
> 
> I think you’re right about the class loader case being a bit of a reach. The jar use case is not currently critical to our usage.
> 
> The test app <https://github.com/buda-base/shapes-testing/blob/master/src/main/java/OntTestLoading5_ONTS_RES_CT.java> is itself simple but the pom.xml may be a bit gnarly.

Code may be simple ("/Users/chris/" !!) but a complete, minimal example 
needs data.

Do you have standalone example? (I don't use Ont models so I'm in the 
dark about the details)

     Andy

> 
> Thanks,
> Chris
> 
>> On Jun 25, 2020, at 8:55 AM, Andy Seaborne <an...@apache.org> wrote:
>>
>>
>>
>> On 25/06/2020 12:55, Chris Tomlinson wrote:
>>> Hi Andy,
>>> Sorry, I put the version at the bottom.
>>
>> :-) given the other email, I didn't read that far. Sorry.
>>
>>> It’s 3.15, also 3.14.
>>
>> and not 3.16.0-SNAPSHOT
>>
>> Do you have complete, minimal example?
>>
>> I think what is happening is that reading imports from an indirected aren't going to know it was indirected.
>>
>> Up to 3.15.0 this code had not changed in a long time IIRC so it is a different issue to thread about location-mapping.
>>
>>     Andy
>>
>>> Thanks,
>>> Chris
>>>> On Jun 25, 2020, at 2:31 AM, Andy Seaborne <an...@apache.org> wrote:
>>>>
>>>> Jena version?
>>>>
>>>> On 25/06/2020 02:59, Chris Tomlinson wrote:
>>>>> Hi,
>>>>> I've got a problem with OntDocumentManager when fetching resources from an element of the classpath via relative urls like   <altURL rdf:resource="adm/admin.ttl"/> .
>>>>> When I use:
>>>>>      OntDocumentManager odm = new OntDocumentManager("A/B/C/ont-policy.rdf")
>>>>> or
>>>>>      OntDocumentManager odm = new OntDocumentManager("https://xxxxx/a/b/c/ont-policy.rdf")
>>>>> all works as expected. The relative urls are retrieved using the path to the ont-policy.rdf either file or url. Part of making this work is
>>>>>      xmlns:base =""
>>>>> in the policy file.
>>>>> However, trying
>>>>>      OntDocumentManager odm = new OntDocumentManager("plop/ont-policy.rdf")
>>>>> finds the policy resource via the LocatorClassLoader - seen with TRACE enabled - as expected; but then all the relative urls are prepended with the path to the app.jar:
>>>>>      java -jar /path/to/where/to/find/app.jar
>>>>> I figure I'm missing some config or a uri scheme or something like that. I'm currently using 3.15.
>>>>> Thank you for your help,
>>>>> Chris
> 
> 

Re: OntDocumentManager and LocatorClassLoader

Posted by Chris Tomlinson <ch...@gmail.com>.
Hi,

Today I’ve tried 3.16.0-SNAPSHOT and it is working the same as 3.15.0 and 3.14.0.

I think you’re right about the class loader case being a bit of a reach. The jar use case is not currently critical to our usage.

The test app <https://github.com/buda-base/shapes-testing/blob/master/src/main/java/OntTestLoading5_ONTS_RES_CT.java> is itself simple but the pom.xml may be a bit gnarly.

Thanks,
Chris

> On Jun 25, 2020, at 8:55 AM, Andy Seaborne <an...@apache.org> wrote:
> 
> 
> 
> On 25/06/2020 12:55, Chris Tomlinson wrote:
>> Hi Andy,
>> Sorry, I put the version at the bottom.
> 
> :-) given the other email, I didn't read that far. Sorry.
> 
>> It’s 3.15, also 3.14.
> 
> and not 3.16.0-SNAPSHOT
> 
> Do you have complete, minimal example?
> 
> I think what is happening is that reading imports from an indirected aren't going to know it was indirected.
> 
> Up to 3.15.0 this code had not changed in a long time IIRC so it is a different issue to thread about location-mapping.
> 
>    Andy
> 
>> Thanks,
>> Chris
>>> On Jun 25, 2020, at 2:31 AM, Andy Seaborne <an...@apache.org> wrote:
>>> 
>>> Jena version?
>>> 
>>> On 25/06/2020 02:59, Chris Tomlinson wrote:
>>>> Hi,
>>>> I've got a problem with OntDocumentManager when fetching resources from an element of the classpath via relative urls like   <altURL rdf:resource="adm/admin.ttl"/> .
>>>> When I use:
>>>>     OntDocumentManager odm = new OntDocumentManager("A/B/C/ont-policy.rdf")
>>>> or
>>>>     OntDocumentManager odm = new OntDocumentManager("https://xxxxx/a/b/c/ont-policy.rdf")
>>>> all works as expected. The relative urls are retrieved using the path to the ont-policy.rdf either file or url. Part of making this work is
>>>>     xmlns:base =""
>>>> in the policy file.
>>>> However, trying
>>>>     OntDocumentManager odm = new OntDocumentManager("plop/ont-policy.rdf")
>>>> finds the policy resource via the LocatorClassLoader - seen with TRACE enabled - as expected; but then all the relative urls are prepended with the path to the app.jar:
>>>>     java -jar /path/to/where/to/find/app.jar
>>>> I figure I'm missing some config or a uri scheme or something like that. I'm currently using 3.15.
>>>> Thank you for your help,
>>>> Chris


Re: OntDocumentManager and LocatorClassLoader

Posted by Andy Seaborne <an...@apache.org>.

On 25/06/2020 12:55, Chris Tomlinson wrote:
> Hi Andy,
> 
> Sorry, I put the version at the bottom.

:-) given the other email, I didn't read that far. Sorry.

> It’s 3.15, also 3.14.

and not 3.16.0-SNAPSHOT

Do you have complete, minimal example?

I think what is happening is that reading imports from an indirected 
aren't going to know it was indirected.

Up to 3.15.0 this code had not changed in a long time IIRC so it is a 
different issue to thread about location-mapping.

     Andy

> 
> Thanks,
> Chris
> 
> 
> 
>> On Jun 25, 2020, at 2:31 AM, Andy Seaborne <an...@apache.org> wrote:
>>
>> Jena version?
>>
>> On 25/06/2020 02:59, Chris Tomlinson wrote:
>>> Hi,
>>> I've got a problem with OntDocumentManager when fetching resources from an element of the classpath via relative urls like   <altURL rdf:resource="adm/admin.ttl"/> .
>>> When I use:
>>>      OntDocumentManager odm = new OntDocumentManager("A/B/C/ont-policy.rdf")
>>> or
>>>      OntDocumentManager odm = new OntDocumentManager("https://xxxxx/a/b/c/ont-policy.rdf")
>>> all works as expected. The relative urls are retrieved using the path to the ont-policy.rdf either file or url. Part of making this work is
>>>      xmlns:base =""
>>> in the policy file.
>>> However, trying
>>>      OntDocumentManager odm = new OntDocumentManager("plop/ont-policy.rdf")
>>> finds the policy resource via the LocatorClassLoader - seen with TRACE enabled - as expected; but then all the relative urls are prepended with the path to the app.jar:
>>>      java -jar /path/to/where/to/find/app.jar
>>> I figure I'm missing some config or a uri scheme or something like that. I'm currently using 3.15.
>>> Thank you for your help,
>>> Chris
> 

Re: OntDocumentManager and LocatorClassLoader

Posted by Chris Tomlinson <ch...@gmail.com>.
Hi Andy,

Sorry, I put the version at the bottom. It’s 3.15, also 3.14.

Thanks,
Chris



> On Jun 25, 2020, at 2:31 AM, Andy Seaborne <an...@apache.org> wrote:
> 
> Jena version?
> 
> On 25/06/2020 02:59, Chris Tomlinson wrote:
>> Hi,
>> I've got a problem with OntDocumentManager when fetching resources from an element of the classpath via relative urls like   <altURL rdf:resource="adm/admin.ttl"/> .
>> When I use:
>>     OntDocumentManager odm = new OntDocumentManager("A/B/C/ont-policy.rdf")
>> or
>>     OntDocumentManager odm = new OntDocumentManager("https://xxxxx/a/b/c/ont-policy.rdf")
>> all works as expected. The relative urls are retrieved using the path to the ont-policy.rdf either file or url. Part of making this work is
>>     xmlns:base =""
>> in the policy file.
>> However, trying
>>     OntDocumentManager odm = new OntDocumentManager("plop/ont-policy.rdf")
>> finds the policy resource via the LocatorClassLoader - seen with TRACE enabled - as expected; but then all the relative urls are prepended with the path to the app.jar:
>>     java -jar /path/to/where/to/find/app.jar
>> I figure I'm missing some config or a uri scheme or something like that. I'm currently using 3.15.
>> Thank you for your help,
>> Chris


Re: OntDocumentManager and LocatorClassLoader

Posted by Andy Seaborne <an...@apache.org>.
Jena version?

On 25/06/2020 02:59, Chris Tomlinson wrote:
> Hi,
> 
> I've got a problem with OntDocumentManager when fetching resources from an element of the classpath via relative urls like   <altURL rdf:resource="adm/admin.ttl"/> .
> 
> When I use:
> 
>      OntDocumentManager odm = new OntDocumentManager("A/B/C/ont-policy.rdf")
> 
> or
> 
>      OntDocumentManager odm = new OntDocumentManager("https://xxxxx/a/b/c/ont-policy.rdf")
> 
> all works as expected. The relative urls are retrieved using the path to the ont-policy.rdf either file or url. Part of making this work is
> 
>      xmlns:base =""
> 
> in the policy file.
> 
> However, trying
> 
>      OntDocumentManager odm = new OntDocumentManager("plop/ont-policy.rdf")
> 
> finds the policy resource via the LocatorClassLoader - seen with TRACE enabled - as expected; but then all the relative urls are prepended with the path to the app.jar:
> 
>      java -jar /path/to/where/to/find/app.jar
> 
> I figure I'm missing some config or a uri scheme or something like that. I'm currently using 3.15.
> 
> Thank you for your help,
> Chris
>