SCHEMA aic_geometrically_bounded_wireframe;
  
USE FROM geometric_model_schema ( geometric_curve_set, geometric_set);
 USE FROM geometry_schema ( axis1_placement, axis2_placement_3d, b_spline_curve_with_knots, bezier_curve, cartesian_transformation_operator_3d, circle, composite_curve, conic, curve, curve_replica, ellipse, geometric_representation_context, hyperbola, line, offset_curve_3d, parabola, point, point_on_curve, point_replica, polyline, quasi_uniform_curve, rational_b_spline_curve, reparametrised_composite_curve_segment, trimmed_curve, uniform_curve);
 USE FROM product_property_representation_schema ( shape_representation);
 USE FROM representation_schema ( mapped_item);
  
ENTITY geometrically_bounded_wireframe_shape_representation 
 SUBTYPE OF ( shape_representation );
 WHERE 
WR1 : 
SIZEOF ( 
QUERY ( it <* SELF.items| NOT ( SIZEOF ( TYPEOF (it) * [ 'AIC_GEOMETRICALLY_BOUNDED_WIREFRAME.GEOMETRIC_CURVE_SET', 'AIC_GEOMETRICALLY_BOUNDED_WIREFRAME.AXIS2_PLACEMENT_3D', 'AIC_GEOMETRICALLY_BOUNDED_WIREFRAME.MAPPED_ITEM' ]) = 1) )) = 0;
WR2 : 
SIZEOF ( 
QUERY ( it <* SELF.items| ( SIZEOF ( TYPEOF (it) * [ 'AIC_GEOMETRICALLY_BOUNDED_WIREFRAME.GEOMETRIC_CURVE_SET', 'AIC_GEOMETRICALLY_BOUNDED_WIREFRAME.MAPPED_ITEM' ]) = 1) )) >= 1;
WR3 : 
SIZEOF ( 
QUERY ( gcs <* 
QUERY ( it <* SELF.items| ('AIC_GEOMETRICALLY_BOUNDED_WIREFRAME.GEOMETRIC_CURVE_SET' IN TYPEOF (it)) )| NOT ( SIZEOF ( 
QUERY ( crv <* 
QUERY ( elem <* gcs\geometric_set.elements| ('AIC_GEOMETRICALLY_BOUNDED_WIREFRAME.CURVE' IN TYPEOF (elem)) )| NOT valid_geometrically_bounded_wf_curve(crv) )) = 0) )) = 0;
WR4 : 
SIZEOF ( 
QUERY ( gcs <* 
QUERY ( it <* SELF.items| ('AIC_GEOMETRICALLY_BOUNDED_WIREFRAME.GEOMETRIC_CURVE_SET' IN TYPEOF (it)) )| NOT ( SIZEOF ( 
QUERY ( pnts <* 
QUERY ( elem <* gcs\geometric_set.elements| ('AIC_GEOMETRICALLY_BOUNDED_WIREFRAME.POINT' IN TYPEOF (elem)) )| NOT valid_geometrically_bounded_wf_point(pnts) )) = 0) )) = 0;
WR5 : 
SIZEOF ( 
QUERY ( gcs <* 
QUERY ( it <* SELF.items| ('AIC_GEOMETRICALLY_BOUNDED_WIREFRAME.GEOMETRIC_CURVE_SET' IN TYPEOF (it)) )| NOT ( SIZEOF ( 
QUERY ( cnc <* 
QUERY ( elem <* gcs\geometric_set.elements| ('AIC_GEOMETRICALLY_BOUNDED_WIREFRAME.CONIC' IN TYPEOF (elem)) )| NOT ('AIC_GEOMETRICALLY_BOUNDED_WIREFRAME.AXIS2_PLACEMENT_3D' IN TYPEOF (cnc\conic.position)) )) = 0) )) = 0;
WR6 : 
SIZEOF ( 
QUERY ( gcs <* 
QUERY ( it <* SELF.items| ('AIC_GEOMETRICALLY_BOUNDED_WIREFRAME.GEOMETRIC_CURVE_SET' IN TYPEOF (it)) )| NOT ( SIZEOF ( 
QUERY ( pline <* 
QUERY ( elem <* gcs\geometric_set.elements| ('AIC_GEOMETRICALLY_BOUNDED_WIREFRAME.POLYLINE' IN TYPEOF (elem)) )| NOT ( SIZEOF (pline\polyline.points) > 2) )) = 0) )) = 0;
WR7 : 
SIZEOF ( 
QUERY ( mi <* 
QUERY ( it <* SELF.items| ('AIC_GEOMETRICALLY_BOUNDED_WIREFRAME.MAPPED_ITEM' IN TYPEOF (it)) )| NOT ('AIC_GEOMETRICALLY_BOUNDED_WIREFRAME.' + 'GEOMETRICALLY_BOUNDED_WIREFRAME_SHAPE_REPRESENTATION' IN TYPEOF (mi\mapped_item.mapping_source.mapped_representation)) )) = 0;
 END_ENTITY ;
  
FUNCTION valid_geometrically_bounded_wf_curve 
( 
crv : curve ) : BOOLEAN ;
 IF SIZEOF ([ 'AIC_GEOMETRICALLY_BOUNDED_WIREFRAME.POLYLINE', 'AIC_GEOMETRICALLY_BOUNDED_WIREFRAME.B_SPLINE_CURVE', 'AIC_GEOMETRICALLY_BOUNDED_WIREFRAME.ELLIPSE', 'AIC_GEOMETRICALLY_BOUNDED_WIREFRAME.CIRCLE' ] * TYPEOF (crv)) = 1 THEN 
 RETURN (TRUE);
 ELSE 
 IF 'AIC_GEOMETRICALLY_BOUNDED_WIREFRAME.TRIMMED_CURVE' IN TYPEOF (crv) THEN 
 IF SIZEOF ([ 'AIC_GEOMETRICALLY_BOUNDED_WIREFRAME.LINE', 'AIC_GEOMETRICALLY_BOUNDED_WIREFRAME.PARABOLA', 'AIC_GEOMETRICALLY_BOUNDED_WIREFRAME.HYPERBOLA' ] * TYPEOF (crv\trimmed_curve.basis_curve)) = 1 THEN 
 RETURN (TRUE);
 ELSE 
 RETURN (valid_geometrically_bounded_wf_curve(crv\trimmed_curve.basis_curve));
 END_IF ;
 ELSE 
 IF 'AIC_GEOMETRICALLY_BOUNDED_WIREFRAME.OFFSET_CURVE_3D' IN TYPEOF (crv) THEN 
 RETURN (valid_geometrically_bounded_wf_curve(crv\offset_curve_3d.basis_curve));
 ELSE 
 IF 'AIC_GEOMETRICALLY_BOUNDED_WIREFRAME.CURVE_REPLICA' IN TYPEOF (crv) THEN 
 RETURN (valid_geometrically_bounded_wf_curve(crv\curve_replica.parent_curve));
 ELSE 
 IF 'AIC_GEOMETRICALLY_BOUNDED_WIREFRAME.COMPOSITE_CURVE' IN TYPEOF (crv) THEN 
 RETURN ( SIZEOF ( 
QUERY ( ccs <* crv\composite_curve.segments| NOT valid_geometrically_bounded_wf_curve(ccs.parent_curve) )) = 0);
 END_IF ;
 END_IF ;
 END_IF ;
 END_IF ;
 END_IF ;
 RETURN (FALSE);
 END_FUNCTION ;
FUNCTION valid_geometrically_bounded_wf_point 
( 
pnt : point ) : BOOLEAN ;
 IF 'AIC_GEOMETRICALLY_BOUNDED_WIREFRAME.CARTESIAN_POINT' IN TYPEOF (pnt) THEN 
 RETURN (TRUE);
 ELSE 
 IF 'AIC_GEOMETRICALLY_BOUNDED_WIREFRAME.POINT_ON_CURVE' IN TYPEOF (pnt) THEN 
 RETURN (valid_geometrically_bounded_wf_curve(pnt\point_on_curve.basis_curve));
 ELSE 
 IF 'AIC_GEOMETRICALLY_BOUNDED_WIREFRAME.POINT_REPLICA' IN TYPEOF (pnt) THEN 
 RETURN (valid_geometrically_bounded_wf_point(pnt\point_replica.parent_pt));
 END_IF ;
 END_IF ;
 END_IF ;
 RETURN (FALSE);
 END_FUNCTION ;
END_SCHEMA;
 