vumix/commit

test stuff

authorMichiel Hildebrand
Wed Apr 25 15:49:20 2012 +0200
committerMichiel Hildebrand
Wed Apr 25 15:49:20 2012 +0200
commitf784eebbe0dda376598a811f1e92868f244f4399
treee9295fa551df9099edb74bc16d1343aa7450c491
parentc629bf7f97365b458909725a11bc942bc7fa5028
Diff style: patch stat
diff --git a/applications/vumix_p0.pl b/applications/vumix_p0.pl
index c1ba98d..0f7c0b5 100644
--- a/applications/vumix_p0.pl
+++ b/applications/vumix_p0.pl
@@ -74,7 +74,7 @@ http_vumix_p0_finish(Request) :-
 			   save_annotations(['http://semanticweb.cs.vu.nl/prestoprime/personAnnotation'-Persons,
 					     'http://semanticweb.cs.vu.nl/prestoprime/placeAnnotation'-Places,
 					     'http://semanticweb.cs.vu.nl/prestoprime/nameAnnotation'-Names,
-					     'http://semanticweb.cs.vu.nl/prestoprime/subjectAnnotation'-Subjects
+					     'http://semanticweb.cs.vu.nl/prestoprime/onderwerpAnnotation'-Subjects
 					    ], Target, User, Graph),
 			   _Head,
 			   Graph),
@@ -116,7 +116,7 @@ http_vumix_p0(Request) :-
 	->  Fields = ['http://semanticweb.cs.vu.nl/prestoprime/personAnnotation',
 		      'http://semanticweb.cs.vu.nl/prestoprime/placeAnnotation',
 		      'http://semanticweb.cs.vu.nl/prestoprime/nameAnnotation',
-		      'http://semanticweb.cs.vu.nl/prestoprime/subjectAnnotation']
+		      'http://semanticweb.cs.vu.nl/prestoprime/onderwerpAnnotation']
 	;   Fields = Fields0
 	),
 	(   setting(login, true)
@@ -139,7 +139,16 @@ http_vumix_p0(Request) :-
 
 link_tags_to_concepts([], []).
 link_tags_to_concepts([Score-Tag|As], [Concept-Score|Rest]) :-
+	Score > 7,
 	rdf_has(Concept,rdfs:label,literal(exact(Tag),_)),
+	%reconcile(Tag, 3, _Type, [], Hits),
+	%member(hit(D,Concept,_,_), Hits),
+	%D < 3,
+	\+ rdf(Concept,skos:inScheme,gtaa:'OnderwerpenBenG'), % hack, to remove duplication between onderwerpenBenG en onderwerpen
+	(   rdf(Concept,skos:inScheme,gtaa:'Onderwerpen')
+	->  true
+	;   rdf(Concept,skos:scopeNote,_)
+	),  %hack. Concepts without a scopenote are dubious
 	!,
 	link_tags_to_concepts(As, Rest).
 link_tags_to_concepts([_|As],  Rest) :-
@@ -236,10 +245,10 @@ html_page(Target, Fields, Concepts) :-
 		  [ div(id(hd), []),
 		    div(id(bd),
 			div([id(layout), class('yui3-g')],
-			    [ div([id(fields), class('yui3-u')],
+			    [ div([id(fields), class('yui3-u ')],
 				  form(action(location_by_id(http_vumix_p0_finish)),
 				       [ input([type(hidden), name(target), value(Target)]),
-					 div(class(bd),
+					 div([id('fields-accordion'), class('bd yui3-accordion')],
 					     \html_suggestion_fields(Fields, Concepts)),
 					 div(class(ft),
 					     input([type(submit), value(submit)]))
@@ -271,7 +280,7 @@ mbh_video_source(_R, @null).
 
 html_suggestion_fields([], _) --> !.
 html_suggestion_fields([URI|T], Concepts) -->
-	html(div(class('annotate-field'),
+	html(div(class('annotate-field yui3-module yui3-accordion-item'),
 		 \html_annotation_field(URI, Concepts))),
 	html_suggestion_fields(T, Concepts).
 
@@ -284,12 +293,13 @@ html_annotation_field(Field, Concepts) -->
 	  ;   Suggestions = []
 	  )
 	},
-	html([ div(class('annotate-header'),
-		   [ h3(Label),
+	html([ div(class('annotate-header yui3-hd yui3-accordion-item-hd'),
+		   [ %a([href('#'), class('yui3-accordion-item-trigger')],
+		       h3(Label),%),
 		     \html_annotation_field_desc(Field)
 		   ]),
 	       %input([id(Id), type(text)]),
-	       div([id(Id+'Suggest'), class('suggest')],
+	       div([id(Id+'Suggest'), class('suggest yui3-bd yui3-accordion-item-bd')],
 		   ul(\html_suggestions(Suggestions, Field)))
 	     ]).
 
@@ -357,12 +367,18 @@ yui_script(Target, _Fields) -->
 	  pairs_keys(Modules, Includes)
 	},
 	yui3([json([modules(json(Modules))])],
-	     ['recordset-base'|Includes],
+	     ['recordset-base','anim'|Includes],
 	     [\js_video(Target),
 	      \js_video_frames(Target),
 	      \js_title_edit(Target),
 	      %\js_annotation_fields(Fields, Target),
-	      'videoFrames.on("frameSelect", function(e) {videoPlayer.setTime(e.time, true)});']).
+	      /*\yui3_plug(one(id('fields-accordion')),
+			'Y.Plugin.NodeAccordion',
+			{ anim:symbol(true),
+			  effect:'Y.Easing.backIn'
+			}),*/
+	      'videoFrames.on("frameSelect", function(e) {videoPlayer.setTime(e.time, true)});'
+	     ]).
 
 js_module('videoplayer', json([fullpath(Path),
 			       requires([node,event,widget])
@@ -467,5 +483,89 @@ js_annotation_field(FieldURI, Target) -->
 		   resultHighlighter: phraseMatch}).
 
 
+:- http_handler(cliopatria(vumix/overview), http_vumix_overview, []).
+
+:- rdf_meta
+	gtaa_concepts(+, r, -).
+
+
+%%	http_vumix_overview(+Request)
+%
+%
+
+http_vumix_overview(Request) :-
+	http_parameters(Request,
+		[ target(Target,
+		     [uri,
+		      description('URI of the object to be annotated')
+		     ])
+		]),
+	% video properties
+	rdf_label(Target, Title),
+	tag_rank(Target, Tags0),
+	remove_stop_words(Tags0, dutch, FilteredTags),
+	tags_with_gtaa_concepts(FilteredTags, TagsWithConcept),
+
+	gtaa_concepts(FilteredTags, gtaa:'GTAA', Concepts),
+	gtaa_concepts(FilteredTags, gtaa:'Onderwerpen', Onderwerpen),
+
 
+	length(Tags0, TagCount),
+	length(FilteredTags, TagFilteredCount),
+	length(TagsWithConcept, TagWithConceptCount),
+	length(Concepts, ConceptCount),
+	length(Onderwerpen, OnderwerpenCount),
 
+	reply_html_page(
+	    [ title(['Concepts -- ', Target])
+	    ],
+	    [ div(class('yui3-skin-sam yui-skin-sam'),
+		  [ div(id(hd),
+			[ h3(Title),
+			  a(href(Target), Target)
+			]),
+		    div(id(bd),
+			[ div(id(tags),
+			      [ h4(['Tags (',TagCount,')'])
+				%\html_tags(Tags0)
+			      ]),
+			  div(id(filteredtags),
+			      [ h4(['Tags without stopwords (',TagFilteredCount,')'])
+			      ]),
+			  div(id(tagwithconcept),
+			      [ h4(['Tags with a GTAA concept (',TagWithConceptCount,')'])
+			      ]),
+			  div(id(concepts),
+			      [ h4(['GTAA concepts (',ConceptCount,')'])
+			      ]),
+			  div(id(onderwerpen),
+			      [ h4(['GTAA onderwerpen (',OnderwerpenCount,')'])
+			      ])
+			])
+		  ])
+	    ]).
+
+
+tags_with_gtaa_concepts([], []).
+tags_with_gtaa_concepts([Score-Tag|As], [Score-Tag|Rest]) :-
+	rdf_has(Concept,rdfs:label,literal(exact(Tag),_)),
+	rdf(Concept,skos:inScheme,gtaa:'GTAA'),
+	!,
+	tags_with_gtaa_concepts(As, Rest).
+tags_with_gtaa_concepts([_|As],  Rest) :-
+	tags_with_gtaa_concepts(As, Rest).
+
+
+gtaa_concepts(Tags, Scheme, Concepts) :-
+	gtaa_concepts_(Tags, Scheme, Concepts0),
+	keysort(Concepts0, Concepts1),
+	group_pairs_by_key(Concepts1, Concepts).
+
+gtaa_concepts_([], _, []).
+gtaa_concepts_([Score-Tag|As], Scheme, [Concept-Score|Rest]) :-
+	rdf_has(Concept,rdfs:label,literal(exact(Tag),_)),
+	rdf(Concept,skos:inScheme, Scheme),
+	!,
+	gtaa_concepts_(As, Scheme, Rest).
+gtaa_concepts_([_|As],  Scheme, Rest) :-
+	gtaa_concepts_(As, Scheme, Rest).
diff --git a/rdf/mbh_example.ttl b/rdf/mbh_example.ttl
index 25b37b5..4c38a42 100644
--- a/rdf/mbh_example.ttl
+++ b/rdf/mbh_example.ttl
@@ -39,7 +39,13 @@ pprime:placeAnnotation
 pprime:subjectAnnotation
     a :annotationField ;
     rdfs:label "Onderwerp"@nl ;
-    dc:comment "voeg subject termen toe toe"@nl ;
+    dc:comment "voeg subject termen toe"@nl ;
     :scheme <http://data.beeldengeluid.nl/gtaa/OnderwerpenBenG> ;
     :source "/api/autocomplete?q={query}&filter={\"scheme\":\"http://data.beeldengeluid.nl/gtaa/OnderwerpenBenG\"}" .
 
+pprime:onderwerpAnnotation
+    a :annotationField ;
+    rdfs:label "Onderwerp"@nl ;
+    dc:comment "voeg subject termen toe"@nl ;
+    :scheme <http://data.beeldengeluid.nl/gtaa/Onderwerpen> ;
+    :source "/api/autocomplete?q={query}&filter={\"scheme\":\"http://data.beeldengeluid.nl/gtaa/Onderwerpen\"}" .
diff --git a/web/css/vumix.css b/web/css/vumix.css
index e64d349..5d933a1 100644
--- a/web/css/vumix.css
+++ b/web/css/vumix.css
@@ -18,7 +18,7 @@
 	
 }
 .suggest {
-	height: 105px;
+	max-height: 120px;
 	overflow: auto;
 	background-color: white;
 }