Hi,
I'd like to access Wikidata via Lua scripts, so the scripts can later be used in MediaWiki. I only know how to create Lua scripts in the module-namespace in Wikimedia wikis, but I want command line scripts that do not require a full MediaWiki installation. To give a minimal example, this script:
language="en" label=mw.wikibase.label("Q42") print(label)
if somehow (?) called from command line (!) should print "Douglas Adams" to stdout.
How to do so? Jakob
-- Jakob Voß Verbundzentrale des GBV (VZG) Abteilung Digitale Bibliothek Platz der Göttinger Sieben 1 37073 Göttingen Telefon: (49)551 39-10242 Internet: www.gbv.de
This would require a locally installable Lua library, which currently does not exist. It would be a great project to do something like this!
The same is true for other languages, but I understand the particular use case you have in mind.
On Thu, Jan 2, 2014 at 1:43 PM, Voß, Jakob Jakob.Voss@gbv.de wrote:
Hi,
I'd like to access Wikidata via Lua scripts, so the scripts can later be used in MediaWiki. I only know how to create Lua scripts in the module-namespace in Wikimedia wikis, but I want command line scripts that do not require a full MediaWiki installation. To give a minimal example, this script:
language="en" label=mw.wikibase.label("Q42") print(label)
if somehow (?) called from command line (!) should print "Douglas Adams" to stdout.
How to do so? Jakob
-- Jakob Voß Verbundzentrale des GBV (VZG) Abteilung Digitale Bibliothek Platz der Göttinger Sieben 1 37073 Göttingen Telefon: (49)551 39-10242 Internet: www.gbv.de
Wikidata-tech mailing list Wikidata-tech@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata-tech
If what you're executing is not something huge, doesn't require (m)any external dependencies, and doesn't have user interaction, you can try to (ab)use Scribunto's console AJAX interface:
$ cat lua.py #!/usr/bin/env python
import requests import sys
print requests.post(sys.argv[1], params={ 'format': 'json', 'action': 'scribunto-console', 'title': '-', 'question': sys.stdin.read(), }).json()['print'] $ cat demo.lua language="en" label=mw.wikibase.label("Q42") print(label) $ ./lua.py https://en.wikipedia.org/w/api.php < demo.lua Douglas Adams
$
-Liangent
On Sat, Jan 4, 2014 at 4:45 AM, Denny Vrandečić vrandecic@gmail.com wrote:
This would require a locally installable Lua library, which currently does not exist. It would be a great project to do something like this!
The same is true for other languages, but I understand the particular use case you have in mind.
On Thu, Jan 2, 2014 at 1:43 PM, Voß, Jakob Jakob.Voss@gbv.de wrote:
Hi,
I'd like to access Wikidata via Lua scripts, so the scripts can later be used in MediaWiki. I only know how to create Lua scripts in the module-namespace in Wikimedia wikis, but I want command line scripts that do not require a full MediaWiki installation. To give a minimal example, this script:
language="en" label=mw.wikibase.label("Q42") print(label)
if somehow (?) called from command line (!) should print "Douglas Adams" to stdout.
How to do so? Jakob
-- Jakob Voß Verbundzentrale des GBV (VZG) Abteilung Digitale Bibliothek Platz der Göttinger Sieben 1 37073 Göttingen Telefon: (49)551 39-10242 Internet: www.gbv.de
Wikidata-tech mailing list Wikidata-tech@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata-tech
Wikidata-tech mailing list Wikidata-tech@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata-tech
If what you're executing is not something huge, doesn't require (m)any external dependencies, and doesn't have user interaction, you can try to (ab)use Scribunto's console AJAX interface:
Thanks, I used your example to set up a git repository with notes. I planned to clone the full module-namespace with git, so modules in MediaWiki can be managed (and locally tested) with git as well:
https://github.com/nichtich/wikidata-lua-client
Jakob
On Sun, Jan 5, 2014 at 9:34 PM, Voß, Jakob Jakob.Voss@gbv.de wrote:
If what you're executing is not something huge, doesn't require (m)any external dependencies, and doesn't have user interaction, you can try to (ab)use Scribunto's console AJAX interface:
Thanks, I used your example to set up a git repository with notes. I planned to clone the full module-namespace with git,
Huh this makes me think of a git-mediawiki tool (compare with git-svn).
There's already an (inactive) wikipediafs http://wikipediafs.sourceforge.net/
Just a quick idea. Nothing exists in reality.
-Liangent
so modules in MediaWiki can be managed (and locally tested) with git as well:
https://github.com/nichtich/wikidata-lua-client
Jakob _______________________________________________ Wikidata-tech mailing list Wikidata-tech@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata-tech
Am 05.01.2014 15:02, schrieb Liangent:
On Sun, Jan 5, 2014 at 9:34 PM, Voß, Jakob <Jakob.Voss@gbv.de mailto:Jakob.Voss@gbv.de> wrote:
> If what you're executing is not something huge, doesn't require (m)any > external dependencies, and doesn't have user interaction, you can try > to (ab)use Scribunto's console AJAX interface: Thanks, I used your example to set up a git repository with notes. I planned to clone the full module-namespace with git,
Huh this makes me think of a git-mediawiki tool (compare with git-svn).
There's already an (inactive) wikipediafs http://wikipediafs.sourceforge.net/
There's also the (inactive) levitation project: https://github.com/scy/levitation - "a project to convert Wikipedia database dumps into Git repositories". It doesn't scale for Wikipedia, but should work fine for smaller dumps.
-- daniel
wikidata-tech@lists.wikimedia.org