[Metafacture] how to access a specific value (index/occurrence)
after applying a filter in an entity
Thomas Gängler
tgaengler at avantgarde-labs.de
Wed Apr 23 10:32:07 CEST 2014
Hi,
we would like to implement the following use case:
1. we have a kind of mabxml, excerpt:
<?xml version="1.0" encoding="UTF-8"?>
<datei xmlns="http://www.ddb.de/professionell/mabxml/mabxml-1.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://files.dnb.de/standards/formate/mabxml-1.xsd">
<datensatz typ="h" status="n" mabVersion="M2.0">
<feld nr="001" ind=" ">06978834</feld>
...
<feld nr="076" ind="v">5</feld>
<feld nr="077" ind="p">00872805<tf/>Roll, Gernot</feld>
<feld nr="077" ind="p">00872284<tf/>Thomas, Eugen</feld>
...
</datensatz>
</datei>
2. with a filter statement we can access values for specific mab keys,
e.g., 076v (note a pre-processing-step in our workflow is the RDFization
of the data source (that's why the uris and rdf:value properties ;) ))
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<metamorph xmlns="http://www.culturegraph.org/metamorph"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" entityMarker=""
version="1" xsi:schemaLocation="http://www.culturegraph.org/metamorph
metamorph.xsd">
<meta>
<name>mapping1</name>
</meta>
<rules>
<combine name="ok" value="${out}" sameEntity="true" reset="false">
<!-- filter elements -->
<data
source="http://www.ddb.de/professionell/mabxml/mabxml-1.xsd#feldhttp://www.ddb.de/professionell/mabxml/mabxml-1.xsd#nr">
<equals string="076" />
</data>
<data
source="http://www.ddb.de/professionell/mabxml/mabxml-1.xsd#feldhttp://www.ddb.de/professionell/mabxml/mabxml-1.xsd#ind">
<equals string="v" />
</data>
<!-- value of attribute path that should be selected for further
processing -->
<data name="out"
source="http://www.ddb.de/professionell/mabxml/mabxml-1.xsd#feldhttp://www.w3.org/1999/02/22-rdf-syntax-ns#value"
/>
</combine>
</rules>
</metamorph>
3. with a filter statement + occurrence function we can access specific
values for specific mab keys (until the key is a repeatable element),
e.g., 077p (note therefore we modified the example and deleted the
second occurrence of the 077p field)
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<metamorph xmlns="http://www.culturegraph.org/metamorph"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" entityMarker=""
version="1" xsi:schemaLocation="http://www.culturegraph.org/metamorph
metamorph.xsd">
<meta>
<name>mapping1</name>
</meta>
<rules>
<combine name="@ok" value="${out}" sameEntity="true" reset="false">
<data
source="http://www.ddb.de/professionell/mabxml/mabxml-1.xsd#feldhttp://www.ddb.de/professionell/mabxml/mabxml-1.xsd#ind">
<equals string="p" />
</data>
<data
source="http://www.ddb.de/professionell/mabxml/mabxml-1.xsd#feldhttp://www.ddb.de/professionell/mabxml/mabxml-1.xsd#nr">
<equals string="077" />
</data>
<data name="out"
source="http://www.ddb.de/professionell/mabxml/mabxml-1.xsd#feldhttp://www.w3.org/1999/02/22-rdf-syntax-ns#value"
/>
</combine>
<data name="ok2" source="@ok">
<occurrence only="2" />
</data>
</rules>
</metamorph>
====================================================
So now we would like to enable this functionality also for repeatable
elements (as the 007p key in the example above is one of). Therefore we
need to ensure to collect all values of an entity that match the filter
criteria (nr = 077 and ind = p) and apply the occurrence function in
context of the entity boundary. We tried to experiment with nested
combines (and with various variants of the parameters for reset,
flushWith and sameEntity). However, so far without any success ... we
always got none or all values back that match the filter criteria :\
Thanks a lot in advance for all your help.
Cheers,
Thomas
More information about the Metafacture
mailing list