Open v4ss4llo opened 6 years ago
This is because you didn't provide any fix file how you would like to see RDF in CSV converted. By default NT files are imported into Catmandu as a deeply nested HASH.
But .nt files are very easy to parse. You could try this:
$ catmandu convert Text to CSV --fix 'parse_text(text,"(?<s><\S+>)\s+(?<p><\S+>)\s+(?<o>.*)\s+\."); move_field(text,.)'< demo.nt > demo.csv
Can I suggest that you guys add a simpler command for this? Especially since RDF are easy to parse as you said, using convert Text to CSV --fix 'parse_text(text,"(?<s><\S+>)\s+(?<p><\S+>)\s+(?<o>.*)\s+\."); move_field(text,.)'
is not handy at all...
TSV (tab delimited format) should be available by default in RDF::Trine but is not available due to a missing include and a bug in the output. See also:
https://github.com/kasei/perlrdf/issues/155
A pull request for RDF::Trine is on its way and with it you can do:
$ catmandu convert RDF --type NTriples to RDF --type TSV < data.nt > data.csv
Looks cool. I'll leave this open until the PR is merged.
Is it possible convert from .nt to .csv? I get a weird result like this