annotation_service/commit
work on graphviz for annotations
author | Jacco van Ossenbruggen |
---|---|
Mon Jun 30 18:40:54 2014 +0200 | |
committer | Jacco van Ossenbruggen |
Mon Jun 30 18:40:54 2014 +0200 | |
commit | 5bf9e9f7624b60021b335866801da8186e79e4f1 |
tree | b25e9ac9ceaf2fb9f4c89e2fa308e34686dfd11c |
parent | c904a59dcee58723720eea754b0090e5663aac82 |
Diff style: patch stat
diff --git a/config-available/oac_graphviz.pl b/config-available/oac_graphviz.pl index f316743..2324939 100644 --- a/config-available/oac_graphviz.pl +++ b/config-available/oac_graphviz.pl @@ -1,13 +1,20 @@ :- module(oa_graphviz, []). +:- use_module(library(http/http_dispatch)). +:- use_module(library(http/html_write)). + :- use_module(cliopatria(hooks)). :- use_module(library(semweb/rdf_db)). :- use_module(library(semweb/rdfs)). :- use_module(library(semweb/rdf_abstract)). +:- use_module(applications(browse)). + +:- use_module(library(oa_annotation)). + % Need these modules solely for their namespace declarations: -:- use_module(library(graph_version)). :- use_module(library(oa_schema)). +:- use_module(library(graph_version)). :- rdf_meta graph_context_triple(r, t). @@ -35,9 +42,6 @@ cliopatria:context_graph(URI, RDF) :- graph_context_triple(G, rdf(S,P,O)) :- rdf_equal(P, oa:hasTarget), rdf(S, P, O, G). -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). @@ -49,12 +53,17 @@ graph_context_triple(G, rdf(H,P,T)) :- annotation_context_triple(S, rdf(S,P,O)) :- rdf_equal(oa:hasTarget, P), rdf_has(S,P,O). +annotation_context_triple(W, rdf(S,P2,T)) :- + rdf_equal(P1, oa:hasTarget), + rdf_equal(P2, oa:hasSource), + rdf_has(W, P1, S), + rdf_has(S, P2, T). annotation_context_triple(S, rdf(S,P,O)) :- rdf_equal(oa:hasBody, P), rdf_has(S,P,O). -annotation_context_triple(S, rdf(S,P,O)) :- - rdf_equal(oa:annotator, P), - rdf_has(S,P,O). +annotation_context_triple(S, rdf(S,R,O)) :- + rdf_equal(oa:annotatedBy, P), + rdf_has(S,P,O,R). annotation_context_triple(S, rdf(Commit,P,G)) :- rdf(S,rdf:type,_,G), @@ -71,4 +80,21 @@ cliopatria:node_shape(URI, Shape, _Options) :- Shape = [fontize('20.00'), style(filled),fillcolor('#FF8888')]. +%% list_resource(URI, Options)// is det. +% +% Extends basic list_resource/2 functionality for resources that +% are an annotation target. +cliopatria:list_resource(URI, Options) --> + { + rdf_get_annotation_target(_, URI), + http_link_to_id(http_annotation, [target(URI)], AnnotateLink) + }, + html([]), + html([ + div(['Existing annotations: ', + \(cpa_browse:as_object(URI, URI)) + ]), + a(href(AnnotateLink), 'Make new annotations') + ]), + list_resource(URI, [raw(true) | Options]).