Skip to content

Conversation

@cboehme
Copy link
Member

@cboehme cboehme commented Nov 29, 2013

Added an if-statement and three quantor-statements to Metamorph. These new statements allow to write more conditional transformations in a more expressive way than combine allows

The statement implements a universal quantor or conjunction operation
(logical and-operation). It allows for checking whether all statements
contained in the <all> statement generated an output. Using the <all>
statement conjunctions can be written in a more expressive way than
(ab)using the <combine> statement allows.

By default the <all> statement outputs an unamed literal with "true" as
value. However, this can be customized.

<all name="MyCustomName" value="all-fired">
	<data source="data1" />
	<data source="data2" />
</all>

The <all> statement supports reset and flushWith.
The statement implements a existential quantor or disjunction operation
(logical or-operation). It allows for checking whether at least one of
the statements contained in the <any> statement generated an output.
Using the <any> statement disjunctions can be written in a more
expressive way than (ab)using the <combine> statement allows.

By default the <any> statement outputs an unamed literal with "true" as
value. However, this can be customized.

<any name="MyCustomName" value="one-fired">
	<data source="data1" />
	<data source="data2" />
</any>

The <any> statement supports reset and flushWith.
The statement implements a logical not-operation. It allows for
checking whether none of the statements contained in the <none>
statement generated an output. Using the <none> statement negations can
be written in a more expressive way than (ab)using the <combine> and
<choose> statements allows.

By default the <none> statement outputs an unamed literal with "true" as
value. However, this can be customized.

<none name="MyCustomName" value="none-fired">
	<data source="data1" />
	<data source="data2" />
</none>

The <none> statement supports reset and flushWith.
This commits introduces an <if> statement which can be used to control
under which conditions a collector generates output. It can be used for
example to write a combine statement that only generates outputif data3
has a value of "x":

<combine name="output" value="${a}${b}">
  <if>
    <data source="data3">
      <equals string="x" />
    </data>
  </if>
  <data source="data1" name="a" />
  <data source="data2" name="b" />
</combine>

The quantors introduced by commits 475a55f, 12a0537 and
e65f6d2 are meant to be used inside the <if> statement.
@dr0i
Copy link
Member

dr0i commented Dec 2, 2013

+1

Updated equalsFilter to support the new if statement

Conflicts:
	src/test/java/org/culturegraph/mf/morph/collectors/CollectorTest.java
@cboehme cboehme merged commit 10b8a58 into metafacture:master Dec 4, 2013
@cboehme cboehme deleted the quantors-for-metamorph branch December 4, 2013 17:20
blackwinter added a commit that referenced this pull request Dec 13, 2024
Change `substring()` Fix function to be compatible with Catmandu.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants