Skip to content

Commit bb22a55

Browse files
committed
Merge pull request #579 from 54GradSoftware/main
Add vocabulary relating to proposals, intentions and measures.
2 parents 68880cd + 1677088 commit bb22a55

File tree

10 files changed

+7317
-35
lines changed

10 files changed

+7317
-35
lines changed

CHANGES.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,21 @@ To be released.
2020
- Added `DocumentLoaderFactoryOptions.maxRedirection` to configure the
2121
maximum number of redirects followed by `getDocumentLoader()`.
2222

23+
### @fedify/vocab
24+
25+
- Added vocabulary types for [FEP-0837], economic resource coordination
26+
in federated networks. [[#578] by Samuel Brinkmann]
27+
28+
- Added `Proposal` class for publishing offers or requests.
29+
- Added `Intent` class for describing economic transactions within
30+
a proposal, with `action`, `resourceConformsTo`, `resourceQuantity`,
31+
`availableQuantity`, and `minimumQuantity` properties.
32+
- Added `Measure` class for representing quantities with units of
33+
measure, with `unit` and `numericalValue` properties.
34+
35+
[FEP-0837]: https://w3id.org/fep/0837
36+
[#578]: https://github.com/fedify-dev/fedify/issues/578
37+
2338
### @fedify/solidstart
2439

2540
- Added `@fedify/solidstart` package for integrating Fedify with
@@ -166,7 +181,6 @@ Released on March 24, 2026.
166181
APIs to distinguish transport failures from specific HTTP fetch failures.
167182
[[#611]]
168183

169-
[FEP-0837]: https://w3id.org/fep/0837
170184
[GoToSocial]: https://gotosocial.org/
171185
[#453]: https://github.com/fedify-dev/fedify/issues/453
172186
[#617]: https://github.com/fedify-dev/fedify/issues/617

docs/manual/vocab.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ property.
158158
> | [`alsoKnownAs`] | `Application.getAliases()`/`Group.getAliases()`/`Organization.getAliases()`/`Person.getAliases()`/`Service.getAliases()` |
159159
> | [`anyOf`] | `Question.getInclusiveOptions()` |
160160
> | [`attributedTo`] | `Object.getAttributions()` |
161+
> | [`hasNumericalValue`] | `Measure.numericalValue` |
162+
> | [`hasUnit`] | `Measure.unit` |
161163
> | [`hreflang`] | `Link.language` |
162164
> | [`inReplyTo`] | `Object.getReplyTargets()` |
163165
> | [`isCat`] | `Application.cat`/`Group.cat`/`Organization.cat`/`Person.cat`/`Service.cat` |
@@ -174,6 +176,8 @@ property.
174176
[`alsoKnownAs`]: https://www.w3.org/TR/did-core/#dfn-alsoknownas
175177
[`anyOf`]: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-anyof
176178
[`attributedTo`]: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-attributedto
179+
[`hasNumericalValue`]: http://www.ontology-of-units-of-measure.org/resource/om-2/hasNumericalValue
180+
[`hasUnit`]: http://www.ontology-of-units-of-measure.org/resource/om-2/hasUnit
177181
[`hreflang`]: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-hreflang
178182
[`inReplyTo`]: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-inreplyto
179183
[`isCat`]: https://misskey-hub.net/ns#iscat

packages/vocab-tools/src/__snapshots__/class.test.ts.deno.snap

Lines changed: 2300 additions & 11 deletions
Large diffs are not rendered by default.

packages/vocab-tools/src/__snapshots__/class.test.ts.node.snap

Lines changed: 2300 additions & 11 deletions
Large diffs are not rendered by default.

packages/vocab-tools/src/__snapshots__/class.test.ts.snap

Lines changed: 2300 additions & 11 deletions
Large diffs are not rendered by default.

packages/vocab/src/__snapshots__/vocab.test.ts.snap

Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,30 @@ snapshot[`Deno.inspect(PropertyValue) [auto] 2`] = `'PropertyValue { id: URL "ht
414414

415415
snapshot[`Deno.inspect(PropertyValue) [auto] 3`] = `'PropertyValue { id: URL "https://example.com/", name: "hello", value: "hello" }'`;
416416

417+
snapshot[`Deno.inspect(Measure) [auto] 1`] = `
418+
'Measure {
419+
id: URL "https://example.com/",
420+
unit: "hello",
421+
numericalValue: "12.34"
422+
}'
423+
`;
424+
425+
snapshot[`Deno.inspect(Measure) [auto] 2`] = `
426+
'Measure {
427+
id: URL "https://example.com/",
428+
unit: "hello",
429+
numericalValue: "12.34"
430+
}'
431+
`;
432+
433+
snapshot[`Deno.inspect(Measure) [auto] 3`] = `
434+
'Measure {
435+
id: URL "https://example.com/",
436+
unit: "hello",
437+
numericalValue: "12.34"
438+
}'
439+
`;
440+
417441
snapshot[`Deno.inspect(AnnounceAuthorization) [auto] 1`] = `
418442
'AnnounceAuthorization {
419443
id: URL "https://example.com/",
@@ -1479,6 +1503,180 @@ snapshot[`Deno.inspect(Multikey) [auto] 3`] = `
14791503
}'
14801504
`;
14811505

1506+
snapshot[`Deno.inspect(Intent) [auto] 1`] = `
1507+
'Intent {
1508+
id: URL "https://example.com/",
1509+
action: "hello",
1510+
resourceConformsTo: URL "https://example.com/",
1511+
resourceQuantity: Measure {},
1512+
availableQuantity: Measure {},
1513+
minimumQuantity: Measure {}
1514+
}'
1515+
`;
1516+
1517+
snapshot[`Deno.inspect(Intent) [auto] 2`] = `
1518+
'Intent {
1519+
id: URL "https://example.com/",
1520+
action: "hello",
1521+
resourceConformsTo: URL "https://example.com/",
1522+
resourceQuantity: Measure {},
1523+
availableQuantity: Measure {},
1524+
minimumQuantity: Measure {}
1525+
}'
1526+
`;
1527+
1528+
snapshot[`Deno.inspect(Intent) [auto] 3`] = `
1529+
'Intent {
1530+
id: URL "https://example.com/",
1531+
action: "hello",
1532+
resourceConformsTo: URL "https://example.com/",
1533+
resourceQuantity: Measure {},
1534+
availableQuantity: Measure {},
1535+
minimumQuantity: Measure {}
1536+
}'
1537+
`;
1538+
1539+
snapshot[`Deno.inspect(Proposal) [auto] 1`] = `
1540+
'Proposal {
1541+
id: URL "https://example.com/",
1542+
attachments: [ Object {}, Link {}, PropertyValue {} ],
1543+
attributions: [ Application {}, Group {}, Organization {}, Person {}, Service {} ],
1544+
audience: Object {},
1545+
contents: [ "hello", <en> "hello" ],
1546+
contexts: [ Object {}, Link {} ],
1547+
names: [ "hello", <en> "hello" ],
1548+
endTime: 2024-03-03T08:30:06.796196096Z,
1549+
generators: [ Object {}, Link {} ],
1550+
icon: Image {},
1551+
image: Image {},
1552+
replyTargets: [ Object {}, Link {} ],
1553+
locations: [ Object {}, Link {} ],
1554+
previews: [ Link {}, Object {} ],
1555+
published: 2024-03-03T08:30:06.796196096Z,
1556+
replies: Collection {},
1557+
shares: Collection {},
1558+
likes: Collection {},
1559+
emojiReactions: Collection {},
1560+
startTime: 2024-03-03T08:30:06.796196096Z,
1561+
summaries: [ "hello", <en> "hello" ],
1562+
tags: [ Object {}, Link {} ],
1563+
updated: 2024-03-03T08:30:06.796196096Z,
1564+
urls: [ URL "https://example.com/", Link {} ],
1565+
to: Object {},
1566+
bto: Object {},
1567+
cc: Object {},
1568+
bcc: Object {},
1569+
mediaType: "hello",
1570+
duration: PT1H,
1571+
sensitive: true,
1572+
source: Source {},
1573+
proof: DataIntegrityProof {},
1574+
interactionPolicy: InteractionPolicy {},
1575+
approvedBy: URL "https://example.com/",
1576+
likeAuthorization: LikeAuthorization {},
1577+
replyAuthorization: ReplyAuthorization {},
1578+
announceAuthorization: AnnounceAuthorization {},
1579+
purpose: "hello",
1580+
publishes: Intent {},
1581+
reciprocal: Intent {},
1582+
unitBased: true
1583+
}'
1584+
`;
1585+
1586+
snapshot[`Deno.inspect(Proposal) [auto] 2`] = `
1587+
'Proposal {
1588+
id: URL "https://example.com/",
1589+
attachments: [ URL "https://example.com/" ],
1590+
attribution: URL "https://example.com/",
1591+
audience: URL "https://example.com/",
1592+
contents: [ "hello", <en> "hello" ],
1593+
contexts: [ URL "https://example.com/" ],
1594+
names: [ "hello", <en> "hello" ],
1595+
endTime: 2024-03-03T08:30:06.796196096Z,
1596+
generators: [ URL "https://example.com/" ],
1597+
icon: URL "https://example.com/",
1598+
image: URL "https://example.com/",
1599+
replyTarget: URL "https://example.com/",
1600+
location: URL "https://example.com/",
1601+
preview: URL "https://example.com/",
1602+
published: 2024-03-03T08:30:06.796196096Z,
1603+
replies: URL "https://example.com/",
1604+
shares: URL "https://example.com/",
1605+
likes: URL "https://example.com/",
1606+
emojiReactions: URL "https://example.com/",
1607+
startTime: 2024-03-03T08:30:06.796196096Z,
1608+
summaries: [ "hello", <en> "hello" ],
1609+
tags: [ URL "https://example.com/" ],
1610+
updated: 2024-03-03T08:30:06.796196096Z,
1611+
urls: [ URL "https://example.com/", Link {} ],
1612+
to: URL "https://example.com/",
1613+
bto: URL "https://example.com/",
1614+
cc: URL "https://example.com/",
1615+
bcc: URL "https://example.com/",
1616+
mediaType: "hello",
1617+
duration: PT1H,
1618+
sensitive: true,
1619+
source: Source {},
1620+
proof: URL "https://example.com/",
1621+
interactionPolicy: InteractionPolicy {},
1622+
approvedBy: URL "https://example.com/",
1623+
likeAuthorization: URL "https://example.com/",
1624+
replyAuthorization: URL "https://example.com/",
1625+
announceAuthorization: URL "https://example.com/",
1626+
purpose: "hello",
1627+
publishes: Intent {},
1628+
reciprocal: Intent {},
1629+
unitBased: true
1630+
}'
1631+
`;
1632+
1633+
snapshot[`Deno.inspect(Proposal) [auto] 3`] = `
1634+
'Proposal {
1635+
id: URL "https://example.com/",
1636+
attachments: [ Object {}, Object {} ],
1637+
attributions: [ Application {}, Application {} ],
1638+
audiences: [ Object {}, Object {} ],
1639+
contents: [ "hello", "hello" ],
1640+
contexts: [ Object {}, Object {} ],
1641+
names: [ "hello", "hello" ],
1642+
endTime: 2024-03-03T08:30:06.796196096Z,
1643+
generators: [ Object {}, Object {} ],
1644+
icons: [ Image {}, Image {} ],
1645+
images: [ Image {}, Image {} ],
1646+
replyTargets: [ Object {}, Object {} ],
1647+
locations: [ Object {}, Object {} ],
1648+
previews: [ Link {}, Link {} ],
1649+
published: 2024-03-03T08:30:06.796196096Z,
1650+
replies: Collection {},
1651+
shares: Collection {},
1652+
likes: Collection {},
1653+
emojiReactions: Collection {},
1654+
startTime: 2024-03-03T08:30:06.796196096Z,
1655+
summaries: [ "hello", "hello" ],
1656+
tags: [ Object {}, Object {} ],
1657+
updated: 2024-03-03T08:30:06.796196096Z,
1658+
urls: [ URL "https://example.com/", URL "https://example.com/" ],
1659+
tos: [ Object {}, Object {} ],
1660+
btos: [ Object {}, Object {} ],
1661+
ccs: [ Object {}, Object {} ],
1662+
bccs: [ Object {}, Object {} ],
1663+
mediaType: "hello",
1664+
duration: PT1H,
1665+
sensitive: true,
1666+
source: Source {},
1667+
proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ],
1668+
interactionPolicy: InteractionPolicy {},
1669+
approvedBy: URL "https://example.com/",
1670+
likeAuthorization: LikeAuthorization {},
1671+
replyAuthorization: ReplyAuthorization {},
1672+
announceAuthorization: AnnounceAuthorization {},
1673+
purpose: "hello",
1674+
publishes: Intent {},
1675+
reciprocal: Intent {},
1676+
unitBased: true
1677+
}'
1678+
`;
1679+
14821680
snapshot[`Deno.inspect(Accept) [auto] 1`] = `
14831681
'Accept {
14841682
id: URL "https://example.com/",

packages/vocab/src/intent.yaml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
$schema: ../../vocab-tools/schema.yaml
2+
name: Intent
3+
compactName: Intent
4+
uri: "https://w3id.org/valueflows/ont/vf#Intent"
5+
entity: false
6+
description: |
7+
A proposed economic transaction describing what is being offered or requested
8+
in a {@link Proposal}.
9+
defaultContext:
10+
- "https://www.w3.org/ns/activitystreams"
11+
- vf: "https://w3id.org/valueflows/ont/vf#"
12+
om2: "http://www.ontology-of-units-of-measure.org/resource/om-2/"
13+
Intent: "vf:Intent"
14+
action: "vf:action"
15+
resourceConformsTo:
16+
"@id": "vf:resourceConformsTo"
17+
"@type": "@id"
18+
resourceQuantity: "vf:resourceQuantity"
19+
availableQuantity: "vf:availableQuantity"
20+
minimumQuantity: "vf:minimumQuantity"
21+
hasUnit: "om2:hasUnit"
22+
hasNumericalValue: "om2:hasNumericalValue"
23+
24+
properties:
25+
- singularName: action
26+
functional: true
27+
compactName: action
28+
uri: "https://w3id.org/valueflows/ont/vf#action"
29+
description: |
30+
The type of economic transaction. The value of this property should be
31+
either `"deliverService"` or `"transfer"`.
32+
range:
33+
- "http://www.w3.org/2001/XMLSchema#string"
34+
35+
- singularName: resourceConformsTo
36+
functional: true
37+
compactName: resourceConformsTo
38+
uri: "https://w3id.org/valueflows/ont/vf#resourceConformsTo"
39+
description: |
40+
The type of an economic resource. Could be any URI.
41+
range:
42+
- "http://www.w3.org/2001/XMLSchema#anyURI"
43+
44+
- singularName: resourceQuantity
45+
functional: true
46+
compactName: resourceQuantity
47+
uri: "https://w3id.org/valueflows/ont/vf#resourceQuantity"
48+
untyped: true
49+
description: |
50+
The amount and unit of the economic resource.
51+
range:
52+
- "http://www.ontology-of-units-of-measure.org/resource/om-2/Measure"
53+
54+
- singularName: availableQuantity
55+
functional: true
56+
compactName: availableQuantity
57+
uri: "https://w3id.org/valueflows/ont/vf#availableQuantity"
58+
untyped: true
59+
description: |
60+
The quantity of the offered resource currently available.
61+
range:
62+
- "http://www.ontology-of-units-of-measure.org/resource/om-2/Measure"
63+
64+
- singularName: minimumQuantity
65+
functional: true
66+
compactName: minimumQuantity
67+
uri: "https://w3id.org/valueflows/ont/vf#minimumQuantity"
68+
untyped: true
69+
description: |
70+
The minimum possible quantity of the resource.
71+
range:
72+
- "http://www.ontology-of-units-of-measure.org/resource/om-2/Measure"

packages/vocab/src/measure.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
$schema: ../../vocab-tools/schema.yaml
2+
name: Measure
3+
compactName: om2:Measure
4+
uri: "http://www.ontology-of-units-of-measure.org/resource/om-2/Measure"
5+
entity: false
6+
description: A quantity with a unit of measure.
7+
defaultContext:
8+
- "https://www.w3.org/ns/activitystreams"
9+
- om2: "http://www.ontology-of-units-of-measure.org/resource/om-2/"
10+
hasUnit: "om2:hasUnit"
11+
hasNumericalValue: "om2:hasNumericalValue"
12+
13+
properties:
14+
- singularName: unit
15+
functional: true
16+
compactName: hasUnit
17+
uri: "http://www.ontology-of-units-of-measure.org/resource/om-2/hasUnit"
18+
description: |
19+
The name of the unit, according to the Ontology of units of Measure
20+
classification. The recommended unit for countable items is `"one"`.
21+
range:
22+
- "http://www.w3.org/2001/XMLSchema#string"
23+
24+
- singularName: numericalValue
25+
functional: true
26+
compactName: hasNumericalValue
27+
uri: "http://www.ontology-of-units-of-measure.org/resource/om-2/hasNumericalValue"
28+
description: |
29+
The amount of the resource. If not specified, arbitrary amounts can be
30+
used when responding to the proposal.
31+
range:
32+
- "http://www.w3.org/2001/XMLSchema#decimal"

0 commit comments

Comments
 (0)