dap4/d4core/src/main/java/dap4/core/ce/CEConstraint.java
public void
    contract()
    {
        // Create a set of contracted compounds
        Set<DapStructure> contracted = new HashSet<>();
        for(int i = 0; i < variables.size(); i++) {
            DapVariable var = variables.get(i);
            if(var.isTopLevel()) {
                DapType base = var.getBaseType();
                if(base.getTypeSort().isCompound()) {
                    contractR((DapStructure) base, contracted);
                }
            }
        }
        this.expansion = Expand.CONTRACTED;
    }
public void
    contract()
    {
        // Create a set of contracted compounds
        Set<DapStructure> contracted = new HashSet<>();
        for(int i = 0; i < variables.size(); i++) {
            DapVariable var = variables.get(i);
            if(var.isTopLevel()) {
                DapType base = var.getBaseType();
                if(base.getTypeSort().isCompound()) {
                    contractR((DapStructure) base, contracted);
                }
            }
        }
        this.expansion = Expand.CONTRACTED;
    }
Locate each Structure|Sequence and:
1. check that all of its fields are referenced recursively and not constrained,
otherwise ignore
2. contract by removing all of the fields of the Structure or Sequence.
This is intended to be (not quite) the dual of expand();