<commit_before><?xml version="1.0" encoding="UTF-8"?>

<metamorph xmlns="http://www.culturegraph.org/metamorph" version="1">

    <vars>
        <var name="swissbib_domain" value="http://data.swissbib.ch/resource/"/>
    </vars>


    <macros>
        <macro name="context">
            <!-- Writes JSON-LD context -->
            <entity name="@context" flushWith="record">

                <data name="bf" source="_id">
                    <constant value="http://bibframe.org/vocab/"/>
                </data>

                <data name="rdfs" source="_id">
                    <constant value="http://www.w3.org/2000/01/rdf-schema#"/>
                </data>

                <data name="dbp" source="_id">
                    <constant value="http://dbpedia.org/ontology/"/>
                </data>

                <data name="rdau" source="_id">
                    <constant value="http://rdaregistry.info/Elements/u/"/>
                </data>

                <data name="dct" source="_id">
                    <constant value="http://purl.org/dc/terms/"/>
                </data>

                <data name="rdf" source="_id">
                    <constant value="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>
                </data>

                <data name="foaf" source="_id">
                    <constant value="http://xmlns.com/foaf/0.1/"/>
                </data>

                <data name="bibo" source="_id">
                    <constant value="http://purl.org/ontology/bibo/"/>
                </data>

                <data name="dc" source="_id">
                    <constant value="http://purl.org/dc/elements/1.1/"/>
                </data>

                <data name="skos" source="_id">
                    <constant value="http://www.w3.org/2004/02/skos/core#"/>
                </data>

            </entity>
        </macro>
    </macros>


    <rules>

        <!-- Definitions for recursions to be used later in substructures (must be set here!) -->

        <data source="008" name="@language">
            <substring start="35" end="38"/>
        </data>

        <combine name="@key1000" value="${name}##${number}##${title}##${lifedata}##${fullname}" flushWith="1000 ">
            <data source="1000 .a" name="name"/>
            <data source="1000 .b" name="number"/>
            <data source="1000 .c" name="title"/>
            <data source="1000 .d" name="lifedata"/>
            <data source="1000 .q" name="fullname"/>
            <postprocess>
                <java class="org.swissbib.linked.mf.morph.functions.AuthorHash"/>
            </postprocess>
        </combine>
        <combine name="@key1001" value="${lastname}##${firstname}##${number}##${title}##${lifedata}##${fullname}"
                 flushWith="1001 ">
            <data source="1001 .a" name="lastname"/>
            <data source="1001 .D" name="firstname"/>
            <data source="1001 .b" name="number"/>
            <data source="1001 .c" name="title"/>
            <data source="1001 .d" name="lifedata"/>
            <data source="1001 .q" name="fullname"/>
            <postprocess>
                <java class="org.swissbib.linked.mf.morph.functions.AuthorHash"/>
            </postprocess>
        </combine>
        <combine name="@key7000" value="${name}##${number}##${title}##${lifedata}##${fullname}" flushWith="7000 ">
            <data source="7000 .a" name="name"/>
            <data source="7000 .b" name="number"/>
            <data source="7000 .c" name="title"/>
            <data source="7000 .d" name="lifedata"/>
            <data source="7000 .q" name="fullname"/>
            <postprocess>
                <java class="org.swissbib.linked.mf.morph.functions.AuthorHash"/>
            </postprocess>
        </combine>
        <combine name="@key7001" value="${lastname}##${firstname}##${number}##${title}##${lifedata}##${fullname}"
                 flushWith="7001 ">
            <data source="7001 .a" name="lastname"/>
            <data source="7001 .D" name="firstname"/>
            <data source="7001 .b" name="number"/>
            <data source="7001 .c" name="title"/>
            <data source="7001 .d" name="lifedata"/>
            <data source="7001 .q" name="fullname"/>
            <postprocess>
                <java class="org.swissbib.linked.mf.morph.functions.AuthorHash"/>
            </postprocess>
        </combine>
        <combine name="@key710" value="${name}##${subunit}##${number}##${date}##${location}" flushWith="710??">
            <data source="710??.a" name="name"/>
            <data source="710??.b" name="subunit"/>
            <data source="710??.n" name="number"/>
            <data source="710??.d" name="date"/>
            <data source="710??.c" name="location"/>
            <postprocess>
                <java class="org.swissbib.linked.mf.morph.functions.AuthorHash"/>
            </postprocess>
        </combine>
        <combine name="@key711" value="${name}##${subunit}##${number}##${date}##${location}" flushWith="711??">
            <data source="710??.a" name="name"/>
            <data source="710??.e" name="subunit"/>
            <data source="710??.n" name="number"/>
            <data source="710??.d" name="date"/>
            <data source="710??.c" name="location"/>
            <postprocess>
                <java class="org.swissbib.linked.mf.morph.functions.AuthorHash"/>
            </postprocess>
        </combine>

        <!--BUILD BULK API HEADER FOR TYPE "BIBLIOGRAPHICRESOURCE"-->

        <!--BUILD THE BASIS RECORD -->

        <!--		<entity name="&#45;&#45;" flushWith="record" >-->
        <!--To define the subject (root element) of each record.
        "entity" makes it possible to create a hierarchical tag structure.-->

        <!-- Set id -->
        <data source="001" name="_id"/>

        <data source="001" name="\@id">
            <compose prefix="http://data.swissbib.ch/resource/"/>
        </data>

        <!--RDF TYPE (CLASS)-->

        <data source="_id" name="\@type">
            <constant value="http://purl.org/dc/terms/BibliographicResource"/>
        </data>

        <!--REFERENCED JSON-LD CONTEXT-->
        <data source="_id" name="\@context">
            <constant value="http://data.swissbib.ch/resource/context.jsonld"/>
        </data>

        <!--RDA CONTENT TYPE -->
        <data name="P60049" source="898  .a">
            <substring start="0" end="6"/>
            <!--To select only positions 0-5 of the field 898$a-->
            <lookup in="type_content"/>
            <!--To look up the links given in the file announced in the tag <map>-->
            <unique part="value"/>
        </data>

        <combine name="rdau:P60049" value="${uid}">
            <if>
                <!--To select only the record types MU03xxxx (=Sound/Ton/Son), that are sounds (vs. spoken words. Includes natural sounds, artificially produced sounds, etc. )
                The function "if" uses the default boolean operator "OR" when various arguments/conditions are present!-->
                <!--Could also use the functions "whitelist" and "blacklist"-->
                <all>
                    <data source="898  .a">
                        <substring start="0" end="4"/>
                        <equals string="MU03"/>
                    </data>
                    <any>
                        <data source="008">
                            <substring start="35" end="38"/>
                            <equals string="und"/>
                        </data>
                        <data source="008"><commit_msg>Data field name P60049 changed to the correct rdau:P60049<commit_after><?xml version="1.0" encoding="UTF-8"?>

<metamorph xmlns="http://www.culturegraph.org/metamorph" version="1">

    <vars>
        <var name="swissbib_domain" value="http://data.swissbib.ch/resource/"/>
    </vars>


    <macros>
        <macro name="context">
            <!-- Writes JSON-LD context -->
            <entity name="@context" flushWith="record">

                <data name="bf" source="_id">
                    <constant value="http://bibframe.org/vocab/"/>
                </data>

                <data name="rdfs" source="_id">
                    <constant value="http://www.w3.org/2000/01/rdf-schema#"/>
                </data>

                <data name="dbp" source="_id">
                    <constant value="http://dbpedia.org/ontology/"/>
                </data>

                <data name="rdau" source="_id">
                    <constant value="http://rdaregistry.info/Elements/u/"/>
                </data>

                <data name="dct" source="_id">
                    <constant value="http://purl.org/dc/terms/"/>
                </data>

                <data name="rdf" source="_id">
                    <constant value="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>
                </data>

                <data name="foaf" source="_id">
                    <constant value="http://xmlns.com/foaf/0.1/"/>
                </data>

                <data name="bibo" source="_id">
                    <constant value="http://purl.org/ontology/bibo/"/>
                </data>

                <data name="dc" source="_id">
                    <constant value="http://purl.org/dc/elements/1.1/"/>
                </data>

                <data name="skos" source="_id">
                    <constant value="http://www.w3.org/2004/02/skos/core#"/>
                </data>

            </entity>
        </macro>
    </macros>


    <rules>

        <!-- Definitions for recursions to be used later in substructures (must be set here!) -->

        <data source="008" name="@language">
            <substring start="35" end="38"/>
        </data>

        <combine name="@key1000" value="${name}##${number}##${title}##${lifedata}##${fullname}" flushWith="1000 ">
            <data source="1000 .a" name="name"/>
            <data source="1000 .b" name="number"/>
            <data source="1000 .c" name="title"/>
            <data source="1000 .d" name="lifedata"/>
            <data source="1000 .q" name="fullname"/>
            <postprocess>
                <java class="org.swissbib.linked.mf.morph.functions.AuthorHash"/>
            </postprocess>
        </combine>
        <combine name="@key1001" value="${lastname}##${firstname}##${number}##${title}##${lifedata}##${fullname}"
                 flushWith="1001 ">
            <data source="1001 .a" name="lastname"/>
            <data source="1001 .D" name="firstname"/>
            <data source="1001 .b" name="number"/>
            <data source="1001 .c" name="title"/>
            <data source="1001 .d" name="lifedata"/>
            <data source="1001 .q" name="fullname"/>
            <postprocess>
                <java class="org.swissbib.linked.mf.morph.functions.AuthorHash"/>
            </postprocess>
        </combine>
        <combine name="@key7000" value="${name}##${number}##${title}##${lifedata}##${fullname}" flushWith="7000 ">
            <data source="7000 .a" name="name"/>
            <data source="7000 .b" name="number"/>
            <data source="7000 .c" name="title"/>
            <data source="7000 .d" name="lifedata"/>
            <data source="7000 .q" name="fullname"/>
            <postprocess>
                <java class="org.swissbib.linked.mf.morph.functions.AuthorHash"/>
            </postprocess>
        </combine>
        <combine name="@key7001" value="${lastname}##${firstname}##${number}##${title}##${lifedata}##${fullname}"
                 flushWith="7001 ">
            <data source="7001 .a" name="lastname"/>
            <data source="7001 .D" name="firstname"/>
            <data source="7001 .b" name="number"/>
            <data source="7001 .c" name="title"/>
            <data source="7001 .d" name="lifedata"/>
            <data source="7001 .q" name="fullname"/>
            <postprocess>
                <java class="org.swissbib.linked.mf.morph.functions.AuthorHash"/>
            </postprocess>
        </combine>
        <combine name="@key710" value="${name}##${subunit}##${number}##${date}##${location}" flushWith="710??">
            <data source="710??.a" name="name"/>
            <data source="710??.b" name="subunit"/>
            <data source="710??.n" name="number"/>
            <data source="710??.d" name="date"/>
            <data source="710??.c" name="location"/>
            <postprocess>
                <java class="org.swissbib.linked.mf.morph.functions.AuthorHash"/>
            </postprocess>
        </combine>
        <combine name="@key711" value="${name}##${subunit}##${number}##${date}##${location}" flushWith="711??">
            <data source="710??.a" name="name"/>
            <data source="710??.e" name="subunit"/>
            <data source="710??.n" name="number"/>
            <data source="710??.d" name="date"/>
            <data source="710??.c" name="location"/>
            <postprocess>
                <java class="org.swissbib.linked.mf.morph.functions.AuthorHash"/>
            </postprocess>
        </combine>

        <!--BUILD BULK API HEADER FOR TYPE "BIBLIOGRAPHICRESOURCE"-->

        <!--BUILD THE BASIS RECORD -->

        <!--		<entity name="&#45;&#45;" flushWith="record" >-->
        <!--To define the subject (root element) of each record.
        "entity" makes it possible to create a hierarchical tag structure.-->

        <!-- Set id -->
        <data source="001" name="_id"/>

        <data source="001" name="\@id">
            <compose prefix="http://data.swissbib.ch/resource/"/>
        </data>

        <!--RDF TYPE (CLASS)-->

        <data source="_id" name="\@type">
            <constant value="http://purl.org/dc/terms/BibliographicResource"/>
        </data>

        <!--REFERENCED JSON-LD CONTEXT-->
        <data source="_id" name="\@context">
            <constant value="http://data.swissbib.ch/resource/context.jsonld"/>
        </data>

        <!--RDA CONTENT TYPE -->
        <data name="rdau:P60049" source="898  .a">
            <substring start="0" end="6"/>
            <!--To select only positions 0-5 of the field 898$a-->
            <lookup in="type_content"/>
            <!--To look up the links given in the file announced in the tag <map>-->
            <unique part="value"/>
        </data>

        <combine name="rdau:P60049" value="${uid}">
            <if>
                <!--To select only the record types MU03xxxx (=Sound/Ton/Son), that are sounds (vs. spoken words. Includes natural sounds, artificially produced sounds, etc. )
                The function "if" uses the default boolean operator "OR" when various arguments/conditions are present!-->
                <!--Could also use the functions "whitelist" and "blacklist"-->
                <all>
                    <data source="898  .a">
                        <substring start="0" end="4"/>
                        <equals string="MU03"/>
                    </data>
                    <any>
                        <data source="008">
                            <substring start="35" end="38"/>
                            <equals string="und"/>
                        </data>
                        <data source="008">
{'fraction_non_alphanumeric': 0.18171044835078018, 'fraction_numerical': 0.03344525643557838, 'mean_word_length': 1.7315231073547923, 'pattern_counts': {'":': 0, '<': 305, '<?xml version=': 2, '>': 305, 'https://': 0, 'lorem ipsum': 0, 'www.': 8, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6077713', 'n_tokens_mistral': 4803, 'n_tokens_neox': 4255, 'n_words': 895}