Skip to content

biotope propose-mapping

Deprecated. Thin alias for biotope map scaffold. Kept for backwards compatibility; new code should call biotope map scaffold directly.

The old heuristic (one RecordSet → one node type, FK-shaped fields → edges) has been removed. The alias now produces an unresolved semantic scaffold (with one slot per project.yaml-declared entity/relation plus an inspector comment appendix) that a human or copilot agent then resolves via biotope map (wizard) or by editing the YAML directly and running biotope map preview.

# These are equivalent.
biotope propose-mapping <croissant>
biotope map scaffold <croissant>

The deprecation notice is printed on each invocation.

biotope propose-mapping — deprecated alias for biotope map scaffold.

The original heuristic propose-mapping has been replaced by an unresolved-scaffold generator under the new biotope map command group. This file remains a thin compatibility shim that prints a deprecation notice and forwards to :func:biotope.croissant.api.scaffold_mapping.

propose_mapping(croissant_path, out, to_stdout, preview_rows)

Generate an unresolved mapping scaffold for a Croissant JSON-LD file.

[deprecated] Use biotope map scaffold instead.

Source code in biotope/biotope/commands/propose_mapping.py
@click.command(name="propose-mapping")
@click.argument("croissant_path", type=str)
@click.option(
    "--out",
    "-o",
    type=click.Path(dir_okay=False, path_type=Path),
    default=None,
    help="Write the proposed scaffold to this path. Default: mappings/<name>.mapping.yaml.",
)
@click.option(
    "--stdout",
    "to_stdout",
    is_flag=True,
    help="Print the scaffold to stdout instead of writing an inferred file.",
)
@click.option(
    "--preview-rows",
    type=click.IntRange(min=0),
    default=3,
    show_default=True,
    help="Sample rows to embed in the inspector comment appendix.",
)
def propose_mapping(croissant_path: str, out: Path | None, to_stdout: bool, preview_rows: int) -> None:
    """Generate an unresolved mapping scaffold for a Croissant JSON-LD file.

    [deprecated] Use ``biotope map scaffold`` instead.
    """
    console.print("[yellow]ℹ `biotope propose-mapping` is deprecated; use `biotope map scaffold` instead.[/yellow]")
    if out is not None and to_stdout:
        raise click.UsageError("Choose either --out or --stdout, not both.")

    # Validate the path with the same friendly error messages as `biotope map scaffold`.
    from biotope.commands.map import _load_croissant

    _load_croissant(croissant_path)

    target = out
    if target is None and not to_stdout:
        target = _default_output_path(croissant_path)
        if target is not None:
            target.parent.mkdir(parents=True, exist_ok=True)

    project = _load_project_optional()
    result = scaffold_mapping(
        croissant_path,
        required_entities=list(project.required_entities) if project else [],
        required_relations=list(project.required_relations) if project else [],
        purpose=project.purpose if project else None,
        write_to=target,
        preview_rows=preview_rows,
    )
    if target:
        console.print(f"✅ Wrote {target}")
    else:
        click.echo(result["yaml"], nl=False)