wikidata-sdk-got
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
gotOptions
Type: Object
See sindresorhus/got for this one.
Consider Caching.
searchEntities(options, [gotOptions])
options
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.