activitypub-behaviors/README

This page excerpts the README of activitypub-behaviors. Find the entirety of the source code in the repository.

activitypub-behaviors

a dataset of behaviors described by the ActivityPub protocol.

Developing

Each behavior corresponds to an entry in ./behaviors whose file name is like {uuid}.yaml.

The Shape of Behavior

Each behavior corresponds to a file like ./behaviors/*.yaml. The syntax of the contents of thosre files is yaml.

type
This is always ConformanceRequirement right now. It will probably change soon to something like a DefineBehavior Activity.
uuid
A uuid uniquely identifying the behavior.
name
a succinct name for the behavior suitable for appearing in lists
content
a human-readable description of the behavior as HTML
context
The notion of "context" used is intentionally vague. The intended function is to serve as a means of grouping objects and activities that share a common originating context or purpose.
"ActivityStreams Vocabulary"@w3.org

In this dataset, we have used this to make it more obvious when a behavior is reasonable expected, e.g. in which part of the protocol the behavior is expected. But this should probably be more structured over time, by e.g. enumerating the 'behavioral contexts' (handwaves) of the protocol.

origin

This is the 'origin' of the behavior. i.e. why it is in this dataset. where it originated. In practice, this is almost always a SpecificResource whose source is https://www.w3.org/TR/activitypub/ and selecting the part of the spec that defines the behavior using a TextQuoteSelector

It might be good to find a way of using as2:origin, which is defined with a domain of Activity.

seeAlso
other related resources
@context
explains how to interpret the rest of the data for those who aren't reading this document

Testing

Run the linkml validation with ./scripts/linkml-validate-behaviors. No output means no errors.

Run the node.js tests with npm test. These do not use linkml.

Usage

with jc

jc can be useful for parsing the yamls. For example, this unix command lets you view a random requirement using jq.

⚡  ls behaviors/*.yaml | shuf | xargs cat | jc --yaml | jq '[.[] | { uuid, content, origin: .origin | {source,selector} }][:1]'
[
  {
    "uuid": "5e781a3a-4314-4ec6-b973-717456dc5da5",
    "content": "The server MUST only target the values of to, cc, and/or audience on the original object being forwarded, and not pick up any new addressees whilst recursing through the linked objects (in case these addressees were purposefully amended by or via the client).\n",
    "origin": {
      "source": "https://www.w3.org/TR/activitypub/",
      "selector": {
        "prefix": "The server SHOULD recurse through these values to look for linked objects owned by the server, and SHOULD set a maximum limit for recursion (ie. the point at which the thread is so deep the recipients followers may not mind if they are no longer getting updates that don't directly involve the recipient).\n",
        "exact": "The server MUST only target the values of to, cc, and/or audience on the original object being forwarded, and not pick up any new addressees whilst recursing through the linked objects (in case these addressees were purposefully amended by or via the client).\n",
        "suffix": "The server MAY filter its delivery targets according to implementation-specific rules (for example, spam filtering).\n"
      }
    }
  }
]