annotate popoto/js/app-template.js @ 0:3b8b5aa8ab65

first check-in
author casties
date Mon, 31 Aug 2015 17:09:18 +0200
parents
children 0f4846255b20
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
1 /**
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
2 * URL used to access Neo4j REST API to execute queries.
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
3 * Update this parameter to your running server instance.
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
4 *
3b8b5aa8ab65 first check-in
casties
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
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
6 */
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
7 popoto.rest.CYPHER_URL = "https://ismi-dev.mpiwg-berlin.mpg.de:7473/db/data/transaction/commit";
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
8
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
9 /**
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
10 * Add this authorization property if your Neo4j server uses basic HTTP authentication.
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
11 * The value of this property must be "Basic <payload>", where "payload" is a base64 encoded string of "username:password".
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
12 *
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
13 * "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.
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
14 *
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
15 * For example Base64 encoding value of "neo4j:password" is "bmVvNGo6cGFzc3dvcmQ="
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
16 */
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
17 popoto.rest.AUTHORIZATION = "Basic " + btoa("neo4j:neo5j");
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
18
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
19 /**
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
20 * Define the Label provider you need for your application.
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
21 * This configuration is mandatory and should contain at least all the labels you could find in your graph model.
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
22 *
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
23 * In this alpha version only nodes with a label are supported.
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
24 *
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
25 * By default If no attributes are specified Neo4j internal ID will be used.
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
26 * These label provider configuration can be used to customize the node display in the graph.
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
27 * See www.popotojs.com or example for more details on available configuration options.
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
28 */
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
29 popoto.provider.nodeProviders = {
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
30 "CODEX": {
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
31 "returnAttributes": ["label", "ismi_id", "identifier"],
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
32 "constraintAttribute": "ismi_id"
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
33 },
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
34 "WITNESS": {
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
35 "returnAttributes": ["label", "ismi_id", "folios"],
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
36 "constraintAttribute": "ismi_id"
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
37 },
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
38 "TEXT": {
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
39 "returnAttributes": ["label", "full_title", "ismi_id"],
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
40 "constraintAttribute": "ismi_id"
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
41 },
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
42 "PERSON": {
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
43 "returnAttributes": ["label", "ismi_id", "death_date_text", "url"],
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
44 "constraintAttribute": "ismi_id"
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
45 },
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
46 "REPOSITORY": {
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
47 "returnAttributes": ["label", "ismi_id"],
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
48 "constraintAttribute": "ismi_id"
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
49 }
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
50 };
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
51
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
52 /**
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
53 * Here a listener is used to retrieve the total results count and update the page accordingly.
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
54 * This listener will be called on every graph modification.
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
55 */
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
56 popoto.result.onTotalResultCount(function (count) {
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
57 document.getElementById("result-total-count").innerHTML = "(" + count + ")";
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
58 });
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
59
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
60 /**
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
61 * The number of results returned can be changed with the following parameter.
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
62 * Default value is 100.
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
63 *
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
64 * Note that in this current alpha version no pagination mechanism is available in displayed results
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
65 */
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
66 //popoto.query.RESULTS_PAGE_SIZE = 100;
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
67
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
68
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
69 /**
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
70 * For the alpha version, popoto.js has been generated with debug traces you can activate with the following properties:
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
71 * The value can be one in DEBUG, INFO, WARN, ERROR, NONE.
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
72 *
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
73 * With INFO level all the executed cypher query can be seen in the navigator console.
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
74 * Default is NONE
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
75 */
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
76 popoto.logger.LEVEL = popoto.logger.LogLevels.INFO;
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
77
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
78 /**
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
79 * Start popoto.js generation.
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
80 * The function requires the label to use as root element in the graph.
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
81 */
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
82 popoto.start("PERSON");
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
83
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
84 /* do not zoom with scroll wheel */
3b8b5aa8ab65 first check-in
casties
parents:
diff changeset
85 popoto.graph.WHEEL_ZOOM_ENABLED = false;