blob: 80988ff730fe83e59fd756cc3df8c3554dff6d10 (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
guile-wikidata
==============
This package provides wikidata-query functions to query and print
data the public wikidata APIs at wikidata.org from Guile Scheme.
It is inspired by guile-sparql, python-wikidata_guessing and python-Wikidata.
It currently has the following dependencies besides guile:
* guile-json
* guix (only the 2 procedures in (guix import json) for alist functionality.
## Use as module
It is exported as "wikidata". It can be imported with:
```
(use-modules (wikidata))
```
## Example usage
To search on wikidata and get back an alist with the 10 first results
with each element being an alist of label, desc, qid, do this:
```
(extract-result "Guix")
```
Example output:
scheme@(guile-user) [2]> (load "wikidata.scm")
scheme@(guile-user) [2]> ,use(wikidata)
scheme@(guile-user) [2]> (extract-result "Guix")
$1 = ((("label" . "GNU Guix") ("description" . "a purely functional
package manager for the GNU system") ("id" . "Q18968627")) (("label"
. "Guixe\
rs") ("description" . #f) ("id" . "Q1905661")) (("label" . "Guixi")
("description" . "county-level city") ("id" . "Q1335331")) (("label"
. "Guixi\
ng Qiu") ("description" . #f) ("id" . "Q39066155")) (("label"
. "GuixSD") ("description" . "distribution of the GNU system via the
Guix package m\
anager, project maintained by the GNU Project") ("id" . "Q19597382"))
(("label" . "Guixi Railway Station") ("description" . "railway station
in G\
uixi, Yingtan") ("id" . "Q24835612")) (("label" . "Guixi Subdistrict")
("description" . "subdistrict in Wuhou, Chengdu") ("id"
. "Q11111703")) ((\
"label" . "Guixiang") ("description" . "military general, father of
Longyu") ("id" . "Q8172534")) (("label" . "Guixia Zhao")
("description" . #f)\
("id" . "Q56528602")) (("label" . "Guixue Wang") ("description" . #f)
("id" . "Q45902385")))
|