[Metafacture] Regex, conjunction

Christoph, Pascal christoph at hbz-nrw.de
Fri Nov 15 11:25:17 CET 2013


Hi *,

I don't know how to do this with metamorph:

"If A andnot B => pass to receiver"

Details:
Having two entities: entity A has to match a regex, and B has also a regex. The
whole should be true if A matches and B does NOT match[1]. Furthermore, if B
does not exist at all, the whole should also be true.

Thus far I only managed using function "combine" with parameter
flushWith="record", like this:

<combine name="foo" value="bar" flushWith="record">
	<data source="051.">
		<regexp match="(^[^a|])"/>
	</data>
	<data source="050.">
		<regexp match="^a.*"/>
	</data>
</combine>

I got my "foo bar" if:

- 050. matches AND 051. is missing

and that's it, because in Regexp.java nothing is fired (aka "passed to
receiver") if the regex does not match. And no, I can't formulate the negative
regex as a positive regex.

Is there a possibility to do what I want?
I enhanced the Regexp class with :

if (this.getNamedValueReceiver().getClass().equals(Combine.class) && !match) {
getNamedValueReceiver().receive(name, NO_MATCH, source, recordCount, entityCount);
}

and adopted the Combine class. It's working , but it does not seem apropriate.
Anything I missed ?

cheers, pascal



More information about the Metafacture mailing list