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

If given just a file via -t csv2rdf does not locate the metadata document #186

Open
RickMoynihan opened this issue Aug 17, 2022 · 1 comment
Labels
good first issue Good for newcomers

Comments

@RickMoynihan
Copy link
Member

RickMoynihan commented Aug 17, 2022

When running csv2rdf with just a -t table csv2rdf does not locate the metadata document, and instead performs the default conversion (note we should also provide a flag to adjust this behaviour #188).

It would be useful if csv2rdf could follow the spirit of the conventions specified in the specs for local files too.

Suggestion

NOTE: the specification falls back to RFC 5785 to specify the well-known location for the csvm templates file; however this RFC says nothing of what to do for the file:/// URI scheme.

Therefore I think the closest behaviour we can achieve here is to fallback to checking for a tool specific config folder ~/.csv2rdf/csvm, and use the template file from there; if no such template file is specified then we should use the default template file from the spec:

{+url}-metadata.json
csv-metadata.json

This would then give us the expected results where inputs like the following work:

-t file:///Users/rick/data/my-data.csv -> file:///Users/rick/data/my-data.csv-metadata.json
-t ../data/my-data.csv -> ../data/my-data.csv-metadata.json

with the final fall back csv-metadata.json being resolved in terms of the original provided URI/path. Resolution here will mean that a sibling csv-metadata.json to the supplied -t file will be located.

@RickMoynihan RickMoynihan changed the title If given just a file via -t csv2rdf does not appear to correctly locate the metadata document If given just a file via -t csv2rdf does not locate the metadata document Aug 17, 2022
@Robsteranium
Copy link
Member

Just to expand upon this, the locating metadata section of the spec defines the precedence:

  1. overriding metadata (csv2rdf -u)
  2. find via link header
  3. find via defaults/ configuration (.well-known/csvm)
  4. use embedded metadata

@RickMoynihan RickMoynihan added the good first issue Good for newcomers label Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants