Code Monkey home page Code Monkey logo

wikibase-sdk's Introduction

wikibase-sdk

JS utils functions to query a Wikibase instance and simplify its results

This package was primarily developed as wikidata-sdk but has now being generalized to support any Wikibase instance: wikidata.org among others.

This project received a Wikimedia Project Grant.

wikibase           wikidata

NPM NPM

License Node JavaScript Style Guide

Summary

Changelog

See CHANGELOG.md for version info

Dependencies

This module uses JavaScript ES6, which means NodeJS >= v6.4.0 or not too outdated web browsers.

For older version, you can use ES5 bundles.

Install

npm install wikibase-sdk

Import

const wbk = require('wikibase-sdk')({
  instance: 'https://my-wikibase-instan.se',
  sparqlEndpoint: 'https://query.my-wikibase-instan.se/sparql'
})

The wdk object of previous versions of this documentation - from the time this module was bound to wikidata.org only - thus corresponds to the following:

const wdk = require('wikibase-sdk')({
  instance: 'https://www.wikidata.org',
  sparqlEndpoint: 'https://query.wikidata.org/sparql'
})

For convenience, and for the sake of retro-compatibility, that same wdk object can be obtain with:

// After having run `npm install wikidata-sdk`
const wdk = require('wikidata-sdk')

and instance-independant helper functions are directly available from the module root:

const { simplify, parse, isEntityId, isPropertyId, ... } = require('wikibase-sdk')

Features

Wikibase API

A set of functions to make read queries to a Wikibase instance API (see Wikidata API documentation). For write operations, see wikibase-edit.

Wikibase Query

There are additional functions for Wikibase instances that have a SPARQL Query Service (such as Wikidata Query for wikidata.org). SPARQL can be a weird thing at first, but the Wikidata team and community really puts lots of efforts to make things easy with a super rich Wikidata Query Help page, an awesome tool to test you queries and visualize the result, and lots of examples!

General helpers

Contributing

Context

This library had for primary purpose to serve the needs of the inventaire project but extending its capabilities to other needs it totally possible: feel welcome to post your suggestions as issues or pull requests!

Design constraints

  • wikibase-sdk should stay "small" and dependency-free, so that a web application can include it in its bundle without paying a too high cost for it. A consequence is that the lib generates URLs where other libs would integrate doing the request and parsing it's response. But that actually feels quite right to do this way: simply generating the URLs let's users free to handle requests as they like (with callbacks, promises, async/await, whatever!)
  • Therefore, it should focus on providing basic, general helper functions most application working with a Wikibase instance would need.
  • Write operations should go into wikibase-edit as it involves working with Wikibase credentials/tokens.
  • General command-line interface tools should go to wikibase-cli, very specific ones — wikidata-filter, import-wikidata-dump-to-couchdb, and alikes — should get their own modules.

Donate

We are developing and maintaining tools to work with Wikidata from NodeJS, the browser, or simply the command line, with quality and ease of use at heart. Any donation will be interpreted as a "please keep going, your work is very much needed and awesome. PS: love". Donate

See Also

You may also like

inventaire banner

Do you know Inventaire? It's a web app to share books with your friends, built on top of Wikidata! And its libre software too.

License

MIT

wikibase-sdk's People

Contributors

maxlath avatar noinkling avatar edjopato avatar nichtich avatar larsgw avatar moshest avatar bynaristar avatar ent8r avatar lsjroberts avatar simon04 avatar offirmo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.