wikidata-sdk-got

v2.1.0
Run wikidata-sdk requests from NodeJS without handling urls
wikidata sparql

wikidata-sdk-got

NPM Version node Dependency Status Peer Dependency Status Dev Dependency Status

Run wikidata-sdk requests from NodeJS without handling urls

When working with Wikidata you can use maxlath/wikidata-sdk. In order to stay small and useable on all platforms wikidata-sdk does not do requests on its own.

Why not use sindresorhus/got for it? As the code is the same all the time, this can be abstracted as it is done here 😎

Install

$ npm install wikidata-sdk wikidata-sdk-got

Usage

const wdkGot = require('wikidata-sdk-got');

await wdkGot.sparqlQuerySimplifiedMinified('SELECT * WHERE { ?item wdt:P50 wd:Q42. } LIMIT 3');
//=> ['Q721', 'Q25169', 'Q187655']
import * as wdkGot from 'wikidata-sdk-got';

await wdkGot.sparqlQuerySimplifiedMinified('SELECT * WHERE { ?item wdt:P50 wd:Q42. } LIMIT 3');
//=> ['Q721', 'Q25169', 'Q187655']

API

Check out maxlath/wikidata-sdk in general.

Not everything is present yet. Open an Issue or Pull Request in order to add whats missing.

getEntities(options, [gotOptions])

getEntitiesSimplified(options, [gotOptions])

Different methods for different simplification levels.

options

See wikidata-sdk Docs

gotOptions

Type: Object

See sindresorhus/got for this one.

Consider Caching.

searchEntities(options, [gotOptions])

options

See wikidata-sdk Docs

gotOptions

Type: Object

See sindresorhus/got for this one.

Consider Caching.

sparqlQuery(query, [gotOptions])

sparqlQuerySimplified(query, [gotOptions])

sparqlQuerySimplifiedMinified(query, [gotOptions])

Different methods for different simplification levels.

query

Type: string

SparQL Query to be run.

gotOptions

Type: Object

See sindresorhus/got for this one.

Consider Caching.

npm i wikidata-sdk-got

Metadata

  • MIT
  • >=10
  • EdJoPaTo
  • released 2/22/2021

Downloads

Maintainers