biotope propose-alignment
Propose alignment.yaml from N mapping.yaml files. Heuristic: shared property names suggest same_node equivalences. v1 only emits same_node; the kind: field is reserved for embedding-based entity resolution later.
If you run it inside a biotope project, the command now writes to
alignment.yaml automatically. Use --out to override the destination or
--stdout to print the YAML instead.
biotope propose-alignment — cross-Croissant equivalence proposals.
propose_alignment(mappings, out, to_stdout)
Propose an alignment.yaml from N mapping.yaml files.
Heuristic: shared property names between two nodes suggest a same_node
equivalence. Human review expected before passing to build.
Source code in biotope/biotope/commands/propose_alignment.py
| @click.command(name="propose-alignment")
@click.argument("mappings", nargs=-1, required=True, type=click.Path(exists=True, path_type=Path))
@click.option(
"--out",
"-o",
type=click.Path(dir_okay=False, path_type=Path),
default=None,
help="Write the proposed alignment to this path. Default: infer alignment.yaml when possible.",
)
@click.option(
"--stdout",
"to_stdout",
is_flag=True,
help="Print the proposed alignment YAML to stdout instead of writing an inferred file.",
)
def propose_alignment(mappings: tuple[Path, ...], out: Path | None, to_stdout: bool) -> None:
"""Propose an alignment.yaml from N mapping.yaml files.
Heuristic: shared property names between two nodes suggest a same_node
equivalence. Human review expected before passing to build.
"""
if out is not None and to_stdout:
raise click.UsageError("Choose either --out or --stdout, not both.")
target = out
if target is None and not to_stdout:
target = _default_output_path(mappings)
result = _propose(list(mappings), write_to=target)
if target is not None:
console.print(f"✅ Wrote {target}")
else:
click.echo(result["yaml"], nl=False)
|