This file contains 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
Hello from the Internet! |
This file contains 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
# sparql_gui, a script for making SPARQL queries from a graphical interface. sparql_gui.py | |
SCRIPT_VERSION = '0.1.0' | |
VERSION_MODIFIED = '2023-08-16' | |
# (c) 2023 Vanderbilt University. This program is released under a GNU General Public License v3.0 http://www.gnu.org/licenses/gpl-3.0 | |
# Author: Steve Baskauf | |
# For more information, see https://github.com/HeardLibrary/linked-data/tree/master/sparql | |
# The Sparqler class code is (c) 2022-2023 Steven J. Baskauf | |
# and released under a GNU General Public License v3.0 http://www.gnu.org/licenses/gpl-3.0 |
This file contains 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 pynput.keyboard import Key, Listener | |
import requests | |
import datetime | |
import time | |
import json | |
class Sparqler: | |
"""Build SPARQL queries of various sorts | |
Parameters |
This file contains 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
SELECT DISTINCT ?work ?workLabel ?class ?classLabel ?otherConcepts ?prefLabel ?nomLabel | |
WHERE { | |
#bind(wd:Q102962863 as ?work) | |
bind(wd:Q104031914 as ?work) | |
?work rdfs:label ?workLabel. | |
?work wdt:P31 ?class. | |
?class rdfs:label ?classLabel. | |
?class skos:exactMatch ?otherConcepts. | |
optional { |
This file contains 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
{ | |
"@context": { | |
"literalForm": "http://www.w3.org/2008/05/skos-xl#literalForm", | |
"prefLabel": "http://www.w3.org/2008/05/skos-xl#prefLabel", | |
"altLabel": "http://www.w3.org/2008/05/skos-xl#altLabel", | |
"identifier": "@id", | |
"language": "http://purl.org/dc/elements/1.1/language", | |
"source": "http://purl.org/dc/elements/1.1/source", | |
"nameType": "http://rs.tdwg.org/min/terms/nameType" | |
}, |
This file contains 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
{ | |
"textAnnotations": [ | |
{ | |
"locale": "en", | |
"description": "Fight World Famine\nenroll in\nThe Boys Working Reserve\nU.S. EMPLOYMENT SERVICE\nAPPLY\nTHER COMPANY, BALTO New You\nDEPARTMENT OF LABOR", | |
"boundingPoly": { | |
"vertices": [ | |
{ | |
"x": 26, | |
"y": 1106 |
This file contains 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
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | |
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | |
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> | |
PREFIX skosxl: <http://www.w3.org/2008/05/skos-xl#> | |
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> | |
PREFIX dc: <http://purl.org/dc/elements/1.1/> | |
PREFIX dcterms: <http://purl.org/dc/terms/> | |
PREFIX dcat: <http://www.w3.org/ns/dcat#> | |
PREFIX wd: <http://www.wikidata.org/entity/> | |
PREFIX wdt: <http://www.wikidata.org/prop/direct/> |
This file contains 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
construct { | |
?class wdt:P279 ?superclass. | |
?base_class rdfs:label ?base_label. | |
?superclass rdfs:label ?super_label. | |
} | |
where { | |
# Q102971873 is "Soba-choko (noodle sauce cup) with a design in blue underglaze of a stylized rock and grasses" | |
bind (wd:Q102971873 as ?artwork) # Comment out this line to do all artworks | |
?artwork wdt:P195 wd:Q18563658. # must be in the Vanderbilt Art Gallery | |
?artwork wdt:P31 ?base_class. # artwork is an instance of the base class |
This file contains 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
construct { | |
?artwork wdt:P31 ?class. | |
?artwork rdfs:label ?label. | |
} | |
where { | |
?artwork wdt:P195 wd:Q18563658. | |
?artwork wdt:P31 ?class. | |
?artwork rdfs:label ?label. | |
filter(lang(?label)="en") | |
} |
This file contains 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
select distinct ?broader_subject ?subject_label ?broader_object ?object_label | |
from <http://AATOut_2Terms> | |
from <http://AATOut_HierarchicalRels> | |
where { | |
# http://vocab.getty.edu/aat/300043022 is the IRI for "teapots" | |
bind(<http://vocab.getty.edu/aat/300193015> as ?broader_subject) | |
?broader_subject gvp:broaderGeneric ?broader_object. |
NewerOlder