Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent Labeling for Blank Nodes Across Writers #1997

Closed
aliariff opened this issue Aug 29, 2023 · 3 comments · Fixed by #1999
Closed

Inconsistent Labeling for Blank Nodes Across Writers #1997

aliariff opened this issue Aug 29, 2023 · 3 comments · Fixed by #1999
Labels
enhancement Incrementally add new feature

Comments

@aliariff
Copy link
Contributor

Version

4.9.0

What happened?

There's an observed inconsistency in how blank nodes are labelled across different writer classes. The RowSetWriterCSV class labels blank nodes using the NodeToLabelMap. However, the RowSetWriterJSON and RowSetWriterXML writers decide on the labelling strategy based on the provided context:

boolean outputGraphBNodeLabels = (context != null) && context.isTrue(ARQ.outputGraphBNodeLabels);
labels = outputGraphBNodeLabels
    ? SyntaxLabels.createNodeToLabelAsGiven()
    : SyntaxLabels.createNodeToLabel();

For consistency across output formats, it's suggested to handle blank node labelling the same way across all writers. Specifically, the CSV writer should also decide the labelling strategy based on context, as in the JSON and XML writers.

Relevant output and stacktrace

No response

Are you interested in making a pull request?

Yes

@aliariff aliariff added the bug label Aug 29, 2023
@afs
Copy link
Member

afs commented Aug 29, 2023

Hi @aliariff - could you show a concrete example and say why it matters to you?

Especially for the CSV format, which is lossy anyway, it uses the _:bN form for brevity of display.

TSV preserves more of the RDF-ness like strings vs URIs.

Blank nodes in the results format are scoped to the result document - they don't represent the original blank node in the data. (That's a feature of blank nodes.)

@aliariff
Copy link
Contributor Author

Hi @afs,

Our platform allows users to export data in various formats, including JSON, XML, and CSV. When using ARQ.outputGraphBNodeLabels = true, the blank node labels in JSON and XML outputs appear without the _:bN form. However, in the CSV format, they're represented in the _:bN form.

Imagine a user referencing a blank node labelled node1 in a JSON file. If they decide to cross-reference or re-analyze the data in CSV, they would expect to see node1 but instead, they'd encounter something like _:b0, which could lead to confusion.

Though the _:bN form in CSV provides brevity, the inconsistency across formats can be misleading. Consistent representations across all export formats reduce potential misunderstandings for our users.

@afs
Copy link
Member

afs commented Aug 29, 2023

That is relying on a Jena-specific feature.

By the standards, blank nodes in the results format are scoped to the result document, not across documents. See, for example, the prettified Turtle output.

Bug label removed - this is a feature request.

If you want to put in a PR for an opt-in (using ARQ.outputGraphBNodeLabels) form of labels for CSV, then please do so.

@afs afs added enhancement Incrementally add new feature and removed bug labels Aug 29, 2023
aliariff added a commit to ACCURIDS/jena that referenced this issue Aug 31, 2023
…writing bnodes

Signed-off-by: Ali Ariff <ali.ariff@accurids.com>
aliariff added a commit to ACCURIDS/jena that referenced this issue Aug 31, 2023
…writing bnodes

Signed-off-by: Ali Ariff <ali.ariff@accurids.com>
@afs afs closed this as completed in #1999 Oct 17, 2023
afs pushed a commit that referenced this issue Oct 17, 2023
…g bnodes

Signed-off-by: Ali Ariff <ali.ariff@accurids.com>
cnanjo pushed a commit to fhircat/jena that referenced this issue Mar 2, 2024
…writing bnodes

Signed-off-by: Ali Ariff <ali.ariff@accurids.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Incrementally add new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants