versioned_graph/commit

show commit history in context graph

authorJacco van Ossenbruggen
Fri Jun 8 09:54:13 2012 +0200
committerJacco van Ossenbruggen
Fri Jun 8 09:56:16 2012 +0200
commit0d06abf3bee9049ea0bfb731cc9b6fe08809f894
tree3a0528d3bd0c46c4685588c9ca6325aedf5f9040
parent8c9fd7178d23c73c21c3a1f451bf769bf724f6cd
Diff style: patch stat
diff --git a/config-available/DEFAULTS b/config-available/DEFAULTS
index 5266efc..52ffe22 100644
--- a/config-available/DEFAULTS
+++ b/config-available/DEFAULTS
@@ -1 +1,2 @@
-config(versioned_graph, link).
+config(versioned_graph,    link).
+config(versioned_graphviz, link).
diff --git a/config-available/versioned_graphviz.pl b/config-available/versioned_graphviz.pl
new file mode 100644
index 0000000..8185613
--- /dev/null
+++ b/config-available/versioned_graphviz.pl
@@ -0,0 +1,37 @@
+:- module(opm_graph, []).
+
+
+:- use_module(cliopatria(hooks)).
+:- use_module(library(semweb/rdf_db)).
+:- use_module(library(semweb/rdfs)).
+:- use_module(library(semweb/rdf_abstract)).
+
+:- rdf_meta
+        context_triple(r, t),
+        transitive_context(r).
+
+/* Conveys commit history by showing key medadata and parent/child (prev/next) commits
+*/
+
+cliopatria:context_graph(URI, RDF) :-
+	rdf(URI, gv:graph, _),
+	!,
+	findall(T, commit_context_triple(URI, T), RDF0),
+	sort(RDF0, RDF1),
+	minimise_graph(RDF1, RDF2),		% remove inverse/symmetric/...
+	bagify_graph(RDF2, RDF3, Bags, []),	% Create bags of similar resources
+	append(RDF3, Bags, RDF),
+	RDF \= [].
+
+commit_direct_context_triple(S, rdf(S,P,O)) :-
+	rdf(S,P,O),
+	\+ O = literal(_).
+
+commit_context_triple(S, Triple) :-
+	commit_direct_context_triple(S, Triple).
+commit_context_triple(S1, Triple) :-
+	rdf(S1,gv:parent, S2),
+	commit_direct_context_triple(S2, Triple).
+commit_context_triple(S1, Triple) :-
+	rdf(S2,gv:parent, S1),
+	commit_direct_context_triple(S2, Triple).