-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
Fetch a property for a list of QIDs in CSV format #148
Comments
For one property,
It can get tricky to get from JSON with deeply nested objects to CSV, but could work for some basic cases.
No, but almost: when you specify
I gave it a try in the this branch. The proposed syntax would be: echo Q3572332 Q98407233 Q10428420 | wd data --props claims.P6375 --format csv and output
Note that P6375 values are grouped per entity: we could generate several rows per entity as in your version, but I'm not sure how we could make it work for cases where there are several properties (generating all combinations seems unnecessarily verbose). Would that work for your use case? |
Thank you for the quick implementation! I was thinking this would be useful in lots of use cases, but my current use case is trying to find matches between certain Wikidata items and another big dataset (OpenStreetMap) based on street addresses. In this case, I need separate rows for each address to see if any of them match, and if I matched on multiple properties, it would be preferable to get all the combinations to see if any of them match a combination present in the other dataset. Could it make sense to do that by default and have an option like Multiple values is the difficult part also in the sense that before today I had no idea how to do the above in |
I'm very grateful that you posted those jq commands, I use jq a lot but never encountered those |
I have to add I'm not saying the solution for now couldn't be to include an example like these in wikibase-cli's documentation and people can use them as templates for what they need. |
I pushed more commits on that branch: now
but the previous behaviour can, as suggested, be recovered with |
I tested the current version briefly and I would have wanted to specify a custom separator instead of the comma as an argument to Also, I expected adding a claim to just result in an added column to the non-joined results, but of course, it turned on the joined mode. I understand this avoids combinatorial explosions but is it more important than consistency?
(By the way, I also noticed that the argument to format is not validated as I sometimes typed "CSV" instead of "csv".) |
Is there a good way to fetch one or multiple properties for a (potentially long) list of QIDs in CSV format?
Here's example code for what I have this far using
wd convert
but would it make sense for it to support--format csv
and fetching more than one property at a time?Or the same using
wd data
: (but does it fetch all item data and would it be more difficult to implement--format csv
?)The text was updated successfully, but these errors were encountered: