[Metamorph] Metamorph: Grouping entites based on entity suffixes

Böhme, Christoph C.Boehme at dnb.de
Thu Apr 11 13:01:34 CEST 2013


Hi all,

I am trying to use Metamorph to transform title records from the ZDB dataset so that the item information can be handled more easily. However, I am not sure if I can achieve this transformation with Metamorph.

In the ZDB dataset each record contains title information and item information for each instance of the title in a library. The item information is described by a sequence of fields. These fields are grouped by a common suffix per item. The suffix is not unique within a record, though; fields describing items belonging to two different libraries may use the same suffix. However, these sequences are (apparently) separated by (an undocumented) field. So, in a nutshell the input records look like this:

record {
	/* ... fields describing the title ... */

	101@ { a: '12' },
	201B/01 { /* literals */ },
	203@/01 { /* literals */ },
	101@ { a: '34' },
	201B/01 { /* literals */ },
	206W/01 { /* literals */  },
	201B/02 { /* literals */  },
	206W/02 { /* literals */  },
	203@/02 { /* literals */  }
}

Obviously, this format is difficult to work with in Metamorph. To make further processing easier, I would like to group all fields describing one item within an entity. So, the output of my transformation should look like this:

record {
	/* ... literals and entities describing the title ... */

	101@ { a: '12' },
	item {
		201B { ... },
		203@ { ... }
	},
	101@ { a: '34' },
	item {
		201B { ... },
		206W { ... },
	},
	item {
		201B { ... },
		206W { ... },
		203@ { ... }
	}
}

So, what needs to be done is basically: open a new "item" entity (and close the previous one) every time the text after the slash changes or if an entity without a slash is encountered (the "101@" entities in the example). However, I am not sure if this can be achieved with Metamorph. Any comments are appreciated!

Cheers,
Christoph


More information about the Metafacture mailing list