annotation_service/commit

context graph viz. for named graphs containing annotations

authorJacco van Ossenbruggen
Fri Jun 8 10:05:04 2012 +0200
committerJacco van Ossenbruggen
Fri Jun 8 10:05:04 2012 +0200
commitf4bf89c16eee0c7253655732318234d514639f55
treecc028791396df446ba1ac522b2e18953d1dcc0b6
parent2ee22cedfe2f41e9fec4f760a83fc9d870153a91
Diff style: patch stat
diff --git a/config-available/DEFAULTS b/config-available/DEFAULTS
index 41624e7..1ef0d92 100644
--- a/config-available/DEFAULTS
+++ b/config-available/DEFAULTS
@@ -1 +1,2 @@
 config(annotation_service, link).
+config(oac_graphviz, link).
diff --git a/config-available/oac_graphviz.pl b/config-available/oac_graphviz.pl
new file mode 100644
index 0000000..571ecee
--- /dev/null
+++ b/config-available/oac_graphviz.pl
@@ -0,0 +1,35 @@
+:- module(oac_graphviz, []).
+
+
+:- 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).
+
+cliopatria:context_graph(URI, RDF) :-
+	rdf(_, gv:graph, URI),
+	!,
+	findall(T, graph_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 \= [].
+
+graph_context_triple(G, rdf(S,P,O)) :-
+	rdf_equal(P, oac:hasTarget),
+	rdf(S, P, O, G).
+graph_context_triple(G, rdf(S,P,G)) :-
+	rdf_equal(P, gv:graph),
+	rdf(S,P,G).
+graph_context_triple(G, rdf(H,P,T)) :-
+	rdf(_, oac:hasTarget, T,G),
+	rdf_equal(P, gv:head),
+	rdf(H,P,T).
+
+cliopatria:node_shape(URI, Shape, _Options) :-
+	rdfs_individual_of(URI, oac:'Annotation'),
+	Shape = [shape('Mdiamond'),fontize('20.00'), style(filled),fillcolor('#FF8888')].