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

Forward base to parser and serializer #5

Closed bergos closed 5 years ago

bergos commented 7 years ago

We should define a standard way to forward the base IRI to the parser and serializer.

elf-pavlik commented 7 years ago

additional options parameter as you suggested in #44 makes sense to me

elf-pavlik commented 7 years ago

https://github.com/rdfjs/representation-task-force/issues/79#issuecomment-255759148

@RubenVerborgh: In any case, make baseIRI and factory properties of an options object, not individual parameters.

elf-pavlik commented 7 years ago

rdf-ext already seems to use baseIRI https://github.com/rdf-ext/rdf-fetch-lite/blob/develop/lib/patch-response.js#L15

@bergos would you like to propose adding it to spec in PR?

bergos commented 7 years ago

I will make a PR for baseIRI, but I'm on the road and can't do it before end of next week. If someone want's to do it in the meantime, feel free.

elf-pavlik commented 7 years ago

Since #113 makes parsers rely on Sink#import() I understand it will get additional options object which will have baseIRI as one of its properties. Which seems like step towards suggestion from #44

ericprud commented 5 years ago

The current Stream interface has prefix:

interface Stream : EventEmitter {
  Quad read();
  ...
  attribute Event data;
  attribute Event prefix;
};

This is usually sufficient because whatever created a Store could be passed a baseIRI. If your RDF has a BASE declaration, the API has no way to retrieve it. While both prefixed as base are outside of the RDF model, they're pretty handy for making tools user-friendly and when they aren't available, people resort to heuristic hacks.

PROPOSE: add attribute Event prefix to Stream with this defn:

base `base(NamedNode base)` This event is emitted every time a document base is set to some IRI.

It's not super precise, but it seems compatible with the defn for prefix.

elf-pavlik commented 5 years ago

resolved in #10