6 Viewing/Editing Attribute Mappings
9. The File Format Version field displays the versions of the source file format associated with the source file attribute. The default entry is that of the attribute group
6.5 XPath Expression Builder Dialog
The XPath Expression Builder dialog is accessed from the Condition, Source Attribute and Source Attribute Units fields of the main Attribute Mappings dialog. It is used to construct XPath expressions to populate these fields.
For more information on XPath expressions, see 20.3: Appendix C: XPath Expressions.
The dialog includes a Build tab, used to construct expressions (see Building Expressions), and a Preview tab which is used to test them (see Setting up Mappings Using the XPath Expression Builder Dialog - Examples).
6.5.1 Building Expressions
Expressions are constructed using the Build tab. The Build tab consists of three sections.
The Source Dictionary pane section, the Shortcuts, XPath Operators and XPath Functions tabs section and the Expression pane section.
An XPath expression may be constructed manually, by typing directly into the Expression area of the dialog. In addition, source file attributes for inclusion in the expression may be selected from the Source dictionary, by navigating to the required element in the source dictionary tree view and double clicking on the required attribute. This attribute will then be added to the expression.
Additional elements for constructing an XPath expression are provided on the Shortcuts, XPath Operators and XPath Functions tabs.
Viewing/Editing Attribute Mappings
Once the required expression has been constructed, select the OK button to close the dialog. The expression is then displayed in the relevant field in the main Attribute Mappings dialog.
• Source Dictionary Pane
The Source Data Dictionary is a tool which helps in visualising and understanding the potential contents of import files, in terms useful when creating attribute mappings.
The Source Dictionary pane contains a tree-view that lists all the relevant Source Data Dictionary information for the current attribute mapping or attribute mapping group.
The database element types are all listed against the top node of the tree view. This node can be expanded to display the import file standards, for example XMpLant, of the imported data.
Each import file standard node can be expanded to list the attributes which are common to all of the selected database element types and that are of that import file standard.
If the required attributes are not displayed, or no attributes are displayed, the dictionary must be populated by extracting attribute data from diagram import files. See Accessing the Source Data Dictionary.
Each of the attribute nodes can be expanded to display the following nodes, which display attribute metadata.
Viewing/Editing Attribute Mappings
Src - XPath to the source of the attribute. This is the text that will be added to the expression if the attribute is added to it.
SrcUnits - XPath to the units of the attribute (if applicable).
Type - Storage type for the attribute (e.g. string, integer).
Has Content - Yes/No, indicates whether or not the attribute has been observed with content at any time.
Min Cardinality - Displays the minimum observed cardinality of the attribute.
Max Cardinality - Displays the maximum observed cardinality of the attribute.
Of the above, Src and SrcUnits can be added to an expression. The other data is presented for information only.
To add an attribute or attribute data to an expression, either drag and drop the data item from the Source Dictionary pane into the Expression pane, or double-click on the data item.
If dragged and dropped, the data item is added to the expression where it is “dropped”. If double-clicked the data item is added to the expression at the point that the cursor is currently located in the Expression pane.
• Shortcuts, XPath Operators and XPath Functions Tabs
The Shortcuts tab lists common XPath expression operations, for example for removing spaces in strings and joining strings together.
The XPath Operators tab lists XPath expression operators, for use in constructing XPath expression operations.
Viewing/Editing Attribute Mappings
The XPath Functions tab lists XPath expression functions, for use in constructing XPath expression operations.
Beneath the tabs, a description of the currently selected item is displayed.
Viewing/Editing Attribute Mappings
If double-clicked, operators are added to the expression at the point that the cursor is currently located in the Expression pane.
If double-clicked, operations and functions are placed at the start of the expression, and the expression is automatically enclosed in parenthesis following the item. If the Expression pane is empty, the item is placed followed by empty parenthesis.
• Expression Pane
As described above, items selected in the upper sections are copied into the Expression pane. Multiple attributes, operations, etc can be selected to construct complex expressions.
XPath expressions, or parts of expressions, may also be typed directly into the pane.
Standard Cut, Copy and Paste text editing options are available on a right-click menu. The right-click menu also includes a Clear Text option, which will clear the Expression pane.
The Status: symbol indicates the validity of the expression. A white question mark within a blue circle indicates that the expression has not yet been validated. See Setting up Mappings Using the XPath Expression Builder Dialog - Examples for details.
6.5.2 Setting up Mappings Using the XPath Expression Builder Dialog - Examples
• Mapping a URL Database Attribute
In this example, a mapping will be set up for the URL Database Attribute of a SCDIAG (diagram) Database Attribute using the XPath Expression Builder.
This scenario assumes that the original intelligent P&ID Diagrams from which import files are generated are subsequently stored in a SharePoint Portal site.
An attribute mapping will be constructed which uses an XPath expression to add both the Sharepoint location and the correct file suffix to the import file’s diagram name Source Attribute value. This is then written to the URL attribute of the corresponding SCDIAG element, thereby providing a link from the schematic database directly to the original intelligent P&ID file (in this example an AVEVA P&ID Diagram (.DWG)).
Viewing/Editing Attribute Mappings
1. Using the Attribute Mappings dialog, create a new mapping and name it