You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.
In your fantastic Scholarly API guide, you provide code for accessing the Wikidata Query Service (WDQS) using Mathematica, but not Python. I do quite a bit of Python programming with Wikidata and a while back I created some Python code to query SPARQL endpoints and the Wikidata Query Service in particular. The code is freely available here:
There are some considerations that I discuss in the blog post, such as the User-Agent requirement. But the object can pretty much be copied and pasted into code and then just run with three lines of code:
once you've created the SPARQL query string and assigned it to query_string.
For Wikidata, only lines 22 through 162 (which define the query method) are actually needed since you can't write to the WDQS, so for use with Wikidata, one would not need to include the code for the entire object.
One issue with using the WDQS is that you need to know how to construct SPARQL queries. But there's quite a bit of information about that online and the Wikidata community is very helpful when it comes to assisting newcomers with learning.
Anyway, if this is helpful, you're welcome to use it.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
In your fantastic Scholarly API guide, you provide code for accessing the Wikidata Query Service (WDQS) using Mathematica, but not Python. I do quite a bit of Python programming with Wikidata and a while back I created some Python code to query SPARQL endpoints and the Wikidata Query Service in particular. The code is freely available here:
https://github.com/HeardLibrary/digital-scholarship/blob/master/code/wikidata/sparqler.py
and there's a blog post about it here.
There are some considerations that I discuss in the blog post, such as the User-Agent requirement. But the object can pretty much be copied and pasted into code and then just run with three lines of code:
once you've created the SPARQL query string and assigned it to
query_string
.For Wikidata, only lines 22 through 162 (which define the query method) are actually needed since you can't write to the WDQS, so for use with Wikidata, one would not need to include the code for the entire object.
One issue with using the WDQS is that you need to know how to construct SPARQL queries. But there's quite a bit of information about that online and the Wikidata community is very helpful when it comes to assisting newcomers with learning.
Anyway, if this is helpful, you're welcome to use it.
The text was updated successfully, but these errors were encountered: