CARVIEW |
Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
How should CSV2JSON behave when generating objects #755
Comments
I am not sure. There may be good reasons for the user to keep that arrays and I am always a bit afraid of trying to guess the user's intention. I would think we should leave it as is...
|
gkellogg
added a commit
that referenced
this issue
Oct 17, 2015
|
gkellogg |
Tests for multiple columns using same propertyUrl and multiple ordere…
…d/unordered values. For #755. |
13c884c
|
gkellogg
referenced
this issue
Oct 17, 2015
Merged
Tests for multiple columns using same propertyUrl and multiple ordere… #757
I created some tests for this, and in the process looked at my implementation further. I disagree with @6a6d74's proposed resolution and think that, for JSON, values should be merged into a single array. This is a fairly artificial example (multiple columns with the same propertyUrl and multiple values per column), but it is IMHO, the simplest implementation and a more natural consequence. It would be odd if adding a single column to a CSV were to make values which were simply in an array, to now be an array of arrays. The purpose of using the same propertyUrl is to merge values from different columns, (again, IMO), so having the values be merged together makes the most sense to me. |
@gkellogg - thanks for progressing this. I'm neutral for either approach.
|
@JeniT's implementation should inform this too. |
My apologies if I appear as defening the process orthodoxy here, but I guess it is my role... The specification extract that @6a6d74 quoted seems to be pretty much unequivocal: the result is an array of arrays. What you propose means to make a technical change in the document in a CR. Not because there is a problem with implementations (that is obviously not the case) but for other reasons. Although the changes are minimal, it still is a red flag that we have to justify more seriously than just "would be odd", otherwise we can get into a push back situation. Is it worth it? I do not think so, hence my proposal to leave it as is. |
That extract is Jeremy's proposed change. I believe my interpretation is consistent with the published version:
|
Oops, my apologies! I misread and did not check. I agree with you.
|
I agree with generating an array of individual values (not an array of arrays) when converting to JSON. |
Closed. See PR #760 |
6a6d74 commentedOct 14, 2015
In response to comments from timeless (see ISSUE #679) the CSV2JSON conversion process for Generating Objects has been updated. Regarding how the information from multiple cells in the row being currently processed that refer to the same subject
i
, the final step (no. 2.4) now says:This situation occurs when multiple columns in the table use the same property URL annotation.
For CSV2RDF, we think the process is clear:
For CSV2JSON, the behaviour is a little different - in JSON, arrays are always ordered. Currently, the doc says that the arrays from the contributing cells should be kept separate; forming an array of arrays. A better behaviour for users is likely to be providing a single flattened array.
This needs to be considered further.
What ever the outcome, we need a test case to validate this edge case.