OK, more or less what I suspected.

And IRIResolver.resolve(String relStr, String baseStr) can be used by
the parser for said URI resolution?
https://jena.apache.org/documentation/javadoc/arq/org/apache/jena/riot/system/IRIResolver.html#resolve-java.lang.String-java.lang.String-

So far I'm not implementing a proper ReaderRIOT yet, just doing some
conversion to RDF.

On Wed, Aug 14, 2019 at 12:13 PM Andy Seaborne <a...@apache.org> wrote:
>
> StreamRDF is an interface called by parsers (and other things) based on
> what it sees.
>
> If in, say Turtle, teh pasrer sees a "BASE" then base(...) is called.
>
> StreamRDF (it is an interface) does not do anything - its a stream of
> incoming RDF for the implementation to deal with.
>
> StreamRDFLib.writer writes N-quads.  No way to say "BASE".
>
> Triples sent to triple() should be already resolved - a parser
> responsibility.
>
>      Andy
>
> On 14/08/2019 09:28, Claude Warren wrote:
> > The StreamRDF just passed the base() argument on to the sink so that the
> > sink would have the base in order to set create the FQ URI from local
> > URIs.
> >
> > StreamRDFLib simply ignores the base() call.
>
> Did you mean StreamRDFBase?
>
> StreamRDFLib is a colelction of fucntiosn and isn't itself does not have
> the StreamRDF interface.
>
> >  I assume this is because it
> > is intended to process fully qualified RDF.
> >
> > I think the assumption is that if you are streaming into the graph you
> > would need the base() to resolve any inbound local URIs while if you are
> > streaming out from the graph the URIs are already fully resolved.
> >
> > I didn't write this code so I am not certain but if that is the case
> > perhaps we should note it in the javadocs.
> >
> > I do note that StreamRDF says it is for output, in which case I am not
> > certain why the base() is needed at all.
> >
> > Claude
> >
> >
> >
> > On Tue, Aug 13, 2019 at 11:46 PM Martynas Jusevičius 
> > <marty...@atomgraph.com>
> > wrote:
> >
> >> Hi,
> >>
> >> I'm trying to understand what the purpose/usage of StreamRDF.base() is.
> >>
> >> Isn't it supposed to set the base URI that relative URIs in the stream
> >> resolve against?
> >>
> >> I've made a simple test:
> >>
> >>      StreamRDF rdfStream = StreamRDFLib.writer(new BufferedWriter(new
> >> OutputStreamWriter(System.out)));
> >>      rdfStream.start();
> >>      rdfStream.base("http://localhost/";);
> >>      rdfStream.triple(new Triple(NodeFactory.createBlankNode(),
> >> NodeFactory.createURI("relative"), NodeFactory.createBlankNode()));
> >>      rdfStream.finish();
> >>
> >> The output I get:
> >>
> >> _:Bf410fc50X2De0baX2D464eX2D996eX2Dbb3207090baa <relative>
> >> _:B4b65b796X2D3561X2D4bf3X2Dbf31X2D1154aac0c816 .
> >>
> >> Why is the property URI <relative> and not <http://localhost/relative>?
> >> Doesn't that make the output invalid N-Triples? Or am I writing it wrong?
> >>
> >> Martynas
> >> atomgraph.com
> >>
> >
> >

Reply via email to