Attribute attClass = (Attribute) newData.classAttribute().copy();
// remove the bagIndex attribute
newData.deleteAttributeAt(0);
// remove the class attribute
newData.setClassIndex(-1);
newData.deleteAttributeAt(newData.numAttributes() - 1);
FastVector attInfo = new FastVector(3);
attInfo.addElement(attBagIndex);
attInfo.addElement(new Attribute("bag", newData)); // relation-valued attribute
attInfo.addElement(attClass);