Mercurial > hg > NetworkVis
annotate popoto/js/app-ismi.js @ 1:db013b2f3e10
added displayAttribute to show on individual nodes.
pull all labels and add getLabelFilter to ignore labels (currently with underscore).
added ismi-specific app-template and html file.
author | Robert Casties <casties@mpiwg-berlin.mpg.de> |
---|---|
date | Tue, 01 Sep 2015 16:56:31 +0200 |
parents | |
children | 130beb4cabec |
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 */ |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
7 popoto.rest.CYPHER_URL = "https://ismi-dev.mpiwg-berlin.mpg.de:7473/db/data/transaction/commit"; |
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"); |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
19 |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
20 /** |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
21 * 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
|
22 * 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
|
23 * |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
24 * 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
|
25 * |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
26 * 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
|
27 * 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
|
28 * 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
|
29 */ |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
30 popoto.provider.nodeProviders = { |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
31 "CODEX": { |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
32 "returnAttributes": ["label", "ismi_id", "identifier"], |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
33 "displayAttribute": "label" |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
34 }, |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
35 "WITNESS": { |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
36 "returnAttributes": ["label", "ismi_id", "folios"], |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
37 "displayAttribute": "label" |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
38 }, |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
39 "TEXT": { |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
40 "returnAttributes": ["label", "full_title", "ismi_id"], |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
41 "displayAttribute": "label" |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
42 }, |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
43 "PERSON": { |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
44 "returnAttributes": ["label", "ismi_id", "death_date_text", "url"], |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
45 "displayAttribute": "label" |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
46 }, |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
47 "REPOSITORY": { |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
48 "returnAttributes": ["label", "ismi_id"], |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
49 "displayAttribute": "label" |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
50 }, |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
51 "FLORUIT_DATE": { |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
52 "isSearchable": false |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
53 } |
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 /** |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
57 * 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
|
58 * 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
|
59 */ |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
60 popoto.result.onTotalResultCount(function (count) { |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
61 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
|
62 }); |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
63 |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
64 /** |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
65 * 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
|
66 * Default value is 100. |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
67 * |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
68 * 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
|
69 */ |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
70 popoto.query.RESULTS_PAGE_SIZE = 1000; |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
71 |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
72 |
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 * 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
|
75 * 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
|
76 * |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
77 * 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
|
78 * Default is NONE |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
79 */ |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
80 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
|
81 |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
82 /** |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
83 * Start popoto.js generation. |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
84 * 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
|
85 */ |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
86 popoto.start("PERSON"); |
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 /* do not zoom with scroll wheel */ |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
89 popoto.graph.WHEEL_ZOOM_ENABLED = false; |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
90 |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
91 /* show source and target relations */ |
db013b2f3e10
added displayAttribute to show on individual nodes.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
92 popoto.query.USE_RELATION_DIRECTION = true; |