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 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 を指定すると、対象属性に紐づく属性制約のうち、指定した種類の制約だけを出力できます。

$ annofabcli annotation_specs list_attribute_restriction \
 --project_id prj1 \
 --attribute_name comment \
 --restriction_type imply
If 'unclear' is checked, 'comment' matches '[0-9]'.

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]
       [--attribute_name ATTRIBUTE_NAME [ATTRIBUTE_NAME ...]]
       [--label_name LABEL_NAME [LABEL_NAME ...]]
       [--restriction_type {can_input,has_label,equals,not_equals,matches,not_matches,imply}]
       [-o OUTPUT] [-f {text,json,pretty_json}]

Named Arguments#

-p, --project_id

対象のプロジェクトのproject_idを指定します。APIで取得したアノテーション仕様情報を元に出力します。

--annotation_specs_json_file

指定したアノテーション仕様のJSONファイルを指定します。JSONファイルに記載された情報を元に出力します。ただしアノテーション仕様の format_version3 である必要があります。

--history_id

出力したいアノテーション仕様のhistory_idを指定してください。 history_idは annotation_specs list_history コマンドで確認できます。 指定しない場合は、最新のアノテーション仕様が出力されます。

--before

出力したい過去のアノテーション仕様が、最新よりいくつ前のアノテーション仕様であるかを指定してください。 たとえば 1 を指定した場合、最新より1個前のアノテーション仕様を出力します。 指定しない場合は、最新のアノテーション仕様が出力されます。

--attribute_name

指定した属性名(英語)の属性の制約を出力します。

--label_name

指定したラベル名(英語)のラベルに紐づく属性の制約を出力します。

--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

出力先のファイルパスを指定します。未指定の場合は、標準出力に出力されます。

-f, --format

Possible choices: text, json, pretty_json

出力フォーマット

  • text: 人が読みやすい形式で出力する

  • json: 属性制約のJSONを1行で出力する形式

  • pretty_json: 属性制約のJSONを整形して出力する形式

Default: 'text'

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リクエストの内容やレスポンスのステータスコードなど、デバッグ用のログが出力されます。