1:- module(
2 jgf,
3 [
4 jgf/3, 5 jgf_reply/2 6 ]
7).
13:- use_module(library(apply)). 14:- use_module(library(http/http_json)). 15
16:- meta_predicate
17 jgf(+, 2, -),
18 jgf_edge(2, +, -),
19 jgf_node(2, +, -),
20 jgf_reply(+, 2).
28jgf(
29 graph(Nodes1,Edges1),
30 NodeLabel_2,
31 _{graph: _{directed: true, edges: Edges2, nodes: Nodes2}}
32):-
33 maplist(jgf_node(NodeLabel_2), Nodes1, Nodes2),
34 maplist(jgf_edge(NodeLabel_2), Edges1, Edges2).
40jgf_edge(NodeLabel_2, edge(S,P,O), _{label: Label, source: S, target: O}) :-
41 call(NodeLabel_2, P, Label).
47jgf_node(NodeLabel_2, Node, _{id: Node, label: Label}) :-
48 call(NodeLabel_2, Node, Label).
54jgf_reply(Graph, NodeLabel_2) :-
55 jgf(Graph, NodeLabel_2, Dict),
56 reply_json_dict(Dict, [content_type('application/vnd.jgf+json')])
Support for the JSON Graph Format (JGF)
*/