-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
How to create a duplicate of an item? #149
Comments
did you have a look at wd generate-template Q4115189 --create-mode --json | wb create-entity -v -s "Test: Copy [[Item:Q1234]]" |
Yes, thank you! For new users, this could be mentioned here: https://github.com/maxlath/wikibase-cli/blob/master/docs/write_operations.md#wb-create-entity I was able to finish the copying process but I had a few bumps even after finding
What worked in the end, the first step to copy items without claims: for i in `seq 1 100`; do
JSON="$(wd generate-template --create-mode --format json Q$i | jq 'del(.claims)')"
if [ "$(echo "$JSON" | jq length)" != "0" ]; then
wb create-entity -v -s "Copy from old wikibase" "$JSON" || break
else
wb create-entity -v -s "Copy from old wikibase" '{"labels": {"en": "(unused id)"}}' || break
fi
done The second step to copy claims to items: for i in `seq 1 100`; do
JSON="$(wd generate-template --format json Q$i)"
if [ "$(echo "$JSON" | jq length)" != "1" ]; then
wb edit-entity -v -s "Copy from old wikibase" "$JSON" || break
fi
done I did the same to properties manually first, but similar steps could work for them and then we'd have a simple way to subset Wikidata! :-) |
I'm trying to copy items from one wikibase to another. (I have copied properties manually first.)
To begin with something simpler, I tried to create a duplicate of an item within one wikibase:
wb create-entity -v -s "Test: Copy [[Item:Q1234]]" <(wb data Q1234 --simplify | jq '{type, labels, aliases, descriptions, claims, sitelinks}')
:Removing
--simplify
does not work either:wb create-entity -v -s "Test: Copy [[Item:Q1234]]" <(wb data Q1234 | jq '{type, labels, aliases, descriptions, claims, sitelinks}')
:Is this even feasible? My case is quite simple but apparently, Wikidata subsetting is a whole topic of its own: https://www.wikidata.org/wiki/Wikidata:WikiProject_Schemas/Subsetting
The text was updated successfully, but these errors were encountered: