This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| import requests | |
| import time | |
| urlbase = 'http://data.europeana.eu/place/base/' | |
| import sys | |
| print (sys.getdefaultencoding()) | |
| def check(Qnumber): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| https://tinyurl.com/s84pyc8 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # see https://phabricator.wikimedia.org/T240809 | |
| # query https://w.wiki/E3V | |
| # youtube https://youtu.be/NnoIhdaU6SQ | |
| from SPARQLWrapper import SPARQLWrapper, JSON | |
| endpoint_url = "https://query.wikidata.org/sparql" | |
| query = """SELECT ?EuropeanaEntity ?tgt ?change (REPLACE(STR(?item), ".*Q", "Q") AS ?qid) (REPLACE(STR(?tgt), ".*Q", "Q") AS ?tgtQid) ?tgtLabel WHERE { | |
| ?tgt wdt:P7704 ?EuropeanaEntityID. | |
| ?item owl:sameAs ?tgt; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """Small utility that reads the CheckConsistency log | |
| and check consistancy that everythings is in Wikidata | |
| 1) Read the logs in INFILE | |
| 2) read Wikidata | |
| 3) loop everything | |
| 3-1) Log missing to file | |
| See also Constraints report in Wikidata | |
| https://www.wikidata.org/wiki/Wikidata:Database_reports/Constraint_violations/P7704 | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # pip install sparqlwrapper | |
| # https://rdflib.github.io/sparqlwrapper/ | |
| from SPARQLWrapper import SPARQLWrapper, JSON | |
| endpoint_url = "https://query.wikidata.org/sparql" | |
| query = """SELECT ?sculptors (REPLACE(STR(?sculptors),".*Q","Q") AS ?WD) ?sculptorsLabel ?birth ?died ?sculptorsDescription WHERE { | |
| VALUES ?sculptors { wd:Q4936564 wd:Q5908201 wd:Q4938072 wd:Q15711231 wd:Q4966391 wd:Q4939597 wd:Q16596588 | |
| wd:Q4952238 wd:Q2827030 wd:Q4970016 wd:Q4970058 wd:Q4935445 wd:Q20156198 wd:Q4981273 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| import urllib.request | |
| import time | |
| from bs4 import BeautifulSoup | |
| def cleanupstring(s): | |
| out_s = s | |
| while ' ' in out_s: | |
| out_s = out_s.strip().replace(' ', ' ') | |
| return out_s, len(s)-len(out_s) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from builtins import type | |
| from selenium import webdriver | |
| from selenium.webdriver.common.keys import Keys | |
| import time | |
| driver = webdriver.Firefox() | |
| start = 1 | |
| endrange = 10000 | |
| with open('breadfilecounty.txt','w') as filehandlecounty: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Find duplicate SBL WD records ..... | |
| # SBL but no sv article https://w.wiki/NUT | |
| #Version 0.2 add blacklist | |
| __version__ = "0.2" | |
| __author__ = "Magnus Sälgö" | |
| print ("version: ",__version__) | |
| import requests | |
| from bs4 import BeautifulSoup |