Mercurial > hg > NetworkVis
annotate popoto/js/app-ismi.js @ 4:72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
author | alistair |
---|---|
date | Mon, 07 Sep 2015 23:51:47 -0400 |
parents | 130beb4cabec |
children | fa1b4fa5b4f8 |
rev | line source |
---|---|
1
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1 /** |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
2 * URL used to access Neo4j REST API to execute queries. |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
3 * Update this parameter to your running server instance. |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
4 * |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
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 |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
6 */ |
2 | 7 popoto.rest.CYPHER_URL = "https://ismi-dev.mpiwg-berlin.mpg.de/neo4j-ismi/db/data/transaction/commit"; |
1
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
8 //popoto.rest.CYPHER_URL = "http://localhost:7474/db/data/transaction/commit"; |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
9 |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
10 /** |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
11 * Add this authorization property if your Neo4j server uses basic HTTP authentication. |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
12 * The value of this property must be "Basic <payload>", where "payload" is a base64 encoded string of "username:password". |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
13 * |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
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. |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
15 * |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
16 * For example Base64 encoding value of "neo4j:password" is "bmVvNGo6cGFzc3dvcmQ=" |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
17 */ |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
18 popoto.rest.AUTHORIZATION = "Basic " + btoa("neo4j:neo5j"); |
4
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
19 //popoto.rest.AUTHORIZATION = "Basic " + btoa("neo4j:eagrussell"); |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
20 |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
21 /** |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
22 * These functions fill the predefinedConstraints array for "PERSON" |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
23 * Called when the filter button is hit |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
24 * |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
25 * Uses the text box implementation currently |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
26 */ |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
27 // TODO: finish textbox implementation as backup and add in dropdown menu implementation |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
28 var personPredefinedConstraints = []; |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
29 d3.select("#filter-button").on("click", function (d) { |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
30 var constraint = d3.select("#constraint")[0][0].value; |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
31 |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
32 personPredefinedConstraints = [constraint]; |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
33 |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
34 // Recreate taxonomies panel |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
35 d3.select("#" + popoto.taxonomy.containerId).selectAll("ul").data([]).exit().remove(); |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
36 popoto.taxonomy.createTaxonomyPanel(); |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
37 |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
38 popoto.tools.reset(); |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
39 }); |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
40 |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
41 d3.select("#filter-button2").on("click", function (d) { |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
42 var constraint = d3.select("#constraint2")[0][0].value; |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
43 |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
44 personPredefinedConstraints = [constraint]; |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
45 |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
46 // Recreate taxonomies panel |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
47 d3.select("#" + popoto.taxonomy.containerId).selectAll("ul").data([]).exit().remove(); |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
48 popoto.taxonomy.createTaxonomyPanel(); |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
49 |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
50 popoto.tools.reset(); |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
51 }); |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
52 |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
53 |
1
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
54 |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
55 /** |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
56 * Define the Label provider you need for your application. |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
57 * This configuration is mandatory and should contain at least all the labels you could find in your graph model. |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
58 * |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
59 * In this alpha version only nodes with a label are supported. |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
60 * |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
61 * By default If no attributes are specified Neo4j internal ID will be used. |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
62 * These label provider configuration can be used to customize the node display in the graph. |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
63 * See www.popotojs.com or example for more details on available configuration options. |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
64 */ |
4
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
65 // TODO: add in predefined constraint functions for other nodeProviders |
1
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
66 popoto.provider.nodeProviders = { |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
67 "CODEX": { |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
68 "returnAttributes": ["label", "ismi_id", "identifier"], |
4
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
69 "displayAttribute": "label", |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
70 //"getPredefinedConstraints": function (node) { |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
71 // return personPredefinedConstraints; |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
72 //}, |
1
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
73 }, |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
74 "WITNESS": { |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
75 "returnAttributes": ["label", "ismi_id", "folios"], |
4
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
76 "displayAttribute": "label", |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
77 //"getPredefinedConstraints": function (node) { |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
78 // return personPredefinedConstraints; |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
79 //}, |
1
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
80 }, |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
81 "TEXT": { |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
82 "returnAttributes": ["label", "full_title", "ismi_id"], |
4
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
83 "displayAttribute": "label", |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
84 //"getPredefinedConstraints": function (node) { |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
85 // return personPredefinedConstraints; |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
86 //}, |
1
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
87 }, |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
88 "PERSON": { |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
89 "returnAttributes": ["label", "ismi_id", "death_date_text", "url"], |
4
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
90 "displayAttribute": "label", |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
91 "getPredefinedConstraints": function (node) { |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
92 return personPredefinedConstraints; |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
93 }, |
1
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
94 }, |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
95 "REPOSITORY": { |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
96 "returnAttributes": ["label", "ismi_id"], |
4
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
97 "displayAttribute": "label", |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
98 //"getPredefinedConstraints": function (node) { |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
99 // return personPredefinedConstraints; |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
100 //}, |
1
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
101 }, |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
102 "FLORUIT_DATE": { |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
103 "isSearchable": false |
4
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
104 //"getPredefinedConstraints": function (node) { |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
105 // return personPredefinedConstraints; |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
106 //}, |
1
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
107 } |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
108 }; |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
109 |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
110 /** |
4
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
111 * Popoto label provider |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
112 * Define the label provider used to customize the link displayed text: |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
113 */ |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
114 // TODO: ensure these cover all the different relations. Commented out for now. |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
115 /* |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
116 popoto.provider.linkProvider = { |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
117 |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
118 // Customize the text displayed on links: |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
119 "getLinkTextValue": function (link) { |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
120 |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
121 // The links labels are just changed in lower case in this example. |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
122 // But it is possible to use a localization mechanism here to replace values. |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
123 if (link.type === popoto.graph.link.LinkTypes.RELATION) { |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
124 |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
125 if (link.source.label == "PERSON") { |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
126 switch (link.label) { |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
127 case "was_student_of": |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
128 return "was student of"; |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
129 case "is_prime_alias_name_of": |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
130 return "is prime alias name of"; |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
131 case "was_born_in": |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
132 return "was born in"; |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
133 case "lived_in": |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
134 return "lived in"; |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
135 case "has_role": |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
136 return "has role"; |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
137 case "has_floruit_date": |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
138 return "has floruit date"; |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
139 case "died_in": |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
140 return "died in"; |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
141 default : |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
142 return "" |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
143 } |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
144 } |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
145 if (link.source.label == "CODEX") { |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
146 switch (link.label) { |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
147 case "owned_by": |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
148 return "owned by"; |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
149 case "is_alias_of": |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
150 return "is alias of"; |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
151 case "is_part_of": |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
152 return "is part of"; |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
153 } |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
154 } |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
155 if (link.source.label == "WITNESS") { |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
156 switch (link.label) { |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
157 case "was_copied_in": |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
158 return "was copied in"; |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
159 case "was_studied_by": |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
160 return "was studied by"; |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
161 case "had_patron": |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
162 return "had patron"; |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
163 case "is_part_of": |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
164 return "is part of"; |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
165 case "is_exemplar_of": |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
166 return "is exemplar of"; |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
167 case "has_title_written_as": |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
168 return "has title written as"; |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
169 case "has_author_written_as": |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
170 return "as author written as"; |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
171 case "was_copied_by": |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
172 return "was copied by"; |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
173 } |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
174 } |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
175 if (link.source.label == "PLACE") { |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
176 switch (link.label) { |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
177 case "is_part_of": |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
178 return "is part of"; |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
179 case "is_in": |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
180 return "is in"; |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
181 } |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
182 } |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
183 } else { |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
184 return popoto.provider.getSemanticValue(link.target); |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
185 } |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
186 } |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
187 |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
188 }; |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
189 */ |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
190 |
72dc19d750ad
ADDED: Basic text box implementation for predefined constraints, to be added to in the coming week. nodeProvider, linkProvider additions.
alistair
parents:
2
diff
changeset
|
191 /** |
1
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
192 * Here a listener is used to retrieve the total results count and update the page accordingly. |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
193 * This listener will be called on every graph modification. |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
194 */ |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
195 popoto.result.onTotalResultCount(function (count) { |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
196 document.getElementById("result-total-count").innerHTML = "(" + count + ")"; |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
197 }); |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
198 |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
199 /** |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
200 * The number of results returned can be changed with the following parameter. |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
201 * Default value is 100. |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
202 * |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
203 * Note that in this current alpha version no pagination mechanism is available in displayed results |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
204 */ |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
205 popoto.query.RESULTS_PAGE_SIZE = 1000; |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
206 |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
207 |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
208 /** |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
209 * For the alpha version, popoto.js has been generated with debug traces you can activate with the following properties: |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
210 * The value can be one in DEBUG, INFO, WARN, ERROR, NONE. |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
211 * |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
212 * With INFO level all the executed cypher query can be seen in the navigator console. |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
213 * Default is NONE |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
214 */ |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
215 popoto.logger.LEVEL = popoto.logger.LogLevels.INFO; |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
216 |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
217 /** |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
218 * Start popoto.js generation. |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
219 * The function requires the label to use as root element in the graph. |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
220 */ |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
221 popoto.start("PERSON"); |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
222 |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
223 /* do not zoom with scroll wheel */ |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
224 popoto.graph.WHEEL_ZOOM_ENABLED = false; |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
225 |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
226 /* show source and target relations */ |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
227 popoto.query.USE_RELATION_DIRECTION = true; |