So on read the base converts all relative URIs to the be grounded in the base. Is there any way to read a file with relative URIs and have the URIs remain relative?
On write the base converts all relative URIs to be grounded in the base in the output. Is there any way to write a file with relative URIs? In the preceeding example if the base were left out of the write would it make any difference in the output since all the URIs are absolute. Claude On Sun, Sep 15, 2013 at 11:24 PM, Andy Seaborne <[email protected]> wrote: > On 15/09/13 17:34, Claude Warren wrote: > >> Can someone give me an example where the base is actually used in the >> model.read and model.write calls? I thought I understood what it does but >> I can't seem to construct a unit test that shows it works. >> >> Claude >> >> > IIRC if a prefix is available, that is preferred over relative URIs. > > Relative URIs: > > public static void main(String ... argv) throws Exception > { > Model model = ModelFactory.**createDefaultModel() ; > String x = "<s> <p> <http://example/ns/o> ." ; > StringReader sr = new StringReader(x) ; > model.read(sr, "http://example/", "TTL") ; > model.write(System.out, "N-TRIPLES") ; > System.out.println("-----") ; > model.setNsPrefix("ex", "http://example/") ; > model.write(System.out, "RDF/XML-ABBREV", "http://example/ns/") ; > } > > > > <http://example/s> <http://example/p> <http://example/ns/o> . > > so relative URIs were resolved against the base. > > <rdf:RDF > > xmlns:rdf="http://www.w3.org/**1999/02/22-rdf-syntax-ns#<http://www.w3.org/1999/02/22-rdf-syntax-ns#> > " > xmlns:ex="http://example/"> > <rdf:Description rdf:about="/s"> > <ex:p rdf:resource="o"/> > </rdf:Description> > </rdf:RDF> > > rdf:resource="o" is relative to a base of "http://example/ns/" > > Andy > -- I like: Like Like - The likeliest place on the web<http://like-like.xenei.com> LinkedIn: http://www.linkedin.com/in/claudewarren
