aboutsummaryrefslogtreecommitdiff
path: root/lib/fragment_graph/rdf_fragment_graph.mli
diff options
context:
space:
mode:
Diffstat (limited to 'lib/fragment_graph/rdf_fragment_graph.mli')
-rw-r--r--lib/fragment_graph/rdf_fragment_graph.mli35
1 files changed, 26 insertions, 9 deletions
diff --git a/lib/fragment_graph/rdf_fragment_graph.mli b/lib/fragment_graph/rdf_fragment_graph.mli
index 44edddd..68d8c3b 100644
--- a/lib/fragment_graph/rdf_fragment_graph.mli
+++ b/lib/fragment_graph/rdf_fragment_graph.mli
@@ -31,9 +31,15 @@ module type HASH = sig
(** [hash v] returns the hash of [v] as an iri. *)
end
-module type T = sig
+module type S = sig
(** RDF Fragment Graph *)
+ (** {1 Predicate and Object} *)
+
+ (** Fragment Graphs can not reuse the {!module:Rdf.Triple.Predicate} and
+ {!module:Rdf.Triple.Object} modules as they do not allow Blank Nodes and in
+ addition to IRIs, references to fragments are allowed.*)
+
module Predicate : sig
type t =
| FragmentReference of string
@@ -68,41 +74,52 @@ module type T = sig
type t
(** Type of a Fragment Graph *)
+ (** {1 Constructors} *)
+
val empty : t
(** [empty] is the empty fragment graph *)
- val equal : t -> t -> bool
- (** [equal a b] returns true if [a] is the same Fragment Graph as [b]. *)
-
val add_statement : Predicate.t -> Object.t -> t -> t
(** [add_statement fragment_graph predicate object'] adds a statement to the fragment graph *)
val add_fragment_statement : string -> Predicate.t -> Object.t -> t -> t
(** [add_fragment_statement] adds a fragment statement to the fragment graph *)
- val statements : t -> (Predicate.t * Object.t) list
+ (** {1 Accessors} *)
+
+ val statements : t -> (Predicate.t * Object.t) Seq.t
(** [statements fragment_graph] returns a list of statements in
[fragment_graph]. *)
- val fragment_statements : t -> (string * Predicate.t * Object.t) list
+ val fragment_statements : t -> (string * Predicate.t * Object.t) Seq.t
(** [fragment_statements fragment_graph] returns a list of fragment statements
in [fragment_graph]. *)
+ val to_triples : t -> Rdf.Triple.t Seq.t
+ (** [to_triples fragment_graph] returns a list of statements in [fragment_graph] as triples. *)
+
+
+ (** {1 Content-addressing} *)
+
val base_subject : t -> Rdf.Iri.t
(** [base_subject fragment_graph] returns the base subject of the fragment graph. *)
+ val equal : t -> t -> bool
+ (** [equal a b] returns true if [a] is the same Fragment Graph as [b].
+ Equality is implemnted by checking the base subject.*)
+
val canonical : t -> string
(** [canonical fragment_graph] returns the canonical serialization of the fragment graph. *)
val of_canonical : string -> (t, string) result
(** [of_canonical s] attempts to decode the fragment graph from the canonical serialization in [s]*)
- val to_triples : t -> Rdf.Triple.t list
- (** [to_triples fragment_graph] returns a list of statements in [fragment_graph] as triples. *)
+ (** {1 (Pretty) Printing} *)
val pp : t Fmt.t
[@@ocaml.toplevel_printer]
(** [pp ppf t] will output a debug output of the Fragment Graph [t] to the formatter [ppf] *)
end
-module Make(H: HASH) : T
+module Make(H: HASH) : S
+(** Constructor of a Fragment Graph *)