0.8.0 • Published 1 year ago

@entitree/helper v0.8.0

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Entitree Helper

Super awesome helper function for Entitree projects. But anyone can use them.

npm version

Source Code:

https://github.com/codeledge/entitree-monorepo/tree/main/packages/entitree-helper

Prerequisites

This project requires NodeJS (version 8 or later) and NPM.

please use either:

$ npm install @entitree/helper

or

$ yarn add @entitree/helper

Table of contents

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Usage

useBasicFetch

import { getWikidataSparql } from "@entitree/helper";
let query = await getWikidataSparql(`#Goats
SELECT ?item ?itemLabel 
WHERE 
{
  ?item wdt:P31 wd:Q2934.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}`);
console.log(query);

getSimplifiedWikidataEntities

let query = await getSimplifiedWikidataEntities(["Q110903311"]));
console.log(query);

use constants instead of Wikidata IDS and properties

use WD_POSITION_HELD instead of "P39" to make your code look cleaner.

just type WD_ in your code editor to get suggestions.

getWikipediaArticle

let article = getWikipediaArticle("Germany", "en");
console.log(article);

Notes

How to sort by Wikidata ID

ORDER BY (xsd:integer(substr(str(?item),33)))

Any better idea?

Recreate constantsfile:

cd packages/entitree-helper/src/wikidata/scripts
ts-node-transpile-only createConstantsFile.ts

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Add your changes: git add .
  4. Commit your changes: git commit -am 'Add some feature'
  5. Push to the branch: git push origin my-new-feature
  6. Submit a pull request :sunglasses:

Credits

Versioning

Authors

Martin and Orlando

License

MIT License

0.8.0

1 year ago

0.5.4

2 years ago

0.5.3

2 years ago

0.5.5

2 years ago

0.5.0

2 years ago

0.7.0

2 years ago

0.6.1

2 years ago

0.5.2

2 years ago

0.6.0

2 years ago

0.5.1

2 years ago

0.3.0

2 years ago

0.4.5

2 years ago

0.4.4

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.3.1

2 years ago

0.4.3

2 years ago

0.4.2

2 years ago

0.2.2

2 years ago

0.1.0

2 years ago

0.2.1

2 years ago

0.1.2

2 years ago

0.2.0

2 years ago

0.1.1

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago