yaz/commit

FIX use of type restriction in Freebase reconcile

authorMichiel Hildebrand
Mon Nov 7 15:34:31 2011 +0100
committerMichiel Hildebrand
Mon Nov 7 15:34:31 2011 +0100
commit57508f178160c0b5e119c0e61f0597807a7cbdd7
tree7531605391f9cfc3db3609f5278edb9b9a229fef
parent65c64a385dc2c6681843052a397a99d73939d022
Diff style: patch stat
diff --git a/applications/yaz_shot_annotation.pl b/applications/yaz_shot_annotation.pl
index 32873f3..380111d 100644
--- a/applications/yaz_shot_annotation.pl
+++ b/applications/yaz_shot_annotation.pl
@@ -44,14 +44,17 @@ www_form_encode('[{"http://www.w3.org/2004/02/skos/core#inScheme":"http://data.b
 reconcile_source(person,
 		 'Person',
 		 'http://standard-reconcile.freebaseapps.com/reconcile',
-		 '&type="/person"').
+		 '/people/person',
+		 '').
 reconcile_source(location,
 		 'Location',
 		 'http://standard-reconcile.freebaseapps.com/reconcile',
-		 '&type="/location"').
+		 '/location/location',
+		'').
 reconcile_source(subject,
 		 'Subject',
 		 Server,
+		 '',
 		 '&type=http://www.w3.org/2006/03/wn/wn20/schema/Synset') :-
 	http_location_by_id(http_reconcile, Server).
 
@@ -83,8 +86,8 @@ http_yaz_shot(Request) :-
 				      ], Process)
 	),
 	start_user_process(Process),
-	findall(Id=json([label=Label,url=URL,parameters=Parameters]),
-		reconcile_source(Id,Label,URL,Parameters), Sources),
+	findall(Id=json([label=Label,url=URL,type=Type,parameters=Parameters]),
+		reconcile_source(Id,Label,URL,Type,Parameters), Sources),
 	findall({uri:Shot, startTime:Start, duration:Duration},
 		video_shot(Video, Shot, Start, Duration),
 		Shots),
@@ -151,7 +154,7 @@ html_video_page_yui(Video, Shots, Sources) -->
 			  }}
 		],
 		[node,event,widget,anim,
-		 'json-parse','jsonp','querystring-stringify-simple',io,
+		 'json','jsonp','querystring-stringify-simple',io,
 		 'video-player','video-frames',timeline,
 		 'tag-list','tag-linker','annotation-form'
 		],
diff --git a/web/css/shotgarden.css b/web/css/shotgarden.css
index ef0f081..de2e5e3 100644
--- a/web/css/shotgarden.css
+++ b/web/css/shotgarden.css
@@ -193,8 +193,9 @@
 }
 .reconcile-item input {
 }
-.reconcile-item .desc {
-	padding-left: 16px;
+.reconcile-item .desc,
+.reconcile-item .types {
+	padding-left: 20px;
 	font-size: 95%;
 	color: #888;
 }
diff --git a/web/js/tagplayer/tagLinker.js b/web/js/tagplayer/tagLinker.js
index 99c0fa6..0315cdb 100644
--- a/web/js/tagplayer/tagLinker.js
+++ b/web/js/tagplayer/tagLinker.js
@@ -126,12 +126,20 @@ YUI.add('tag-linker', function(Y) {
 				limit = this.get("limit");
 				
 			for(var key in sources) {
-				var source = sources[key];					
+				var source = sources[key],
+					type = source.type,
+					query = {
+						query: tag,
+						limit: limit,
+						type_strict: "should"
+					};
+				if(type) {
+					query.type = type;
+				}
 				var url = source.url
 						+ "?callback={callback}"
 						+ source.parameters
-						+ "&query="+tag
-						+ "&limit="+limit;
+						+ "&query="+Y.JSON.stringify(query);
 				Y.log('reconcile against '+source.label);
 				this.fire("reconcileStart", {"source":source});
 				this.reconcile(url, source);
@@ -159,17 +167,14 @@ YUI.add('tag-linker', function(Y) {
 			var id = item.id,
 				name = item.name,
 				types = item.type||[];
-			
+
 			var html = "<input type=radio name='reconcileItem' value='"+id+"'>";
 			html += "<span class='name'>"+name+"</span>";
-			html += "<div class='types'>";
-			for (var i=0; i < (types.length||3); i++) {
-				html += "<span class='type'>"+types[i].name+"</span>";
-				if(i<(types.length&&3)) {
-					html += "; "
-				}
-			}
-			html +=	"</div>";
+			if(types) {
+				html += "<div class='types'>";
+				html += "<span class='type'>"+types[0].name+"</span>";
+				html +=	"</div>";
+			}	
 			if(item.desc) { 
 				html += "<div class='desc'>"+item.desc+"</div>";
 			}