Skip to content

[long-task] [long-task] schema:unitText → schema:unitCode に訂正(RealWorldDataStructureProperty に unitCode が無い) (#18) - #19

Merged
nagata-yoshiteru merged 2 commits into
mainfrom
claude/task-18-long-task-schema-unittext-schema-unitcod
Jul 25, 2026
Merged

[long-task] [long-task] schema:unitText → schema:unitCode に訂正(RealWorldDataStructureProperty に unitCode が無い) (#18)#19
nagata-yoshiteru merged 2 commits into
mainfrom
claude/task-18-long-task-schema-unittext-schema-unitcod

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Issue #18 の長期タスク。進捗は Issue 内の bot コメントを参照してください。

…t unitText comment

UN/CEFACT Common Codes (e.g. DD=degree) belong in schema:unitCode, not
schema:unitText (human-readable free text). dbp:RealWorldDataStructureProperty
previously defined only unitText, and its comment wrongly described it as a
"unece.org Rec 20 value".

- Add `unitCode` field (UNECE Recommendation 20 code) to
  RealWorldDataStructureProperty in dbp_schema.proto / dbp_schema.ja.proto,
  mirroring the already-correct dbp:DataFieldType definition.
- Correct the unitText comment to "human-readable free-text unit" in both protos.
- Add schema:unitCode to the RealWorldDataStructureProperty rangeIncludes in
  dbp-schema.jsonld / dbp-schema.ja.jsonld (hand-edited to match what
  ProtoToJsonld.py would emit; protoc/requests unavailable in this runner).

Refs #18

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@claude

claude Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Claude finished @github-actions[bot]'s task —— View job


コードレビュー

Issue #18 に対応する、dbp:RealWorldDataStructurePropertyschema:unitCode を追加する変更をレビューしました。

  • 変更ファイルの読み込みと差分の把握
  • JSON-LD の妥当性・整合性チェック
  • proto の妥当性・整合性チェック
  • 生成物(Go / Rust / SQL / dbdiagram)との同期チェック

結論

変更自体は妥当で、意図(RealWorldDataStructurePropertyunitText と対になる unitCode を追加)は正しく実装されています。dbp:DataFieldType が既に unitText + unitCode の両方を持っていた(aa90b3c 相当)ので、今回の変更で両クラスのモデルが揃う形になり整合性が取れます。schema.org の QuantitativeValueunitText = 人間可読、unitCode = UN/CEFACT Rec 20 コード)とも一致した綺麗な設計です。

ただし、1 点だけ確実に対応が必要な指摘があります。

🔴 生成コード(Go / Rust)が未再生成で source と乖離しています

.proto を編集したのに、そこから生成される Go / Rust が再生成・コミットされていません。

  • dbp_schema.pb.go RealWorldDataStructurePropertydbp_schema.pb.go:1873 付近): UnitText の後に UnitCode(tag 41)が無い。しかも UnitText のコメントが旧文言(Value representing the unit of the variable (unece.org Rec 20 value))のままで、今回 proto 側で更新した Human-readable free-text unit ... が反映されていません。
  • src/dbp_schema.rs RealWorldDataStructurePropertysrc/dbp_schema.rs:480 付近): 同様に unit_code(tag 41)が無く、unit_text の doc コメントも旧文言のまま。

比較として、DataFieldType 側は前回 PR で再生成済みのため両言語に unit_code(tag 41)が入っています(dbp_schema.pb.go:4294, src/dbp_schema.rs:1086)。前回 aa90b3c で「Go/Rust を再生成してコミット」という運用になっているので、今回もこの 2 ファイルを再生成してコミットするのが揃った対応になります。

補足: dbp_schema.sql(dbdiagram DBML)と dbdiagram-oss_exported_data.json には RealWorldDataStructureProperty に相当するテーブルが存在しない(DataFieldType テーブルのみ unitCode を持つ)ため、この 2 つは今回の対象外で問題ありません。

🟡 (参考)型の使い分け

unitTextgoogle.protobuf.StringValue(wrapper 型)、unitCodeoptional string になっています。proto3 の optional でも presence は表現できるので機能上の問題はなく、また DataFieldType の既存定義(unitText=StringValue / unitCode=optional string)と一致しているので、あえて合わせているなら現状で OK です。将来的に統一したい場合の判断材料として一応記載します。

良かった点

  • .jsonld / .proto ともに ja / en 版が対称に更新されている。
  • proto のフィールド番号 41 は未使用で衝突なし(次は variableScaleType = 50)。
  • unitText のコメントを「人間可読な自由文」に、unitCode を「Rec 20 コード」に整理した点は、旧コメント(unitText に "unece.org Rec 20 value" と書かれていた)の誤解を解消していて良い改善です。

まとめると、モデル定義(jsonld / proto)としては問題なし。マージ前に Go / Rust の生成物(dbp_schema.pb.go, src/dbp_schema.rs)を再生成してコミットしていただくのが望ましいです(前回 PR と同じ運用)。

· branch: claude/task-18-long-task-schema-unittext-schema-unitcod

@claude

claude Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Claude finished @github-actions[bot]'s task —— View job


コードレビュー(再レビュー: synchronize 後)

前回レビューで指摘した「Go / Rust の生成物が未再生成」の件が、追加コミット 179995f で解消されているか確認しました。

  • 変更ファイルの読み込みと差分の把握
  • proto(en / ja)の整合性チェック
  • JSON-LD(en / ja)の整合性チェック
  • 生成物(Go / Rust)の再生成・同期チェック

結論 — ✅ 前回の指摘は解消済み。モデル定義・生成物ともに整合が取れています

RealWorldDataStructureProperty への schema:unitCode(tag 41)追加と unitText コメント修正が、ソース・生成物すべてに一貫して反映されているのを確認しました。

確認できた点:

  • proto dbp_schema.proto:241 / dbp_schema.ja.proto:241: unitCode = 41 追加、unitText コメントを「人間可読な自由文」に更新。en / ja 対称。tag 41 は未使用で衝突なし(次は 50)。
  • JSON-LD dbp-schema.jsonld / dbp-schema.ja.jsonld: schema:unitText に続けて schema:unitCode を追加。en / ja 対称。
  • Go dbp_schema.pb.go: UnitCode *string(tag 41, dbp_schema.pb.go:1874)、GetUnitCode() getter(:2064)、raw descriptor バイト列(:4994)すべて再生成済み。UnitText コメントも新文言に更新。
  • Rust src/dbp_schema.rs:482: unit_code(tag 41)追加、unit_text の doc コメントも更新。差分は最小限でクリーン。

DataFieldType(前回 PR で対応済み)と RealWorldDataStructureProperty の両クラスで unitText + unitCode が揃い、schema.org QuantitativeValue の設計とも一致しています。


🟡 タスク範囲外の副次的変更(マージ判断のための共有・ブロッカーではありません)

今回の再生成に伴い、unitCode 追加以外に以下の差分が dbp_schema.pb.go / README.md に入っています。意図的か念のため人間の目で確認いただければと思います。

  1. Go パッケージ名 package __package dbp_schemadbp_schema.pb.go:8
    • README.md の Go 生成コマンドに --go_opt=Mdbp_schema.proto=exdata.co.jp/project/protos/dbp_schema が追加されたことによるものです。
    • これは従来の package __(明らかに壊れていた名前)を 正しく直す良い変更 ですが、本 PR の主題(unitTextunitCode)とは独立した修正なので、意図的なものかだけ確認をお願いします。
  2. 埋め込みツールチェーンのバージョンコメント更新protoc-gen-go v1.36.10→v1.36.11 / protoc v6.33.1→v7.35.1, dbp_schema.pb.go:3-4
    • 再生成環境のバージョン差によるもので、機能への影響はありません。

CLAUDE.md の「差分は最小限に」の観点から一応挙げていますが、いずれも再生成の自然な副産物、または既存バグの修正であり、マージを妨げるものではありません

dbp_schema.sql(DBML)と dbdiagram-oss_exported_data.jsonRealWorldDataStructureProperty に相当するテーブルを持たない(DataFieldType のみ)ため、前回同様に対象外で問題なしです。


まとめ

前回のブロッカーは解消済みで、source(jsonld / proto)と生成物(Go / Rust)が完全に同期しています。マージ可能な状態と判断します。上記 🟡 の副次的差分だけ、意図どおりか一読いただければ万全です。

(※ 私は formal な GitHub PR review / approve はできないため、これはコメントによるレビュー所見です。)

· branch: claude/task-18-long-task-schema-unittext-schema-unitcod · View job

@nagata-yoshiteru
nagata-yoshiteru merged commit cd90b66 into main Jul 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant