rdfjs / stream-spec

RDF/JS: Stream interfaces – A specification of a low level interface definition representing RDF data independent of a serialized format in a JavaScript environment.
https://rdf.js.org/stream-spec/
5 stars 2 forks source link

Standardise a baseIRI parameter on import #18

Open tpluscode opened 4 years ago

tpluscode commented 4 years ago

As discussed in https://github.com/rdfjs/rdfxml-streaming-parser.js/issues/41, @rubensworks proposed to add a parameter to the import method so that it's a standard feature of all parsers to accept a baseIRI

const parser = new MyParser()

parser.import(stream, { baseIRI: 'http://example.com' })

This is already implemented by a most and would nicely complement the analogous param on the constructor

rubensworks commented 4 years ago

Just to note, several parsers (N3, RDF/XML, JSON-LD, RDFa) have this parameter on the constructor, instead of the import method. It might make sense to have a standard for what as well/instead.

tpluscode commented 4 years ago

That is already there: https://github.com/rdfjs/stream-spec/blob/master/index.html#L155

And not "instead of". Those are separate features

rubensworks commented 4 years ago

That is already there: https://github.com/rdfjs/stream-spec/blob/master/index.html#L155

Oh, I completely missed that, then my implementations adhere to it by coincidence 😄

And not "instead of". Those are separate features

Just wondering if this will not be too confusing for people, as there would be two places to set a baseIRI.

tpluscode commented 3 years ago

Just wondering if this will not be too confusing for people, as there would be two places to set a baseIRI.

I mostly use the Sink returned by a sink map, typically constructed by @rdf-esm/formats-common or even @rdfjs/fetch. This way I never call the constructor myself and thus have no opportunity for setting the base.