accurator/commit

Added optional query variable to cluster and path.

authorChris Dijkshoorn
Thu Mar 24 15:04:58 2016 +0100
committerChris Dijkshoorn
Thu Mar 24 15:04:58 2016 +0100
commit8f68bbb87e82945bc81ca992f644e0aada0243cd
treec0e88c6c2eefeb218637c96edb020c9d820206c7
parent738c5a5be95c469db7af6a34c82ec5fc099c00dc
Diff style: patch stat
diff --git a/web/js/components/cluster.js b/web/js/components/cluster.js
index dcbeed0..f5d94bf 100644
--- a/web/js/components/cluster.js
+++ b/web/js/components/cluster.js
@@ -1,11 +1,12 @@
 /*******************************************************************************
 Cluster
 *******************************************************************************/
-function Cluster(id, uris, path) {
+function Cluster(id, uris, path, query) {
 	this.id = id; // id of the cluster
 	this.uris = uris; // list of uris of the items
 	this.items = []; // enriched items
-	this.path = new Path(path, this.id);
+	this.path = new Path(path, this.id, query); // path describing how items are reached
+	this.query = query; // the query that caused this cluster to be
 	this.pagination = null;
 	this.thumbnails = []; // thumbnails
 	this.node = $.el.div({'class':'well well-sm', 'id':this.id});
diff --git a/web/js/components/path.js b/web/js/components/path.js
index cfaf326..9eebef6 100644
--- a/web/js/components/path.js
+++ b/web/js/components/path.js
@@ -1,12 +1,13 @@
 /*******************************************************************************
 Path
 *******************************************************************************/
-function Path(path, parentId) {
+function Path(path, parentId, query) {
     this.path = path; // uris or title element of the path
     this.labels = null; // labels of elements of the path
     this.elements = []; // elements of the path
     this.node = null;
     this.parentId = parentId; // id of the parent element (probably cluster)
+    this.query = query; // the query which is the start of the path
 
     this.init();
 }
@@ -75,9 +76,7 @@ Path.prototype.unfoldEvent = function() {
         if (i==0) {
 			pathHtml.appendChild(
 				$.el.span({'class':'path-label path-literal'},
-        //TODO: Get the query?
-                        //   query));
-                        "query"));
+                    this.query));
 		} else if (i%2==0) {
             pathHtml.appendChild(
                 $.el.span({'class':'path-label path-resource'},
diff --git a/web/js/results.js b/web/js/results.js
index 9e6fdc6..d156928 100644
--- a/web/js/results.js
+++ b/web/js/results.js
@@ -226,7 +226,7 @@ function processClusters(data, query, labels) {
 			for(var j = 0; j < data.clusters[i].items.length; j++)
 				uris[j] = data.clusters[i].items[j].uri;
 
-			clusters[i] = new Cluster(id, uris, path);
+			clusters[i] = new Cluster(id, uris, path, query);
 		}
 		return clusters;
 	}