annotation_service/commit

move to new oa namespace

authorJacco van Ossenbruggen
Tue Jun 19 16:10:19 2012 +0200
committerJacco van Ossenbruggen
Tue Jun 19 16:10:19 2012 +0200
commite403eb8eeee6cd2457abdbcfea4acd90b431c251
tree178e48c817977ee5ecfb812ac7abe34cdd34e39b
parentf4a26112b2e4fad98d97ccd983fdd936cf54ba41
Diff style: patch stat
diff --git a/api/annotation.pl b/api/annotation.pl
index 70075f4..551bedf 100644
--- a/api/annotation.pl
+++ b/api/annotation.pl
@@ -20,9 +20,9 @@
 * http handlers
 ***************************************************/
 
+:- http_handler(cliopatria(api/annotation/get),	   http_get_annotation, []).
 :- http_handler(cliopatria(api/annotation/add),    http_add_annotation, []).
 :- http_handler(cliopatria(api/annotation/remove), http_remove_annotation, []).
-:- http_handler(cliopatria(api/annotation/get),	   http_get_annotation, []).
 
 %%	http_add_annotation(+Request)
 %
@@ -89,7 +89,7 @@ http_remove_annotation(Request) :-
         ->  ensure_logged_on(User)
         ;   logged_on(User, anonymous)
         ),
-	once(rdf(Annotation, oac:hasTarget, Target)),
+	once(rdf(Annotation, oa:hasTarget, Target)),
 	findall(rdf(Annotation,O,P), rdf(Annotation,O,P,Graph), Triples),
 	gv_resource_commit(Target, User,
 			   remove(Triples),
@@ -143,13 +143,13 @@ rdf_add_annotation(Options, Annotation,Triples) :-
 	time_stamp(T),
 	format_time(atom(TimeStamp), '%Y-%m-%dT%H-%M-%S%Oz', T),
 	KeyValue0 = [
-		     po(rdf:type, oac:'Annotation'),
+		     po(rdf:type, oa:'Annotation'),
 		     po(oa:annotated, literal(type(xsd:dateTime, TimeStamp))),
-		     po(dcterms:creator,User),
+		     po(oa:annotator, User),
 		     po(dcterms:title, literal(Label)),
 		     po(an:annotationField, Field),
-		     po(oac:hasTarget, Target),
-		     po(oac:hasBody, Body)
+		     po(oa:hasTarget, Target),
+		     po(oa:hasBody, Body)
 		     |
 		     CommentPair
 		    ],
@@ -197,10 +197,10 @@ annotation_in_field(Target, FieldURI, Annotation, Body, Label, Comment, User) :-
 	->  logged_on(User, anonymous)
 	;   true
 	),
-	rdf(Annotation, oac:hasTarget, Target, Graph),
+	rdf(Annotation, oa:hasTarget, Target, Graph),
 	rdf(Annotation, an:annotationField, FieldURI, Graph),
-	rdf(Annotation, dcterms:creator, User, Graph),
-	rdf(Annotation, oac:hasBody, Body0, Graph),
+	rdf(Annotation, oa:annotator, User, Graph),
+	rdf(Annotation, oa:hasBody, Body0, Graph),
 	rdf(Annotation, dcterms:title, Lit, Graph),
 	(   rdf(Annotation, rdfs:comment, Comment0, Graph)
 	->  literal_text(Comment0, Comment)
diff --git a/config-available/oac_graphviz.pl b/config-available/oac_graphviz.pl
index 264f722..d2e2842 100644
--- a/config-available/oac_graphviz.pl
+++ b/config-available/oac_graphviz.pl
@@ -1,4 +1,4 @@
-:- module(oac_graphviz, []).
+:- module(oa_graphviz, []).
 
 :- use_module(cliopatria(hooks)).
 :- use_module(library(semweb/rdf_db)).
@@ -23,7 +23,7 @@ cliopatria:context_graph(URI, RDF) :-
 	RDF \= [].
 
 cliopatria:context_graph(URI, RDF) :-
-	rdfs_individual_of(URI, oac:'Annotation'),% assume URI is an Annotations
+	rdfs_individual_of(URI, oa:'Annotation'),% assume URI is an Annotations
 	!,
 	findall(T, annotation_context_triple(URI, T), RDF0),
 	sort(RDF0, RDF1),
@@ -33,24 +33,24 @@ cliopatria:context_graph(URI, RDF) :-
 	RDF \= [].
 
 graph_context_triple(G, rdf(S,P,O)) :-
-	rdf_equal(P, oac:hasTarget),
+	rdf_equal(P, oa: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(_, oa:hasTarget, T,G),
 	rdf_equal(P, gv:head),
 	rdf(H,P,T).
 
 annotation_context_triple(S, rdf(S,P,O)) :-
-	rdf_equal(oac:hasTarget, P),
+	rdf_equal(oa:hasTarget, P),
 	rdf(S,P,O).
 annotation_context_triple(S, rdf(S,P,O)) :-
-	rdf_equal(oac:hasBody, P),
+	rdf_equal(oa:hasBody, P),
 	rdf(S,P,O).
 annotation_context_triple(S, rdf(S,P,O)) :-
-	rdf_equal(dcterms:creator, P),
+	rdf_equal(oa:annotator, P),
 	rdf(S,P,O).
 
 annotation_context_triple(S, rdf(Commit,P,G)) :-
@@ -59,7 +59,7 @@ annotation_context_triple(S, rdf(Commit,P,G)) :-
 	rdf(Commit, P, G).
 
 cliopatria:node_shape(URI, Shape, _Options) :-
-	rdfs_individual_of(URI, oac:'Annotation'),
+	rdfs_individual_of(URI, oa:'Annotation'),
 	Shape = [shape('Mdiamond'),fontize('20.00'), style(filled),fillcolor('#FF8888')].
 
 
diff --git a/lib/oa_schema.pl b/lib/oa_schema.pl
index 82ad2c8..4142568 100644
--- a/lib/oa_schema.pl
+++ b/lib/oa_schema.pl
@@ -19,5 +19,5 @@ Prolog.
 :- rdf_register_ns(oax,	'http://www.w3.org/ns/openannotation/extension/').
 
 :- rdf_attach_library(annotation_service(rdf)).
-% :- rdf_load_library(oa).
+:- rdf_load_library(oa_compat).
 
diff --git a/rdf/oa_compat.ttl b/rdf/oa_compat.ttl
new file mode 100644
index 0000000..3c78672
--- /dev/null
+++ b/rdf/oa_compat.ttl
@@ -0,0 +1,12 @@
+@prefix      oa: <http://www.w3.org/ns/openannotation/core/> .
+@prefix     oax: <http://www.w3.org/ns/openannotation/extension/> .
+@prefix     oac: <http://www.openannotation.org/ns/> .
+@prefix    rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix     rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix dcterms: <http://purl.org/dc/terms/dcterms.rdf> .
+
+oa:Annotation rdfs:subClassOf oac:Annotation .
+
+oa:hasTarget rdfs:subPropertyOf oac:hasTarget .
+oa:hasBody   rdfs:subPropertyOf oac:Body .
+oa:annotator rdfs:subPropertyOf dcterms:creator .
diff --git a/rdf/void.ttl b/rdf/void.ttl
new file mode 100644
index 0000000..c513d91
--- /dev/null
+++ b/rdf/void.ttl
@@ -0,0 +1,20 @@
+@prefix    void: <http://rdfs.org/ns/void#> .
+@prefix    vann: <http://purl.org/vocab/vann/> .
+@prefix     lib: <http://www.swi-prolog.org/rdf/library/> .
+@prefix     owl: <http://www.w3.org/2002/07/owl#> .
+@prefix	dcterms: <http://purl.org/dc/terms/> .
+
+[ vann:preferredNamespacePrefix	"oac" ;
+  vann:preferredNamespaceUri "http://www.openannotation.org/ns/" ;
+] .
+
+[ vann:preferredNamespacePrefix	"oa" ;
+  vann:preferredNamespaceUri "http://www.w3.org/ns/openannotation/core/";
+] .
+
+<oa_compat>
+	a void:Dataset ;
+	dcterms:title "Backward compatibility triples for oa namespace updates";
+	owl:versionInfo "0.01" ;
+	void:dataDump
+		<oa_compat.ttl> .