Bentley Automation Service Help

Building a Component Schema

If you plan to use the DGN Indexing processor to extract component data, a component schema is created automatically. If you plan to use a custom document processor, you will need to create a component schema.

As part of the process of extracting component data from documents, project administrators create data models that determine what information is to be extracted from the drawings and how that information is to be structured in the ProjectWise datasource. This requires data modeling in two object-oriented technologies — JSpace and the ProjectWise Object Data System (ODS). JSpace is used to extract the component level data from the drawings, and ODS is used to store this data in ProjectWise. Each technology provides its own object class editor for data modeling: JSpace has JSpace Class Editor, and ODS has ProjectWise Class Editor.

A utility uses an XML mapping file to pass information from JSpace to ODS. In the image below, component data is extracted from DGNs and imported into ProjectWise



Designing a Component Schema

ProjectWise Class Editor is used create the component schema. For details, see the ProjectWise Class Editor help.

The designer of a component schema will need to consider the various sources of data that need to be imported and then begin to evaluate the following aspects:

  • Component classes
  • Component attributes
  • Component relational searches
  • Component links
  • Component hierarchy

Component classes

Determine the classes of components that are required not only for managing information related to engineering components, but also hierarchical collections such as plants, areas, systems, lines, assemblies, and disciplines. When you create the classes in ProjectWise Class Editor, you should make them subclasses of the internal base component class called Component. This will ensure that the required core attributes are inherited by all of your component classes.

Component attributes

Determine the attributes that are required for each of the classes that you have identified. You will need to decide what data type and length each attribute will require. Since you may be importing component data from multiple sources, you will need to define attributes for all of the combined data that you need to collect about a component. To detect discrepancies in values that are available from multiple sources, it may be best to define separate attributes that can be compared. For example, if a pipe spec is imported from a P&ID as 'CS150' but then is later imported as 'CS300' from a 3D design, it would not be possible to detect a discrepancy unless they were imported into separate attributes in the pipe class.

Component relational searches

Determine the relational searches that are required for your component schema. These searches should be planned for in advance since they work only when attributes in different classes can be matched. For example, if you need to support a relational search that finds all valves that isolate a piece of equipment, then you will need to define an attribute for the valve class to hold the tag number of the equipment it isolates.

Component links

Identify which components should be linked with other components. Complex relational component searches also use component links.

Component hierarchy

Identify a component hierarchy to define how the component data can be navigated. A component hierarchy can be created using searches, relational searches, and component link classes.

Creating a Component Schema Mapping File

A component schema mapping file is an XML document that defines how information extracted from the source document is imported into ProjectWise as component data.

The XML schema for the mapping file is provided to ensure that the XML document is valid, as well as to document the valid options that are available.

Sample Schema Mapping

The following sample schema mapping shows how to map classes, index keys, attributes, and links in the mapping file:

<?xml version="1.0" encoding="UTF-8"?>

<SchemaMap xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="SchemaMap.xsd" Source="JSpace">

	<ClassMap Source="EQUIP_MEQP" Destination="EQUIP" SourceKey="TAG"
SourceKeyRequired="FALSE" DgnNativeId="ELEMENT_ID">
		<AttributeMap Source="TAG" Destination="EQUIP_TAG"/>
	</ClassMap>
	<ClassMap Source="EQUIP" Destination="EQUIP" SourceKey="TAG"
SourceKeyRequired="FALSE">
		<AttributeMap Source="TAG" Destination="EQUIP_TAG"/>
		<AttributeMap Source="CAPACITY" Destination="EQUIP_CAPACITY"/>
		<AttributeMap Source="DESCRIPTION" Destination="EQUIP_DESCRIPTION"/>
		<AttributeMap Source="TYPE" Destination="EQUIP_TYPE"/>
		<AttributeMap Source="SUB_TYPE" Destination="EQUIP_SUB_TYPE"/>
		<AttributeMap SourceJsExpression="PID_LINE\\SERVICE"
Destination="EQUIP_SYSTEM"/>
		<LinkMap Source="ASSOCIATED" Destination="EQUIP_ASSOCIATED"/>
		<LinkMap Source="$CONNECTED_TO" Destination="EQUIP_CONNECTED_TO"/>
</ClassMap>
<ClassMap Source="EQUIP_NOZZLE" Destination="NOZZLE"
SourceKeyJsExpression='EQUIP_TAG+"-"+TAG' SourceKeyRequired="FALSE">
	<AttributeMap SourceJsExpression='EQUIP_TAG+"-"+TAG'
Destination="NOZZLE_ID"/>
	<AttributeMap Source="SERVICE" Destination="NOZZLE_SYSTEM"/>
	<AttributeMap Source="TAG" Destination="NOZZLE_TAG"/>
	<AttributeMap Source="SIZE" Destination="NOZZLE_SIZE"/>
	<LinkMap Source="TO" Destination="NOZZLE_TO"/>
	<LinkMap Source="FROM" Destination="NOZZLE_FROM"/>
	<LinkMap Source="$CONNECTED_TO" Destination="NOZZLE_CONNECTED_TO"/>
</ClassMap>
</SchemaMap>

Mapping Classes

The XML element ClassMap is used to define the mapping of a JSpace class to a ProjectWise class. Additionally, the ClassMap element contains the mapping definitions for all the attributes and links of the class.

  • Source — the name of the class of the JSpace object to be indexed/imported.
  • SourceJsExpression — a JSpace expression that will be evaluated against each object to determine if this mapping definition should be used to index/import the object. SourceJSExpression is alternative to using Source for defining whether the mapping applies.
  • SourceKey — the name of the JSpace property that is to be used as business key.
  • SourceKeyJsExpression — a JSpace expression that will be evaluated to generate the business key value. SourceKeyJsExpression is an alternative to using SourceKey.
  • SourceKeyRequired — determines whether to extract/index a component if it does not have a business key. If this value is set to TRUE then any component without a business key will not be extracted/indexed. If this value is set to FALSE then components without a business key will be extracted/indexed but they will be anonymous components.
  • DgnNativeId — a JSpace property that defines the native ID for the component represented in the DGN file.
    Note: This is needed when doing TriForma indexing to ensure that the DGN element ID is used as the native ID. This is not needed for Schematics indexing as the DGN element ID is used for the JSpace object ID and component indexing uses the JSpace object ID as the default native ID for a component.
  • DgnNativeIdJsExpression — a JSpace expression that defines the native ID for the component represented in the DGN file.
  • Destination — the name of the component class to be instanced.

Examples:

  1. <ClassMap Source="EQUIP" Destination="EQUIP" SourceKey="TAG">
  2. <ClassMap SourceJsExpression ='CLASS("EQUIP") AND TYPE="PUMP"' Destination="PUMP" SourceKey="TAG">
  3. <ClassMap Source="VALVE" Destination="VALVE" SourceKeyJsExpression='"V"+VALVE_NUMBER', SourceKeyRequired = "TRUE">
  4. <ClassMap Source="VALVE" Destination="VALVE" SourceJsExpressionKey='"V"+VALVE_NUMBER' DgnNativeId = "ELEMENT_ID">

Mapping Attributes

The XML element AttributeMap is used to define the mapping of a JSpace property to a ProjectWise component attribute. Any JSpace properties that are not mapped will not be imported.

  • Source — the name of the JSpace property to be imported.
  • SourceJsExpression — a JSpace expression that will be evaluated against a JSpace object to generate the attribute value.
  • Destination — the name of the ProjectWise attribute to receive the value.

Examples:

  1. <AttributeMap Source="TYPE" Destination="EQUIP_TYPE" />
  2. <AttributeMap SourceJsExpression="PID_LINE\\SERVICE" Destination="EQUIP_SYSTEM" />

Mapping Links

The XML element LinkMap is used to define the mapping from a JSpace relationship to a ProjectWise component link. Any JSpace properties that are not mapped will not be imported.

  • Source — the name of the JSpace relationship to map to the link class.
  • Destination — the name of the link class that is to be used to create the links.

Examples:

  1. <LinkMap Source="ASSOCIATED" Destination="EquipAssociated" />
  2. <LinkMap Source="MEMBERS" Destination="ProcessLineMembers" />

Mapping Between JSpace and ProjectWise

The following tables describe what the JSpace definitions and instances become once imported into ProjectWise.

Definitions

JSpace ProjectWise
Class Class (maps to component table)
Property Attribute (maps to a column in a component table)
Relationship Link Class (maps to a component link table)

Instances

JSpace ProjectWise
Object Row in a component table
Related objects Row in a component table
Relationships Row in a component table