From 2472baaa52e1bf6204c66b26a21b8a95b8da8dd2 Mon Sep 17 00:00:00 2001 From: nleanba <25827850+nleanba@users.noreply.github.com> Date: Thu, 29 Feb 2024 15:38:22 +0100 Subject: [PATCH] removed mat-cit frankenstein uri and put authors as string - frankensteun uri is now only used if neither uuid or httpUri are set in the xml - haveing separate authors as separate properties has no benefits but loses their order - this fixes https://github.com/plazi/names_LOD/issues/155 --- src/gg2rdf.ts | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/gg2rdf.ts b/src/gg2rdf.ts index 7dc1acf..1085412 100644 --- a/src/gg2rdf.ts +++ b/src/gg2rdf.ts @@ -507,13 +507,12 @@ export function gg2rdf(inputPath: string, outputPath: string) { const httpUri = c.getAttribute("httpUri"); const specimenCode = c.getAttribute("specimenCode"); - // TODO remove (&& !specimenCode) - const uri = (mcId && !specimenCode) + const uri = mcId ? `` : (httpUri ? `<${httpUri}>` : ``); if (!mcId && !httpUri && !specimenCode) { @@ -1025,8 +1024,6 @@ export function gg2rdf(inputPath: string, outputPath: string) { ranks.includes("variety") ? taxonName.getAttribute("variety") : "", ranks.includes("form") ? taxonName.getAttribute("form") : "", ]; - // the variety || subSpecies is due to a quirk of the xslt - // after replacement, this should proably be modified to put both if avaliable return "/" + names.filter((n) => !!n).map(normalizeSpace).map((n) => n.replaceAll(" ", "_") @@ -1084,13 +1081,12 @@ export function gg2rdf(inputPath: string, outputPath: string) { const mods = document.getElementsByTagName( "MODSname", ); - const modsAuthor = mods.filter((m) => - m.querySelector("MODSroleTerm").innerText.match(/author/i) - ).map((m) => - STR((m.querySelector("MODSnamePart").innerText as string).trim()) - ).join(", "); - // to keep author ordering (after xslt replaced): - // const modsAuthor = STR(mods.filter((m) => m.querySelector("MODSroleTerm").innerText.match(/author/i)).map((m) => (m.querySelector("MODSnamePart").innerText as string).trim()).join("; ")); + const modsAuthor = STR( + mods.filter((m) => + m.querySelector("MODSroleTerm").innerText.match(/author/i) + ).map((m) => (m.querySelector("MODSnamePart").innerText as string).trim()) + .join("; "), + ); // if (modsAuthor) return modsAuthor;