annotation_specs add_attribute_restriction#

Description#

アノテーション仕様に属性の制約を追加します。 アノテーション仕様画面では設定できない「属性間の制約」を追加するときに有用です。

Examples#

以下のコマンドは、「IDが"X"の属性の値が"true"のとき、IDが"Y"の属性は空文字ではない」という制約を追加します。

restrictions.json#
[
    {
        "additional_data_definition_id": "y",
        "condition": {
            "premise": {
                "additional_data_definition_id": "x",
                "condition": {
                    "value": "true",
                    "_type": "Equals"
                }
            },
            "condition": {
                "value": "",
                "_type": "NotEquals"
            },
            "_type": "Imply"
        }
    }
]
$ annofabcli annotation_specs add_attribute_restriction --project_id prj1 --restriction_json file://restriction.json

属性制約のJSON形式については https://annofab.readme.io/docs/constraints-between-attributes を参照してください。

なお annofabcli-llm annotation_specs parse_attribute_restriction コマンドを利用すると、自然言語で記載された制約から属性制約のJSONを生成できます。

Usage Details#

アノテーション仕様に属性の制約を追加します。アノテーション仕様画面では設定できない「属性間の制約」を追加するときに有用です。

usage: annofabcli annotation_specs add_attribute_restriction
       [-h] [--yes] [--endpoint_url ENDPOINT_URL]
       [--annofab_user_id ANNOFAB_USER_ID]
       [--annofab_password ANNOFAB_PASSWORD] [--annofab_pat ANNOFAB_PAT]
       [--logdir LOGDIR] [--disable_log] [--debug] -p PROJECT_ID
       --restriction_json RESTRICTION_JSON [--comment COMMENT]

Named Arguments#

-p, --project_id

対象のプロジェクトのproject_idを指定します。

--restriction_json

追加する属性の制約情報のJSONを指定します。JSON形式は ... を参照してください。 (例) [{"additional_data_definition_id": "a1", "condition": {"value": "true", "_type": "Equals"}}] file:// を先頭に付けるとjsonファイルを指定できます。

--comment

アノテーション仕様の変更内容を説明するコメント。未指定の場合、自動でコメントが生成されます。

global optional arguments#

--yes

処理中に現れる問い合わせに対して、常に yes と回答します。

--endpoint_url

Annofab WebAPIのエンドポイントを指定します。

Default: 'https://annofab.com'

--annofab_user_id

Annofabにログインする際のユーザーID

--annofab_password

Annofabにログインする際のパスワード

--annofab_pat

Annofabにログインする際のパーソナルアクセストークン

--logdir

ログファイルを保存するディレクトリを指定します。

Default: .log

--disable_log

ログを無効にします。

--debug

HTTPリクエストの内容やレスポンスのステータスコードなど、デバッグ用のログが出力されます。

See also#