Schema: kinematic_topology_schema

Source : ISO 10303-105



SCHEMA kinematic_topology_schema;

REFERENCE FROM representation_schema   -- ISO 10303-43
  (representation);

REFERENCE FROM topology_schema   -- ISO 10303-42
  (connected_edge_set,
   edge,
   edge_loop,
   oriented_edge,
   path,
   vertex);


TYPE kinematic_topology_representation_select = SELECT
   (kinematic_topology_structure,
    kinematic_topology_directed_structure,
    kinematic_topology_network_structure);
END_TYPE;

ENTITY kinematic_joint
  SUBTYPE OF (edge);
  SELF\edge.edge_start : kinematic_link;
  SELF\edge.edge_end : kinematic_link;
UNIQUE
  UR1: edge_start, edge_end;
WHERE
  WR1: edge_start :<>: edge_end;
END_ENTITY;

ENTITY kinematic_link
  SUBTYPE OF (vertex);
END_ENTITY;

ENTITY kinematic_loop
  SUBTYPE OF (edge_loop);
  SELF\path.edge_list : LIST[1:?] OF UNIQUE oriented_joint;
END_ENTITY;

ENTITY kinematic_topology_directed_structure
  SUBTYPE OF (representation);
  SELF\representation.items : SET[1:?] OF oriented_joint;
  parent : kinematic_topology_structure;
WHERE
  WR1: context_of_items :=: parent.context_of_items;
  WR2: get_kinematic_joints_from_oriented_joints(items) <= parent.items;
END_ENTITY;

ENTITY kinematic_topology_network_structure
  SUBTYPE OF (representation);
  SELF\representation.items : SET[1:?] OF kinematic_loop;
  parent : kinematic_topology_structure;
WHERE
  WR1: context_of_items :=: parent.context_of_items;
  WR2: get_kinematic_joints_from_kinematic_loops(items) <= parent.items;
END_ENTITY;

ENTITY kinematic_topology_structure
  SUBTYPE OF (representation);
  SELF\representation.items : SET[1:?] OF kinematic_joint;
WHERE
  WR1: SIZEOF (QUERY (item <* items | 'TOPOLOGY_SCHEMA.ORIENTED_EDGE' in TYPEOF(item))) = 0;
END_ENTITY;

ENTITY kinematic_topology_substructure
  SUBTYPE OF (kinematic_topology_structure);
  parent : kinematic_topology_structure;
WHERE
  WR1: context_of_items :=: parent.context_of_items;
  WR2: SELF\kinematic_topology_structure.items <= parent\kinematic_topology_structure.items;
END_ENTITY;

ENTITY kinematic_topology_tree_structure
  SUBTYPE OF (kinematic_topology_directed_structure);
END_ENTITY;

ENTITY oriented_joint
  SUBTYPE OF (oriented_edge);
  SELF\oriented_edge.edge_element : kinematic_joint;
END_ENTITY;

SUBTYPE_CONSTRAINT kts_representation_subtypes FOR representation;
  ONEOF (kinematic_topology_structure,
         kinematic_topology_directed_structure,
         kinematic_topology_network_structure);
END_SUBTYPE_CONSTRAINT;

FUNCTION get_kinematic_joints_from_kinematic_loops
 (kls : SET[0:?] OF kinematic_loop) : SET[0:?] OF kinematic_joint;
LOCAL
    result : SET OF oriented_joint := [];
  END_LOCAL;
  IF SIZEOF(kls) > 0 THEN
    REPEAT i := 1 TO HIINDEX(kls);
      result := result + kls[i].edge_list;
    END_REPEAT;
  END_IF;
  RETURN (get_kinematic_joints_from_oriented_joints(result));
END_FUNCTION;

FUNCTION get_kinematic_joints_from_oriented_joints
 (ors : SET[0:?] OF oriented_joint) : SET[0:?] OF kinematic_joint;
LOCAL
    result : SET OF kinematic_joint := [];
  END_LOCAL;
  IF SIZEOF(ors) > 0 THEN
    REPEAT i := 1 TO HIINDEX(ors);
      result := result + ors[i].edge_element;
    END_REPEAT;
  END_IF;
  RETURN (result);
END_FUNCTION;

END_SCHEMA;  -- kinematic_topology_schema