Skip to content

Instantly share code, notes, and snippets.

@ostephens
Last active December 21, 2015 16:49
Show Gist options
  • Save ostephens/6336085 to your computer and use it in GitHub Desktop.
Save ostephens/6336085 to your computer and use it in GitHub Desktop.
GREL (Google Refine Expression Language) to extract ISSN from the GOKb Co-referencing service. Gives appropriate errors if multiple records or multiple ISSNs in GOKb Co-reference Service response
if(
length(value.parseJson()["records"])>1,
"Multiple Records match that identifier, check CRED (Web UI) for errors",
with(
filter(value.parseJson()["records"][0]["sameAs"],v,v["namespace"]=="issn"),
issns,
if(length(issns)>1,"Multiple ISSNs for one Title": ","") + forEach(issns,v,v["identifier"]).join(",")
)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment