- From: Iwan Aucamp <aucampia@gmail.com>
- Date: Mon, 22 May 2023 21:38:55 +0200
- To: James Anderson <anderson.james.1955@gmail.com>
- Cc: public-rdf-dev@w3.org
- Message-ID: <CAGjV75DG5C0_uMh77fdOtDKWYyvz1zmXtNSeCV_xeXvt2W7f0w@mail.gmail.com>
> > To me, it is not clear that the intent is to serialize a subset of the RDF Dataset. > if that is not clear, than why has to author chosen a media type for triples rather than for quads? They could have made a mistake. If they explicitly wanted to serialize some subset of the Dataset, or just some graphs in the Dataset, they could have done that much more explicitly. > > One could argue that in this case, the caller asking for Turtle format it seems clear they just want to serialize a subset, but if this is being passed as a variable this no longer holds. > please explain " if this is being passed as a variable this no longer holds " If the code was: def routine(output_format: str) -> str: dataset = Dataset() # add some named graphs and triples to the dataset return dataset.serialize(format=output_format) Then the intent may be lost, as the code was possibly written with the intent of serializing the whole dataset, after all, the serialize function was called on the dataset, not one specific graph in the dataset. > > And after all, there are easy ways in which users can much more explicitly say that they want to serialize the default graph alone, and in those cases, the intent is much clearer. > the opposite is just as true. there are easy ways for an author to say that they want to serialize the entire dataset with graphs, but they did not. If `Dataset.serialize()` should signal intent as "best effort serialization of the dataset" instead of "serialize the whole dataset", then there is no way in python RDFLib for a user of RDFLib to request serializing the whole dataset, and a new function or flag would have to be introduced to do so. Iwan Aucamp On Sun, May 21, 2023 at 11:32 PM James Anderson < anderson.james.1955@gmail.com> wrote: > good evening; > > > On 21. May 2023, at 16:35, Iwan Aucamp <aucampia@gmail.com> wrote: > > > > but the sentiment remains the same: follow the expressed intent. > > I would agree with this, but I guess the real challenge is, what is the > expressed intent with code like this: > > > > dataset = Dataset() > > # add some named graphs and triples inside them > > dataset.serialize(format="turtle") > > To me, it is not clear that the intent is to serialize a subset of the > RDF Dataset. > > if that is not clear, than why has to author chosen a media type for > triples rather than for quads? > > > I would rather say that the expressed intent seems to be to serialize > the whole Dataset. > > ... as triples. > > > One could argue that in this case, the caller asking for Turtle format > it seems clear they just want to serialize a subset, but if this is being > passed as a variable this no longer holds. > > > > please explain " if this is being passed as a variable this no longer > holds " > > > And after all, there are easy ways in which users can much more > explicitly say that they want to serialize the default graph alone, and in > those cases, the intent is much clearer. > > the opposite is just as true. there are easy ways for an author to say > that they want to serialize the entire dataset with graphs, but they did > not. > > > > > From: James Anderson <anderson.james.1955@gmail.com> > > Date: Sun, 21 May 2023 10:16:18 +0200 > > To: public-rdf-dev@w3.org > > Message-Id: <D010D2F3-2B55-4353-86E1-FF6A5BFA676D@gmail.com> > > good morning; in the context of the original question, the closer > analogy might be to CONSTRUCT { ?s ?p ?o} WHERE { GRAPH ?g { ?s ?p ?o } } > but the sentiment remains the same: follow the expressed intent. > On 21. > May 2023, at 10:07, Reto Gmür <reto@factsmission.com> wrote: > > > > > > Good morning. > > > > > > I'd recommend to be consistent with CONSTRUCT { ?s ?p ?o} WHERE { ?s > ?p ?o } and to serialize the default graph by default. > > > > > > May 21, 2023 6:48:19 AM James Anderson <anderson.james.1955@gmail.com > >: > > > > > >> good morning; > > >> > > >> the issue is similar for graph store protocol put and post operations > and for sparql update load and insert operations. > > >> the insert operation is the only one which is explicit about the > consequences of the various combinations. > > >> if one takes it as the precedent, the effect should be to do what the > operation variant says to do. > > >> in this case, drop the graph. > > >> > > >>> On 21. May 2023, at 00:16, Iwan Aucamp <aucampia@gmail.com> wrote: > > >>> > > >>> Hi > > >>> > > >>> I would like some feedback on what people think the right behaviour > should be when serializing named graphs using a format that does not > support named graphs like Turtle or N-Quads. > > >>> > > >>> These are : > > >>> • > > >>> Raise an error: Indicate to the caller that the requested operation > cannot be completed successfully. The output in this case is somewhat > open-ended, in case of streaming there could be some output, though I would > expect the output to be a subset of #2, not of #3. > > >>> • Only output triples from the default graph, but don't output > triples from named graphs without raising an error. > > >>> • Output triples from the named graphs without a graph label without > raising an error. > > >>> > > >>> To me, #1 seems right - though Python RDFLib does #3 and Jena does > #2. > > >>> > > >>> Two GitHub issues related to this are: > > >>> > > >>> - <https://github.com/RDFLib/rdflib/issues/2393>: Formats that > don't support named graphs serialize Datasets and ConjunctiveGraphs with > non-default graphs without raising any errors > > >>> - <https://github.com/apache/jena/issues/1873>: Using riot with > N-Quads input with named graphs and N-Triples/Turtle output silently drops > part of the input #1873 > > >>> > > >>> Regards > > >>> Iwan Aucamp > > >> > > >> --- > > >> james anderson | james@dydra.com | https://dydra.com --- > > james anderson | james@dydra.com | https://dydra.com -- > > Iwan Aucamp > > --- > james anderson | james@dydra.com | https://dydra.com > > > >
Received on Monday, 22 May 2023 19:39:37 UTC