Library
Module
Module type
Parameter
Class
Class type
Interface of activitypub objects + convenient functions.
type id = Rdf.Term.term
An id is an RDF term.
val gen_id : Iri.t -> Rdf.Term.term * Iri.t
Generate a new id, by appending to a given base IRI. For a same base IRI, Ids are guaranteed to be generated in increasing order when compared alphanumerically. The function returns both the id and the corresponding IRI, for conveniency.
class type collection = object ... end
A Collection's interface.
class type collection_page = object ... end
A CollectionPage's interface.
class type ordered_collection = object ... end
An OrderedCollection's interface.
class type ordered_collection_page = object ... end
An OrderedCollectionPage's interface.
module AS = Rdf.Activitypub
val activity_types : (activity_type * Iri.t) list
val activity_type_of_iri : Iri.t -> activity_type option
val iri_of_activity_type : activity_type -> Iri.t
val actor_types : (actor_type * Iri.t) list
val actor_type_of_iri : Iri.t -> actor_type option
val iri_of_actor_type : actor_type -> Iri.t
iri_of_lo (`L link)
returns link#href
. iri_of_lo (`O obj)
returns obj#iri
.
val iri_of_liri : [ `I of Iri.t | `L of link ] -> Iri.t
iri_of_liri (`L link)
returns link#href
. iri_of_liri (`I iri)
returns iri
.
iri_of_li (`L link)
returns link#href
. iri_of_li (`I image)
returns the iri associated to image#id
, or else the first iri of image#url
.
val actor_name :
?lang:Smap.key ->
< name : string option
; name_map : string Smap.t
; preferred_username : string option.. > ->
string
actor_name a
returns name of actor is present, or preferred_username if present, or ""
. Whe a lang
argument is given, lookup for the name in then name language map of a
.
object_content o
returns content string of o
if present, or ""
. If a lang
argument is given, lookup in the content map of o
.
This is a recursive representation of activities, since activities can refer to activities, themselves referring to other activities and so on.
It is sometimes useful to be able to pattern-match on activities on different depths.
type activity_obj = [
| `None
| `Activity of activity_tree
| `Actor of actor_type * object_
| `Object of object_
| `Loop of id
]
and activity_tree = activity_type * activity * activity_obj
val activity_tree :
< object_ : object_ option ; type_ : Iri.t.. > as 'a ->
(activity_type * 'a * activity_obj) option
Build an activity_tree
from the given object and its internal graph. No dereferencing is performed to build the tree.