code: private void validationRelations(Task task)
     {
        List<Relation> predecessors = task.getPredecessors();
        if (!predecessors.isEmpty())
        {
           ArrayList<Relation> invalid = new ArrayList<Relation>();
           for (Relation relation : predecessors)
           {
              Task sourceTask = relation.getSourceTask();
              Task targetTask = relation.getTargetTask();
  
              String sourceOutlineNumber = sourceTask.getOutlineNumber();
              String targetOutlineNumber = targetTask.getOutlineNumber();
  
              if (sourceOutlineNumber != null && targetOutlineNumber != null && sourceOutlineNumber.startsWith(targetOutlineNumber + '.'))
              {
                 invalid.add(relation);
              }
           }
  
           for (Relation relation : invalid)
           {
              relation.getSourceTask().removePredecessor(relation.getTargetTask(), relation.getType(), relation.getLag());
           }
        }
     }
docs: This method validates all relationships for a task, removing
  any which have been incorrectly read from the MPP file and
  point to a parent task.
  
  @param task task under test