Skip to main content
Solved

Using xfmap to create multiple values for one attribute

  • March 13, 2019
  • 4 replies
  • 66 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

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

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

4 replies

friesewoudloper
Participant
Forum|alt.badge.img+1
  • Participant
  • 50 replies
  • March 13, 2019

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
Participant
Forum|alt.badge.img+1
  • Participant
  • 50 replies
  • March 13, 2019

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
  • 7 replies
  • March 14, 2019

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
Participant
Forum|alt.badge.img+1
  • Participant
  • 50 replies
  • Best Answer
  • March 14, 2019

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