Solved

Using xfmap to create multiple values for one attribute

  • 13 March 2019
  • 4 replies
  • 21 views

I am currently mapping a MVDxml and I am not able to create multiple values for an attribute.

This is what I want to map:

<ConceptRoot uuid="e4b5239f-16dd-4813-a632-71911712a26d" name="IfcWall" status="proposal" applicableRootEntity="IfcWall">

 

<Applicability uuid="00000000-0000-0000-0000-000000000000" status="sample">

 

<Template ref="ad664563-049e-45d1-8379-1553f9172d33" />

 

<TemplateRules operator="and" />

 

</Applicability>

 

<Concept uuid="6082a8f9-f04c-44c6-a4ce-61bf4a12dbbb" name="Property Sets for Objects" status="sample" override="false">

<Template ref="f74255a6-0c0e-4f31-84ad-24981db62461" />

<TemplateRules operator="and">

<TemplateRule Parameters="PsetName[Value]='Pset_WallCommon'" />

<TemplateRule Parameters="PsetName[Value]='Pset_ConcreteElementGeneral'" />

<TemplateRule Parameters="PsetName[Value]='Pset_PrecastConcreteElementFabrication'" />

<TemplateRule Parameters="PsetName[Value]='Pset_PrecastConcreteElementGeneral'" />

<TemplateRule Parameters="PsetName[Value]='Pset_ReinforcementBarPitchOfWall'" />

</TemplateRules>

</Concept>

</ConceptRoot>

This is my current xfmap attempt:

<?xml version="1.0"?>

<xfMap>

<feature-map multi-feature-construction="true">

<mapping match="ConceptRoot">

<feature-type> <extract expr="@name"/> </feature-type>

</mapping>

</feature-map>

<feature-content-map>

<mapping match="Concept">

<attributes>

<attribute>

<name>

<extract expr="@name"/>

</name>

<value>

<extract expr="./TemplateRules/TemplateRule[@Parameters]"/>

</value>

</attribute>

</attributes>

</mapping>

</feature-content-map>

</xfMap>

I am currently getting one Feature called IfcWall with the attribute Property Sets for Objects, but I get only one value which is PsetName[Value]='Pset_WallCommon'. My Question is: In what way do I have to change my xfmap so that all the other elements show up as values. (Like PsetName[Value]='PsetConcreteElementGeneral' and so on)

 

*edit

added some pictures for better visibility

icon

Best answer by friesewoudloper 14 March 2019, 12:33

View original

4 replies

Badge

I'm not sure what you are trying to achieve, but wouldn't be easier to use the "Feature Paths" option in the XML reader instead of xfMap?

Badge

I'm not sure what you are trying to achieve, but wouldn't be easier to use the "Feature Paths" option in the XML reader instead of xfMap?

Or maybe this is the output format you are looking for?

 

I used an Aggregator and StringReplacer to create the string with concatenated TemplateRules.

Download link for my example workspace: https://gist.github.com/FrieseWoudloper/3df932757f3601545b5f8ee99c6123c9/archive/5d0f2a9054d5329cddb4da69b31eeabe967735b8.zip

I'm not sure what you are trying to achieve, but wouldn't be easier to use the "Feature Paths" option in the XML reader instead of xfMap?

Thank you for your answer @friesewoudloper, my goal with using xfMap was to dynamically create a FME feature called IfcWall with the attribute Property Sets for Objects and the values PsetName[Value]='Pset_WallCommon' and so on. I do not want to include any other information. I wasn’t able to create this feature using the „Feature Paths“ option.

I want to use the resulting FME feature to filter an IFC file.

Here is an example of what I would like to achieve, the only thing missing right now is a way to get the Parameters at TemplateRule as multiple values or as a list for my attribute Property Sets for Objects. (It would be even better if the values were only called Pset_WallCommon and so on)

Badge

You can add an AttributeTransposer and AttributeExposer. However, you will need to know all attribute names (all possible values for the attribute name in the tag Concept) up front.

See https://gist.github.com/FrieseWoudloper/3df932757f3601545b5f8ee99c6123c9/archive/cf3f7cc4a8bd845c38c92cdfc53df612d89e8eb3.zip

Reply