package forester

  1. Overview
  2. Docs
A tool for tending mathematical forests

Install

dune-project
 Dependency

Authors

Maintainers

Sources

5.0.tar.gz
md5=24f4aed96a8b8af33aba13fba66f1b37
sha512=d36b896aca11858bb4a00fc704c16cc27a1f197bdb3e479d6132fd70f70d67d7158096285cb0b6fb00db14417f0f822cc27fe65d82f0971e42378fd8271ce573

doc/src/forester.core/Forest_graphs.ml.html

Source file Forest_graphs.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
(*
 * SPDX-FileCopyrightText: 2024 The Forester Project Contributors
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 *)

open Forester_prelude

open struct
  module T = Types
  module Dl = Datalog_engine
end

module type S = sig
  val dl_db : Dl.db
  val register_uri : URI.t -> unit
end

let init (db : Dl.db) : (module S) =
(module struct
  let dl_db = db

  let register_uri uri =
    let vtx : Vertex.t = T.Uri_vertex uri in
    Dl.db_add_fact dl_db @@ Dl.mk_literal Builtin_relation.is_node [Dl.mk_const vtx];
    let@ host = Option.iter @~ URI.host uri in
    let host_vtx = T.Content_vertex (T.Content [T.Text host]) in
    Dl.db_add_fact dl_db @@ Dl.mk_literal Builtin_relation.in_host [Dl.mk_const vtx; Dl.mk_const host_vtx]
end)

module Make () : S = (val (init @@ Dl.db_create ()))
OCaml

Innovation. Community. Security.