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

pass name for default graph to the parser #13

Open elf-pavlik opened 5 years ago

elf-pavlik commented 5 years ago

This could work similar as still pending PR #10

Inspired by comment in https://github.com/rdfjs/data-model-spec/issues/144#issuecomment-473697146

@namedgraph: I think a more relevant experiment is reading such data, then taking it from the default graph and storing it into named graph, which name is most likely the URI the data was read from. Am I supposed to iterate the quads to change the graph component to do that?

@elf-pavlik: or it would make sense in a similar way as one can give baseIRI to the parser to also provide some kind of nameForDefaultGraph. This way quads could have that IRI instead the default graph from the begging.

I mentioned quad immutability in linked issue, here I would just like to gather feedback on providing an option similar to baseIRI to set name for default graph in parsers.

rubensworks commented 5 years ago

This is definitely a useful feature. I also do this in my JSON-LD and RDF/XML parsers using the defaultGraph constructor option, see https://github.com/rubensworks/jsonld-streaming-parser.js#configuration

blake-regalia commented 5 years ago

What would this mean for quad formats?

elf-pavlik commented 5 years ago

I think it would just affect the default graph of the dataset and have not impact on any of named graphs already existing in it. Only edge case I can think of would come if dataset has a default graph and existing named graph named with IRI one would want to use for default graph.