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 / nomisma-pleiades-json
Created July 11, 2014 18:18
SPARQL query of nomisma3 - get geoJSON for regions associated with Pleiades
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX osgeo: <http://data.ordnancesurvey.co.uk/ontology/geometry/>
SELECT ?place ?pleiades ?geoJSON WHERE {
?place skos:relatedMatch ?pleiades .
?place geo:location ?loc .
?loc osgeo:asGeoJSON ?geoJSON
}
@ewg118
ewg118 / nomisma-images
Created February 24, 2015 22:21
Nomisma SPARQL images
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX dcmitype: <http://purl.org/dc/dcmitype/>
PREFIX dcterms: <http://purl.org/dc/terms/>
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 osgeo: <http://data.ordnancesurvey.co.uk/ontology/geometry/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:template match="/">
<xsl:for-each select="descendant::*:fsDecl">
<xsl:variable name="id" select="@xml:id"/>
<xsl:value-of select="*:fsDescr"/>
<xsl:text>: </xsl:text>
<xsl:value-of select="count(ancestor::*:TEI/descendant::*:fs[@type=$id])"/>
@ewg118
ewg118 / rome_labels
Last active August 29, 2015 14:21
Query labels for nm:rome
SELECT ?label WHERE {
<http://nomisma.org/id/rome> <http://www.w3.org/2004/02/skos/core#prefLabel> ?label
}
@ewg118
ewg118 / gist:3c55da72510cae200f93
Last active August 29, 2015 14:21
Get information about nm:rome
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX nm: <http://nomisma.org/id/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT ?label ?type ?field ?lat ?long WHERE {
nm:rome skos:prefLabel ?label .
nm:rome rdf:type ?type .
nm:rome dcterms:isPartOf ?field .
@ewg118
ewg118 / rome_metadata_semicolons
Last active August 29, 2015 14:21
Get information about nm:rome with semicolons
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX nm: <http://nomisma.org/id/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT ?label ?type ?field ?lat ?long WHERE {
nm:rome skos:prefLabel ?label ;
rdf:type ?type ;
dcterms:isPartOf ?field ;
@ewg118
ewg118 / gist:00be8e5671a795a147ed
Last active August 29, 2015 14:21
Get labels, order alphabetally
PREFIX nm: <http://nomisma.org/id/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?label WHERE {
nm:rome skos:prefLabel ?label
} ORDER BY ASC(xsd:string(?label))
@ewg118
ewg118 / gist:8161a9e118f3b8803a97
Last active August 29, 2015 14:21
Filter by English label
PREFIX nm: <http://nomisma.org/id/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT ?label WHERE {
nm:rome skos:prefLabel ?label .
FILTER langMatches( lang(?label), "en" )
}
@ewg118
ewg118 / gist:5e94523486541f3d89e2
Last active August 29, 2015 14:21
Get a list of mints
PREFIX nmo: <http://nomisma.org/ontology#>
SELECT ?mints WHERE {
?mints a nmo:Mint
}
@ewg118
ewg118 / gist:7eb155ed89f04219af0f
Last active August 29, 2015 14:21
Visualizing Greek coin production
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX nm: <http://nomisma.org/id/>
PREFIX nmo: <http://nomisma.org/ontology#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT ?label ?lat ?long WHERE {
?mints a nmo:Mint ;
skos:prefLabel ?label ;
dcterms:isPartOf nm:greek_numismatics ;