wikibase-cli 19.4.2 → 20.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/README.md +2 -4
  2. package/bin/wb-claims.js +1 -1
  3. package/bin/wb-config.js +1 -1
  4. package/bin/wb-graph-path.js +85 -0
  5. package/bin/wb-props.js +1 -1
  6. package/bin/wb-query.js +6 -1
  7. package/bin/wb-search.js +1 -1
  8. package/lib/common_errors.js +1 -1
  9. package/lib/config/config.js +1 -1
  10. package/lib/config/credentials_config.js +1 -1
  11. package/lib/debug.js +1 -1
  12. package/lib/edit/assert_credentials.js +1 -1
  13. package/lib/edit/edit_command.js +1 -1
  14. package/lib/edit/init_credentials.js +1 -1
  15. package/lib/edit/prompt.js +1 -1
  16. package/lib/entity_attribute_command.js +1 -1
  17. package/lib/errors.js +1 -1
  18. package/lib/exit_on_missing.js +1 -1
  19. package/lib/fetch_lang_props.js +1 -1
  20. package/lib/get_claims_texts.js +1 -3
  21. package/lib/log_claims.js +1 -1
  22. package/lib/log_command_examples.js +1 -1
  23. package/lib/make_sparql_query.js +1 -1
  24. package/lib/object_arg_parser.js +1 -1
  25. package/lib/output.js +1 -1
  26. package/lib/properties.js +1 -1
  27. package/lib/reset_properties.js +1 -1
  28. package/lib/summary_parser.js +2 -2
  29. package/lib/tabularize.js +1 -1
  30. package/metadata/add-alias.js +3 -3
  31. package/metadata/add-badge.js +1 -1
  32. package/metadata/add-claim.js +2 -2
  33. package/metadata/add-qualifier.js +7 -7
  34. package/metadata/add-reference.js +3 -3
  35. package/metadata/aliases.js +3 -3
  36. package/metadata/badges.js +1 -1
  37. package/metadata/claims.js +7 -7
  38. package/metadata/config.js +11 -11
  39. package/metadata/convert.js +4 -4
  40. package/metadata/create-entity.js +3 -3
  41. package/metadata/data.js +8 -8
  42. package/metadata/delete-entity.js +2 -2
  43. package/metadata/description.js +3 -3
  44. package/metadata/edit-entity.js +5 -5
  45. package/metadata/generate-template.js +6 -6
  46. package/metadata/graph-path.js +18 -0
  47. package/metadata/id.js +3 -3
  48. package/metadata/label.js +4 -4
  49. package/metadata/lang.js +3 -3
  50. package/metadata/lemma.js +3 -3
  51. package/metadata/merge-entity.js +1 -1
  52. package/metadata/move-claim.js +7 -7
  53. package/metadata/move-qualifier.js +3 -3
  54. package/metadata/open.js +12 -12
  55. package/metadata/props.js +10 -10
  56. package/metadata/query.js +15 -15
  57. package/metadata/remove-alias.js +3 -3
  58. package/metadata/remove-badge.js +1 -1
  59. package/metadata/remove-claim.js +2 -2
  60. package/metadata/remove-description.js +1 -1
  61. package/metadata/remove-label.js +1 -1
  62. package/metadata/remove-qualifier.js +3 -3
  63. package/metadata/remove-reference.js +3 -3
  64. package/metadata/remove-sitelink.js +1 -1
  65. package/metadata/revisions.js +5 -5
  66. package/metadata/search.js +5 -5
  67. package/metadata/set-alias.js +3 -3
  68. package/metadata/set-description.js +2 -2
  69. package/metadata/set-label.js +2 -2
  70. package/metadata/set-sitelink.js +1 -1
  71. package/metadata/sparql.js +9 -9
  72. package/metadata/summary.js +4 -4
  73. package/metadata/update-claim.js +3 -3
  74. package/metadata/update-qualifier.js +7 -7
  75. package/package.json +3 -3
  76. package/lib/chalk.js +0 -13
package/README.md CHANGED
@@ -55,7 +55,7 @@ See [CHANGELOG.md](CHANGELOG.md) for version info
55
55
  ## Dependencies
56
56
 
57
57
  ### General
58
- * [NodeJs](https://nodejs.org) **>= v18** (recommended way to install it: use [NVM](https://github.com/creationix/nvm) to install the latest LTS version `nvm install --lts`)
58
+ * [NodeJS](https://nodejs.org) **>= v20.12.0** (Older NodeJS versions can be used for older wikibase-cli version, see [changelogs](./CHANGELOG.md). Recommendable way to install NodeJS: you may use [NVM](https://github.com/creationix/nvm) to install the latest LTS version `nvm install --lts`)
59
59
  * [Git](https://git-scm.com/)
60
60
 
61
61
  ### Per feature
@@ -124,9 +124,7 @@ export DEBUG=wikibase-cli:request ; wd label Q1
124
124
  * [wikibase-sdk](https://www.npmjs.com/package/wikibase-sdk): A javascript tool suite to query and work with Wikibase data, heavily used by wikibase-cli
125
125
  * [wikibase-edit](https://www.npmjs.com/package/wikibase-edit): Edit Wikibase from NodeJS, used in wikibase-cli for all [write operations](docs/write_operations.md)
126
126
  * [wikibase-dump-filter](https://npmjs.com/package/wikibase-dump-filter): Filter and format a newline-delimited JSON stream of Wikibase entities
127
- * [wikidata-subset-search-engine](https://github.com/inventaire/entities-search-engine/tree/wikidata-subset-search-engine): Tools to setup an ElasticSearch instance fed with subsets of Wikidata
128
- * [wikidata-taxonomy](https://github.com/nichtich/wikidata-taxonomy): A command-line tool to extract taxonomies from Wikidata
129
- * [import-wikidata-dump-to-couchdb](https://github.com/maxlath/import-wikidata-dump-to-couchdb): Import a subset or a full Wikidata dump into a CouchDB database
127
+ * [wikidata-taxonomy](https://www.npmjs.com/package/wikidata-taxonomy): A command-line tool to extract taxonomies from Wikidata
130
128
  * [Other Wikidata external tools](https://www.wikidata.org/wiki/Wikidata:Tools/External_tools)
131
129
 
132
130
  ## You may also like
package/bin/wb-claims.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
+ import { yellow } from 'tiny-chalk'
2
3
  import { isPropertyId, simplifyClaims, simplifyPropertyClaims, getStatementsKey } from 'wikibase-sdk'
3
- import { yellow } from '#lib/chalk'
4
4
  import errors_ from '#lib/errors'
5
5
  import { exitOnMissingInstance } from '#lib/exit_on_missing'
6
6
  import getEntities from '#lib/get_entities'
package/bin/wb-config.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { green } from '#lib/chalk'
2
+ import { green } from 'tiny-chalk'
3
3
  import { checkConfigFileExistance } from '#lib/config/check_config_file_existance'
4
4
  import { config } from '#lib/config/config'
5
5
  import { configurateCredentials } from '#lib/config/credentials_config'
@@ -0,0 +1,85 @@
1
+ #!/usr/bin/env node
2
+ import { map, partition, uniq, values, without } from 'lodash-es'
3
+ import { grey } from 'tiny-chalk'
4
+ import { isEntityId, isPropertyId } from 'wikibase-sdk'
5
+ import errors_ from '#lib/errors'
6
+ import { getEntitiesLabels } from '#lib/get_entities_labels'
7
+ import { makeSparqlQuery } from '#lib/make_sparql_query'
8
+ import program from '#lib/program'
9
+
10
+ await program
11
+ .option('-f, --format <format>', 'Available alternative formats: mermaid')
12
+ .process('graph-path')
13
+
14
+ const { args, format } = program
15
+ const [ subject, property, joinedObjects ] = args
16
+
17
+ if (!(subject && property && joinedObjects)) {
18
+ program.helpAndExit(0)
19
+ }
20
+
21
+ const objects = joinedObjects.split(',')
22
+
23
+ if (!isEntityId(subject)) throw new Error(`invalid subject id: ${subject}`)
24
+ if (!isPropertyId(property)) throw new Error(`invalid property id: ${property}`)
25
+ objects.forEach(object => {
26
+ if (!isEntityId(object)) throw new Error(`invalid object id: ${object}`)
27
+ })
28
+
29
+ const rows = await makeSparqlQuery(`SELECT DISTINCT ?intermediary ?next {
30
+ VALUES (?object) { ${objects.map(object => `(wd:${object})`).join(' ')} }
31
+ wd:${subject} wdt:${property}* ?intermediary .
32
+ ?object ^wdt:${property}* ?intermediary .
33
+ OPTIONAL {
34
+ ?intermediary wdt:${property} ?next .
35
+ }
36
+ }`)
37
+
38
+ if (rows.length === 0) {
39
+ errors_.exitMessage('no path found')
40
+ }
41
+
42
+ const intermediaries = uniq(map(rows, 'intermediary'))
43
+ const relevantRows = rows.filter(row => intermediaries.includes(row.next))
44
+
45
+ const allEntityIds = uniq(relevantRows.flatMap(row => values(row)))
46
+ const labels = await getEntitiesLabels(allEntityIds, program.lang)
47
+
48
+ if (format === 'mermaid') {
49
+ let output = 'graph LR\n'
50
+ const getNodeLabel = id => `${labels[id]} (${id})`
51
+ for (const { intermediary, next } of relevantRows) {
52
+ output += `${getNodeLabel(intermediary)} --> ${getNodeLabel(next)}\n`
53
+ }
54
+ console.log(output.trim())
55
+ } else {
56
+ let remainingRows = relevantRows
57
+ let nextSubjects = [ subject ]
58
+ let paths = [ subject ]
59
+ const replacedPaths = []
60
+
61
+ while (remainingRows.length > 0) {
62
+ const newPaths = []
63
+ const [ nextRows, rest ] = partition(remainingRows, ({ intermediary }) => {
64
+ return nextSubjects.includes(intermediary)
65
+ })
66
+ if (rest.length === remainingRows.length) throw new Error('stuck')
67
+ remainingRows = rest
68
+ nextRows.forEach(({ intermediary, next }) => {
69
+ const relevantPaths = paths.filter(path => {
70
+ const pathParts = path.split('.')
71
+ return pathParts.at(-1) === intermediary
72
+ })
73
+ const updatedPaths = relevantPaths.map(path => `${path}.${next}`)
74
+ // Leave the relevantPaths in paths, to let other rows fork them if needed
75
+ replacedPaths.push(...relevantPaths)
76
+ newPaths.push(...updatedPaths)
77
+ })
78
+ nextSubjects = uniq(map(nextRows, 'next'))
79
+ paths = [ ...without(paths, ...replacedPaths), ...newPaths ]
80
+ }
81
+
82
+ for (const path of paths) {
83
+ console.log(path.split('.').map(part => `${labels[part]} ${grey(`(${part})`)}`).join(' → '))
84
+ }
85
+ }
package/bin/wb-props.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { red } from '#lib/chalk'
2
+ import { red } from 'tiny-chalk'
3
3
  import errors_ from '#lib/errors'
4
4
  import formatPropertiesData from '#lib/format_properties_data'
5
5
  import getLangProps from '#lib/get_lang_props'
package/bin/wb-query.js CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { grey } from '#lib/chalk'
2
+ import { grey } from 'tiny-chalk'
3
+ import errors_ from '#lib/errors'
3
4
  import { generateDescribeSparqlQuery } from '#lib/generate_describe_sparql_query'
4
5
  import { generateSampleSparqlQuery } from '#lib/generate_sample_sparql_query'
5
6
  import { generateSelectSparqlQuery } from '#lib/generate_select_sparql_query'
@@ -30,6 +31,10 @@ await program
30
31
  .option('-x, --index <variable>', "Return the result as an index, instead of a list, using the passed variable as key (can't be used with the 'raw' option)")
31
32
  .process('query')
32
33
 
34
+ if (program.args.length > 0) {
35
+ errors_.exitMessage('wb query can not have positional arguments', `found positional arguments: ${program.args}`)
36
+ }
37
+
33
38
  if (!(program.subject || program.property || program.object || program.describe || program.sample || program.statementProperty)) {
34
39
  program.helpAndExit(0)
35
40
  }
package/bin/wb-search.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { padEnd } from 'lodash-es'
3
- import { red, grey } from '#lib/chalk'
3
+ import { red, grey } from 'tiny-chalk'
4
4
  import { entityDataParser } from '#lib/entity_data_parser'
5
5
  import { exitOnMissingInstance } from '#lib/exit_on_missing'
6
6
  import parseEntityType from '#lib/parse_entity_type'
@@ -1,4 +1,4 @@
1
- import { red } from '#lib/chalk'
1
+ import { red } from 'tiny-chalk'
2
2
 
3
3
  export const missingProperty = property => {
4
4
  console.error(red(`the property ${property} could not be found\n`) +
@@ -1,4 +1,4 @@
1
- import { red } from '#lib/chalk'
1
+ import { red } from 'tiny-chalk'
2
2
  import { readJsonFile } from '#lib/json'
3
3
  import { configFilePath } from './file_path.js'
4
4
 
@@ -1,4 +1,4 @@
1
- import { yellow, green } from '#lib/chalk'
1
+ import { yellow, green } from 'tiny-chalk'
2
2
  import { initCredentials } from '#lib/edit/init_credentials'
3
3
  import validateInstanceCredentials from '../edit/validate_instance_credentials.js'
4
4
  import errors_ from '../errors.js'
package/lib/debug.js CHANGED
@@ -1,4 +1,4 @@
1
- import { cyan, grey } from '#lib/chalk'
1
+ import { cyan, grey } from 'tiny-chalk'
2
2
 
3
3
  const { DEBUG = '' } = process.env
4
4
  const namespace = 'wikibase-cli'
@@ -1,4 +1,4 @@
1
- import { yellow } from '#lib/chalk'
1
+ import { yellow } from 'tiny-chalk'
2
2
  import { debug } from '#lib/debug'
3
3
  import { initCredentials } from './init_credentials.js'
4
4
 
@@ -1,7 +1,7 @@
1
1
  import { inspect } from 'node:util'
2
2
  import split from 'split'
3
+ import { red } from 'tiny-chalk'
3
4
  import wbEdit from 'wikibase-edit'
4
- import { red } from '#lib/chalk'
5
5
  import { debug } from '#lib/debug'
6
6
  import { config } from '../config/config.js'
7
7
  import errors_ from '../errors.js'
@@ -1,4 +1,4 @@
1
- import { green, red } from '#lib/chalk'
1
+ import { green, red } from 'tiny-chalk'
2
2
  import configOps from '../config/file_operations.js'
3
3
  import prompt from './prompt.js'
4
4
  import validateInstanceCredentials from './validate_instance_credentials.js'
@@ -1,5 +1,5 @@
1
1
  import read from 'read'
2
- import { blue, yellow, grey } from '#lib/chalk'
2
+ import { blue, yellow, grey } from 'tiny-chalk'
3
3
 
4
4
  export default readsData => {
5
5
  const results = {}
@@ -1,5 +1,5 @@
1
1
  import { max, padEnd, values } from 'lodash-es'
2
- import { grey, red } from '#lib/chalk'
2
+ import { grey, red } from 'tiny-chalk'
3
3
  import { debug } from '#lib/debug'
4
4
  import entityAttributeParser from './entity_attribute_parser.js'
5
5
  import { entityDataParser } from './entity_data_parser.js'
package/lib/errors.js CHANGED
@@ -1,4 +1,4 @@
1
- import { red } from '#lib/chalk'
1
+ import { red } from 'tiny-chalk'
2
2
 
3
3
  const errors_ = {
4
4
  new: (message, context) => {
@@ -1,4 +1,4 @@
1
- import { red } from '#lib/chalk'
1
+ import { red } from 'tiny-chalk'
2
2
 
3
3
  const missingInstance = `A Wikibase instance should be specificed.
4
4
 
@@ -1,5 +1,5 @@
1
+ import { red, yellow } from 'tiny-chalk'
1
2
  import { simplifySparqlResults } from 'wikibase-sdk'
2
- import { red, yellow } from '#lib/chalk'
3
3
  import { get } from '#lib/request'
4
4
  import { isValidLang } from '#lib/validate'
5
5
  import { getWbk } from '#lib/wbk'
@@ -1,11 +1,9 @@
1
- import chalk from 'chalk'
1
+ import chalk, { grey, bgWhite, black } from 'tiny-chalk'
2
2
  import { isEntityId } from 'wikibase-sdk'
3
3
  import { missingProperty } from './common_errors.js'
4
4
  import getPropertiesData from './get_properties_data.js'
5
5
  import { propTypes } from './properties.js'
6
6
 
7
- const { grey, bgWhite, black } = chalk
8
-
9
7
  export default async ({ labels, simplifiedClaims, resort, lang }) => {
10
8
  const propertiesIds = Object.keys(simplifiedClaims)
11
9
  const propertiesData = await getPropertiesData(propertiesIds, lang)
package/lib/log_claims.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { chain, compact, max, padEnd, uniq } from 'lodash-es'
2
- import { bgMagenta, grey } from '#lib/chalk'
2
+ import { bgMagenta, grey } from 'tiny-chalk'
3
3
  import filterClaimsProperties from '#lib/filter_claims_properties'
4
4
  import getClaimsTexts from '#lib/get_claims_texts'
5
5
  import { getEntitiesLabels } from './get_entities_labels.js'
@@ -1,6 +1,6 @@
1
1
  import { execSync } from 'node:child_process'
2
2
  import { dirname } from 'node:path'
3
- import { grey } from '#lib/chalk'
3
+ import { grey } from 'tiny-chalk'
4
4
 
5
5
  export default (command, examples, doc, dryRun = false) => {
6
6
  if (examples && examples.length > 0) {
@@ -1,5 +1,5 @@
1
+ import { grey } from 'tiny-chalk'
1
2
  import { simplifySparqlResults, minimizeSimplifiedSparqlResults, buildBlazeGraphSparqlQueryUrl, buildQLeverSparqlQueryUrl } from 'wikibase-sdk'
2
- import { grey } from '#lib/chalk'
3
3
  import errors_ from '#lib/errors'
4
4
  import { exitOnMissingSparqlEndpoint } from '#lib/exit_on_missing'
5
5
  import { outputFactory } from '#lib/output'
@@ -1,5 +1,5 @@
1
1
  import { existsSync } from 'node:fs'
2
- import { red } from '#lib/chalk'
2
+ import { red } from 'tiny-chalk'
3
3
  import { readJsonFile } from '#lib/json'
4
4
  import { isJsonString, getAbsoluteFileUrl, validateTemplateCommand } from '#lib/utils'
5
5
  import { parseReconciliationArg } from './edit/reconciliation.js'
package/lib/output.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { promisify } from 'node:util'
2
- import { grey } from '#lib/chalk'
2
+ import { grey } from 'tiny-chalk'
3
3
  import { copyAndExit } from '#lib/copy'
4
4
  import { tabularize } from '#lib/tabularize'
5
5
  import { isArray, isCollection, isPlainObject } from '#lib/types'
package/lib/properties.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export const mainProps = {
2
- 'https://www.wikidata.org': [ 'P31', 'P279' ],
2
+ 'https://www.wikidata.org': [ 'P31', 'P279', 'P569', 'P570', 'P571', 'P577', 'P580', 'P582' ],
3
3
  }
4
4
 
5
5
  export const propTypes = {
@@ -1,5 +1,5 @@
1
1
  import { exec } from 'node:child_process'
2
- import { green } from '#lib/chalk'
2
+ import { green } from 'tiny-chalk'
3
3
  import { getCacheFolderPath } from '#lib/get_cache_folder_path'
4
4
 
5
5
  export default () => {
@@ -1,6 +1,6 @@
1
1
  import { pick, values } from 'lodash-es'
2
+ import { bgGreen, bgMagenta, bgBlue, grey, white } from 'tiny-chalk'
2
3
  import { simplify, getSitelinkUrl } from 'wikibase-sdk'
3
- import { bgGreen, bgMagenta, bgBlue, grey, white } from '#lib/chalk'
4
4
  import entityAttributeParser from '#lib/entity_attribute_parser'
5
5
  import logClaims from '#lib/log_claims'
6
6
  import { mainProps } from '#lib/properties'
@@ -69,7 +69,7 @@ const parseEntity = async (entity, params) => {
69
69
  if (instanceMainProps) properties = instanceMainProps
70
70
  }
71
71
  claims = program.verbose ? claims : pick(claims, properties)
72
- const simplifiedClaims = simplify.claims(claims, { keepTypes: true })
72
+ const simplifiedClaims = simplify.claims(claims, { keepTypes: true, timeConverter: 'simple-day' })
73
73
 
74
74
  const extraData = {}
75
75
  if (type === 'lexeme') {
package/lib/tabularize.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { get, padEnd } from 'lodash-es'
2
- import { inverse } from '#lib/chalk'
2
+ import { inverse } from 'tiny-chalk'
3
3
  import { isPlainObject } from './types.js'
4
4
 
5
5
  export function tabularize (collection) {
@@ -3,10 +3,10 @@ import { editCommandsOptions } from '#lib/common_options'
3
3
  export default {
4
4
  alias: 'aa',
5
5
  args: '<entity> <language> <aliases>',
6
- description: 'add one or several aliases to the list of aliases of an entity in a given language',
6
+ description: 'Add one or several aliases to the list of aliases of an entity in a given language',
7
7
  options: editCommandsOptions,
8
8
  examples: [
9
- { args: 'Q4115189 fr foo', comment: "add 'foo' to the Sandbox entity (Q4115189) French aliases" },
10
- { args: 'Q4115189 fr "foo|bar|buzz', comment: "add 'foo', 'bar', and 'buzz' to the Sandbox entity (Q4115189) French aliases" },
9
+ { args: 'Q4115189 fr foo', comment: "Add 'foo' to the Sandbox entity (Q4115189) French aliases" },
10
+ { args: 'Q4115189 fr "foo|bar|buzz', comment: "Add 'foo', 'bar', and 'buzz' to the Sandbox entity (Q4115189) French aliases" },
11
11
  ],
12
12
  }
@@ -3,7 +3,7 @@ import { editCommandsOptions } from '#lib/common_options'
3
3
  export default {
4
4
  alias: 'ab',
5
5
  args: '<entity> <site> [badges]',
6
- description: 'add badges on an existing sitelink, without removing other badges that might already have been set',
6
+ description: 'Add badges on an existing sitelink, without removing other badges that might already have been set',
7
7
  options: editCommandsOptions,
8
8
  examples: [
9
9
  { args: 'Q4115189 enwikiquote Q17437796,Q17437798', comment: 'Add Q17437796 and Q17437798 badges on Q4115189 enwikiquote sitelink' },
@@ -3,9 +3,9 @@ import { editCommandsOptions } from '#lib/common_options'
3
3
  export default {
4
4
  alias: 'ac',
5
5
  args: '<entity> <property> <value>',
6
- description: 'add a claim to an entity',
6
+ description: 'Add a claim to an entity',
7
7
  options: { rank: true, reconciliation: true, ...editCommandsOptions },
8
8
  examples: [
9
- { args: 'Q4115189 P2002 Zorglub', comment: "add the Twitter account (P2002) 'Zorglub' to the Sandbox (Q4115189) entity" },
9
+ { args: 'Q4115189 P2002 Zorglub', comment: "Add the Twitter account (P2002) 'Zorglub' to the Sandbox (Q4115189) entity" },
10
10
  ],
11
11
  }
@@ -3,14 +3,14 @@ import { editCommandsOptions } from '#lib/common_options'
3
3
  export default {
4
4
  alias: 'aq',
5
5
  args: '<claim-guid> <property> <value>',
6
- description: 'add a qualifier to a claim',
6
+ description: 'Add a qualifier to a claim',
7
7
  options: editCommandsOptions,
8
8
  examples: [
9
- { args: "'Q4115189$E66DBC80-CCC1-4899-90D4-510C9922A04F' P155 'Q13406268'", comment: 'entity qualifier' },
10
- { args: "'Q4115189$E66DBC80-CCC1-4899-90D4-510C9922A04F' P1545 'A-123'", comment: 'string qualifier' },
11
- { args: "'Q4115189$E66DBC80-CCC1-4899-90D4-510C9922A04F' P580 '1802-02-26'", comment: 'time qualifier' },
12
- { args: "'Q4115189$E66DBC80-CCC1-4899-90D4-510C9922A04F' P2130 123", comment: 'quantity qualifier' },
13
- { args: "'Q4115189$E66DBC80-CCC1-4899-90D4-510C9922A04F' P2130 '{\"amount\":123,\"unit\":\"Q4916\"}'", comment: 'quantity qualifier with a unit' },
14
- { args: "'Q4115189$E66DBC80-CCC1-4899-90D4-510C9922A04F' P3132 \"text=les sanglots long des violons de l'automne&language=fr\"", comment: 'monolingualtext qualifier' },
9
+ { args: "'Q4115189$E66DBC80-CCC1-4899-90D4-510C9922A04F' P155 'Q13406268'", comment: 'Entity qualifier' },
10
+ { args: "'Q4115189$E66DBC80-CCC1-4899-90D4-510C9922A04F' P1545 'A-123'", comment: 'String qualifier' },
11
+ { args: "'Q4115189$E66DBC80-CCC1-4899-90D4-510C9922A04F' P580 '1802-02-26'", comment: 'Time qualifier' },
12
+ { args: "'Q4115189$E66DBC80-CCC1-4899-90D4-510C9922A04F' P2130 123", comment: 'Quantity qualifier' },
13
+ { args: "'Q4115189$E66DBC80-CCC1-4899-90D4-510C9922A04F' P2130 '{\"amount\":123,\"unit\":\"Q4916\"}'", comment: 'Quantity qualifier with a unit' },
14
+ { args: "'Q4115189$E66DBC80-CCC1-4899-90D4-510C9922A04F' P3132 \"text=les sanglots long des violons de l'automne&language=fr\"", comment: 'Monolingualtext qualifier' },
15
15
  ],
16
16
  }
@@ -3,10 +3,10 @@ import { editCommandsOptions } from '#lib/common_options'
3
3
  export default {
4
4
  alias: 'ar',
5
5
  args: '<claim-guid> <property> <value>',
6
- description: 'add a reference to a claim',
6
+ description: 'Add a reference to a claim',
7
7
  options: editCommandsOptions,
8
8
  examples: [
9
- { args: "'Q4115189$E66DBC80-CCC1-4899-90D4-510C9922A04F' P854 'https://example.org/rise-and-box-of-the-holy-sand-box'", comment: 'add a reference URL (P854) to this claim' },
10
- { args: "'Q4115189$E66DBC80-CCC1-4899-90D4-510C9922A04F' P143 Q60856", comment: 'reference the claim as imported from (P143) Wikipedia in Uyghur (Q60856)' },
9
+ { args: "'Q4115189$E66DBC80-CCC1-4899-90D4-510C9922A04F' P854 'https://example.org/rise-and-box-of-the-holy-sand-box'", comment: 'Add a reference URL (P854) to this claim' },
10
+ { args: "'Q4115189$E66DBC80-CCC1-4899-90D4-510C9922A04F' P143 Q60856", comment: 'Reference the claim as imported from (P143) Wikipedia in Uyghur (Q60856)' },
11
11
  ],
12
12
  }
@@ -3,10 +3,10 @@ import { entityAttributeCommandsOptions } from '#lib/common_options'
3
3
  export default {
4
4
  alias: 'a',
5
5
  args: '<entity>',
6
- description: "display the entity's aliases",
6
+ description: "Display the entity's aliases",
7
7
  options: entityAttributeCommandsOptions,
8
8
  examples: [
9
- { args: 'Q123', comment: 'fetch the aliases for the entity Q123' },
10
- { args: 'Q123 --lang ja', comment: 'fetch the aliases for the entity Q123 in Japanese' },
9
+ { args: 'Q123', comment: 'Fetch the aliases for the entity Q123' },
10
+ { args: 'Q123 --lang ja', comment: 'Fetch the aliases for the entity Q123 in Japanese' },
11
11
  ],
12
12
  }
@@ -1,7 +1,7 @@
1
1
  export default {
2
2
  alias: 'b',
3
3
  args: '',
4
- description: 'list sitelink badges available on a Wikibase instance',
4
+ description: 'List sitelink badges available on a Wikibase instance',
5
5
  options: {
6
6
  lang: false,
7
7
  verbose: false,
@@ -1,7 +1,7 @@
1
1
  export default {
2
2
  alias: 'c',
3
3
  args: '<entity> [property]',
4
- description: 'display the claims of an entity',
4
+ description: 'Display the claims of an entity',
5
5
  options: {
6
6
  lang: true,
7
7
  verbose: true,
@@ -11,11 +11,11 @@ export default {
11
11
  sparqlEndpoint: true,
12
12
  },
13
13
  examples: [
14
- { args: 'Q2001', comment: 'fetch all claims for the entity Q2001' },
15
- { args: 'Q2001 P106', comment: 'or just the claims for the property P106' },
16
- { args: 'Q2001 --type Url', comment: 'or just the claims from properties of type Url (other possible types: ExternalId, String, WikibaseItem, WikibaseProperty, Time, Monolingualtext, Quantity, CommonsMedia, GlobeCoordinate)' },
17
- { args: 'Q2001 library', comment: 'or just the claims from properties with labels matching "library"' },
18
- { args: 'Q2001 website', comment: 'or website, etc' },
19
- { args: 'Q2001 --lang de', comment: 'fetch all claims for the entity Q2001 with properties labels in German' },
14
+ { args: 'Q2001', comment: 'Fetch all claims for the entity Q2001' },
15
+ { args: 'Q2001 P106', comment: 'Or just the claims for the property P106' },
16
+ { args: 'Q2001 --type Url', comment: 'Or just the claims from properties of type Url (other possible types: ExternalId, String, WikibaseItem, WikibaseProperty, Time, Monolingualtext, Quantity, CommonsMedia, GlobeCoordinate)' },
17
+ { args: 'Q2001 library', comment: 'Or just the claims from properties with labels matching "library"' },
18
+ { args: 'Q2001 website', comment: 'Or website, etc' },
19
+ { args: 'Q2001 --lang de', comment: 'Fetch all claims for the entity Q2001 with properties labels in German' },
20
20
  ],
21
21
  }
@@ -1,8 +1,8 @@
1
- import { grey } from '#lib/chalk'
1
+ import { grey } from 'tiny-chalk'
2
2
 
3
3
  export default {
4
4
  args: '<key> [value]',
5
- description: 'get and set configuration parameters',
5
+ description: 'Get and set configuration parameters',
6
6
  options: {
7
7
  lang: false,
8
8
  verbose: false,
@@ -12,15 +12,15 @@ export default {
12
12
  sparqlEndpoint: false,
13
13
  },
14
14
  examples: [
15
- { args: 'clipboard true', comment: 'always copy results to the clipboard when possible' },
16
- { args: 'lang nl', comment: 'set prefered language to Dutch' },
17
- { args: 'instance reset', comment: 'reset the instance setting to its default value' },
18
- { args: 'credentials https://www.wikidata.org', comment: 'get the credentials for an instance' },
19
- { args: 'credentials https://localhost:8181 reset', comment: 'reset the credentials for an instance' },
20
- { args: 'credentials http://localhost:8181 test', comment: 'test the validity of your credentials for an instance' },
21
- { args: 'path', comment: 'get configuration path' },
22
- { args: 'reset', comment: 'reset configuration' },
23
- { args: `--json > config.json.backup\n ${grey('# to restore it, simply override the current config file')}\n cp config.json.backup $(wb config path)`, comment: 'can be used to backup the config' },
15
+ { args: 'clipboard true', comment: 'Always copy results to the clipboard when possible' },
16
+ { args: 'lang nl', comment: 'Set prefered language to Dutch' },
17
+ { args: 'instance reset', comment: 'Reset the instance setting to its default value' },
18
+ { args: 'credentials https://www.wikidata.org', comment: 'Get the credentials for an instance' },
19
+ { args: 'credentials https://localhost:8181 reset', comment: 'Reset the credentials for an instance' },
20
+ { args: 'credentials http://localhost:8181 test', comment: 'Test the validity of your credentials for an instance' },
21
+ { args: 'path', comment: 'Get configuration path' },
22
+ { args: 'reset', comment: 'Reset configuration' },
23
+ { args: `--json > config.json.backup\n ${grey('# to restore it, simply override the current config file')}\n cp config.json.backup $(wb config path)`, comment: 'Can be used to backup the config' },
24
24
  ],
25
25
  doc: 'https://github.com/maxlath/wikibase-cli/blob/main/docs/config.md#config',
26
26
  }
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  args: '',
3
- description: 'convert batches of external ids to Wikidata ids and vice versa',
3
+ description: 'Convert batches of external ids to Wikidata ids and vice versa',
4
4
  options: {
5
5
  lang: false,
6
6
  verbose: true,
@@ -10,8 +10,8 @@ export default {
10
10
  sparqlEndpoint: true,
11
11
  },
12
12
  examples: [
13
- { args: '-p P268 -o 11865344k 11932251d', comment: 'get the Wikidata ids corresponding to those BNF ids' },
14
- { args: '-p P268 -s Q45 Q140', comment: 'get the BNF ids corresponding to those Wikidata ids' },
15
- { args: '-p P268 -o < ids_list', comment: 'the same but taking the ids from a file' },
13
+ { args: '-p P268 -o 11865344k 11932251d', comment: 'Get the Wikidata ids corresponding to those BNF ids' },
14
+ { args: '-p P268 -s Q45 Q140', comment: 'Get the BNF ids corresponding to those Wikidata ids' },
15
+ { args: '-p P268 -o < ids_list', comment: 'The same but taking the ids from a file' },
16
16
  ],
17
17
  }
@@ -8,15 +8,15 @@ export default {
8
8
  examples: [
9
9
  {
10
10
  args: "'{\"labels\":{\"en\":\"a label\",\"fr\":\"un label\"},\"descriptions\":{\"en\":\"some description\",\"fr\":\"une description\"},\"claims\":{\"P1775\":[\"Q3576110\",\"Q12206942\"],\"P2002\":\"bulgroz\"}}'",
11
- comment: 'pass data as JSON',
11
+ comment: 'Pass data as JSON',
12
12
  },
13
13
  {
14
14
  args: './new_entity_data.json',
15
- comment: 'pass data as a JSON file path',
15
+ comment: 'Pass data as a JSON file path',
16
16
  },
17
17
  {
18
18
  args: './new_entity_data.json --instance http://some/wikibase/instance/w/api.php --sparql-endpoint http://some/sparql/endpoint',
19
- comment: 'in case you use are not editing wikidata.org, make sure to specify the custom Wikibase instance and its SPARQL endpoint, as claims formatting and validation will depend on properties types that are retrieved from the SPARQL endpoint',
19
+ comment: 'In case you use are not editing wikidata.org, make sure to specify the custom Wikibase instance and its SPARQL endpoint, as claims formatting and validation will depend on properties types that are retrieved from the SPARQL endpoint',
20
20
  },
21
21
  ],
22
22
  }
package/metadata/data.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export default {
2
2
  alias: 'd',
3
3
  args: '<entity>',
4
- description: "output the entity's data",
4
+ description: "Output the entity's data",
5
5
  options: {
6
6
  lang: false,
7
7
  verbose: false,
@@ -11,12 +11,12 @@ export default {
11
11
  sparqlEndpoint: false,
12
12
  },
13
13
  examples: [
14
- { args: 'Q123', comment: "fetch Q123's raw data" },
15
- { args: '--props labels,claims,sitelinks Q123', comment: "fetch Q123's labels, claims, and sitelinks only" },
16
- { args: '--simplify Q123', comment: 'fetch Q123 simplified data' },
17
- { args: '--simplify --keep ids,references,qualifiers,hashes,nontruthy Q123', comment: 'simplified Q123 data, but keep some attributes' },
18
- { args: '--simplify --keep all Q123', comment: 'same as above' },
19
- { args: 'Q1496 | jq .labels.pt', comment: "take advantage of the raw data being output as JSON\n # to pass it to jq (a JSON parsers https://jqlang.github.io/jq/)\n # and get only the piece of data you're looking for" },
20
- { args: '--simplify --keep ids Q123 | jq .claims.P138 -j', comment: 'get Q123 P138 claims ids' },
14
+ { args: 'Q123', comment: "Fetch Q123's raw data" },
15
+ { args: '--props labels,claims,sitelinks Q123', comment: "Fetch Q123's labels, claims, and sitelinks only" },
16
+ { args: '--simplify Q123', comment: 'Fetch Q123 simplified data' },
17
+ { args: '--simplify --keep ids,references,qualifiers,hashes,nontruthy Q123', comment: 'Simplified Q123 data, but keep some attributes' },
18
+ { args: '--simplify --keep all Q123', comment: 'Same as above' },
19
+ { args: 'Q1496 | jq .labels.pt', comment: "Take advantage of the raw data being output as JSON\n # to pass it to jq (a JSON parsers https://jqlang.github.io/jq/)\n # and get only the piece of data you're looking for" },
20
+ { args: '--simplify --keep ids Q123 | jq .claims.P138 -j', comment: 'Get Q123 P138 claims ids' },
21
21
  ],
22
22
  }
@@ -8,11 +8,11 @@ export default {
8
8
  examples: [
9
9
  {
10
10
  args: 'Q1',
11
- comment: 'delete an item',
11
+ comment: 'Delete an item',
12
12
  },
13
13
  {
14
14
  args: 'P1',
15
- comment: 'delete a property',
15
+ comment: 'Delete a property',
16
16
  },
17
17
  ],
18
18
  }
@@ -3,10 +3,10 @@ import { entityAttributeCommandsOptions } from '#lib/common_options'
3
3
  export default {
4
4
  alias: 'desc',
5
5
  args: '<entity>',
6
- description: "display the entity's description",
6
+ description: "Display the entity's description",
7
7
  options: entityAttributeCommandsOptions,
8
8
  examples: [
9
- { args: 'Q123', comment: 'fetch the description for the entity Q123' },
10
- { args: 'Q123 --lang ja', comment: 'fetch the description for the entity Q123 in Japanese' },
9
+ { args: 'Q123', comment: 'Fetch the description for the entity Q123' },
10
+ { args: 'Q123 --lang ja', comment: 'Fetch the description for the entity Q123 in Japanese' },
11
11
  ],
12
12
  }