annotate popoto_dev/js/app-ismi.js @ 31:a6b2a09ea413

fix commentary chain visualisation author name display and search by clicking author name.
author casties
date Fri, 11 Dec 2015 17:06:26 -0500
parents d67c5ad47709
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
1 /**
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
2 * URL used to access Neo4j REST API to execute queries.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
3 * Update this parameter to your running server instance.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
4 *
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
5 * For more information on Neo4J REST API the documentation is available here: http://neo4j.com/docs/stable/rest-api-cypher.html
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
6 */
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
7 popoto.rest.CYPHER_URL = "https://ismi-dev.mpiwg-berlin.mpg.de/neo4j-ismi/db/data/transaction/commit";
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
8 //popoto.rest.CYPHER_URL = "http://localhost:7474/db/data/transaction/commit";
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
9
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
10 /**
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
11 * Add this authorization property if your Neo4j server uses basic HTTP authentication.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
12 * The value of this property must be "Basic <payload>", where "payload" is a base64 encoded string of "username:password".
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
13 *
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
14 * "btoa" is a JavaScript function that can be used to encode the user and password value in base64 but it is recommended to directly use the Base64 value.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
15 *
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
16 * For example Base64 encoding value of "neo4j:password" is "bmVvNGo6cGFzc3dvcmQ="
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
17 */
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
18 popoto.rest.AUTHORIZATION = "Basic " + btoa("neo4j:neo5j");
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
19 //popoto.rest.AUTHORIZATION = "Basic " + btoa("neo4j:eagrussell");
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
20
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
21 /**
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
22 * These functions fill the predefinedConstraints array for "PERSON"
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
23 * Called when the filter button is hit
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
24 *
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
25 * Uses the text box implementation currently
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
26 */
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
27 // TODO: finish textbox implementation as backup
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
28 // have single filter button which on click sets constraints equal to d3.select("#constraintNUMBS)[0][0].value
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
29 // for a bunch of spots in the array
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
30 // will have to create only 1 d3.select
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
31 // the d3.select will need to know what constraints to pull from input boxes based on ids related to whether they
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
32 // are person/codex/witness/etc attributes and put them into the corresponding arrays
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
33 // personPredefinedConstraints codexPreDef
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
34 var personPredefinedConstraints = [];
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
35 var codexPredefinedConstraints = [];
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
36 var witnessPredefinedConstraints = [];
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
37 d3.select("#filter-button").on("click", function (d) {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
38 personPredefinedConstraints = [];
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
39 codexPredefinedConstraints = [];
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
40 witnessPredefinedConstraints = [];
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
41
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
42 var person1 = d3.select("#person-constraint")[0][0].value;
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
43 var person2 = d3.select("#person-constraint2")[0][0].value;
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
44
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
45 var codex1 = d3.select("#codex-constraint")[0][0].value;
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
46 var codex2 = d3.select("#codex-constraint2")[0][0].value;
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
47
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
48 var witness1 = d3.select("#witness-constraint")[0][0].value;
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
49 var witness2 = d3.select("#witness-constraint2")[0][0].value;
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
50
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
51 if (person1.substring(person1.indexOf('"')+1,person1.lastIndexOf('"'))) personPredefinedConstraints.push(person1);
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
52 if (person2.substring(person2.indexOf('"')+1,person2.lastIndexOf('"'))) personPredefinedConstraints.push(person2);
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
53
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
54 if (codex1.substring(codex1.indexOf('"')+1,codex1.lastIndexOf('"'))) codexPredefinedConstraints.push(codex1);
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
55 if (codex2.substring(codex2.indexOf('"')+1,codex2.lastIndexOf('"'))) codexPredefinedConstraints.push(codex2);
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
56
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
57 if (witness1.substring(witness1.indexOf('"')+1,witness1.lastIndexOf('"'))) witnessPredefinedConstraints.push(witness1);
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
58 if (witness2.substring(witness2.indexOf('"')+1,witness2.lastIndexOf('"'))) witnessPredefinedConstraints.push(witness2);
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
59
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
60 // Recreate taxonomies panel
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
61 d3.select("#" + popoto.taxonomy.containerId).selectAll("ul").data([]).exit().remove();
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
62 popoto.taxonomy.createTaxonomyPanel();
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
63
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
64 popoto.tools.reset();
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
65 });
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
66
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
67 d3.select("#clear-button").on("click", function (d) {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
68 personPredefinedConstraints = [];
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
69 codexPredefinedConstraints = [];
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
70 witnessPredefinedConstraints = [];
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
71
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
72 // Recreate taxonomies panel
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
73 d3.select("#" + popoto.taxonomy.containerId).selectAll("ul").data([]).exit().remove();
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
74 popoto.taxonomy.createTaxonomyPanel();
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
75
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
76 popoto.tools.reset();
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
77 });
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
78
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
79
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
80 /**
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
81 * Define the Label provider you need for your application.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
82 * This configuration is mandatory and should contain at least all the labels you could find in your graph model.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
83 *
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
84 * In this alpha version only nodes with a label are supported.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
85 *
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
86 * By default If no attributes are specified Neo4j internal ID will be used.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
87 * These label provider configuration can be used to customize the node display in the graph.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
88 * See www.popotojs.com or example for more details on available configuration options.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
89 */
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
90 // TODO: add in predefined constraint functions for other nodeProviders
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
91 popoto.provider.nodeProviders = {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
92 "CODEX": {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
93 "returnAttributes": ["label", "ismi_id", "identifier"],
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
94 "displayAttribute": "label",
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
95 "getPredefinedConstraints": function (node) {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
96 return codexPredefinedConstraints;
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
97 },
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
98 },
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
99 "WITNESS": {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
100 "returnAttributes": ["label", "ismi_id", "folios"],
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
101 "displayAttribute": "label",
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
102 "getPredefinedConstraints": function (node) {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
103 return witnessPredefinedConstraints;
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
104 },
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
105 },
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
106 "TEXT": {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
107 "returnAttributes": ["label", "full_title", "ismi_id"],
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
108 "displayAttribute": "label",
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
109 //"getPredefinedConstraints": function (node) {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
110 // return textPredefinedConstraints;
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
111 //},
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
112 },
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
113 "PERSON": {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
114 "returnAttributes": ["label", "ismi_id", "death_date_text", "url"],
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
115 "displayAttribute": "label",
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
116 "getPredefinedConstraints": function (node) {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
117 return personPredefinedConstraints;
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
118 },
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
119 },
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
120 "REPOSITORY": {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
121 "returnAttributes": ["label", "ismi_id"],
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
122 "displayAttribute": "label",
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
123 //"getPredefinedConstraints": function (node) {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
124 // return repositoryPredefinedConstraints;
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
125 //},
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
126 },
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
127 "FLORUIT_DATE": {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
128 "isSearchable": false,
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
129 //"getPredefinedConstraints": function (node) {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
130 // return floruitPredefinedConstraints;
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
131 //},
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
132 }
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
133 };
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
134
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
135 /**
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
136 * Popoto label provider
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
137 * Define the label provider used to customize the link displayed text:
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
138 */
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
139 // TODO: ensure these cover all the different relations. Commented out for now.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
140 /*
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
141 popoto.provider.linkProvider = {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
142
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
143 // Customize the text displayed on links:
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
144 "getLinkTextValue": function (link) {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
145
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
146 // The links labels are just changed in lower case in this example.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
147 // But it is possible to use a localization mechanism here to replace values.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
148 if (link.type === popoto.graph.link.LinkTypes.RELATION) {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
149
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
150 if (link.source.label == "PERSON") {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
151 switch (link.label) {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
152 case "was_student_of":
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
153 return "was student of";
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
154 case "is_prime_alias_name_of":
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
155 return "is prime alias name of";
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
156 case "was_born_in":
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
157 return "was born in";
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
158 case "lived_in":
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
159 return "lived in";
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
160 case "has_role":
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
161 return "has role";
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
162 case "has_floruit_date":
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
163 return "has floruit date";
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
164 case "died_in":
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
165 return "died in";
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
166 default :
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
167 return ""
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
168 }
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
169 }
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
170 if (link.source.label == "CODEX") {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
171 switch (link.label) {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
172 case "owned_by":
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
173 return "owned by";
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
174 case "is_alias_of":
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
175 return "is alias of";
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
176 case "is_part_of":
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
177 return "is part of";
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
178 }
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
179 }
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
180 if (link.source.label == "WITNESS") {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
181 switch (link.label) {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
182 case "was_copied_in":
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
183 return "was copied in";
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
184 case "was_studied_by":
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
185 return "was studied by";
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
186 case "had_patron":
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
187 return "had patron";
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
188 case "is_part_of":
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
189 return "is part of";
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
190 case "is_exemplar_of":
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
191 return "is exemplar of";
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
192 case "has_title_written_as":
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
193 return "has title written as";
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
194 case "has_author_written_as":
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
195 return "as author written as";
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
196 case "was_copied_by":
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
197 return "was copied by";
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
198 }
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
199 }
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
200 if (link.source.label == "PLACE") {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
201 switch (link.label) {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
202 case "is_part_of":
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
203 return "is part of";
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
204 case "is_in":
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
205 return "is in";
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
206 }
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
207 }
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
208 } else {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
209 return popoto.provider.getSemanticValue(link.target);
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
210 }
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
211 }
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
212
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
213 };
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
214 */
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
215
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
216
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
217
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
218
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
219
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
220
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
221
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
222 //d3.select("#clear-button").on("click", function (d) {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
223 // popoto.graph.node.expandNode()
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
224 //});
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
225
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
226 //take d3.select of any click that calls popoto.graph.node.expandNode()
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
227 // make sure to search in popoto.js what kind of events trigger the expandNode fn
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
228 //
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
229 // on these events, instead of executing the normal expandNode function, call a modified function that will generate an
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
230 // html table with the required results. Still maintaining the info being sent to results but ensuring that what is
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
231 // displayed is thrown into a table.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
232
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
233 // to override the popoto.graph.node.expandNode() fn just use:
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
234
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
235 // Expand Override
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
236 var tableArray = [];
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
237 (function() {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
238 var oldVersionExpand = popoto.graph.node.expandNode;
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
239 popoto.graph.node.expandNode = function(clickedNode) {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
240 console.log("NODES OPEN");
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
241 //var result = oldVersionExpand.apply(this, arguments);
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
242 // do some more stuff
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
243 //return result;
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
244
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
245 var dataToAdd = clickedNode.data;
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
246 // Then each node is created
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
247 var i = 1;
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
248 dataToAdd.forEach(function (d) {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
249 // for each of these bits of data make sure to add the id and the attributes into the html list
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
250 var nx = clickedNode.x;
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
251 var ny = clickedNode.y;
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
252
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
253 var node = {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
254 "id": (++popoto.graph.node.idgen),
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
255 "parent": clickedNode,
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
256 "attributes": d,
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
257 "type": popoto.graph.node.NodeTypes.VALUE,
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
258 "label": clickedNode.label,
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
259 "count": d.count,
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
260 "x": nx,
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
261 "y": ny,
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
262 "internalID": d[popoto.query.NEO4J_INTERNAL_ID.queryInternalName]
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
263 };
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
264
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
265 popoto.graph.force.nodes().push(node);
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
266 // add this node to an array of node values
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
267 // popoto.graph.force.nodes().push(node);
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
268 tableArray.push(node);
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
269
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
270 var dd = document.getElementById("dropdown");
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
271 var newListOption = document.createElement("option");
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
272
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
273 // TODO: Haven't been able to
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
274 newListOption.text = node.internalID;
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
275 console.log(node.internalID);
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
276 dd.add(newListOption);
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
277
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
278 i++;
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
279 });
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
280
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
281 $('#dropdown').attr('style','visibility: visible; overflow: scroll; position: fixed; left: '+clickedNode.x+'px; bottom: '+clickedNode.y+'px; z-index: 10;');
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
282 //$('#dropdown').attr('style','visibility: visible; overflow: scroll; position: fixed;');
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
283
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
284 // Pin clicked node and its parent to avoid the graph to move for selection, only new value nodes will blossom around the clicked node.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
285 clickedNode.fixed = true;
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
286
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
287 if (clickedNode.parent && clickedNode.parent.type !== popoto.graph.node.NodeTypes.ROOT) {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
288 clickedNode.parent.fixed = true;
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
289 }
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
290 // Change node state
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
291 clickedNode.valueExpanded = true;
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
292 popoto.update();
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
293
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
294 };
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
295 })();
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
296
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
297 // Collapse Override
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
298 (function() {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
299 popoto.graph.node.collapseNode = function(clickedNode) {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
300
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
301 if (clickedNode.valueExpanded) { // node is collapsed only if it has been expanded first
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
302 console.log("NODES CLOSED");
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
303
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
304 popoto.logger.debug("collapseNode (" + clickedNode.label + ")");
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
305
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
306 // Node has been fixed when expanded so we unfix it back here.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
307 if (clickedNode.type !== popoto.graph.node.NodeTypes.ROOT) {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
308 clickedNode.fixed = false;
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
309 }
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
310
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
311 // Parent node too if not root
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
312 if (clickedNode.parent && clickedNode.parent.type !== popoto.graph.node.NodeTypes.ROOT) {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
313 clickedNode.parent.fixed = false;
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
314 }
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
315
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
316 clickedNode.valueExpanded = false;
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
317 popoto.update();
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
318
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
319 $('#dropdown').attr('style','visibility: hidden; overflow: scroll; position: fixed;');
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
320 //TODO: need to delete existing options
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
321 var x = document.getElementById("dropdown");
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
322 for (i=x.length; i > 0; i--) {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
323 if (x.length > 1) {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
324 x.remove(x.length-1);
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
325 }
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
326 }
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
327
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
328 } else {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
329 popoto.logger.debug("collapseNode called on an unexpanded node");
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
330 }
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
331 };
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
332 })();
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
333
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
334
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
335 d3.select("#dropdown").on("change", function (d) {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
336 if (document.getElementById('dropdown').value != '- Select -') {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
337 console.log(document.getElementById('dropdown').value);
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
338 popoto.graph.node.valueNodeClick(document.getElementById('dropdown').value);
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
339 }
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
340 });
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
341 // Value click override
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
342 (function() {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
343 popoto.graph.node.valueNodeClick = function(selectValue) {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
344 console.log("NODE SELECTED");
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
345
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
346 popoto.logger.debug("valueNodeClick (" + selectValue.label + ")");
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
347 // change this next line to take the node id from the table and pull it from the nodes list
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
348
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
349 var clickedNode;
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
350 for (i in tableArray) {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
351 if (i.label == selectValue) {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
352 clickedNode = i;
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
353 }
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
354 }
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
355
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
356 clickedNode.parent.value = clickedNode;
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
357 popoto.result.hasChanged = true;
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
358 popoto.graph.hasGraphChanged = true;
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
359
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
360 popoto.graph.node.collapseNode(clickedNode.parent);
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
361 };
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
362 })();
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
363
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
364
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
365 /**
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
366 * Here a listener is used to retrieve the total results count and update the page accordingly.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
367 * This listener will be called on every graph modification.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
368 */
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
369 popoto.result.onTotalResultCount(function (count) {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
370 document.getElementById("result-total-count").innerHTML = "(" + count + ")";
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
371 });
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
372
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
373 /**
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
374 * The number of results returned can be changed with the following parameter.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
375 * Default value is 100.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
376 *
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
377 * Note that in this current alpha version no pagination mechanism is available in displayed results
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
378 */
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
379 popoto.query.RESULTS_PAGE_SIZE = 1000;
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
380
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
381
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
382 /**
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
383 * For the alpha version, popoto.js has been generated with debug traces you can activate with the following properties:
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
384 * The value can be one in DEBUG, INFO, WARN, ERROR, NONE.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
385 *
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
386 * With INFO level all the executed cypher query can be seen in the navigator console.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
387 * Default is NONE
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
388 */
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
389 popoto.logger.LEVEL = popoto.logger.LogLevels.INFO;
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
390
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
391 /**
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
392 * Start popoto.js generation.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
393 * The function requires the label to use as root element in the graph.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
394 */
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
395 popoto.start("PERSON");
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
396
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
397 /* do not zoom with scroll wheel */
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
398 popoto.graph.WHEEL_ZOOM_ENABLED = false;
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
399
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
400 /* show source and target relations */
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
401 popoto.query.USE_RELATION_DIRECTION = true;