Skip to content

Note

このドキュメントは2026-02-27 02:32PLaMo Translation Modelを使用して自動翻訳されました。

FEP-bad1: オブジェクト履歴コレクションの定義

概要

[AS2-Core]では、オブジェクトの「履歴」を表現する例示として18番、19番、および32番が提供されています。

特に例示32においては、オブジェクトの作成(Create)、更新(Update)、および削除(Delete)が記録されている事例が見られます。しかしながら、この目的に適したコレクションを明示的に示すプロパティは定義されていません。本FEPでは、この種のコレクションを適切に定義することを試みます。

ActivityStreams 2.0から引用した具体例

(本セクションは規範的ではありません)

便宜上、以下の具体例はActivityStreams 2.0 [AS2-Core]仕様書から直接転載しています。例示18と19は規範的なセクションに、例示32は非規範的なセクションにそれぞれ記載されています。

例示18:

{
  "@context": "https://www.w3.org/ns/activitystreams",
  "summary": "オブジェクト履歴",
  "type": "Collection",
  "totalItems": 2,
  "items": [
    {
      "type": "Create",
      "actor": "http://www.test.example/sally",
      "object": "http://example.org/foo"
    },
    {
      "type": "Like",
      "actor": "http://www.test.example/joe",
      "object": "http://example.org/foo"
    }
  ]
}

例示19:

{
  "@context": "https://www.w3.org/ns/activitystreams",
  "summary": "オブジェクト履歴",
  "type": "OrderedCollection",
  "totalItems": 2,
  "orderedItems": [
    {
      "type": "Create",
      "actor": "http://www.test.example/sally",
      "object": "http://example.org/foo"
    },
    {
      "type": "Like",
      "actor": "http://www.test.example/joe",
      "object": "http://example.org/foo"
    }
  ]
}

例示32:

{
  "@context": [
    "https://www.w3.org/ns/activitystreams",
    {
      "oa": "http://www.w3.org/ns/oa#",
      "prov": "http://www.w3.org/ns/prov#",
      "dcterms": "http://purl.org/dc/terms/",
      "dcterms:created": {
        "@id": "dcterms:created",
        "@type": "xsd:dateTime"
      }
    }
  ],
  "summary": "ノートの編集履歴",
  "type": "Collection",
  "items": [
    {
      "id": "http://example.org/activity/20150101000000",
      "type": [ "Create", "prov:Activity" ],
      "actor": {
        "id": "http://example.org/#eric",
        "name": "Eric"
      },
      "summary": "Ericがノートを作成しました.",
      "object": {
        "id": "http://example.org/entry/20150101000000",
        "type": [ "Note", "prov:Entity" ],
        "attributedTo": "http://example.org/#eric",
        "content": "Remember... all I'm offering is the trooth. Nothing more."
      },
      "published": "2015-01-01T00:00:00Z"
    },
    {
      "id": "http://example.org/activity/20150101000059",
      "type": [ "Update", "prov:Activity", "oa:Annotation" ],
      "summary": "Ericがノートを編集しました.",
      "dcterms:created": "2015-01-01T00:00:59Z",
      "dcterms:creator": { "@id": "http://example.org/#eric" },
      "oa:hasBody": {
        "id": "http://example.org/entry/20150101000059",
        "type": [ "Note", "prov:Entity" ],
        "content": "Remember... all I'm offering is the truth. Nothing more.",
        "prov:wasAttributedTo": { "@id": "http://example.org/#eric" },
        "prov:wasRevisionOf": { "@id": "http://example.org/entry/20150101000000" }
      },
      "oa:hasTarget": { "@id": "http://example.org/entry/20150101000000" },
      "oa:motivatedBy": { "@id": "oa:editing" },
      "prov:generated": { "@id": "http://example.org/entry/20150101000059" },
      "prov:wasInformedBy": { "@id": "http://example.org/activity/20150101000000" }
    },
    {
      "id": "http://example.org/activity/20150101010101",
      "type": [ "Delete", "prov:Activity" ],
      "actor": "http://example.org/#eric",
      "summary": "Ericがノートを削除しました.",
      "object": "http://example.org/entry/20150101000059",
      "published": "2015-01-01T01:01:01Z"
    }
  ]
}

これらの例示から、例示18はタイプがCollectionである点を除けば、例示19と実質的に同一です。オブジェクト履歴コレクションは当然時系列順に整理される必要がありますが、その順序が順方向か逆方向かについては未確定事項です。このFEP作成時点では、[ActivityPub]セクション5に以下の記述があります:

OrderedCollectionを使用する場合、その順序は必ず逆時系列順に表示されなければならない。

この記載から、OrderedCollectionを用いる場合には順序を逆時系列順にすることが必須であることが示されています。

history特殊コレクションの定義

オブジェクトの履歴は、そのオブジェクトのhistoryプロパティを通じて取得されます。historyOrderedCollectionでなければなりません。

履歴ストリームには、そのオブジェクトがobjectとして参照されているすべてのアクティビティが含まれます。ここでactorattributedTo属性と一致する必要があります。これには作成、更新、および削除といった各種アクティビティが含まれる可能性があります。

これは[FEP-7888]におけるcontextとは明確に区別されます。contextは、関連するオブジェクトやアクティビティを含むコレクションを指す場合があり(ただしその定義についてはFEP-9606の採用待ちです)、特定のケースでは与えられたオブジェクトを参照するobject項目をすべて含むこのようなコレクションをフィルタリングすることで履歴を取得することも可能です。ただし、これは一貫性のある、あるいは直感的な方法とは言えません。

本FEPで定義される用語

関連contextにおいて、以下の用語を定義します:

history

URI : https://w3id.org/fep/bad1/history

説明 : このオブジェクトの表現に関連する著者が実施したすべてのアクティビティを含むコレクション。

JSON-LD定義(FEP-9606採用待ちのため@idは未確定):

{
    "@context": {
        "history": {
            "@id": "https://w3id.org/fep/bad1/history",
            "@type": "@id"
        }
    }
}

具体例:

{
    "@context": [
        "https://w3id.org/fep/bad1/history",
        "https://www.w3.org/ns/activitystreams"
    ],
    "id": "https://example.com/some-file",
    "type": "Tombstone",
    "formerType": "Document",
    "url": "https://example.com/404",
    "history": {
        "id": "https://example.com/some-object/log",
        "type": "OrderedCollection",
        "orderedItems": [
            {
                "id": "https://example.com/some-file/log/3",
                "type": "Delete",
                "object": "https://example.com/some-file"
            },
            {
                "id": "https://example.com/some-file/log/2",
                "type": "Update",
                "object": {
                    "id": "https://example.com/some-file",
                    "url": "https://example.com/storage/hash2"
                }
            },
            {
                "id": "https://example.com/some-file/log/1",
                "type": "Create",
                "object": {
                    "type": "Document",
                    "url": "https://example.com/storage/hash1"
                }
            }
        ]
    }
}

参考文献

  • [ActivityPub] Christine Lemmer Webber, Jessica Tallon, [ActivityPub]仕様書
  • [FEP-7888] FEP-7888: 特定のプロパティ定義に関する提案

著作権について

[AS2-Core]における本作業について、著者らはすべての著作権および関連する権利を放棄しています。これにより、この著作物に対するいかなる知的財産権も主張しないこととします。