SCHEMA aic_shell_based_wireframe;
  
USE FROM geometric_model_schema ( shell_based_wireframe_model);
 USE FROM geometry_schema ( axis2_placement_3d, b_spline_curve_with_knots, bezier_curve, cartesian_transformation_operator_3d, circle, conic, curve, curve_replica, ellipse, geometric_representation_context, hyperbola, line, offset_curve_3d, parabola, point, point_replica, polyline, quasi_uniform_curve, rational_b_spline_curve, uniform_curve);
 USE FROM product_property_representation_schema ( shape_representation);
 USE FROM representation_schema ( mapped_item);
 USE FROM topology_schema ( edge_curve, edge_loop, path, vertex_loop, vertex_point, vertex_shell, wire_shell);
  
ENTITY shell_based_wireframe_shape_representation 
 SUBTYPE OF ( shape_representation );
 WHERE 
WR1 : 
SIZEOF ( 
QUERY ( it <* SELF.items| NOT ( SIZEOF ([ 'AIC_SHELL_BASED_WIREFRAME.SHELL_BASED_WIREFRAME_MODEL', 'AIC_SHELL_BASED_WIREFRAME.MAPPED_ITEM', 'AIC_SHELL_BASED_WIREFRAME.AXIS2_PLACEMENT_3D' ] * TYPEOF (it)) = 1) )) = 0;
WR2 : 
SIZEOF ( 
QUERY ( it <* SELF.items| ( SIZEOF ([ 'AIC_SHELL_BASED_WIREFRAME.SHELL_BASED_WIREFRAME_MODEL', 'AIC_SHELL_BASED_WIREFRAME.MAPPED_ITEM' ] * TYPEOF (it)) = 1) )) >= 1;
WR3 : 
SIZEOF ( 
QUERY ( sbwm <* 
QUERY ( it <* SELF.items| ('AIC_SHELL_BASED_WIREFRAME.SHELL_BASED_WIREFRAME_MODEL' IN TYPEOF (it)) )| NOT ( SIZEOF ( 
QUERY ( ws <* 
QUERY ( sb <* sbwm\shell_based_wireframe_model.sbwm_boundary| ('AIC_SHELL_BASED_WIREFRAME.WIRE_SHELL' IN TYPEOF (sb)) )| NOT ( SIZEOF ( 
QUERY ( eloop <* 
QUERY ( wsb <* ws\wire_shell.wire_shell_extent| ('AIC_SHELL_BASED_WIREFRAME.EDGE_LOOP' IN TYPEOF (wsb)) )| NOT ( SIZEOF ( 
QUERY ( el <* eloop\path.edge_list| NOT ('AIC_SHELL_BASED_WIREFRAME.EDGE_CURVE' IN TYPEOF (el.edge_element)) )) = 0) )) = 0) )) = 0) )) = 0;
WR4 : 
SIZEOF ( 
QUERY ( sbwm <* 
QUERY ( it <* SELF.items| ('AIC_SHELL_BASED_WIREFRAME.SHELL_BASED_WIREFRAME_MODEL' IN TYPEOF (it)) )| NOT ( SIZEOF ( 
QUERY ( ws <* 
QUERY ( sb <* sbwm\shell_based_wireframe_model.sbwm_boundary| ('AIC_SHELL_BASED_WIREFRAME.WIRE_SHELL' IN TYPEOF (sb)) )| NOT ( SIZEOF ( 
QUERY ( eloop <* 
QUERY ( wsb <* ws\wire_shell.wire_shell_extent| ('AIC_SHELL_BASED_WIREFRAME.EDGE_LOOP' IN TYPEOF (wsb)) )| NOT ( SIZEOF ( 
QUERY ( pline_el <* 
QUERY ( el <* eloop\path.edge_list| ('AIC_SHELL_BASED_WIREFRAME.POLYLINE' IN TYPEOF (el.edge_element\edge_curve.edge_geometry)) )| NOT ( SIZEOF (pline_el.edge_element\edge_curve.edge_geometry\polyline.points) > 2) )) = 0) )) = 0) )) = 0) )) = 0;
WR5 : 
SIZEOF ( 
QUERY ( sbwm <* 
QUERY ( it <* SELF.items| ('AIC_SHELL_BASED_WIREFRAME.SHELL_BASED_WIREFRAME_MODEL' IN TYPEOF (it)) )| NOT ( SIZEOF ( 
QUERY ( ws <* 
QUERY ( sb <* sbwm\shell_based_wireframe_model.sbwm_boundary| ('AIC_SHELL_BASED_WIREFRAME.WIRE_SHELL' IN TYPEOF (sb)) )| NOT ( SIZEOF ( 
QUERY ( eloop <* 
QUERY ( wsb <* ws\wire_shell.wire_shell_extent| ('AIC_SHELL_BASED_WIREFRAME.EDGE_LOOP' IN TYPEOF (wsb)) )| NOT ( SIZEOF ( 
QUERY ( el <* eloop\path.edge_list| NOT valid_wireframe_edge_curve(el.edge_element\edge_curve.edge_geometry) )) = 0) )) = 0) )) = 0) )) = 0;
WR6 : 
SIZEOF ( 
QUERY ( sbwm <* 
QUERY ( it <* SELF.items| ('AIC_SHELL_BASED_WIREFRAME.SHELL_BASED_WIREFRAME_MODEL' IN TYPEOF (it)) )| NOT ( SIZEOF ( 
QUERY ( ws <* 
QUERY ( sb <* sbwm\shell_based_wireframe_model.sbwm_boundary| ('AIC_SHELL_BASED_WIREFRAME.WIRE_SHELL' IN TYPEOF (sb)) )| NOT ( SIZEOF ( 
QUERY ( eloop <* 
QUERY ( wsb <* ws\wire_shell.wire_shell_extent| ('AIC_SHELL_BASED_WIREFRAME.EDGE_LOOP' IN TYPEOF (wsb)) )| NOT ( SIZEOF ( 
QUERY ( el <* eloop\path.edge_list| NOT (('AIC_SHELL_BASED_WIREFRAME.VERTEX_POINT' IN TYPEOF (el.edge_element.edge_start)) AND ('AIC_SHELL_BASED_WIREFRAME.VERTEX_POINT' IN TYPEOF (el.edge_element.edge_end))) )) = 0) )) = 0) )) = 0) )) = 0;
WR7 : 
SIZEOF ( 
QUERY ( sbwm <* 
QUERY ( it <* SELF.items| ('AIC_SHELL_BASED_WIREFRAME.SHELL_BASED_WIREFRAME_MODEL' IN TYPEOF (it)) )| NOT ( SIZEOF ( 
QUERY ( ws <* 
QUERY ( sb <* sbwm\shell_based_wireframe_model.sbwm_boundary| ('AIC_SHELL_BASED_WIREFRAME.WIRE_SHELL' IN TYPEOF (sb)) )| NOT ( SIZEOF ( 
QUERY ( eloop <* 
QUERY ( wsb <* ws\wire_shell.wire_shell_extent| ('AIC_SHELL_BASED_WIREFRAME.EDGE_LOOP' IN TYPEOF (wsb)) )| NOT ( SIZEOF ( 
QUERY ( el <* eloop\path.edge_list| NOT (valid_wireframe_vertex_point(el.edge_element.edge_start\vertex_point.vertex_geometry) AND valid_wireframe_vertex_point(el.edge_element.edge_end\vertex_point.vertex_geometry)) )) = 0) )) = 0) )) = 0) )) = 0;
WR8 : 
SIZEOF ( 
QUERY ( sbwm <* 
QUERY ( it <* SELF.items| ('AIC_SHELL_BASED_WIREFRAME.SHELL_BASED_WIREFRAME_MODEL' IN TYPEOF (it)) )| NOT ( SIZEOF ( 
QUERY ( ws <* 
QUERY ( sb <* sbwm\shell_based_wireframe_model.sbwm_boundary| ('AIC_SHELL_BASED_WIREFRAME.WIRE_SHELL' IN TYPEOF (sb)) )| NOT ( SIZEOF ( 
QUERY ( vloop <* 
QUERY ( wsb <* ws\wire_shell.wire_shell_extent| ('AIC_SHELL_BASED_WIREFRAME.VERTEX_LOOP' IN TYPEOF (wsb)) )| NOT ('AIC_SHELL_BASED_WIREFRAME.VERTEX_POINT' IN TYPEOF (vloop\vertex_loop.loop_vertex)) )) = 0) )) = 0) )) = 0;
WR9 : 
SIZEOF ( 
QUERY ( sbwm <* 
QUERY ( it <* SELF.items| ('AIC_SHELL_BASED_WIREFRAME.SHELL_BASED_WIREFRAME_MODEL' IN TYPEOF (it)) )| NOT ( SIZEOF ( 
QUERY ( ws <* 
QUERY ( sb <* sbwm\shell_based_wireframe_model.sbwm_boundary| ('AIC_SHELL_BASED_WIREFRAME.WIRE_SHELL' IN TYPEOF (sb)) )| NOT ( SIZEOF ( 
QUERY ( vloop <* 
QUERY ( wsb <* ws\wire_shell.wire_shell_extent| ('AIC_SHELL_BASED_WIREFRAME.VERTEX_LOOP' IN TYPEOF (wsb)) )| NOT valid_wireframe_vertex_point(vloop\vertex_loop.loop_vertex\vertex_point.vertex_geometry) )) = 0) )) = 0) )) = 0;
WR10 : 
SIZEOF ( 
QUERY ( sbwm <* 
QUERY ( it <* SELF.items| ('AIC_SHELL_BASED_WIREFRAME.SHELL_BASED_WIREFRAME_MODEL' IN TYPEOF (it)) )| NOT ( SIZEOF ( 
QUERY ( vs <* 
QUERY ( sb <* sbwm\shell_based_wireframe_model.sbwm_boundary| ('AIC_SHELL_BASED_WIREFRAME.VERTEX_SHELL' IN TYPEOF (sb)) )| NOT ('AIC_SHELL_BASED_WIREFRAME.VERTEX_POINT' IN TYPEOF (vs\vertex_shell.vertex_shell_extent.loop_vertex)) )) = 0) )) = 0;
WR11 : 
SIZEOF ( 
QUERY ( sbwm <* 
QUERY ( it <* SELF.items| ('AIC_SHELL_BASED_WIREFRAME.SHELL_BASED_WIREFRAME_MODEL' IN TYPEOF (it)) )| NOT ( SIZEOF ( 
QUERY ( vs <* 
QUERY ( sb <* sbwm\shell_based_wireframe_model.sbwm_boundary| ('AIC_SHELL_BASED_WIREFRAME.VERTEX_SHELL' IN TYPEOF (sb)) )| NOT valid_wireframe_vertex_point(vs\vertex_shell.vertex_shell_extent.loop_vertex\vertex_point.vertex_geometry) )) = 0) )) = 0;
WR12 : 
SIZEOF ( 
QUERY ( mi <* 
QUERY ( it <* SELF.items| ('AIC_SHELL_BASED_WIREFRAME.MAPPED_ITEM' IN TYPEOF (it)) )| NOT ('AIC_SHELL_BASED_WIREFRAME.' + 'SHELL_BASED_WIREFRAME_SHAPE_REPRESENTATION' IN TYPEOF (mi\mapped_item.mapping_source.mapped_representation)) )) = 0;
WR13 : SELF.context_of_items\geometric_representation_context.coordinate_space_dimension = 3;
 END_ENTITY ;
  
FUNCTION valid_wireframe_edge_curve 
( 
crv : curve ) : BOOLEAN ;
 IF SIZEOF ([ 'AIC_SHELL_BASED_WIREFRAME.LINE', 'AIC_SHELL_BASED_WIREFRAME.CONIC', 'AIC_SHELL_BASED_WIREFRAME.B_SPLINE_CURVE', 'AIC_SHELL_BASED_WIREFRAME.POLYLINE' ] * TYPEOF (crv)) = 1 THEN 
 RETURN (TRUE);
 ELSE 
 IF 'AIC_SHELL_BASED_WIREFRAME.CURVE_REPLICA' IN TYPEOF (crv) THEN 
 RETURN (valid_wireframe_edge_curve(crv\curve_replica.parent_curve));
 ELSE 
 IF 'AIC_SHELL_BASED_WIREFRAME.OFFSET_CURVE_3D' IN TYPEOF (crv) THEN 
 RETURN (valid_wireframe_edge_curve(crv\offset_curve_3d.basis_curve));
 END_IF ;
 END_IF ;
 END_IF ;
 RETURN (FALSE);
 END_FUNCTION ;
FUNCTION valid_wireframe_vertex_point 
( 
pnt : point ) : BOOLEAN ;
 IF 'AIC_SHELL_BASED_WIREFRAME.CARTESIAN_POINT' IN TYPEOF (pnt) THEN 
 RETURN (TRUE);
 ELSE 
 IF 'AIC_SHELL_BASED_WIREFRAME.POINT_REPLICA' IN TYPEOF (pnt) THEN 
 RETURN (valid_wireframe_vertex_point(pnt\point_replica.parent_pt));
 END_IF ;
 END_IF ;
 RETURN (FALSE);
 END_FUNCTION ;
END_SCHEMA;
 