annotation_specs list_attribute_restriction#
Description#
アノテーション仕様の属性の制約情報を出力します。
Examples#
基本的な使い方#
属性の制約を自然言語で出力します。
$ annofabcli annotation_specs list_attribute_restriction --project_id prj1
'comment' is read-only
'comment' is not empty
'comment' matches '[abc]+'
If 'unclear' is checked, 'comment' matches '[0-9]'.
'type' is 'medium'
'link' has labels 'bike', 'bus'
過去のアノテーション仕様を出力する方法は、 過去のアノテーション仕様を指定する を参照してください。
--format text_with_ids を指定すると、属性ID・ラベルID・選択肢IDなどのIDを含めて自然言語で出力します。
--use_japanese_name を指定すると、自然言語形式のラベル名・属性名・選択肢名を日本語名で出力します。日本語名が登録されていない場合は英語名を出力します。
$ annofabcli annotation_specs list_attribute_restriction --project_id prj1 --format text_with_ids
'comment' [attribute_id='54fa5e97-6f88-49a4-aeb0-a91a15d11528'] is read-only
--format json または --format pretty_json を指定すると、属性制約のJSONを出力できます。
このJSONはAPIのrestrictionオブジェクトそのものなので、将来的に削除コマンドなどへそのまま渡しやすい形式です。
$ annofabcli annotation_specs list_attribute_restriction --project_id prj1 --format pretty_json
[
{
"additional_data_definition_id": "54fa5e97-6f88-49a4-aeb0-a91a15d11528",
"condition": {
"enable": false,
"_type": "CanInput"
}
}
]
特定の属性に紐づく制約のみ出力する#
--restriction_type を指定すると、対象属性に紐づく属性制約のうち、指定した種類の制約だけを出力できます。
属性は --attribute_id または --attribute_name_en で指定できます。
ラベルに紐づく属性の制約を出力する場合は、 --label_name_en にラベルの英語名を指定してください。
旧オプション --label_name は使用できません。
$ annofabcli annotation_specs list_attribute_restriction \
--project_id prj1 \
--attribute_name_en comment \
--restriction_type imply
If 'unclear' is checked, 'comment' matches '[0-9]'.
$ annofabcli annotation_specs list_attribute_restriction \
--project_id prj1 \
--attribute_id 54fa5e97-6f88-49a4-aeb0-a91a15d11528 \
--restriction_type imply
Usage Details#
アノテーション仕様の属性の制約情報を出力します。
usage: annofabcli annotation_specs list_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 |
--annotation_specs_json_file ANNOTATION_SPECS_JSON_FILE)
[--history_id HISTORY_ID | --before BEFORE |
--updated_datetime UPDATED_DATETIME]
[--attribute_id ATTRIBUTE_ID [ATTRIBUTE_ID ...]]
[--attribute_name_en ATTRIBUTE_NAME_EN [ATTRIBUTE_NAME_EN ...]]
[--label_name_en LABEL_NAME_EN [LABEL_NAME_EN ...]]
[--restriction_type {can_input,has_label,equals,not_equals,matches,not_matches,imply}]
[-o OUTPUT] [--use_japanese_name]
[-f {text,text_with_ids,json,pretty_json}]
Named Arguments#
- -p, --project_id
対象のプロジェクトのproject_idを指定します。APIで取得したアノテーション仕様情報を元に出力します。
- --annotation_specs_json_file
指定したアノテーション仕様のJSONファイルを指定します。JSONファイルに記載された情報を元に出力します。ただしアノテーション仕様の
format_versionは3である必要があります。- --history_id
参照するアノテーション仕様のhistory_id。指定しない場合は最新のアノテーション仕様を参照します。
- --before
参照するアノテーション仕様が最新よりいくつ前かを指定します。たとえば
1は最新より1個前を表します。- --updated_datetime
参照するアノテーション仕様の更新日時をISO 8601形式で指定します。日、分、秒、小数秒の精度で検索し、1件に特定できる必要があります。 タイムゾーンを省略した場合はJSTとして扱います。
- --attribute_id
指定した属性IDに紐づく属性制約を出力します。1個だけ指定して
file://を先頭に付けると、属性IDを1行ずつ記載したファイルを指定できます。 ファイルを読み込む場合は、ファイル指定を1個だけ渡してください。直接指定する値や別のファイル指定とは併用できません。- --attribute_name_en
指定した属性名(英語)に紐づく属性制約を出力します。1個だけ指定して
file://を先頭に付けると、属性名(英語)を1行ずつ記載したファイルを指定できます。 ファイルを読み込む場合は、ファイル指定を1個だけ渡してください。直接指定する値や別のファイル指定とは併用できません。- --label_name_en
指定したラベル名(英語)のラベルに紐づく属性の制約を出力します。
file://を先頭に付けると、改行区切りの一覧ファイルを指定できます。 ファイルを読み込む場合は、ファイル指定を1個だけ渡してください。直接指定する値や別のファイル指定とは併用できません。- --restriction_type
Possible choices: can_input, has_label, equals, not_equals, matches, not_matches, imply
出力対象の属性制約種類。 *
can_input: 入力可否制約 *has_label: ラベル条件制約 *equals: 等価制約 *not_equals: 非等価制約 *matches: 正規表現一致制約 *not_matches: 正規表現不一致制約 *imply: 属性間の相関制約- -o, --output
出力先のファイルパスを指定します。未指定の場合は、標準出力に出力されます。
- --use_japanese_name
ラベル名、属性名、選択肢名をアノテーション仕様に登録されている日本語名で出力します。日本語名がない場合は英語名を出力します。
- -f, --format
Possible choices: text, text_with_ids, json, pretty_json
出力フォーマット
text: 人が読みやすい形式で出力する
text_with_ids: 人が読みやすい形式で、属性ID・ラベルID・選択肢IDなどのIDも出力する
json: 属性制約のJSONを1行で出力する形式
pretty_json: 属性制約のJSONを整形して出力する形式
Default:
'text'
common options (after the subcommand)#
- --yes
処理中に現れる問い合わせに対して、常に
yesと回答します。- --endpoint_url
Annofab WebAPIのエンドポイントを指定します。
- --annofab_user_id
Annofabにログインする際のユーザーID
- --annofab_password
Annofabにログインする際のパスワード
- --annofab_pat
Annofabにログインする際のパーソナルアクセストークン
- --logdir
ログファイルを保存するディレクトリを指定します。
Default:
.log- --disable_log
ログを無効にします。
- --debug
HTTPリクエストの内容やレスポンスのステータスコードなど、デバッグ用のログが出力されます。
すべてのプロジェクトメンバーロールで実行できます。