Skip to main content
Solved

Using xfmap to create multiple values for one attribute


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

Best answer by friesewoudloper

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

View original
Did this help you find an answer to your question?

4 replies

friesewoudloper
Forum|alt.badge.img

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?


friesewoudloper
Forum|alt.badge.img
friesewoudloper wrote:

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


  • Author
  • March 14, 2019
friesewoudloper wrote:

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)


friesewoudloper
Forum|alt.badge.img

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings