hmmmm..... I wonder if this might be the cause of some import issues.....
 Thx for the help.  Perhaps it is time to open the wiki and get some of
this documented there.... Guess I need to get back to looking into that.


On Wed, Sep 18, 2013 at 12:25 PM, Andy Seaborne <[email protected]> wrote:

> On 17/09/13 20:57, Claude Warren wrote:
>
>> public static void main(String ... argv) throws Exception
>>    {
>>    String[] lines = {
>> "<rdf:RDF",
>>      "  
>> xmlns:rdf=\"http://www.w3.org/**1999/02/22-rdf-syntax-ns#\<http://www.w3.org/1999/02/22-rdf-syntax-ns#%5C>
>> ">",
>>      "  <rdf:Description rdf:about=\"e\">",
>>      "    <p5>verify base works</p5>",
>>      "  </rdf:Description>",
>>      "</rdf:RDF>"
>> };
>>
>>    String eol = System.getProperty("line.**separator");
>> StringBuilder sb = new StringBuilder();
>> for (String l : lines)
>> {
>> sb.append( l ).append(eol);
>> }
>>
>>    Model model = ModelFactory.**createDefaultModel() ;
>>
>>      StringReader sr = new StringReader(sb.toString()) ;
>>      model.read(sr, "http://example/";) ;
>>      model.write(System.out, "N-TRIPLES") ;
>>      System.out.println("-----") ;
>>      model.setNsPrefix("ex", "http://example/";) ;
>>      model.write(System.out, "RDF/XML-ABBREV", "http://another/";) ;
>>    }
>>
>> The above should create an RDF file that in TTL would be
>> [ <e> <p5> "verify base works" . ]
>>
>> I would expect that the read could convert the <e> and <p5> to <
>> http://example/e> and <http://example/p5> respectively.  However,
>> if you run the code you get
>>
>> <http://example/e> <p5> "verify base works" .
>>
>> and then an exception due to a relative URI in the output.
>>
>> Should the <p5> be converted to <http://example/p5> either by the read or
>>    <http://another/p5> by the write?
>>
>
> You have the information I have :-)
>
> I looked at the RDF/XML spec and it seems to say that the URI resolution
> rules that are specific to RDF apply to rdf:about and rdf:id.  The rule for
> XML tags looks like it is only XML namespaces and the RDF addition for
> namespaces (concatenate namespace and local name; XML base does not apply
> to namepaces in XML processing)
>
>         Andy
>
>
>
>> Claude
>>
>>
>> On Tue, Sep 17, 2013 at 10:10 AM, Andy Seaborne <[email protected]> wrote:
>>
>>  On 17/09/13 07:41, Claude Warren wrote:
>>>
>>>  So to summarize:
>>>>
>>>> 1) URIs in  RDF inside jena are always absolute
>>>>
>>>>
>>> "should be" rather than "must be" because there are ways round it but it
>>> would not be proper RDF.
>>>
>>>
>>>   2) the "base" argument in a read provides the base to make relative
>>> URIs
>>>
>>>> absolute.
>>>>
>>>>
>>> Yes - except NT where the format does not have a base concept and
>>> relative
>>> URIs are illegal.
>>>
>>>
>>>   3)  If  the "base" on a read is not provided some reasonable value
>>> will be
>>>
>>>> constructed (e.g. file name) so there is no way to create an internal
>>>> representation of a relative URI through the read() methods.
>>>>
>>>>
>>> Yes because there is always a base URI - the current directory.
>>>
>>> This is not special to RDF - it comes from the URI RFC 3986, section 5.
>>>
>>>
>>>   4) the "base" argument in a write provides a mechanism to convert
>>> absolute
>>>
>>>> URIs to relative URIs in that URIs that have a namespace matching the
>>>> base
>>>> are written as relative URIs
>>>>
>>>>
>>> Yes (writer and syntax dependent)
>>>
>>>
>>>   5) if the "base" is not provided no conversion to relative URIs will be
>>>
>>>> performed.
>>>>
>>>>
>>>>  Yes
>>>
>>>
>>>
>>>  Does that cover it?
>>>>
>>>> Claude
>>>>
>>>>
>>>          Andy
>>>
>>>
>>
>>
>>
>


-- 
I like: Like Like - The likeliest place on the web<http://like-like.xenei.com>
LinkedIn: http://www.linkedin.com/in/claudewarren

Reply via email to