def separate_into_groups(dependency_relationships):
    """ Split into sorted logical groups. """
    projects = list()
    projects_bad = list()
    packages = list()
    packages_bad = list()
    for dep in dependency_relationships:
        if dep.is_package:
            if dep.is_known:
                packages.append(dep.path)
            elif not dep.is_known:
                packages_bad.append(dep.to_name)
        elif dep.is_known:
            projects.append(dep.path)
        elif not dep.is_known:
            projects_bad.append(dep.to_name)
    projects = sorted(set(projects))
    projects_bad = sorted(set(projects_bad))
    packages = sorted(set(packages))
    packages_bad = sorted(set(packages_bad))
    return projects, projects_bad, packages, packages_bad
