[librecat-dev] fix usecase

Patrick Hochstenbach Patrick.Hochstenbach at UGent.be
Thu Sep 1 14:46:16 CEST 2016


Hi Spiros

I didn’t find an exact answer using the Fix language..but a report that can get you started.

You need to create a CVS file like:

test.csv:

name,value
DLC,DLC
OCLC,OCLC

Yes..it requires a name and value column. It doesn’t matter what is in the value column as long as it isn’t empty.

This fix file will generate a report on all the MARC tags that have the $$c subfield matching the CVS file:

test.fix:

do marc_each()
  copy_field(record.0.0,test.name)
  marc_map(***c,test.value)
  lookup(test.value,test.csv,delete:1)
  if exists(test.value)
    copy_field(test,found.$append)
  end
  remove_field(test)
end

remove_field(record)

Run it as:

$ catmandu convert MARC to YAML --fix test.fix < camel.usmarc 
---
_id: 'fol05872355 '
found:
- name: '040'
  value: DLC
...
---
_id: 'fol05882032 '
found:
- name: '040'
  value: DLC

You don’t get the indicators not are the fields sorted and counted. To be very honest, the report you would actually want would require programming Perl,PHP,Ruby,whatever by hand.

Patrick

> On 30 Aug 2016, at 16:26, Spiros Antonio <spiros.antonio at gmail.com> wrote:
> 
> Hello,
> 
> say one has in a csv in a per row basis, some $a values.
> 
> One has to lookup the csv, and for each value found there, check the whole mrc,
> and report for each tag found, what are the occurrences found, so in order to be able to see duplicates, all unique values. The important part is that this array(?) that will be stored,
> will have to take into account the whole tag, along with its indicators.
>  
> 
> 601  \\$a678676382683768$bmetadata$cotherdata
> 601  1\$a678676382683768$bmetadata$cotherdata, should be reported, as different values since the indicator differs.
> and this lookup, should be done in the whole mrc, not in a per record basis.
> 
> Something like return all unique values of each tag found in the mrc, that has as $3 each value found in the csv file. How would you approach this with an example script?
> 
> 
> perhaps the inclusion of 001 would also be a good idea in the whole report.
> 
> 001 ||| $3_value ||| tags_sorted_by_times_found
> 
> Thank you
> 
> _______________________________________________
> librecat-dev mailing list
> - send list mails to librecat-dev at lists.uni-bielefeld.de
> - to unsubscribe or change options, visit https://lists.uni-bielefeld.de/mailman2/cgi/unibi/listinfo/librecat-dev
> - project website: http://librecat.org/

Patrick Hochstenbach - digital architect
University Library Ghent
Sint-Hubertusstraat 8 - 9000 Ghent - Belgium
patrick.hochstenbach at ugent.be
+32 (0)9 264 7980




More information about the librecat-dev mailing list