  We propose a unified framework for dealing with matching rules of
quasiperiodic patterns, relevant for both tiling models and real world
quasicrystals. The approach is intended for extraction and validation of a
minimal set of matching rules, directly from the phased diffraction data. The
construction yields precise values for the spatial density of distinct atomic
positions and tolerates the presence of defects in a robust way.
