Exercise 3: Creating validation rules (Production Mapping)

复杂程度: 初级 数据要求: ArcGIS.com 目标: Configure batch jobs for attribute validation rules and spatial validation rules and associate the batch jobs with the product library.

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.

步骤:
  1. 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.

  2. 在主菜单上,单击自定义 > 工具条 > Data Reviewer
  3. Data Reviewer 工具条上,单击检查器批处理作业管理器按钮 检查器批处理作业管理器

    将弹出检查器批处理作业管理器 对话框。

  4. Checks are configured in a batch job using the Batch Job Manager.
    Reviewer Batch Job Manager dialog box
    You can create groups in which you store checks that apply to different aspects of your database.
  5. 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.

  6. Right-click the Group1 node and choose Add Check > Table Checks > Execute SQL Check.

    Execute SQL Check selection

    The Execute SQL Check Properties dialog box appears.
    Execute SQL Check Properties dialog box
  7. Type Name is Blank in the Check Title text box.
  8. Choose BuildP from the Feature Class/Subtype drop-down list.
  9. 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.

    Select Feature Using a Query dialog box
  10. From the Fields list, click nam, then click Add.
  11. In the Where Clause text box, type IS NULL.
  12. Leave a single space after the last character.
  13. From the Operators, click the Or button.
  14. Ensure there is a single space between IS NULL and Or.
  15. From the Fields list, click nam, then click Add.
  16. From the Operators, click the = button.
  17. In the Where Clause text box, type ".
  18. Leave a single space after the last character. This is an open single quotation mark and a closed single quotation mark.
  19. From the Operators, click the Or button.
  20. Make sure there is a single space between '' and Or.
  21. From the Fields list, click nam, then click Add.
  22. From the Operators, click the = button.
  23. 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:

    Where Clause field for nam attribute
  24. Click OK.
  25. If a message appears saying that the Query returns no rows, click OK.
  26. Type Nam must be populated in the Notes text box.
  27. The notes allow you to provide a more specific description for a check.
  28. Set the value for the Severity rating to 3.
  29. The severity rating allows you to indicate how important the results from a check are in terms of your quality assurance/quality control processes. The lower the number, the greater the priority the check results have.
  30. 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.

  31. Right-click the Name is Blank node and select Duplicate Check.

    The Duplicate Check Generator dialog box appears.

    Duplicate Check Generator dialog box
  32. 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
  33. 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.

    Output of Duplicate group added to tree
  34. In the tree, select the Name is Blank check under the Group 1 group
  35. Drag the check so it appears under the Output of Duplicate Group.
  36. Click the Output of Duplicate group and press F2.
  37. Type Name is Blank.

    This changes the name of the group.

  38. You have now created checks that will validate that the nam field for all feature classes is populated with some value. The severity rating was set to 3 because it is a fairly significant issue when the nam field is blank. Next you will follow the same procedure to create checks to find when the nam field is set to UNK or Unknown
  39. Right-click the Group 1 node and choose Add Check > Table Checks > Execute SQL Check.

    The Execute SQL Check Properties dialog box appears.

    Execute SQL Check Properties dialog box
  40. Type Name is Unknown in the Check Title text box.
  41. Choose BuildP from the Feature Class/Subtype drop-down list.
  42. Click SQL next to the Where Clause field.

    The Select Features Using a Query dialog box appears.

  43. From the Fields list, click nam, then click Add.
  44. From the Operators, click the = button.
  45. In the Where Clause text box, type 'UNK'.

    Leave a single space after the last character.

  46. From the Operators, click the Or button.

    Ensure that there is a single space between 'UNK' and Or.

  47. From the Fields list, click nam, then click Add.
  48. From the Operators, click the = button.
  49. In the Where Clause text box, type 'Unknown'.

    When finished, the Where Clause text box should look like the following:

    Where Clause for Name is unknown
  50. Click OK.

    If a message appears saying that the Query returns no rows, click OK.

  51. In the Notes text box, type Please set the nam value if the name of the feature is known.
  52. Set the value for the Severity rating to 5.
  53. Click OK.

    The Name is Unknown node is added to the tree view.

  54. Right-click the Name is Unknown node and click Duplicate Check.

    The Duplicate Check Generator dialog box appears.

    Duplicate Check Generator dialog box
  55. 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
  56. 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.

  57. In the tree, select the Name is Unknown check under the Group 1 group.
  58. Drag the check so it appears under the Output of Duplicate group.
  59. Click the Output of Duplicate group and press F2.
  60. Type Name is Unknown.

    This changes the name of the group.

  61. Right-click the Group 1 node and choose Delete Group.
  62. Click Yes on the Delete Group message to delete the group.
  63. Delete Group message box
    Once you are finished adding all the checks to the batch job, it can be saved and distributed. When the batch job is saved, it is stored as a Reviewer batch job (.rbj) file.
  64. Click Save As on the Reviewer Batch Job Manager dialog box.

    The Save As dialog box appears.

  65. Navigate to the location where you copied the Product Library tutorial data and type the file name Attribute.rbj for the batch job.
  66. Click Save.
  67. 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.

步骤:
  1. If necessary, click the Product Library button Product Library window on the Production Editing toolbar to open the Product Library window.
  2. 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.

    Product Library expanded

  3. Right-click the 1.0.0.0 node and choose Associate Batch Jobs.

    The Batch Job dialog box appears.

    Batch Job dialog box
  4. Click in the first cell in the Batch Job Type column and choose Attribute.
  5. Click ellipsis (…) button at the end of the first row.

    The Check in Batch job file dialog box appears.

    Check in Batch Job file dialog box
  6. Navigate to the Attribute.rbj file that you created in Exercise 3a and click Open.
  7. 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.

  8. 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.

  9. You have now associated your batch job with your product library, so is now ready to be used when editing. The Attribute Batch Job you created can be used to validate the attribution of the nam field in your data and can be run when you create or modify the attributes of features using the Feature Manager.
  10. Click OK.
  11. You have now completed the configuration of your product library to include the various types of information used when editing in Production Mapping.

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.

步骤:
  1. If necessary, click the Production Start Editing button Production Start Editing on the Production Editing toolbar to start an edit session.
  2. In the Manage Features dialog box, click the Create tab.
  3. 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.

步骤:
  1. In the Create Attributes window, click on the WorshipType attribute and change the value to 2-Cathedral.
  2. Click Apply.

    The attribute combination is validated and an error is returned.

    Validation Results showing errors
  3. 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.

  4. Attribute field value not 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.

步骤:
  1. Using the same attribute combination failed with the validation error (WorshipType = 2 - Cathedral), click on the nam attribute and type UNK as the value.
  2. Click Apply.

    The Validation Results dialog box returns a warning.

    Validation Results showing warnings
  3. You will notice that the WorshipType and nam attributes are no longer blue but have returned to a black color. This indicates that the attribute value has been applied. If you create a feature in the map, it will have this attribute combination.

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.

步骤:
  1. Using the House of Worship template, set the WorshipType to 2 - Cathedral and the nam to Test.
  2. 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.

4/27/2014