WolfgangFahl / py-3rdparty-mediawiki

Wrapper for pywikibot and mwclient MediaWiki API librarties with improvements for 3rd party wikis
Apache License 2.0
4 stars 5 forks source link

add wikiquery option #56

Closed WolfgangFahl closed 1 year ago

WolfgangFahl commented 3 years ago

The wikiquery command line should allow to get results in a given format:

The base functionality for this should be taken from pyLodStorage.

Acceptance criterion:

Situation The query {{#ask: [[IsA::Event]][[Acronym::~ES*]][[start date::>2018]][[start date::<2019]] | ?Title = title | ?Event in series = series | ?ordinal=ordinal | ?Homepage = homepage |format=table }} is given see https://www.openresearch.org/wiki/Workdocumentation_2021-02-16 Action put the query in a file "query1.ask"

  1. wikiquery -s or --queryFile query1.ask --format csv
  2. wikiquery -s or --queryFile query1.ask --format json

Expected Result

WolfgangFahl commented 3 years ago

I get

.wikiquery: TypeError("'>=' not supported between instances of 'int' and 'str'")

when i currently try out the feature with the acceptance criterion

WolfgangFahl commented 3 years ago
wikiquery -V
wikiquery v0.3.12 (2020-03-17)

now creates

{"data": [{"": "ESA 2018", "title": "26th Annual European Symposium on Algorithms", "series": "ESA", "ordinal": null, "homepage": "http://algo2018.hiit.fi/esa/"}, {"": "ESEC/FSE 2018", "title": "26th ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering (ESEC/FSE)", "series": "ESEC/FSE", "ordinal": null, "homepage": "https://2018.fseconference.org/"}, {"": "ESOP 2018", "title": "27th European Symposium on Programming", "series": "ESOP", "ordinal": null, "homepage": "https://etaps.org/2018/esop"}, {"": "ESORICS 2018", "title": "23rd European Symposium on Research in Computer Security,", "series": "ESORICS", "ordinal": null, "homepage": null}, {"": "ESSCIRC 2018", "title": "44th European Solid-State Circuits Conference", "series": "ESSCIRC", "ordinal": null, "homepage": null}, {"": "ESWC 2018", "title": "15th European Semantic Web Symposium (ESWS)", "series": "ESWC", "ordinal": null, "homepage": "http://2018.eswc-conferences.org/"}]}
tholzheim commented 3 years ago

If you want that the first key is not an empty string use|mainlabel= in the query to define this key.

For example '|mainlabel=Event' would result in:

{"data": [{"Event": "ESA 2018", "title": "26th Annual European Symposium on Algorithms", "series": "ESA", "ordinal": null, "homepage": "http://algo2018.hiit.fi/esa/"}, {"Event": "ESEC/FSE 2018", "title": "26th ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering (ESEC/FSE)", "series": "ESEC/FSE", "ordinal": null, "homepage": "https://2018.fseconference.org/"}, {"Event": "ESOP 2018", "title": "27th European Symposium on Programming", "series": "ESOP", "ordinal": null, "homepage": "https://etaps.org/2018/esop"}, {"Event": "ESORICS 2018", "title": "23rd European Symposium on Research in Computer Security,", "series": "ESORICS", "ordinal": null, "homepage": null}, {"Event": "ESSCIRC 2018", "title": "44th European Solid-State Circuits Conference", "series": "ESSCIRC", "ordinal": null, "homepage": null}, {"Event": "ESWC 2018", "title": "15th European Semantic Web Symposium (ESWS)", "series": "ESWC", "ordinal": null, "homepage": "http://2018.eswc-conferences.org/"}]}
WolfgangFahl commented 1 year ago

Need to migrate queries to cr wiki