# Validation of STEP files

`Validate` is an application program used to validate exchange structures, that is, files prepared according to 'ISO 10303-21: Implementation methods: Clear text encoding of the exchange structure'. After importing the submitted exchange structure to a temporary repository, validation is performed in two stages:
- validation of all entity instances contained in all models of the repository;
- validation of all global and uniqueness rules for all schema instances of the repository.
In the first stage for each entity instance the following operations are performed:
- validate required explicit attributes assigned;
- validate inverse attributes;
- validate explicit attributes references;
- validate aggregates size;
- validate aggregates uniqueness;
- validate array not optional;
- validate where rule.
In the second stage the following two operations on schema instances are performed:
- validate global rule;
- validate uniqueness rule.

`Validate` belongs to `jsdai.util` package and for a given exchange structure with the name, say, 'abc.stp' could be executed by applying a command like this:

        java -Djava.ext.dirs=C:/path/to/jsdai/ext/dir jsdai.util.Validate abc.stp -stdout Valid.log

Here 'Valid.log' is (an arbitrary) name of a log file produced by the program.
NOTE: similarly as other JSDAI-based applications, `Validate` also requires configuration file `jsdai.properties` to be in its disposition.
The log file includes the following information:
- the name of the exchange structure and the name of the repository to which this structure is imported;
- for each model the total number of instances and a list of instances not conforming to the validation; for each such instance also a more specific information (like violated rules or atributes with mandatory values not set) is displayed; in the case when a where rule is violated its parent item (either partial entity data type or defined type) is indicated;
- for each model the number of instances not conforming to the validation;
- for each schema instance the total number of global rules and a list of global rules which are not satisfied by the population associated with this schema instance; for each such global rule violated where rules are given;
- for each schema instance the number of global rules for which validation has failed (`false` was returned);
- for each schema instance a list of violated uniqueness rules (if any); for each such rule entity instances not conforming to the validation are displayed;
- for each schema instance the number of violated uniqueness rules.

You should see in the log file something similar to:

`
'Validate' program. Copyright 1999-2005, LKSoftWare GmbH
--- Exchange structure: allied_203.stp
--- Imported to the repository: allied_203_org
--- Reading time=4sec
count of instances in model "default": 785
#28=MECHANICAL_CONTEXT('CONFIGURATION CONTROL DESIGN',#26,'MECHANICAL');
where rule "wr1" in entity "mechanical_context" is violated
#36=PRODUCT_DEFINITION_SHAPE('DESIGN SHAPE','SHAPE FOR part',#35);
where rule "wr1" in entity "product_definition_shape" is violated
count of erroneous instances: 2
count of global rules in schema instance "schema1": 79
For the global rule "restrict_date_time_role" validation gives FALSE
where rule "wr1" is violated
For the global rule "restrict_person_organization_role" validation gives FALSE
where rule "wr1" is violated
For the global rule "restrict_security_classification_level" validation gives FALSE
where rule "wr1" is violated
For the global rule "security_classification_requires_date_time" validation gives FALSE
where rule "wr1" is violated
For the global rule "restrict_approval_status" validation gives FALSE
where rule "wr1" is violated
For the global rule "product_version_requires_person_organization" validation gives FALSE
where rule "wr1" is violated
where rule "wr2" is violated
For the global rule "product_requires_product_category" validation gives FALSE
where rule "wr1" is violated
For the global rule "restrict_product_category_value" validation gives FALSE
where rule "wr1" is violated
For the global rule "design_context_for_property" validation gives FALSE
where rule "wr1" is violated
count of violated global rules: 9
count of violated uniqueness rules: 0
--- Validation time=32sec`