Commit 2a934e68 authored by Bruno Guillaume's avatar Bruno Guillaume

Graph.node_matching —> Matching.nodes

parent b7499232
......@@ -566,7 +566,7 @@ module Rule = struct
(fun pid gid acc ->
let pnode = P_graph.find pid (fst pattern).graph in
let gnode = G_graph.find gid graph in
(P_node.get_name pnode, G_node.get_float gnode) :: acc
(P_node.get_name pnode, G_node.get_name gid gnode) :: acc
) n_match []
let empty_matching ?(lexicons=[]) () = { n_match = Pid_map.empty; e_match = []; l_param = lexicons;}
......@@ -774,7 +774,6 @@ module Rule = struct
else raise Fail
| Feature_eq_lex (pid, feature_name, (lexicon,field)) ->
begin
Printf.printf "### Feature_eq_lex\n%!";
match get_string_feat pid feature_name with
| None -> raise Fail
| Some v ->
......
......@@ -59,8 +59,8 @@ module Rule : sig
val build_pattern: ?domain:Domain.t -> ?lexicons: Lexicons.t -> Ast.pattern -> pattern
(** [node_matching pattern graph matching] return a assoc list (pid_name, gid.position) *)
val node_matching: pattern -> G_graph.t -> matching -> (string * float) list
(** [node_matching pattern graph matching] return a assoc list (pid_name, gid_name) *)
val node_matching: pattern -> G_graph.t -> matching -> (string * string) list
(** [match_in_graph rule graph] returns the list of matching of the pattern of the rule into the graph *)
val match_in_graph: ?domain:Domain.t -> ?lexicons: Lexicons.t -> pattern -> G_graph.t -> matching list
......
......@@ -92,7 +92,7 @@ module Pattern = struct
Libgrew.handle ~name:"Pattern.load" (fun () -> Grew_rule.Rule.build_pattern ?domain (Grew_loader.Parser.pattern desc)) ()
let pid_name_list pattern =
Libgrew.handle ~name:"Pattern.pid_lits"
Libgrew.handle ~name:"Pattern.pid_list"
(fun () -> List.map (fun x -> x) (Grew_rule.Rule.pid_name_list pattern)
) ()
end
......@@ -104,6 +104,12 @@ module Matching = struct
type t = Grew_rule.Rule.matching
let to_json pattern graph t = Grew_rule.Rule.to_python pattern graph t
let nodes pattern graph matching =
Libgrew.handle ~name:"Matching.nodes" (fun () ->
Grew_rule.Rule.node_matching pattern graph matching
) ()
end
(* ==================================================================================================== *)
......@@ -231,11 +237,6 @@ module Graph = struct
Libgrew.handle ~name:"Graph.search_pattern" (fun () ->
Grew_rule.Rule.match_in_graph ?domain pattern graph
) ()
let node_matching pattern graph matching =
Libgrew.handle ~name:"Graph.node_matching" (fun () ->
Grew_rule.Rule.node_matching pattern graph matching
) ()
end
(* ==================================================================================================== *)
......
......@@ -56,6 +56,8 @@ module Matching: sig
type t
val to_json: Pattern.t -> Grew_graph.G_graph.t -> t -> json
val nodes: Pattern.t -> Grew_graph.G_graph.t -> t -> (string * string) list
end
(* ==================================================================================================== *)
......@@ -109,8 +111,6 @@ module Graph : sig
(** [search_pattern pattern graph] returns the list of the possible matching of [pattern] in [graph] *)
val search_pattern: ?domain:Domain.t -> Pattern.t -> t -> Matching.t list
val node_matching: Pattern.t -> t -> Matching.t -> (string * float) list
end
(* ==================================================================================================== *)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment