Last active
February 8, 2023 13:04
-
-
Save mjlassila/9d9f8541949d7959076a08445123de90 to your computer and use it in GitHub Desktop.
Count affiliation data availability in Journal.fi data and create list for all relevant publications.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare option output:method "csv"; | |
declare option output:csv "header=yes, separator=;"; | |
let $docs_with_affils:= | |
<records>{ | |
for $record in //oai_marc | |
where $record/controlfield[@tag eq "001"] contains text {'article.*'} using wildcards | |
let $parent:=substring-before(substring-after(base-uri($record),"/journalfi-data/"),".xml") | |
let $affiliation_count:=count($record//datafield[@tag eq '100' or @tag eq '700']/subfield[@code eq 'u']) | |
let $orcid_count:=count($record//datafield[@tag eq '100' or @tag eq '700']/subfield[@code eq '0' and . contains text {"orcid.*"} using wildcards]) | |
let $year:=substring($record/controlfield[@tag="008"],8,4) | |
let $journal_name:=replace(data($record/datafield[@tag eq "773"]/subfield[@code eq "t"]),". -","") | |
return | |
<entry> | |
<document>{$parent}</document> | |
<journal_name>{$journal_name}</journal_name> | |
<affiliation_count>{$affiliation_count}</affiliation_count> | |
<orcid_count>{$orcid_count}</orcid_count> | |
<year>{$year}</year> | |
</entry> | |
}</records> | |
let $csv:= | |
<csv>{for $record in $docs_with_affils/entry | |
let $journal:=$record/document | |
let $journal_name:=$record/journal_name | |
let $year:=$record/year | |
group by $journal,$journal_name,$year | |
order by $journal,$year descending | |
let $with_affils:=count($record[./affiliation_count >= 1]) | |
let $no_affils:=count($record[./affiliation_count = 0]) | |
let $with_orcid:=count($record[./orcid_count >= 1]) | |
let $no_orcid:=count($record[./orcid_count = 0]) | |
return | |
<entry> | |
<journal>{$journal}</journal> | |
<journal_name>{$journal_name}</journal_name> | |
<year>{$year}</year> | |
<with_affils>{$with_affils}</with_affils> | |
<no_affils>{$no_affils}</no_affils> | |
<with_orcid>{$with_orcid}</with_orcid> | |
<no_orcid>{$no_orcid}</no_orcid> | |
</entry> | |
}</csv> | |
return $csv | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare option output:method "csv"; | |
declare option output:csv "header=yes, separator=;"; | |
let $docs_with_affils:= | |
<records>{ | |
for $record in //oai_marc | |
let $affiliation_count:=count($record//datafield[@tag eq '100' or @tag eq '700']/subfield[@code eq 'u' and . contains text {"Tampere.*"} using wildcards]) | |
let $year:=substring($record/controlfield[@tag="008"],8,4) | |
where $record/controlfield[@tag eq "001"] contains text {'article.*'} using wildcards and $affiliation_count > 0 and $year eq "2022" | |
let $parent:=substring-before(substring-after(base-uri($record),"/journalfi-data/"),".xml") | |
let $orcid_count:=count($record//datafield[@tag eq '100' or @tag eq '700']/subfield[@code eq '0' and . contains text {"orcid.*"} using wildcards]) | |
let $journal_name:=replace(data($record/datafield[@tag eq "773"]/subfield[@code eq "t"]),". -","") | |
let $url:=data($record//datafield[@tag eq "856" and @ind1 eq "4"]/subfield[@code eq "u" and (. contains text {"article/view.*"} using wildcards or . contains text {"doi.*"} using wildcards)]) | |
let $title:=data($record//datafield[@tag eq "245" and @ind1 eq "1"]/subfield[@code eq "a"]) | |
let $section:=data($record//datafield[@tag eq "490"]/subfield[@code eq "a"]) | |
return | |
<entry> | |
<document>{$parent}</document> | |
<journal_name>{$journal_name}</journal_name> | |
<year>{$year}</year> | |
<title>{$title}</title> | |
<section>{$section}</section> | |
<url>{$url}</url> | |
</entry> | |
}</records> | |
return $docs_with_affils |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment