<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def resolve_relative_paths(paths: List[str]) -> Dict[str, str]: """ Query buck to obtain a mapping from each absolute path to the relative location in the analysis directory. """

    buck_root = find_buck_root(os.getcwd())
    if buck_root is None:
        LOG.error(
            "Buck root couldn't be found. Returning empty analysis directory mapping."
        )
        return {}
    command = [
        "buck",
        "query",
        "--json",
        "--output-attribute",
        ".*",
        "owner(%s)",
        *paths,
    ]
    try:
        output = json.loads(
            subprocess.check_output(command, timeout=30, stderr=subprocess.DEVNULL)
            .decode()
            .strip()
        )
    except (
        subprocess.TimeoutExpired,
        subprocess.CalledProcessError,
        json.decoder.JSONDecodeError,
    ) as error:
        raise BuckException("Querying buck for relative paths failed: {}".format(error))
    # TODO(T40580762) we should use the owner name to determine which files are a
    # part of the pyre project
    results = {}
    for path in paths:
        # For each path, search for the target that owns it.
        for owner in output.values():
            prefix = os.path.join(buck_root, owner["buck.base_path"]) + os.sep

            if not path.startswith(prefix):
                continue

            suffix = path[len(prefix) :]

            if suffix not in owner["srcs"]:
                continue

            if "buck.base_module" in owner:
                base_path = os.path.join(*owner["buck.base_module"].split("."))
            else:
                base_path = owner["buck.base_path"]

            results[path] = os.path.join(base_path, owner["srcs"][suffix])
            break  # move on to next path
    return results