Library
Module
Module type
Parameter
Class
Class type
Objects pre-implementation and graph convenient functions.
Convenient functions to implement Types.object_
s, including a virtual object_
class performing queries on its internal graph.
type E.error +=
| Could_not_parse_graph of Iri.t * Ldp.Ct.t * string
| Http_error of Iri.t * Cohttp.Code.meth * string
val ct_json : Ldp.Ct.t
application/json
val mime_json : Ldp.Ct.mime
val ct_jsonld : Ldp.Ct.t
application/ld+json
val mime_jsonld : Ldp.Ct.mime
val ct_activity_json : Ldp.Ct.t
application/activity+json
val mime_activity_json : Ldp.Ct.mime
val accept_rdf_cts : Ldp.Ct.t list
List of accepted content-types: json-ld, activity_json, json, turtle, xmlrdf.
val jsonld_string_to_graph :
?g:Rdf.Graph.graph ->
Rdf_json_ld.T.options ->
string ->
(Rdf.Graph.graph * Iri.t option) Lwt.t
val jsonld_parser :
?jsonld_loader:(Iri.Map.key -> (string, exn) Stdlib.result Lwt.t) ->
string option ->
Rdf.Graph.graph ->
Ldp.Ct.t ->
string ->
(Rdf.Graph.graph * Iri.t option, E.error) Stdlib.result Lwt.t
val parse_graph :
?jsonld_loader:(Iri.Map.key -> (string, exn) Stdlib.result Lwt.t) ->
string option ->
Iri.t ->
Ldp.Ct.t ->
string ->
(Rdf.Graph.graph * Iri.t option, E.error) Stdlib.result Lwt.t
module G : sig ... end
A module with convenient function to query an object_'s graph.
val none_if_iri_only :
Rdf.Term.term ->
Rdf.Graph.graph option ->
Rdf.Graph.graph option
class link : G.G.graph -> Rdf.Term.term -> Activitypub.Types.link
Implementation of a link.
class virtual object_ : ?g:Rdf.Graph.graph option -> Types.id -> object ... end
A pre-implementation of an Types.object_
. Dereferencing and casting methods remain to be implemented.
val graph_roots : Rdf.Graph.graph -> Rdf.Term.term list
graph_roots g
returns the list of root nodes, i.e. nodes which do not appear as object in edges of the graph. Some nodes are filtered out (blank nodes having a blank node as type, which are sent by Mastodon).
is_activity typ
returns whether typ
corresponds to an activity type.
val map_graph :
(Rdf.Term.term -> Rdf.Term.term) ->
Rdf.Graph.graph ->
Rdf.Graph.graph
map_graph f g
returns a new graph with all triples mapped with f
. f
is also applied to the graph name (an IRI) to get the name of the new graph (as an IRI).
val copy_addresses :
src:
< audience :
[< `L of < href : Iri.t.. > | `O of < id : Rdf.Term.term.. > ] option
; bcc :
[< `L of < href : Iri.t.. > | `O of < id : Rdf.Term.term.. > ] list
; bto :
[< `L of < href : Iri.t.. > | `O of < id : Rdf.Term.term.. > ] list
; cc :
[< `L of < href : Iri.t.. > | `O of < id : Rdf.Term.term.. > ] list
; to_ :
[< `L of < href : Iri.t.. > | `O of < id : Rdf.Term.term.. > ] list.. > ->
dst:Rdf.Graph.graph ->
dstid:Rdf.Term.term ->
bool
For each relation to_
, bto
, cc
, bcc
and audience
of src
, copy_addresses ~src ~dst ~dstid
adds a triple in graph dst
with dstid
as subjet and the same predicates (to, cc, ...) and objects. Returns true
if at least one address was copied in dst
(but does not check if such a triple already existed).
val remove_addresses : Rdf.Graph.graph -> Rdf.Term.term -> unit
remove_addresses g sub
removes all triples of g
with subject sub
and to
, bto
, cc
, bcc
or audience
predicate.
val id_of_link_or_object :
[< `L of < href : Iri.t.. > | `O of < id : Rdf.Term.term.. > ] ->
Rdf.Term.term
id_of_link_or_object (`L link)
returns Iri link#href
. id_of_link_or_object (`O obj)
returns obj#id
.
val remove_bto_bcc : Rdf.Graph.graph -> unit
remove_bto_bcc g
removes all triples having bto
and bcc
as predicate.