Awinkler3
https://orcid.org/0000-0002-9145-7238
Works for digiS Berlin (Research and Competence Centre Digitalisation Berlin (Q51845259))
Member of the Committee for Digital Resources of the International Association for Neo-Latin Studies (Q16319503) [1]
Possible ToDos
editAdd nicknames of members of Italian learned societies
editCurrently, the most commonly used data model doesn't appear to be appropriate (mostly the nickname is given as pseudonym (P742), cf. the following query:
SELECT ?pers ?persLabel ?society ?societyLabel ?name WHERE {
?pers wdt:P31 wd:Q5 ;
wdt:P463 ?society ;
wdt:P1810| wdt:P742 | wdt:P1449 ?name .
?society wdt:P17 wd:Q38 .
SERVICE wikibase:label { bd:serviceParam wikibase:language "it". }
It would be better (I think) to add the nickname as a qualifier subject named as (P1810) in a member of (P463):
SELECT ?pers ?persLabel ?society ?societyLabel ?name WHERE {
?pers wdt:P31 wd:Q5 ;
p:P463 ?statement .
?statement ps:P463 ?society ;
pq:P742| pq:P1810 ?name .
?society wdt:P17 wd:Q38 .
SERVICE wikibase:label { bd:serviceParam wikibase:language "it". }
Neo-Latin
editResources
editSlides for digital@IANLS sessions on "Wikidata for Neolatinists": https://doi.org/10.5281/zenodo.7638227, https://doi.org/10.5281/zenodo.7674768
Wikidata related Projects
edit- Database of Neo-Latin epic poems (uses Wikidata Q-IDs to identify authors and subjects).
Database of Neo-Latin Epic Poetry
editDatabase of Neo-Latin Epic Poetry
SPARQL queries
editSum of all Neo-Latin Literature
editMastodon on Wikidata
editZeiteiste mit GLAMs auf Wikidata
#defaultView:Timeline
SELECT DISTINCT ?inst ?instLabel ?mastodon ?coords ?startDate
WHERE {
{ ?inst wdt:P31/wdt:P279* wd:Q33506 } UNION #Museums
{ ?inst wdt:P31/wdt:P279* wd:Q7075 } UNION #Libraries
{ ?inst wdt:P31/wdt:P279* wd:Q5003624 } UNION #Gedenkstätte
{ ?inst wdt:P31/wdt:P279* wd:Q166118 } # Archives
?inst wdt:P4033 ?mastodon .
OPTIONAL { ?inst wdt:P625 ?coords . }
OPTIONAL { ?inst p:P4033 [ pq:P580 ?startDate ] . }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
Alle aktiven GLAM-Mastodon-Accounts (ohne "endDate" qualifier):
#defaultView:Timeline
SELECT DISTINCT ?inst ?instLabel ?mastodon ?coords ?startDate
WHERE {
{ ?inst wdt:P31/wdt:P279* wd:Q33506 } UNION #Museums
{ ?inst wdt:P31/wdt:P279* wd:Q7075 } UNION #Libraries
{ ?inst wdt:P31/wdt:P279* wd:Q5003624 } UNION #Gedenkstätte
{ ?inst wdt:P31/wdt:P279* wd:Q166118 } # Archives
?inst wdt:P4033 ?mastodon .
?inst p:P4033 ?statement .
?statement pq:P580 ?startDate .
MINUS { ?statement pq:P582 ?endDate . }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
Alle Mastodon-Accounts auf Wikidata
SELECT DISTINCT ?inst ?instLabel ?mastodon
WHERE {
?inst wdt:P4033 ?mastodon .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Aktuellste Followerzahlen für Mastodonaccounts auf Wikidata
#title: Get most recent Mastodon follower count
# adapted from: https://stackoverflow.com/questions/36181713/sparql-query-to-get-only-results-with-the-most-recent-date
SELECT ?id ?address ?follower ?date WHERE {
?id p:P8687 ?statement .
?statement pq:P4033 ?address ;
pq:P585 ?date ;
ps:P8687 ?follower .
FILTER NOT EXISTS {
?id p:P8687 [ pq:P585 ?date2 ] .
FILTER (?date2 > ?date)
}
}
import requests from tqdm import tqdm from datetime import datetime import sys from SPARQLWrapper import SPARQLWrapper, JSON def getTS(): # Get current datetime now = datetime.now() # Format datetime as required formatted_now = "+"+now.strftime("%Y-%m-%dT00:00:00Z/11") return formatted_now def get_results(endpoint_url, query): user_agent = "WDQS-example Python/%s.%s" % (sys.version_info[0], sys.version_info[1]) # TODO adjust user agent; see https://w.wiki/CX6 sparql = SPARQLWrapper(endpoint_url, agent=user_agent) sparql.setQuery(query) sparql.setReturnFormat(JSON) return sparql.query().convert() def getMastoInfo(acctname): name, instance = acctname.split('@') res = requests.get( f"https://{instance}/api/v1/accounts/lookup?acct={name}" ).json() return { 'name' : name, 'accID' : res.get('id'), 'instance' : instance, 'followers' : res.get('followers_count'), 'following' : res.get('following_count'), 'statuses' : res.get('statuses_count'), 'timestamp' : getTS() } endpoint_url = "https://query.wikidata.org/sparql" query = "" logs = [] with open('followers.csv', 'w') as OUT: for result in tqdm(results["results"]["bindings"]): QID = result['inst']['value'].rpartition('/')[2] try: acctname = result['mastodon']['value'] mastInfo = getMastoInfo(acctname) OUT.write(f"{QID}\tP8687\t{mastInfo.get('followers')}\tP4033\t\"{acctname}\"\tP585\t{mastInfo.get('timestamp')}\n") #print(f"{QID}\tP8687\t{mastInfo.get('followers')}\tP4033\t\"{acctname}\"\tP585\t{mastInfo.get('timestamp')}") except Exception as e: print(e) logs.append(QID)
GLAM
edit- Wikidata:WikiProject_sum_of_all_paintings
- Wikidata:GLAM
- Museo egizio di Torino
- Wikidata:WikiProject_Städel_Museum_Wikidata_Clean-Up
Resources
editPresentation on Wikidata for GLAMs (in German): Slides and recording
(not my) Projects
edit- OpenArtBrowser
- Short poll on Mastodon
SPARQL queries
editZahl der Objekte (d.h. Items) in #Berliner Museen auf #Wikidata (#SPARQL) je Museum
edit#defaultView:BarChart
SELECT ?mus ?musLabel (COUNT(?obj) AS ?n) WHERE {
?mus (wdt:P31|wdt:P31/wdt:P279|wdt:P31/wdt:P279/wdt:P279|wdt:P31/wdt:P279/wdt:P279/wdt:P279) wd:Q33506 ;
wdt:P131/wdt:P131* wd:Q64 .
?obj wdt:P276 ?mus .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} GROUP BY ?mus ?musLabel
ORDER BY DESC(?n)
Objects in the Gemäldegalerie Berlin without a depicts statement
edit# Objekte der Gemäldegalerie ohne Themenangabe
SELECT ?work ?workLabel ?URL WHERE {
?work wdt:P276 wd:Q165631 ;
wdt:P8923 ?SMBID .
FILTER NOT EXISTS {
?work wdt:P180 ?_ .
}
wd:P8923 wdt:P1630 ?formatterurl .
BIND(IRI(REPLACE(?SMBID, '^(.+)$', ?formatterurl)) AS ?URL).
SERVICE wikibase:label { bd:serviceParam wikibase:language "de,[AUTO_LANGUAGE],en". }
}
Objects in the Gemäldegalerie Berlin without an image property
edit#title: Objekte der Berliner Gemäldegalerie ohne image
SELECT DISTINCT ?obj ?objLabel WHERE {
?obj (wdt:P276| wdt:P195) wd:Q165631 .
?obj wdt:P31/wdt:P279+ wd:Q838948 .
MINUS { ?obj wdt:P18 ?img . }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
How many objects do art museums have on Wikidata and how many statements have the object items on average?
edit#title: Wie viele Objekte je Kunstmuseum (Q207694) sind auf Wikidata und wie viele Wikidata-Statements haben die Objekt-Items durchschnittlich?
SELECT ?mus ?musLabel ?objCount ?avgStatements WHERE {
{
SELECT ?mus (COUNT(?obj) AS ?objCount) (AVG(?c) AS ?avgStatements) WHERE {
?mus wdt:P31 wd:Q207694 .
?obj wdt:P276 ?mus;
wikibase:statements ?c
} GROUP BY ?mus ?musLabel }
FILTER ( ?objCount > 100)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY DESC(?avgStatements)
Average number of references in statements on objects located in German art museum
edit#title: Durchschnittliche Zahl an Quellenangabe (URL bzw. Item) bei Objekten in Kunstmuseen
SELECT ?collection ?collectionLabel (AVG(?numberOfReferences) AS ?revAverage)
WITH {
#named Subquery via https://renenyffenegger.ch/notes/development/Data/open/Wikidata/index nach https://w.wiki/5pWb
SELECT ?obj $collection WHERE {
?obj wdt:P276 $collection .
?collection wdt:P31 wd:Q207694;
wdt:P17 wd:Q183 .
}
} AS %objects
WHERE {
SELECT ?collection ?collectionLabel ?obj (COUNT(?refnode) AS ?numberOfReferences)
WHERE {
include %objects
?obj ?x ?statement.
?statement prov:wasDerivedFrom ?refnode.
?refnode (pr:P248| pr:P854) ?ref.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?collection ?collectionLabel ?obj
}
GROUP BY ?collection ?collectionLabel
ORDER BY DESC(?revAverage)
BiB2WD - Bildhauerei in Berlin und Wikidata
editLanguages
editBabel user information | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
Users by language |
BEACON -> Quickstatements -> Wikidata
editBEACON -> QS-Files
edit
curl "<BEACON-URL>" | grep '||' | awk -F"|" '{print $3"\tP<PROPERTY>\t"$1}' | split -d -a 3 -l 3000 - <PREFIX>_
Results in a bunch of files <PREFIX>_000
through <PREFIX>_n
containing QS commands like Q123 P<PROPERTY> ID
.
QS-Files -> Wikidata
editQS-Token can be found here.
for i in <PREFIX>_*; do curl https://quickstatements.toolforge.org/api.php -d action=import -d submit=1 -d format=v1 -d username=Awinkler3 -d "batchname=$i" --data-raw 'token=<QS Token>' --data-urlencode data@$i; done