Exercise 3: Creating validation rules (Production Mapping)
The validation rules used when editing features are configured as batch jobs using Data Reviewer. The batch job can be thought of as a quality control model, a way to encapsulate and distribute quality control and validation information. The batch job allows users in different locations to utilize a consistent set of automated checks when validating their data.
There are two tools in data editing that will validate a batch job - the Feature Manager, which validates the attributes of features when you change values, and the Validate Spatial Batch Job tool which validates both attribute and spatial aspects of the selected set of features. For this exercise you will learn how to create a batch job using the Batch Job Manager. You will configure two batch jobs, one with attribute validation rules and one with spatial validation rules.
Exercise 3a: Creating an attribute batch job
The attribute validation rules are run whenever you click the Apply button in the Feature Attributes window. When configuring attribute validation batch jobs you should only include checks like Execute SQL and Domain, which validate the attributes of features. Any checks that validate spatial components will NOT be validated through the Feature Manager even if they are configured in the batch job. The most commonly used check is the Execute SQL check, which can be used to define invalid values for a field or invalid attribute combinations across fields.
In this exercise, you will configure two Execute SQL checks and use the duplicate check function to repeat the checks for all of the feature classes in the Edit_Sample.gdb.
-
Ensure that ArcMap is open and the Edit_Sample.gdb sample data has been loaded.
If necessary, start ArcMap and then click the Add Data button on the Standard toolbar. Navigate to the location where you copied the Product Library tutorial data and load the Features dataset and BuildingOwners table from the Edit_Sample.gdb.
- On the main menu, click Customize → Toolbars → Data Reviewer.
-
Click the Reviewer Batch Job Manager button on the Data Reviewer toolbar.
The Reviewer Batch Job Manager dialog box appears.
- Right-click in the empty space in the upper box of the Reviewer Batch Job Manager dialog box and click New Group.
A node called Group 1 is added to the tree.
- Right-click the Group1 node and choose Add Check → Table Checks → Execute SQL Check.The Execute SQL Check Properties dialog box appears.
- Type Name is Blank in the Check Title text box.
- Choose BuildP from the Feature Class/Subtype drop-down list.
- Click SQL next to the Where Clause field.
The Select Features Using a Query dialog box appears, which allows you to find features based on a SQL query where clause.
- From the Fields list, click nam, then click Add.
- In the Where Clause text box, type IS NULL.
- From the Operators, click the Or button.
- From the Fields list, click nam, then click Add.
- From the Operators, click the = button.
- In the Where Clause text box, type ".
- From the Operators, click the Or button.
- From the Fields list, click nam, then click Add.
- From the Operators, click the = button.
- In the Where Clause text box, type ' '.
This is an open single quotation mark, a space, and a closed single quotation mark.
When finished, the Where Clause text box would look like the following:
- Click OK.
- Type Nam must be populated in the Notes text box.
- Set the value for the Severity rating to 3.
- Click OK.
The Name is Blank node is added to the tree.
When creating multiple checks with similar properties, the Batch Job Manager has the ability to duplicate the parameters of the check and assign different feature classes. For this portion of the exercise, you will duplicate the Execute SQL check for the other feature classes.
- Right-click the Name is Blank node and select Duplicate Check.
The Duplicate Check Generator dialog box appears.
- Click the check boxes next to the following feature classes to duplicate the Name is Blank check for them:
- AerofacP
- BuiltupA
- LakeresA
- RailrdL
- RoadL
- TreesA
- WatercrsL
- Click OK.
A new group named Output of Duplicate is added to the tree. A Name is Blank check is added to the Output of Duplicate group for each feature class that was chosen on the Duplicate Check Generator dialog box.
- In the tree, select the Name is Blank check under the Group 1 group
- Drag the check so it appears under the Output of Duplicate Group.
- Click the Output of Duplicate group and press F2.
- Type Name is Blank.
This changes the name of the group.
- Right-click the Group 1 node and choose Add Check → Table Checks → Execute SQL Check.
The Execute SQL Check Properties dialog box appears.
- Type Name is Unknown in the Check Title text box.
- Choose BuildP from the Feature Class/Subtype drop-down list.
- Click SQL next to the Where Clause field.
The Select Features Using a Query dialog box appears.
- From the Fields list, click nam, then click Add.
- From the Operators, click the = button.
- In the Where Clause text box, type 'UNK'.
Leave a single space after the last character.
- From the Operators, click the Or button.
Ensure that there is a single space between 'UNK' and Or.
- From the Fields list, click nam, then click Add.
- From the Operators, click the = button.
- In the Where Clause text box, type 'Unknown'.
When finished, the Where Clause text box should look like the following:
- Click OK.
If a message appears saying that the Query returns no rows, click OK.
- In the Notes text box, type Please set the nam value if the name of the feature is known.
- Set the value for the Severity rating to 5.
- Click OK.
The Name is Unknown node is added to the tree view.
- Right-click the Name is Unknown node and click Duplicate Check.
The Duplicate Check Generator dialog box appears.
- Click the check boxes next to the following feature classes to duplicate the Name is Unknown check for them:
- AerofacP
- BuiltupA
- LakeresA
- RailrdL
- RoadL
- TreesA
- WatercrsL
- Click OK.
A new group named Output of Duplicate is added to the tree. (You may have to collapse the Name is Blank group to see this new group.) A Name is Unknown check is added to the Output of Duplicate group for each feature class that was chosen on the Duplicate Check Generator dialog box.
- In the tree, select the Name is Unknown check under the Group 1 group.
- Drag the check so it appears under the Output of Duplicate group.
- Click the Output of Duplicate group and press F2.
- Type Name is Unknown.
This changes the name of the group.
- Right-click the Group 1 node and choose Delete Group.
- Click Yes on the Delete Group message to delete the group.
- Click Save As on the Reviewer Batch Job Manager dialog box.
The Save As dialog box appears.
- Navigate to the location where you copied the Product Library tutorial data and type the file name Attribute.rbj for the batch job.
- Click Save.
- Click OK on the Reviewer Batch Job Manager dialog box to close it.
Exercise 3b: Associating validation rules to the product library
Now that you have created batch jobs, they need to be associated to the product library so they can be used when editing. In this exercise, you will associate the batch jobs you created in Exercise 3a with the product library you configured in Exercise 1a.
There are three types of batch jobs that can be associated with a product library: Attribute, Spatial, and Reviewer. Attribute batch jobs are designed to validate specific attribute combinations or values in the data, and they are run when you create or modify the attributes of features using the Feature Manager. Spatial batch jobs run on the selected set of features and are designed to validate the geometry of a feature or the spatial relationship between multiple features. Any type of associated batch job can be run using the Reviewer Batch Validate tool in Data Reviewer, however, if a batch job is associated as a Reviewer batch job it can only be run through Batch Validate.
- If necessary, click the Product Library button on the Production Editing toolbar to open the Product Library window.
- In the Product Library window, make sure you have expanded all the nodes under the Product Library node so that the 1.0.0.0 data model version node is visible.
- Right-click the 1.0.0.0 node and choose Associate Batch Jobs.
The Batch Job dialog box appears.
- Click in the first cell in the Batch Job Type column and choose Attribute.
- Click ellipsis (…) button at the end of the first row.
The Check in Batch job file dialog box appears.
- Navigate to the Attribute.rbj file that you created in Exercise 3a and click Open.
- Set the slider in the Error Severity to 1-3.
In the Attribute Batch Job you created, the Name is Blank checks have a severity rating of 3 and the Name is Unknown checks have a severity rating of 5. By setting the Error severity at 1-3 you will not be able to commit a feature to the database if the nam attribute is not populated. However, you will only receive a Validation Results message if the nam attribute is populated with a value of UNK or Unknown.
- Click OK.
Next you will set the Error Severity. The Error Severity is used with Attribute batch jobs to indicate how critical an error issue is. When the severity in a check falls in the Error Severity range specified, then any time the attributes of a feature fail the feature will not be committed until the error is fixed. When the severity in a check does not fall in the Error Severity range specified you will receive a message, but the attributes will be committed to the feature.
Exercise 3c: Verifying the validation rules
In this exercise, you will see how the validation rules you defined in Exercise 3b work when editing the attributes of features.
- If necessary, click the Production Start Editing button on the Production Editing toolbar to start an edit session.
- In the Manage Features dialog box, click the Create tab.
- Click the House of Worship template in the BuildP group.
In the following sections, you will use the House of Worship template to change attributes and view how the validation rules are applied. You will see how the validation rules return:
- Errors
- Warnings
- Valid Attributes
Errors
When you created your batch jobs, you created the Name is Blank check to find when the name attribute is not populated. This check will return an error that will not allow you to apply your attribute changes until the error is fixed. Notice that when you choose the House of Worship template the name is populated with <Null> by default. You will change other attributes and apply the change to see the error.
- In the Create Attributes window, click on the WorshipType attribute and change the value to 2-Cathedral.
- Click Apply.
The attribute combination is validated and an error is returned.
- Click on a field beside the Worship Type field.
You will notice that the WorshipType field appears in blue. The blue color in the Attribute grid is used to indicate fields where the value has been changed but not applied. Because of the error that was returned this attribute combination cannot be applied.
Warnings
When you created your batch jobs, you created the Name is Unknown check to find when the name attribute is set to UNK or Unknown. Warnings are similar to errors in that they return a message to the user to indicate when there is a problem. However, they still allow the attribute combination to be applied.
- Using the same attribute combination failed with the validation error (WorshipType = 2 - Cathedral), click on the nam attribute and type UNK as the value.
- Click Apply.
The Validation Results dialog box returns a warning.
Valid Attributes
You have seen what happens when you enter an attribute combination that returns errors and warnings. You will now see what happens when the attribute combination you enter is valid.
- Using the House of Worship template, set the WorshipType to 2 - Cathedral and the nam to Test.
- Click Apply.
In this scenario no message appears. In fact, if you left the warning message open from the previous steps, it will automatically be closed. Notice that in this scenario, the blue attributes changed to black indicating that the attribute value has been applied. You can create a new feature with this attribute combination.
In this exercise, you have learned about creating batch jobs and associating them with the product library. You have also used the Feature Manager to validate your attributes when you change values according to the rules defined. These methods can now be applied as you edit features attributes in your own data.