Skip to content

Instantly share code, notes, and snippets.

View ewg118's full-sized avatar

Ethan Gruber ewg118

  • American Numismatic Society
  • Charlottesville, Virginia
View GitHub Profile
@ewg118
ewg118 / uva-lib:2372197.xml
Created May 8, 2026 18:23
uva-lib:2372197 enriched MODS
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<mods xmlns="http://www.loc.gov/mods/v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/mods/v3 mods-3-6.xsd" version="3.6">
<typeOfResource>still image</typeOfResource>
<titleInfo>
<title>North Wales</title>
</titleInfo>
<name authority="lcnaf" type="personal" valueURI="http://id.loc.gov/authorities/names/n85307501">
<namePart>Johnston, Frances Benjamin, 1864-1952</namePart>
<role>
<roleTerm type="code" authority="marcrelator" valueURI="http://id.loc.gov/vocabulary/relators/pht"/>
{
"@context": "https://linked.art/ns/v1/linked-art.json",
"id": "https://search.lib.virginia.edu/sources/images/items/uva-lib:2372197",
"type": "HumanMadeObject",
"_label": "North Wales",
"identified_by": [
{
"type": "Name",
"content": "North Wales",
"classified_as": [
@ewg118
ewg118 / set.ttl
Last active March 4, 2026 19:16
Linked Art Set provenance example
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix la: <https://linked.art/ns/terms/> .
@prefix crm: <http://www.cidoc-crm.org/cidoc-crm/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<http://numismatics.org/lot/1955.190>
a la:Set ;
rdfs:label "1955.190" ;
la:members_exemplified_by [
a crm:E22_Human-Made_Object ;
@ewg118
ewg118 / gist:fc8b0cb305a6d733f95b6792e0ced50a
Created February 17, 2026 16:28
Apache config for blocking old user agents
SetEnvIf User-Agent "Mozilla/[1-3].*" badbot
SetEnvIf User-Agent "Ubuntu/1*" badbot
SetEnvIf User-Agent "Android [1-4]\." badbot
SetEnvIf User-Agent "iPhone OS [0-6]_" badbot
SetEnvIf User-Agent "Mac OS X 10_[0-6]_" badbot
SetEnvIf User-Agent "Windows NT [1-6]\..*" badbot
SetEnvIf User-Agent "Safari/[1-4][0-9][0-9]\..*" badbot
SetEnvIf User-Agent "Chrome/[0-6][0-9]\." badbot
SetEnvIf User-Agent "Windows 9.*" badbot
SetEnvIf User-Agent "Windows CE.*" badbot
@ewg118
ewg118 / wikidata-hierarchy.sparql
Last active December 1, 2025 20:50
Wikidata basic hierarchy query
SELECT ?concept ?conceptLabel (GROUP_CONCAT(DISTINCT(?altLabel); separator = "|") AS ?altLabels) ?parent ?parentLabel (GROUP_CONCAT(DISTINCT(?parentAltLabel); separator = "|") AS ?parentAltLabels) WHERE {
BIND (<http://www.wikidata.org/entity/Q2102> as ?concept)
?concept wdt:P279+|wdt:P31 ?parent .
FILTER NOT EXISTS {?parent wdt:P31 wd:Q19478619}
FILTER NOT EXISTS {?parent wdt:P31 wd:Q124711104}
FILTER NOT EXISTS {?parent wdt:P279 wd:Q27043950}
OPTIONAL {?concept skos:altLabel ?altLabel FILTER (langMatches(lang(?altLabel), "en")) }
OPTIONAL {?parent skos:altLabel ?parentAltLabel FILTER (langMatches(lang(?parentAltLabel), "en")) }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
} GROUP BY ?concept ?conceptLabel ?parent ?parentLabel
@ewg118
ewg118 / pella_gold.sparql
Last active October 24, 2025 15:22
PELLA gold coins and images
PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX dcmitype: <http://purl.org/dc/dcmitype/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX nm: <http://nomisma.org/id/>
PREFIX nmo: <http://nomisma.org/ontology#>
PREFIX org: <http://www.w3.org/ns/org#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
@ewg118
ewg118 / yale-template.rdf
Last active October 14, 2025 18:02
Yale OpenRefine RDF template for Kerameikos
<crm:E22_Man-Made_Object rdf:about="{{cells['URI'].value}}">
<crm:P1_is_identified_by>
<crm:E33_E41_Linguistic_Appellation>
<crm:P190_has_symbolic_content>{{cells['Title'].value}}</crm:P190_has_symbolic_content>
<crm:P2_has_type rdf:resource="http://vocab.getty.edu/aat/300404670"/>
</crm:E33_E41_Linguistic_Appellation>
</crm:P1_is_identified_by>
<crm:P1_is_identified_by>
<crm:E42_Identifier>
<crm:P190_has_symbolic_content>{{cells['Accession number'].value}}</crm:P190_has_symbolic_content>
@ewg118
ewg118 / met-meseum-template.rdf
Last active September 5, 2025 20:21
Met Museum OpenRefine template
<crm:E22_Man-Made_Object rdf:about="{{cells['URI'].value}}">
<crm:P1_is_identified_by>
<crm:E33_E41_Linguistic_Appellation>
<crm:P190_has_symbolic_content>{{cells['Title'].value}}</crm:P190_has_symbolic_content>
<crm:P2_has_type rdf:resource="http://vocab.getty.edu/aat/300404670"/>
</crm:E33_E41_Linguistic_Appellation>
</crm:P1_is_identified_by>
<crm:P1_is_identified_by>
<crm:E42_Identifier>
<crm:P190_has_symbolic_content>{{cells['Accession'].value}}</crm:P190_has_symbolic_content>
@ewg118
ewg118 / ashmolean-template.rdf
Last active September 4, 2025 15:26
Ashmolean OpenRefine RDF template for Kerameikos
<crm:E22_Man-Made_Object rdf:about="{{cells['URI'].value}}">
<crm:P1_is_identified_by>
<crm:E33_E41_Linguistic_Appellation>
<crm:P190_has_symbolic_content>{{cells['Title'].value}}</crm:P190_has_symbolic_content>
<crm:P2_has_type rdf:resource="http://vocab.getty.edu/aat/300404670"/>
</crm:E33_E41_Linguistic_Appellation>
</crm:P1_is_identified_by>
<crm:P1_is_identified_by>
<crm:E42_Identifier>
<crm:P190_has_symbolic_content>{{cells['Accession number'].value}}</crm:P190_has_symbolic_content>
@ewg118
ewg118 / hoard_concordance.sparql
Created July 25, 2025 14:43
Get hoard concordance URIs from Nomisma SPARQL
PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX dcmitype: <http://purl.org/dc/dcmitype/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX nm: <http://nomisma.org/id/>
PREFIX nmo: <http://nomisma.org/ontology#>
PREFIX org: <http://www.w3.org/ns/org#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>