Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Method for aligning Nomisma mints with Getty via Ryan B's script
#' ----
#' title: " A script for aligning data from the TGN to Nomisma based on Pleiades IDs"
#' author: "Daniel Pett"
#' date: "10/16/2015"
#' output: csv_document
#' ----
setwd("C:\\rstuff")
nomisma <- read.csv("http://nomisma.org/query?query=PREFIX+nm%3A%09%3Chttp%3A%2F%2Fnomisma.org%2Fid%2F%3E%0D%0A++++PREFIX+nmo%3A%09%3Chttp%3A%2F%2Fnomisma.org%2Fontology%23%3E%0D%0A++++PREFIX+skos%3A%09%3Chttp%3A%2F%2Fwww.w3.org%2F2004%2F02%2Fskos%2Fcore%23%3E%0D%0A++++SELECT+*+WHERE+%7B%0D%0A++++%3Furi+a+nmo%3AMint%3B%0D%0A++++skos%3AprefLabel+%3Flabel%3B%0D%0A++++skos%3AcloseMatch+%3Fmatch%3B%0D%0A++++.FILTER+regex%28str%28%3Fmatch%29%2C+%22pleiades%22%29+.%0D%0A++++FILTER%28langMatches%28lang%28%3Flabel%29%2C+%22EN%22%29%29+.%0D%0A++++%7D+LIMIT+100000&output=csv")
names(nomisma) <- c('uri', 'prefLabel', 'pleiades')
tgn <- read.csv('https://raw.githubusercontent.com/ryanfb/pleiades-tgn/master/pleiades-tgn.csv', header=FALSE)
names(tgn) <- c('gettyID', 'pleiades')
final <- merge(tgn, nomisma, by='pleiades', all=FALSE )
write.csv(final, file="matchedNomismaTGN.csv",row.names=FALSE)
@portableant

This comment has been minimized.

Copy link
Owner Author

portableant commented Oct 22, 2015

The sparql query for this is:
PREFIX nm: http://nomisma.org/id/
PREFIX nmo: http://nomisma.org/ontology#
PREFIX skos: http://www.w3.org/2004/02/skos/core#
SELECT * WHERE {
?uri a nmo:Mint;
skos:prefLabel ?label;
skos:closeMatch ?match;
.FILTER regex(str(?match), "pleiades") .
FILTER(langMatches(lang(?label), "EN")) .
} LIMIT 1000

Obtain the data from @ryanfb's repo here for matching: https://github.com/ryanfb/pleiades-tgn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.