AW: [Metafacture] how to access a specific value (index/occurrence) after applying a filter in an entity

Thomas Gängler tgaengler at avantgarde-labs.de
Fri May 23 17:35:51 CEST 2014


Hi Christoph,

thanks a lot for the "sameEntity" hint. I think that I got it working 
right now with something like

<combine name="@ok" value="${out}" sameEntity="true" reset="false">
			<data
				 
source="http://www.ddb.de/professionell/mabxml/mabxml-1.xsd#feld&#30;http://www.ddb.de/professionell/mabxml/mabxml-1.xsd#ind">
				<equals string="p"/>
			</data>
			<data
				 
source="http://www.ddb.de/professionell/mabxml/mabxml-1.xsd#feld&#30;http://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#feld&#30;http://www.w3.org/1999/02/22-rdf-syntax-ns#value">
				<occurrence only="2" sameEntity="true"/>
			</data>
		</combine>
		<data name="ok4" source="@ok">
			<occurrence only="2"/>
		</data>

wich delivers

   ok2= Thomas, Eugen

i.e. the second value of the second matched entity ;)

Cheers,


Thomas


On 23/05/14 16:54, Böhme, Christoph wrote:
> Hi Thomas,
>
> Sorry for only replying now to your email. I hope my answer is still helpful.
>
> Do I understand correctly that the output that you want to get is
>
> 	ok2= Roll, Gernot
> 	ok2= Thomas, Eugen
>
> but instead you only get
>
> 	ok2= Roll, Gernot?
>
> The occurrence filter can be reset on changes of the entity. I think, you could use this to solve your problem:
>
> <combine name="ok" value="${out}" sameEntity="true">
> 	<data source="feld.ind">
> 		<equals string="p" />
> 	</data>
> 	<data source="feld.nr">
> 		<equals string="077" />
> 	</data>
> 	<data name="out" source="feld.value">
> 		<occurrence only="2" sameEntity="true" />
> 	</data>
> </combine>
>
> I am not a 100% sure that the above code works since I do not know how you convert the mabxml into Metamorph stream events. I suppose you use the GenericXmlHandler for parsing your mabxml into Metamorph stream events. Did you consider writing a specific handler for mabxml? This probably makes sense as the stream structure you currently has does not follow the actual structure of the mab format but instead follows the structure of its xml representation. This makes it quite hard to process.
>
> Best,
> Christoph
>



More information about the Metafacture mailing list