guile-fediverse/activitystreams/vocabulary.scm

vocabulary.scm

1
;;;; Copyright (C) 2020 Julien Lepiller <julien@lepiller.eu>
2
;;;; 
3
;;;; This library is free software; you can redistribute it and/or
4
;;;; modify it under the terms of the GNU Lesser General Public
5
;;;; License as published by the Free Software Foundation; either
6
;;;; version 3 of the License, or (at your option) any later version.
7
;;;; 
8
;;;; This library is distributed in the hope that it will be useful,
9
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
10
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11
;;;; Lesser General Public License for more details.
12
;;;; 
13
;;;; You should have received a copy of the GNU Lesser General Public
14
;;;; License along with this library; if not, write to the Free Software
15
;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
;;;; 
17
;;;;
18
;;;;
19
;;;; Note that most of this file is a direct translation of the activitystreams
20
;;;; vocabulary specification (esp. comments in type and property) which
21
;;;; is under these terms:
22
;;;;
23
;;;;    Copyright © 2017 Activity Streams Working Group, IBM & W3C® (MIT,
24
;;;;    ERCIM, Keio, Beihang). W3C liability, trademark and permissive
25
;;;;    document license rules apply.
26
;;;;
27
;;;; You should have received a copy of the Permissive Document License along
28
;;;; with this library; if not, that document license is accessible online at:
29
;;;; https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
30
;;;;
31
;;;; The origin document used to develop this can be found at:
32
;;;; https://www.w3.org/TR/activitystreams-vocabulary
33
34
(define-module (activitystreams vocabulary)
35
  #:use-module (activitystreams ontology)
36
  #:use-module (activitystreams predicates)
37
  #:use-module (ice-9 match)
38
  #:use-module (jsonld json)
39
  #:use-module (web uri)
40
  #:export (activitystreams-ontology))
41
42
;; Core types
43
44
(define-public Object
45
  (build-as-type
46
    "Object"
47
    #:comment
48
    "Describes an object of any kind.  The Object type serves as the base type
49
for most of the other kinds of objects defined in the Activity Vocabulary,
50
including other Core types such as Activity, IntransitiveActivity, Collection
51
and OrderedCollection."))
52
53
(define-public Link
54
  (build-as-type
55
    "Link"
56
    #:comment
57
    "A Link is an indirect, qualified reference to a resource identified by a
58
URL.  The fundamental model for links is established by [RFC5988].  Many of the
59
properties defined by the Activity Vocabulary allow values that are either
60
instances of Object or Link.  When a Link is used, it establishes a qualified
61
relation connecting the subject (the containing object) to the resource
62
identified by the href.  Properties of the Link are properties of the
63
reference as opposed to properties of the resource."))
64
65
(define-public Activity
66
  (build-as-type
67
    "Activity"
68
    #:subclass-of (list Object)
69
    #:comment
70
    "An Activity is a subtype of Object that describes some form of action that
71
may happen, is currently happening, or has already happened.  The Activity type
72
itself serves as an abstract base type for all types of activities.  It is
73
important to note that the Activity type itself does not carry any specific
74
semantics about the kind of action being taken."))
75
76
(define-public IntransitiveActivity
77
  (build-as-type
78
    "IntrasitiveActivity"
79
    #:subclass-of (list Activity)
80
    #:comment
81
    "Instances of IntransitiveActivity are a subtype of Activity representing
82
intransitive actions.  The object property is therefore inappropriate for
83
these activities."))
84
85
(define-public Collection
86
  (build-as-type
87
    "Collection"
88
    #:subclass-of (list Object)
89
    #:comment
90
    "A Collection is a subtype of Object that represents ordered or unordered
91
sets of Object or Link instances.  Refer to the Activity Streams 2.0 Core
92
specification for a complete description of the Collection type."))
93
94
(define-public OrderedCollection
95
  (build-as-type
96
    "OrderedCollection"
97
    #:subclass-of (list Collection)
98
    #:comment
99
    "A subtype of Collection in which members of the logical collection are
100
assumed to always be strictly ordered."))
101
102
(define-public CollectionPage
103
  (build-as-type
104
    "CollectionPage"
105
    #:subclass-of (list Collection)
106
    #:comment
107
    "Used to represent distinct subsets of items from a Collection.  Refer to
108
the Activity Streams 2.0 Core for a complete description of the CollectionPage
109
object."))
110
111
(define-public OrderedCollectionPage
112
  (build-as-type
113
    "OrderedCollectionPage"
114
    #:subclass-of (list OrderedCollection CollectionPage)
115
    #:comment
116
    "Used to represent ordered subsets of items from an OrderedCollection.
117
Refer to the Activity Streams 2.0 Core for a complete description of the
118
OrderedCollectionPage object."))
119
120
(define as-core-types (list Object Link Activity IntransitiveActivity
121
                            Collection OrderedCollection CollectionPage
122
                            OrderedCollectionPage))
123
124
;; Extended Types
125
;; Activity Types
126
127
(define-public Accept
128
  (build-as-type
129
    "Accept"
130
    #:subclass-of (list Activity)
131
    #:comment
132
    "Indicates that the actor accepts the object.  The target property can be
133
used in certain circumstances to indicate the context into which the object has
134
been accepted."))
135
136
(define-public TentativeAccept
137
  (build-as-type
138
    "TentativeAccept"
139
    #:subclass-of (list Accept)
140
    #:comment
141
    "A specialization of Accept indicating that the acceptance is tentative."))
142
143
(define-public Add
144
  (build-as-type
145
    "Add"
146
    #:subclass-of (list Activity)
147
    #:comment
148
    "Indicates that the actor has added the object to the target.  If the target
149
property is not explicitly specified, the target would need to be determined
150
implicitly by context.  The origin can be used to identify the context from
151
which the object originated."))
152
153
(define-public Arrive
154
  (build-as-type
155
    "Arrive"
156
    #:subclass-of (list IntransitiveActivity)
157
    #:comment
158
    "An IntransitiveActivity that indicates that the actor has arrived at the
159
location.  The origin can be used to identify the context from which the actor
160
originated.  The target typically has no defined meaning."))
161
162
(define-public Create
163
  (build-as-type
164
    "Create"
165
    #:subclass-of (list Activity)
166
    #:comment
167
    "Indicates that the actor has created the object."))
168
169
(define-public Delete
170
  (build-as-type
171
    "Delete"
172
    #:subclass-of (list Activity)
173
    #:comment
174
    "Indicates that the actor has deleted the object.  If specified, the origin
175
indicates the context from which the object was deleted."))
176
177
(define-public Follow
178
  (build-as-type
179
    "Follow"
180
    #:subclass-of (list Activity)
181
    #:comment
182
    "Indicates that the actor is ``following'' the object.  Following is defined
183
in the sense typically used within Social systems in which the actor is
184
interested in any activity performed by or on the object.  The target and
185
origin typically have no defined meaning."))
186
187
(define-public Ignore
188
  (build-as-type
189
    "Ignore"
190
    #:subclass-of (list Activity)
191
    #:comment
192
    "Indicates that the actor is ignoring the object.  The target and origin
193
typically have no defined meaning."))
194
195
(define-public Join
196
  (build-as-type
197
    "Join"
198
    #:subclass-of (list Activity)
199
    #:comment
200
    "Indicates that the actor has joined the object.  The target and origin
201
typically have no defined meaning."))
202
203
(define-public Leave
204
  (build-as-type
205
    "Leave"
206
    #:subclass-of (list Activity)
207
    #:comment
208
    "Indicates that the actor has left the object.  The target and origin
209
typically have no meaning."))
210
211
(define-public Like
212
  (build-as-type
213
    "Like"
214
    #:subclass-of (list Activity)
215
    #:comment
216
    "Indicates that the actor likes, recommends or endorses the object.  The
217
target and origin typically have no defined meaning."))
218
219
(define-public Offer
220
  (build-as-type
221
    "Offer"
222
    #:subclass-of (list Activity)
223
    #:comment
224
    "Indicates that the actor is offering the object.  If specified, the target
225
indicates the entity to which the object is being offered."))
226
227
(define-public Invite
228
  (build-as-type
229
    "Invite"
230
    #:subclass-of (list Offer)
231
    #:comment
232
    "A specialization of Offer in which the actor is extending an invitation
233
for the object to the target."))
234
235
(define-public Reject
236
  (build-as-type
237
    "Reject"
238
    #:subclass-of (list Activity)
239
    #:comment
240
    "Indicates that the actor is rejecting the object.  The target and origin
241
typically have no defined meaning."))
242
243
(define-public TentativeReject
244
  (build-as-type
245
    "TentativeReject"
246
    #:subclass-of (list Reject)
247
    #:comment
248
    "A specialization of Reject in which the rejection is considered tentative."))
249
250
(define-public Remove
251
  (build-as-type
252
    "Remove"
253
    #:subclass-of (list Activity)
254
    #:comment
255
    "Indicates that the actor is removing the object.  If specified, the
256
origin indicates the context from which the object is being removed."))
257
258
(define-public Undo
259
  (build-as-type
260
    "Undo"
261
    #:subclass-of (list Activity)
262
    #:comment
263
    "Indicates that the actor is undoing the object.  In most cases, the object
264
will be an Activity describing some previously performed action (for instance,
265
a person may have previously ``liked'' an article but, for whatever reason,
266
might choose to undo that like at some later point in time).  The target and
267
origin typically have no defined meaning."))
268
269
(define-public Update
270
  (build-as-type
271
    "Update"
272
    #:subclass-of (list Activity)
273
    #:comment
274
    "Indicates that the actor has updated the object.  Note, however, that this
275
vocabulary does not define a mechanism for describing the actual set of
276
modifications made to object.  The target and origin typically have no defined
277
meaning."))
278
279
(define-public View
280
  (build-as-type
281
    "View"
282
    #:subclass-of (list Activity)
283
    #:comment
284
    "Indicates that the actor has viewed the object."))
285
286
(define-public Listen
287
  (build-as-type
288
    "Listen"
289
    #:subclass-of (list Activity)
290
    #:comment
291
    "Indicates that the actor has listened to the object."))
292
293
(define-public Read
294
  (build-as-type
295
    "Read"
296
    #:subclass-of (list Activity)
297
    #:comment
298
    "Indicates that the actor has read the object."))
299
300
(define-public Move
301
  (build-as-type
302
    "Move"
303
    #:subclass-of (list Activity)
304
    #:comment
305
    "Indicates that the actor has moved object from origin to target.  If the
306
origin or target are not specified, either can be determined by context."))
307
308
(define-public Travel
309
  (build-as-type
310
    "Travel"
311
    #:subclass-of (list IntransitiveActivity)
312
    #:comment
313
    "Indicates that the actor is traveling to target from origin.  Travel is
314
an IntransitiveObject whose actor specifies the direct object.  If the target
315
or origin are not specified, either can be determined by context."))
316
317
(define-public Announce
318
  (build-as-type
319
    "Announce"
320
    #:subclass-of (list Activity)
321
    #:comment
322
    "Indicates that the actor is calling the target's attention the object.  The
323
origin typically has no defined meaning."))
324
325
(define-public Block
326
  (build-as-type
327
    "Block"
328
    #:subclass-of (list Ignore)
329
    #:comment
330
    "Indicates that the actor is blocking the object.  Blocking is a stronger
331
form of Ignore.  The typical use is to support social systems that allow one
332
user to block activities or content of other users.  The target and origin
333
typically have no defined meaning."))
334
335
(define-public Flag
336
  (build-as-type
337
    "Flag"
338
    #:subclass-of (list Activity)
339
    #:comment
340
    "Indicates that the actor is ``flagging'' the object.  Flagging is defined
341
in the sense common to many social platforms as reporting content as being
342
inappropriate for any number of reasons."))
343
344
(define-public Dislike
345
  (build-as-type
346
    "Dislike"
347
    #:subclass-of (list Activity)
348
    #:comment
349
    "Indicates that the actor dislikes the object."))
350
351
(define-public Question
352
  (build-as-type
353
    "Question"
354
    #:subclass-of (list IntransitiveActivity)
355
    #:comment
356
    "Represents a question being asked.  Question objects are an extension of
357
IntransitiveActivity.  That is, the Question object is an Activity, but the
358
direct object is the question itself and therefore it would not contain an
359
object property.  Either of the anyOf and oneOf properties MAY be used to
360
express possible answers, but a Question object MUST NOT have both properties."))
361
362
(define as-activity-types
363
  (list Accept Add Announce Arrive Block Create Delete
364
        Dislike Flag Follow Ignore Invite Join Leave
365
        Like Listen Move Offer Question Reject Read
366
        Remove TentativeReject TentativeAccept Travel Undo
367
        Update View))
368
369
;; Actor Types
370
(define-public Application
371
  (build-as-type
372
    "Application"
373
    #:subclass-of (list Object)
374
    #:comment
375
    "Describes a software application."))
376
377
(define-public Group
378
  (build-as-type
379
    "Group"
380
    #:subclass-of (list Object)
381
    #:comment
382
    "Represents a formal or informal collective of Actors."))
383
384
(define-public Organisation
385
  (build-as-type
386
    "Organisation"
387
    #:subclass-of (list Object)
388
    #:comment
389
    "Represents an organization."))
390
391
(define-public Person
392
  (build-as-type
393
    "Person"
394
    #:subclass-of (list Object)
395
    #:comment
396
    "Represents an individual person."))
397
398
(define-public Service
399
  (build-as-type
400
    "Service"
401
    #:subclass-of (list Object)
402
    #:comment
403
    "Represents a service of any kind."))
404
405
(define as-actor-types
406
  (list Application Group Organisation Person Service))
407
408
;; 
409
410
(define-public Relationship
411
  (build-as-type
412
    "Relationship"
413
    #:subclass-of (list Object)
414
    #:comment
415
    "Describes a relationship between two individuals.  The subject and object
416
properties are used to identify the connected individuals.  See 5.2 Representing
417
Relationships Between Entities for additional information."))
418
419
(define-public Article
420
  (build-as-type
421
    "Article"
422
    #:subclass-of (list Object)
423
    #:comment
424
    "Represents any kind of multi-paragraph written work."))
425
426
(define-public Document
427
  (build-as-type
428
    "Document"
429
    #:subclass-of (list Object)
430
    #:comment
431
    "Represents a document of any kind."))
432
433
(define-public Audio
434
  (build-as-type
435
    "Audio"
436
    #:subclass-of (list Document)
437
    #:comment
438
    "Represents an audio document of any kind."))
439
440
(define-public Image
441
  (build-as-type
442
    "Image"
443
    #:subclass-of (list Document)
444
    #:comment
445
    "An image document of any kind."))
446
447
(define-public Video
448
  (build-as-type
449
    "Video"
450
    #:subclass-of (list Document)
451
    #:comment
452
    "Represents a video document of any kind."))
453
454
(define-public Note
455
  (build-as-type
456
    "Note"
457
    #:subclass-of (list Object)
458
    #:comment
459
    "Represents a short written work typically less than a single paragraph in
460
length."))
461
462
(define-public Page
463
  (build-as-type
464
    "Page"
465
    #:subclass-of (list Document)
466
    #:comment
467
    "Represents a Web Page."))
468
469
(define-public Event
470
  (build-as-type
471
    "Event"
472
    #:subclass-of (list Object)
473
    #:comment
474
    "Represents any kind of event."))
475
476
(define-public Place
477
  (build-as-type
478
    "Place"
479
    #:subclass-of (list Object)
480
    #:comment
481
    "Represents a logical or physical location.  See 5.3 Representing Places
482
for additional information."))
483
484
(define-public Mention
485
  (build-as-type
486
    "Mention"
487
    #:subclass-of (list Link)
488
    #:comment
489
    "A specialized Link that represents an @mention."))
490
491
(define-public Profile
492
  (build-as-type
493
    "Profile"
494
    #:subclass-of (list Object)
495
    #:comment
496
    "A Profile is a content object that describes another Object, typically
497
used to describe Actor Type objects.  The describes property is used to
498
reference the object being described by the profile"))
499
500
(define-public Tombstone
501
  (build-as-type
502
    "Tombstone"
503
    #:subclass-of (list Object)
504
    #:comment
505
    "A Tombstone represents a content object that has been deleted.  It can be
506
used in Collections to signify that there used to be an object at this
507
position, but it has been deleted."))
508
509
(define as-object-and-link-types
510
  (list Article Audio Document Event Image Note Page
511
        Place Profile Relationship Tombstone Video Mention))
512
513
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
514
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
515
;;                                Properties                                 ;;
516
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
517
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
518
519
(define-public id
520
  (build-as-property
521
    "id" (list Object Link) uri?
522
    #:uri "@id"
523
    #:comment "Provides the globally unique identifier for an Object or Link."
524
    #:functional? #t))
525
526
(define-public type
527
  (build-as-property
528
    "type" (list Object Link) uri?
529
    #:uri "@type"
530
    #:comment "Identifies the Object or Link type.  Multiple values may be
531
specified."))
532
533
(define-public attributedTo
534
  (build-as-property
535
    "attributedTo" (list Object Link) (list Object Link)
536
    #:comment
537
    "Identifies one or more entities to which this object is attributed.  The
538
attributed entities might not be Actors.  For instance, an object might be
539
attributed to the completion of another activity."))
540
541
(define-public actor
542
  (build-as-property
543
    "actor" (list Object Link) (list Object Link)
544
    #:subproperty-of (list attributedTo)
545
    #:comment
546
    "Describes one or more entities that either performed or are expected to
547
perform the activity.  Any single activity can have multiple actors.  The actor
548
MAY be specified using an indirect Link."))
549
550
(define-public attachment
551
  (build-as-property
552
    "attachment" Object (list Object Link)
553
    #:comment
554
    "Identifies a resource attached or related to an object that potentially
555
requires special handling.  The intent is to provide a model that is at least
556
semantically similar to attachments in email."))
557
558
(define-public audience
559
  (build-as-property
560
    "audience" Object (list Object Link)
561
    #:comment
562
    "Identifies one or more entities that represent the total population of
563
entities for which the object can considered to be relevant."))
564
565
(define-public bcc
566
  (build-as-property
567
    "bcc" Object (list Object Link)
568
    #:comment
569
    "Identifies one or more Objects that are part of the private secondary
570
audience of this Object."))
571
572
(define-public bto
573
  (build-as-property
574
    "bto" Object (list Object Link)
575
    #:comment
576
    "Identifies an Object that is part of the private primary audience of this
577
Object."))
578
579
(define-public cc
580
  (build-as-property
581
    "cc" Object (list Object Link)
582
    #:comment
583
    "Identifies an Object that is part of the public secondary audience of
584
this Object."))
585
586
(define-public context
587
  (build-as-property
588
    "context" Object (list Object Link)
589
    #:comment
590
    "Identifies the context within which the object exists or an activity was
591
performed.  The notion of ``context'' used is intentionally vague.  The
592
intended function is to serve as a means of grouping objects and activities
593
that share a common originating context or purpose.  An example could be all
594
activities relating to a common project or event."))
595
596
(define-public current
597
  (build-as-property
598
    "current" Collection (list CollectionPage Link)
599
    #:functional? #t
600
    #:comment
601
    "In a paged Collection, indicates the page that contains the most recently
602
updated member items."))
603
604
(define-public first
605
  (build-as-property
606
    "first" Collection (list CollectionPage Link)
607
    #:functional? #t
608
    #:comment
609
    "In a paged Collection, indicates the furthest preceeding page of items in
610
the collection."))
611
612
(define-public generator
613
  (build-as-property
614
    "generator" Object (list Object Link)
615
    #:comment
616
    "Identifies the entity (e.g. an application) that generated the object."))
617
618
(define-public icon
619
  (build-as-property
620
    "icon" Object (list Image Link)
621
    #:comment
622
    "Indicates an entity that describes an icon for this object.  The image
623
should have an aspect ratio of one (horizontal) to one (vertical) and should
624
be suitable for presentation at a small size."))
625
626
(define-public image
627
  (build-as-property
628
    "image" Object (list Image Link)
629
    #:comment
630
    "Indicates an entity that describes an image for this object.  Unlike the
631
icon property, there are no aspect ratio or display size limitations assumed."))
632
633
(define-public inReplyTo
634
  (build-as-property
635
    "inReplyTo" Object (list Object Link)
636
    #:comment
637
    "Indicates one or more entities for which this object is considered a
638
response."))
639
640
(define-public instrument
641
  (build-as-property
642
    "instrument" Activity (list Object Link)
643
    #:comment
644
    "Identifies one or more objects used (or to be used) in the completion of
645
an Activity."))
646
647
(define-public last
648
  (build-as-property
649
    "last" Collection (list CollectionPage Link)
650
    #:functional? #t
651
    #:comment
652
    ""))
653
654
(define-public location
655
  (build-as-property
656
    "location" Object (list Object Link)
657
    #:comment
658
    "Indicates one or more physical or logical locations associated with the
659
object."))
660
661
(define-public items
662
  (build-as-property
663
    "items" Collection (list Object Link)
664
    #:comment
665
    "Identifies the items contained in a collection. The items might be ordered
666
or unordered."))
667
668
(define-public oneOf
669
  (build-as-property
670
    "oneOf" Question (list Object Link)
671
    #:comment
672
    "Identifies an exclusive option for a Question.  Use of oneOf implies that
673
the Question can have only a single answer.  To indicate that a Question can
674
have multiple answers, use anyOf."))
675
676
(define-public anyOf
677
  (build-as-property
678
    "anyOf" Question (list Object Link)
679
    #:comment
680
    "Identifies an inclusive option for a Question.  Use of anyOf implies that
681
the Question can have multiple answers.  To indicate that a Question can have
682
only one answer, use oneOf."))
683
684
(define-public closed
685
  (build-as-property
686
    "closed" Question (list Object Link date? boolean?)
687
    #:comment
688
    "Indicates that a question has been closed, and answers are no longer
689
accepted."))
690
691
(define-public origin
692
  (build-as-property
693
    "origin" Activity (list Object Link)
694
    #:comment
695
    "Describes an indirect object of the activity from which the activity is
696
directed.  The precise meaning of the origin is the object of the English
697
preposition ``from''.  For instance, in the activity ``John moved an item to
698
List B from List A'', the origin of the activity is ``List A''."))
699
700
(define-public next
701
  (build-as-property
702
    "next" CollectionPage (list CollectionPage Link)
703
    #:functional? #t
704
    #:comment
705
    "In a paged Collection, indicates the next page of items."))
706
707
(define-public object
708
  (build-as-property
709
    "object" (list Activity Relationship) (list Object Link)
710
    #:comment
711
    "When used within an Activity, describes the direct object of the activity.
712
For instance, in the activity ``John added a movie to his wishlist'', the
713
object of the activity is the movie added.  When used within a Relationship
714
describes the entity to which the subject is related."))
715
716
(define-public prev
717
  (build-as-property
718
    "prev" CollectionPage (list CollectionPage Link)
719
    #:functional? #t
720
    #:comment
721
    "In a paged Collection, identifies the previous page of items."))
722
723
(define-public preview
724
  (build-as-property
725
    "preview" (list Object Link) (list Object Link)
726
    #:comment
727
    "Identifies an entity that provides a preview of this object."))
728
729
(define-public result
730
  (build-as-property
731
    "result" Activity (list Object Link)
732
    #:comment
733
    "Describes the result of the activity.  For instance, if a particular
734
action results in the creation of a new resource, the result property can be
735
used to describe that new resource."))
736
737
(define-public replies
738
  (build-as-property
739
    "replise" Object Collection
740
    #:functional? #t
741
    #:comment
742
    "Identifies a Collection containing objects considered to be responses to
743
this object."))
744
745
(define-public tag
746
  (build-as-property
747
    "tag" Object (list Object Link)
748
    #:comment
749
    "One or more ``tags'' that have been associated with an object.  A tag can
750
be any kind of Object.  The key difference between attachment and tag is that
751
the former implies association by inclusion, while the latter implies
752
associated by reference."))
753
754
(define-public target
755
  (build-as-property
756
    "target" Activity (list Object Link)
757
    #:comment
758
    "Describes the indirect object, or target, of the activity.  The precise
759
meaning of the target is largely dependent on the type of action being
760
described but will often be the object of the English preposition ``to''.  For
761
instance, in the activity ``John added a movie to his wishlist'', the target
762
of the activity is John's wishlist. An activity can have more than one target."))
763
764
(define-public to
765
  (build-as-property
766
    "to" Object (list Object Link)
767
    #:comment
768
    "Identifies an entity considered to be part of the public primary audience
769
of an Object."))
770
771
(define-public url
772
  (build-as-property
773
    "url" Object (list uri? Link)
774
    #:comment
775
    "Identifies one or more links to representations of the object."))
776
777
(define-public accuracy
778
  (build-as-property
779
    "accuracy" Place float?
780
    #:comment
781
    "Indicates the accuracy of position coordinates on a Place objects.
782
Expressed in properties of percentage.  e.g. ``94.0'' means ``94.0% accurate''."))
783
784
(define-public altitude
785
  (build-as-property
786
    "altitude" Object float?
787
    #:functional? #t
788
    #:comment
789
    "Indicates the altitude of a place.  The measurement units is indicated
790
using the units property.  If units is not specified, the default is assumed
791
to be ``m'' indicating meters."))
792
793
(define-public content
794
  (build-as-property
795
    "content" Object string-or-lang-string?
796
    #:comment
797
    "The content or textual representation of the Object encoded as a JSON
798
string.  By default, the value of content is HTML.  The mediaType property can
799
be used in the object to indicate a different content type.  The content MAY
800
be expressed using multiple language-tagged values."))
801
802
(define-public name
803
  (build-as-property
804
    "name" (list Object Link) string-or-lang-string?
805
    #:comment
806
    "A simple, human-readable, plain-text name for the object.  HTML markup
807
MUST NOT be included.  The name MAY be expressed using multiple language-tagged
808
values."))
809
810
(define-public duration
811
  (build-as-property
812
    "duration" Object duration?
813
    #:functional? #t
814
    #:comment
815
    "When the object describes a time-bound resource, such as an audio or video,
816
a meeting, etc, the duration property indicates the object's approximate
817
duration.  The value MUST be expressed as an xsd:duration as defined by
818
[xmlschema11-2], section 3.3.6 (e.g. a period of 5 seconds is represented as
819
``PT5S'')."))
820
821
(define-public height
822
  (build-as-property
823
    "height" Link non-negative-integer?
824
    #:functional? #t
825
    #:comment
826
    "On a Link, specifies a hint as to the rendering height in device-independent
827
pixels of the linked resource."))
828
829
(define-public href
830
  (build-as-property
831
    "href" Link uri?
832
    #:functional? #t
833
    #:comment
834
    "The target resource pointed to by a Link."))
835
836
(define-public hreflang
837
  (build-as-property
838
    "hreflang" Link langtag?
839
    #:functional? #t
840
    #:comment
841
    "Hints as to the language used by the target resource.  Value MUST be a
842
[BCP47] Language-Tag."))
843
844
(define-public partOf
845
  (build-as-property
846
    "partOf" CollectionPage (list Collection Link)
847
    #:functional? #t
848
    #:comment
849
    "Identifies the Collection to which a CollectionPage objects items belong."))
850
851
(define-public latitude
852
  (build-as-property
853
    "latitude" Place float?
854
    #:functional? #t
855
    #:comment
856
    "The latitude of a place."))
857
858
(define-public longitude
859
  (build-as-property
860
    "longitude" Place float?
861
    #:functional? #t
862
    #:comment
863
    "The longitude of a place."))
864
865
(define-public mediaType
866
  (build-as-property
867
    "mediaType" (list Link Object) mime-type?
868
    #:functional? #t
869
    #:comment
870
    "When used on a Link, identifies the MIME media type of the referenced
871
resource.  When used on an Object, identifies the MIME media type of the value
872
of the content property.  If not specified, the content property is assumed to
873
contain text/html content."))
874
875
(define-public endTime
876
  (build-as-property
877
    "endTime" Object date?
878
    #:functional? #t
879
    #:comment
880
    "The date and time describing the actual or expected ending time of the
881
object.  When used with an Activity object, for instance, the endTime property
882
specifies the moment the activity concluded or is expected to conclude."))
883
884
(define-public published
885
  (build-as-property
886
    "published" Object date?
887
    #:functional? #t
888
    #:comment
889
    "The date and time at which the object was published."))
890
891
(define-public startTime
892
  (build-as-property
893
    "startTime" Object date?
894
    #:functional? #t
895
    #:comment
896
    "The date and time describing the actual or expected starting time of the
897
object.  When used with an Activity object, for instance, the startTime
898
property specifies the moment the activity began or is scheduled to begin."))
899
900
(define-public radius
901
  (build-as-property
902
    "radius" Place float?
903
    #:functional? #t
904
    #:comment
905
    "The radius from the given latitude and longitude for a Place.  The units
906
is expressed by the units property.  If units is not specified, the default is
907
assumed to be ``m'' indicating ``meters''."))
908
909
(define-public rel
910
  (build-as-property
911
    "rel" Link link-relation?
912
    #:comment
913
    "A link relation associated with a Link.  The value MUST conform to both the
914
[HTML5] and [RFC5988] ``link relation'' definitions.  In the [HTML5], any
915
string not containing the ``space'' U+0020, ``tab'' (U+0009), ``LF'' (U+000A),
916
``FF'' (U+000C), ``CR'' (U+000D) or ``,'' (U+002C) characters can be used as a
917
valid link relation."))
918
919
(define-public startIndex
920
  (build-as-property
921
    "startIndex" OrderedCollectionPage non-negative-integer?
922
    #:functional? #t
923
    #:comment
924
    "A non-negative integer value identifying the relative position within the
925
logical view of a strictly ordered collection."))
926
927
(define-public summary
928
  (build-as-property
929
    "summary" Object string-or-lang-string?
930
    #:comment
931
    "A natural language summarization of the object encoded as HTML.  Multiple
932
language tagged summaries MAY be provided."))
933
934
(define-public totalItems
935
  (build-as-property
936
    "totalItems" Collection non-negative-integer?
937
    #:functional? #t
938
    #:comment
939
    "A non-negative integer specifying the total number of objects contained by
940
the logical view of the collection.  This number might not reflect the actual
941
number of items serialized within the Collection object instance."))
942
943
(define-public units
944
  (build-as-property
945
    "units" Place (list uri? (lambda (s) (member s '("cm" "feet" "inches" "km"
946
                                                     "m" "miles"))))
947
    #:functional? #t
948
    #:comment
949
    "Specifies the measurement units for the radius and altitude properties on
950
a Place object.  If not specified, the default is assumed to be ``m'' for
951
``meters''."))
952
953
(define-public updated
954
  (build-as-property
955
    "updated" Object date?
956
    #:functional? #t
957
    #:comment
958
    "The date and time at which the object was updated."))
959
960
(define-public width
961
  (build-as-property
962
    "width" Link non-negative-integer?
963
    #:functional? #t
964
    #:comment
965
    "On a Link, specifies a hint as to the rendering width in device-independent
966
pixels of the linked resource."))
967
968
(define-public subject
969
  (build-as-property
970
    "subject" Relationship (list Object Link)
971
    #:functional? #t
972
    #:comment
973
    "On a Relationship object, the subject property identifies one of the
974
connected individuals.  For instance, for a Relationship object describing
975
``John is related to Sally'', subject would refer to John."))
976
977
(define-public relationship
978
  (build-as-property
979
    "relationship" Relationship Object
980
    #:comment
981
    "On a Relationship object, the relationship property identifies the kind of
982
relationship that exists between subject and object."))
983
984
(define-public describes
985
  (build-as-property
986
    "describes" Profile Object
987
    #:functional? #t
988
    #:comment
989
    "On a Profile object, the describes property identifies the object described
990
by the Profile."))
991
992
(define-public formerType
993
  (build-as-property
994
    "formerType" Tombstone Object
995
    #:comment
996
    "On a Tombstone object, the formerType property identifies the type of the
997
object that was deleted."))
998
999
(define-public deleted
1000
  (build-as-property
1001
    "deleted" Tombstone date?
1002
    #:functional? #t
1003
    #:comment
1004
    "On a Tombstone object, the deleted property is a timestamp for when the
1005
object was deleted."))
1006
1007
(define as-properties
1008
  (list actor attachment attributedTo audience bcc bto
1009
        cc context current first generator icon id
1010
        image inReplyTo instrument last location items
1011
        oneOf anyOf closed origin next object prev
1012
        preview result replies tag target to type
1013
        url accuracy altitude content name duration
1014
        height href hreflang partOf latitude longitude
1015
        mediaType endTime published startTime radius
1016
        rel startIndex summary totalItems units updated
1017
        width subject relationship describes formerType
1018
        deleted))
1019
1020
(define activitystreams-ontology
1021
  (make-ontology
1022
    '("https://www.w3.org/ns/activitystreams")
1023
    (append as-core-types as-activity-types as-actor-types as-object-and-link-types)
1024
    as-properties))
1025
1026