(* $Id: effectivity_schema.exp,v 1.19 2019/05/08 19:31:23 sjohnston Exp $ ISO 10303 TC184/SC4/WG12 N10232 EXPRESS Source: ISO 10303-41 ed6 Fundamentals of product description and support - Effectivity schema The following permission notice and disclaimer shall be included in all copies of this EXPRESS schema ("the Schema"), and derivations of the Schema: Copyright ISO 2019 All rights reserved Permission is hereby granted, free of charge in perpetuity, to any person obtaining a copy of the Schema, to use, copy, modify, merge and distribute free of charge, copies of the Schema for the purposes of developing, implementing, installing and using software based on the Schema, and to permit persons to whom the Schema is furnished to do so, subject to the following conditions: THE SCHEMA IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SCHEMA OR THE USE OR OTHER DEALINGS IN THE SCHEMA. In addition, any modified copy of the Schema shall include the following notice: THIS SCHEMA HAS BEEN MODIFIED FROM THE SCHEMA DEFINED IN ISO 10303-41 ed4 Fundamentals of product description and support - Effectivity schema AND SHOULD NOT BE INTERPRETED AS COMPLYING WITH THAT STANDARD *) SCHEMA effectivity_schema '{iso standard 10303 part(41) version(8) object(1) effectivity_schema(9)}'; REFERENCE FROM action_schema -- ISO 10303-41 (action_method); REFERENCE FROM basic_attribute_schema ( -- ISO 10303-41 description_attribute, description_attribute_select, get_description_value, get_name_value, name_attribute, name_attribute_select); REFERENCE FROM date_time_schema ( -- ISO 10303-41 date_time_or_event_occurrence, time_interval); REFERENCE FROM measure_schema ( -- ISO 10303-41 measure_with_unit); REFERENCE FROM support_resource_schema ( -- ISO 10303-41 bag_to_set, identifier, label, text); TYPE effs_description_attribute_select = SELECT BASED_ON description_attribute_select WITH ( effectivity); END_TYPE; TYPE effs_name_attribute_select = SELECT BASED_ON name_attribute_select WITH ( effectivity); END_TYPE; ENTITY condition SUBTYPE OF (action_method); END_ENTITY; ENTITY conditional_effectivity SUBTYPE OF (condition, effectivity); END_ENTITY; ENTITY conditional_configuration SUBTYPE OF (conditional_effectivity); configuration_type : STRING; inheritance_type : STRING; END_ENTITY; ENTITY dated_effectivity SUBTYPE OF (effectivity); effectivity_end_date : OPTIONAL date_time_or_event_occurrence; effectivity_start_date : OPTIONAL date_time_or_event_occurrence; WHERE WR1: EXISTS(effectivity_end_date) OR EXISTS(effectivity_start_date); END_ENTITY; ENTITY effectivity SUPERTYPE OF (ONEOF(serial_numbered_effectivity, dated_effectivity, lot_effectivity, time_interval_based_effectivity)); id : identifier; DERIVE name : label := get_name_value(SELF); description : text := get_description_value(SELF); WHERE WR1: SIZEOF(USEDIN(SELF, 'BASIC_ATTRIBUTE_SCHEMA.' + 'NAME_ATTRIBUTE.NAMED_ITEM')) <= 1; WR2: SIZEOF(USEDIN(SELF, 'BASIC_ATTRIBUTE_SCHEMA.' + 'DESCRIPTION_ATTRIBUTE.DESCRIBED_ITEM')) <= 1; END_ENTITY; ENTITY effectivity_relationship; name : label; description : OPTIONAL text; related_effectivity : effectivity; relating_effectivity : effectivity; END_ENTITY; ENTITY lot_effectivity SUBTYPE OF (effectivity); effectivity_lot_id : identifier; effectivity_lot_size : measure_with_unit; END_ENTITY; ENTITY serial_numbered_effectivity SUBTYPE OF (effectivity); effectivity_start_id : identifier; effectivity_end_id : OPTIONAL identifier; END_ENTITY; ENTITY time_interval_based_effectivity SUBTYPE OF (effectivity); effectivity_period : time_interval; END_ENTITY; FUNCTION acyclic_effectivity_relationship (relation : effectivity_relationship; relatives : SET [1:?] OF effectivity; specific_relation : STRING):BOOLEAN; LOCAL x : SET OF effectivity_relationship; END_LOCAL; IF relation.relating_effectivity IN relatives THEN RETURN (FALSE); END_IF; x := QUERY(eff <* bag_to_set(USEDIN(relation.relating_effectivity, 'EFFECTIVITY_SCHEMA.' + 'EFFECTIVITY_RELATIONSHIP.' + 'RELATED_EFFECTIVITY')) | specific_relation IN TYPEOF(eff)); REPEAT i := 1 TO HIINDEX(x); IF NOT acyclic_effectivity_relationship(x[i], relatives + relation.relating_effectivity, specific_relation) THEN RETURN (FALSE); END_IF; END_REPEAT; RETURN (TRUE); END_FUNCTION; END_SCHEMA;