├── .eslintignore ├── .eslintrc.js ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── workflows │ └── nodejs.yml ├── .gitignore ├── .npmrc ├── .prettierignore ├── .prettierrc.json ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── __mocks__ ├── leaflet.js ├── neo4jDesktopApi.js └── window.js ├── img ├── desktop_graphapp_add.png ├── desktop_graphapp_add_2.png └── desktop_graphapp_install.png ├── package-lock.json ├── package.json ├── public ├── favicon.ico ├── icon.png ├── index.html └── manifest.json ├── release-notes.md └── src ├── App.css ├── App.js ├── components ├── ColorPicker.js ├── ColorPicker.test.js ├── Geoman.js ├── Layer.js ├── Layer.test.js ├── Map.js ├── Map.test.js ├── Menu.js ├── Menu.test.js ├── SettingsModal.js ├── SideBar.js ├── SideBar.test.js ├── constants.js └── utils.js ├── index.css ├── index.js └── services ├── neo4jService.js └── neo4jService.test.js /.eslintignore: -------------------------------------------------------------------------------- 1 | build/* 2 | dist/* 3 | node_modules/* 4 | .git/* 5 | .github/* 6 | .idea/* 7 | .vscode/* -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | browser: true, 4 | es6: true, 5 | node: false, 6 | }, 7 | extends: ["eslint:recommended", "prettier", "plugin:react/recommended", "plugin:jest/recommended"], 8 | parser: "babel-eslint", 9 | parserOptions: { 10 | ecmaFeatures: { 11 | jsx: true, 12 | }, 13 | ecmaVersion: 11, 14 | sourceType: "module", 15 | }, 16 | plugins: ["react", "prettier", "flowtype", "react-hooks", "jest"], 17 | rules: { 18 | "func-style": ["error", "expression", { allowArrowFunctions: true }], 19 | "brace-style": ["error", "1tbs", { allowSingleLine: true }], 20 | "comma-dangle": [ 21 | "error", 22 | { 23 | arrays: "always-multiline", 24 | exports: "always-multiline", 25 | functions: "always-multiline", 26 | imports: "always-multiline", 27 | objects: "always-multiline", 28 | }, 29 | ], 30 | "comma-spacing": ["error", { before: false, after: true }], 31 | "react/prop-types": 0, 32 | "jest/valid-expect": "off", 33 | "no-case-declarations": "off", 34 | "react/display-name": "off", 35 | }, 36 | }; 37 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Neo4j *Desktop* Version [e.g. 3.2.1] 30 | - Neo4j Version [e.g 3.4] 31 | - Neomap Version [e.g. 22] 32 | 33 | 34 | **Additional context** 35 | Add any other context about the problem here. 36 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/workflows/nodejs.yml: -------------------------------------------------------------------------------- 1 | name: Node CI 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | build: 7 | 8 | runs-on: ubuntu-latest 9 | 10 | strategy: 11 | matrix: 12 | node-version: [10.x, 12.x] 13 | 14 | steps: 15 | - uses: actions/checkout@v1 16 | - name: Use Node.js ${{ matrix.node-version }} 17 | uses: actions/setup-node@v1 18 | with: 19 | node-version: ${{ matrix.node-version }} 20 | - name: npm install, build, and test 21 | run: | 22 | npm ci 23 | npm run build --if-present 24 | npm test 25 | env: 26 | CI: true 27 | - name: eslint 28 | run: | 29 | npx eslint . 30 | env: 31 | CI: true 32 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Custom Files 2 | # tmp files 3 | *~ 4 | 5 | .idea 6 | 7 | _tests 8 | 9 | .vscode 10 | 11 | # Logs 12 | logs 13 | *.log 14 | npm-debug.log* 15 | yarn-debug.log* 16 | yarn-error.log* 17 | lerna-debug.log* 18 | 19 | # Diagnostic reports (https://nodejs.org/api/report.html) 20 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 21 | 22 | # Runtime data 23 | pids 24 | *.pid 25 | *.seed 26 | *.pid.lock 27 | 28 | # Directory for instrumented libs generated by jscoverage/JSCover 29 | lib-cov 30 | 31 | # Coverage directory used by tools like istanbul 32 | coverage 33 | *.lcov 34 | 35 | # nyc test coverage 36 | .nyc_output 37 | 38 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 39 | .grunt 40 | 41 | # Bower dependency directory (https://bower.io/) 42 | bower_components 43 | 44 | # node-waf configuration 45 | .lock-wscript 46 | 47 | # Compiled binary addons (https://nodejs.org/api/addons.html) 48 | build/Release 49 | 50 | # Dependency directories 51 | node_modules/ 52 | jspm_packages/ 53 | 54 | # Snowpack dependency directory (https://snowpack.dev/) 55 | web_modules/ 56 | 57 | # TypeScript cache 58 | *.tsbuildinfo 59 | 60 | # Optional npm cache directory 61 | .npm 62 | 63 | # Optional eslint cache 64 | .eslintcache 65 | 66 | # Microbundle cache 67 | .rpt2_cache/ 68 | .rts2_cache_cjs/ 69 | .rts2_cache_es/ 70 | .rts2_cache_umd/ 71 | 72 | # Optional REPL history 73 | .node_repl_history 74 | 75 | # Output of 'npm pack' 76 | *.tgz 77 | 78 | # Yarn Integrity file 79 | .yarn-integrity 80 | 81 | # dotenv environment variables file 82 | .env 83 | .env.test 84 | 85 | # parcel-bundler cache (https://parceljs.org/) 86 | .cache 87 | .parcel-cache 88 | 89 | # Next.js build output 90 | .next 91 | 92 | # Nuxt.js build / generate output 93 | .nuxt 94 | dist 95 | 96 | # Gatsby files 97 | .cache/ 98 | # Comment in the public line in if your project uses Gatsby and not Next.js 99 | # https://nextjs.org/blog/next-9-1#public-directory-support 100 | # public 101 | 102 | # vuepress build output 103 | .vuepress/dist 104 | 105 | # Serverless directories 106 | .serverless/ 107 | 108 | # FuseBox cache 109 | .fusebox/ 110 | 111 | # DynamoDB Local files 112 | .dynamodb/ 113 | 114 | # TernJS port file 115 | .tern-port 116 | 117 | # Stores VSCode versions used for testing VSCode extensions 118 | .vscode-test 119 | 120 | # yarn v2 121 | 122 | .yarn/cache 123 | .yarn/unplugged 124 | .yarn/build-state.yml 125 | .pnp.* 126 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | registry=https://neo.jfrog.io/neo/api/npm/npm/ 2 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | # Ignore artifacts: 2 | build 3 | coverage 4 | dist 5 | .vscode 6 | .idea 7 | .github 8 | 9 | package.json 10 | package-lock.json 11 | 12 | node_modules -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 120, 3 | "trailingComma": "all", 4 | "tabWidth": 2, 5 | "semi": true, 6 | "bracketSpacing": true 7 | } 8 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contribution guide (WIP) 2 | 3 | All contributions are currently welcome. Some tasks that are in our priority list right now include: 4 | 5 | - Code review and improvements using latest React release and standard (hooks) https://github.com/stellasia/neomap/issues/55 6 | - Write real covering tests https://github.com/stellasia/neomap/issues/62 7 | - Map: feature request: https://github.com/stellasia/neomap/issues/51 8 | - UI needs to be checked by someone with more experience in UI/UX 9 | 10 | ## Issue contribution 11 | 12 | Open an issue if: 13 | 14 | - You encounter problems installing or using neomap 15 | - You find something that looks like a bug (even if you are unsure) 16 | - You would like us to include a new feature 17 | 18 | ## Documentation contribution 19 | 20 | Right now the documentation is hosted on GitHub wiki: https://github.com/stellasia/neomap/wiki. Contact me if you would like to help improving it. 21 | 22 | ## Code contribution 23 | 24 | 1. Let the others know you are working on the topic: 25 | - comment on an existing issue or 26 | - create a new issue if the topic is new. It will also allow us to make sure we are all aligned with the direction we want to push the project to. 27 | 2. Clone the repo and start a new branch on your local clone 28 | 3. Develop on your branch 29 | 4. Make sure you are not breaking tests and potentially add new ones (ok, given the state of the tests right now, this is not a big constraint) 30 | 5. Open a PR againt the dev branch referencing the issue 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | logo:Neomap 3 |

neomap

4 |

5 | 6 | 7 | 8 |

9 |
10 | 11 | A Neo4J Desktop (React-based) application to visualize nodes with geographical attributes on a map. 12 | 13 | 14 | ## This project is not maintained anymore 15 | Looking for map with Neo4j? Check out the [neodash](https://github.com/neo4j-labs/neodash) project. 16 | 17 | ## Installation 18 | 19 | ### Add the app to Neo4jDesktop 20 | 21 | #### From NPM package URL (Recommended) 22 | 23 | 1. Open neo4j desktop and go to "Graph Applications" view: 24 | 25 | ![](img/desktop_graphapp_install.png) 26 | 27 | 2. Paste the following link in the text input: 28 | 29 | https://registry.npmjs.org/neomap 30 | 31 | #### From tarball 32 | 33 | 1. Go to the repository [releases](https://github.com/stellasia/neomap/releases) 34 | 2. Download the `neomap-.tar.gz` 35 | 3. Open neo4j desktop and go to "Graph Applications" view (see image in previous section) 36 | 4. Drag and drop the tarball you downloaded earlier below "Install Graph Application" 37 | 5. Trust the application 38 | 6. The application is now available and you can add it to your projects: 39 | 40 | ![](img/desktop_graphapp_add.png) 41 | 42 | 7. Click "Add" 43 | 44 | ![](img/desktop_graphapp_add_2.png) 45 | 46 | ## Usage 47 | 48 | Read the [tutorial](https://github.com/stellasia/neomap/wiki/NeoMap-Tutorial/) or the [FAQ](https://github.com/stellasia/neomap/wiki/FAQ). 49 | 50 | ## Want to contribute? 51 | 52 | See [CONTRIBUTING.md](CONTRIBUTING.md). 53 | 54 | ### WARNING 55 | 56 | I am a data scientist, not a front-end developer. If someone with expertise with React wants to take a look and suggest improvements, that would be very welcome! 57 | 58 | ### Developer mode 59 | 60 | 1. Clone this repo 61 | 62 | 2. Install dependencies: 63 | 64 | npm install 65 | 66 | 3. Start the development server: 67 | 68 | npm run start 69 | 70 | 4. Configure Neo4jDesktop by enabling the development mode in settings with the following parameters: 71 | 72 | - Entry point: `http://localhost:3000` 73 | - Root path: root of this repository 74 | 75 | 5. Run tests: install dev dependencies and 76 | 77 | npm run test 78 | 79 | ### Build for release (TODO: add this to CI?) 80 | 81 | 1. Make sure the version in package.json is correct 82 | 2. Build: 83 | 84 | npm run build 85 | 86 | 3. Create tgz package: 87 | 88 | npm pack 89 | 90 | 4. Publish to NPM: (after npm login): 91 | 92 | `npm publish neomap-.tgz # --registry=https://registry.npmjs.org` 93 | -------------------------------------------------------------------------------- /__mocks__/leaflet.js: -------------------------------------------------------------------------------- 1 | /** 2 | * This is a copy of the very nice jest leaflet mock from 3 | * [react-leaflet](https://github.com/PaulLeCam/react-leaflet/blob/master/__mocks__/leaflet.js). 4 | * 5 | * Consider contributing back to the package :) 6 | */ 7 | 8 | import { L } from "leaflet"; 9 | const LeafletMock = jest.createMockFromModule("leaflet"); 10 | LeafletMock.Symbol.arrowHead = jest.fn(() => {}); 11 | 12 | class ControlMock extends LeafletMock.Control { 13 | constructor(options) { 14 | super(); 15 | this.options = { ...L.Control.prototype.options, ...options }; 16 | } 17 | 18 | getPosition() { 19 | return this.options.position; 20 | } 21 | 22 | setPosition(position) { 23 | this.options.position = position; 24 | return this; 25 | } 26 | } 27 | 28 | const controlMock = (options) => new ControlMock(options); 29 | 30 | class LayersControlMock extends ControlMock { 31 | constructor(baseLayers = [], overlays = [], options) { 32 | super(options); 33 | this._layers = []; 34 | 35 | baseLayers.forEach((layer, i) => { 36 | this._addLayer(layer, i); 37 | }); 38 | overlays.forEach((layer, i) => { 39 | this._addLayer(layer, i, true); 40 | }); 41 | } 42 | 43 | _addLayer(layer, name, overlay) { 44 | this._layers.push({ layer, name, overlay }); 45 | } 46 | 47 | addBaseLayer(layer, name) { 48 | this._addLayer(layer, name); 49 | return this; 50 | } 51 | 52 | addOverlay(layer, name) { 53 | this._addLayer(layer, name, true); 54 | return this; 55 | } 56 | 57 | removeLayer(obj) { 58 | this._layers.splice(this._layers.indexOf(obj), 1); 59 | } 60 | } 61 | 62 | ControlMock.Layers = LayersControlMock; 63 | controlMock.layers = (baseLayers, overlays, options) => { 64 | return new LayersControlMock(baseLayers, overlays, options); 65 | }; 66 | 67 | class MapMock extends LeafletMock.Map { 68 | constructor(id, options = {}) { 69 | super(); 70 | Object.assign(this, L.Evented.prototype); 71 | 72 | this.options = { ...L.Map.prototype.options, ...options }; 73 | this._container = id; 74 | 75 | if (options.bounds) { 76 | this.fitBounds(options.bounds, options.boundsOptions); 77 | } 78 | 79 | if (options.maxBounds) { 80 | this.setMaxBounds(options.maxBounds); 81 | } 82 | 83 | if (options.center && options.zoom !== undefined) { 84 | this.setView(L.latLng(options.center), options.zoom); 85 | } 86 | } 87 | 88 | _limitZoom(zoom) { 89 | const min = this.getMinZoom(); 90 | const max = this.getMaxZoom(); 91 | return Math.max(min, Math.min(max, zoom)); 92 | } 93 | 94 | _resetView(center, zoom) { 95 | this._initialCenter = center; 96 | this._zoom = zoom; 97 | } 98 | 99 | fitBounds(bounds, options) { 100 | this._bounds = bounds; 101 | this._boundsOptions = options; 102 | } 103 | 104 | getBounds() { 105 | return this._bounds; 106 | } 107 | 108 | getCenter() { 109 | return this._initialCenter; 110 | } 111 | 112 | getMaxZoom() { 113 | return this.options.maxZoom === undefined ? Infinity : this.options.maxZoom; 114 | } 115 | 116 | getMinZoom() { 117 | return this.options.minZoom === undefined ? 0 : this.options.minZoom; 118 | } 119 | 120 | getZoom() { 121 | return this._zoom; 122 | } 123 | 124 | setMaxBounds(bounds) { 125 | bounds = L.latLngBounds(bounds); 126 | this.options.maxBounds = bounds; 127 | return this; 128 | } 129 | 130 | setView(center, zoom) { 131 | zoom = zoom === undefined ? this.getZoom() : zoom; 132 | this._resetView(L.latLng(center), this._limitZoom(zoom)); 133 | return this; 134 | } 135 | 136 | setZoom(zoom) { 137 | return this.setView(this.getCenter(), zoom); 138 | } 139 | } 140 | 141 | class PopupMock extends LeafletMock.Popup { 142 | constructor(options, source) { 143 | super(); 144 | Object.assign(this, L.Evented.prototype); 145 | 146 | this.options = { ...L.Popup.prototype.options, ...options }; 147 | this._source = source; 148 | } 149 | 150 | getContent() { 151 | return this._content; 152 | } 153 | 154 | setContent(content) { 155 | this._content = content; 156 | } 157 | } 158 | 159 | // eslint-disable-next-line no-undef 160 | module.exports = { 161 | ...LeafletMock, 162 | Control: ControlMock, 163 | control: controlMock, 164 | LatLng: L.LatLng, 165 | latLng: L.latLng, 166 | LatLngBounds: L.LatLngBounds, 167 | latLngBounds: L.latLngBounds, 168 | Map: MapMock, 169 | map: (id, options) => new MapMock(id, options), 170 | Popup: PopupMock, 171 | popup: (options, source) => new PopupMock(options, source), 172 | }; 173 | -------------------------------------------------------------------------------- /__mocks__/neo4jDesktopApi.js: -------------------------------------------------------------------------------- 1 | Object.defineProperty(window, "neo4jDesktopApi", { 2 | writable: true, 3 | value: { 4 | getContext: jest.fn().mockImplementation(() => { 5 | const mockGraph = { 6 | name: "mock graph", 7 | description: "mock graph for testing", 8 | status: "ACTIVE", 9 | connection: { 10 | configuration: { 11 | protocols: { 12 | bolt: { 13 | url: "", 14 | username: "", 15 | password: "", 16 | }, 17 | }, 18 | }, 19 | }, 20 | }; 21 | 22 | const mockProject = { 23 | graphs: [mockGraph], 24 | }; 25 | 26 | const mockContext = { 27 | projects: [mockProject], 28 | }; 29 | 30 | return Promise.resolve(mockContext); 31 | }), 32 | }, 33 | }); 34 | -------------------------------------------------------------------------------- /__mocks__/window.js: -------------------------------------------------------------------------------- 1 | Object.defineProperty(window, "confirm", { 2 | value: jest.fn().mockImplementation(() => { 3 | return true; 4 | }), 5 | }); 6 | -------------------------------------------------------------------------------- /img/desktop_graphapp_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stellasia/neomap/09fd7ca002c278699265b9f1b80db6265b2cd576/img/desktop_graphapp_add.png -------------------------------------------------------------------------------- /img/desktop_graphapp_add_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stellasia/neomap/09fd7ca002c278699265b9f1b80db6265b2cd576/img/desktop_graphapp_add_2.png -------------------------------------------------------------------------------- /img/desktop_graphapp_install.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stellasia/neomap/09fd7ca002c278699265b9f1b80db6265b2cd576/img/desktop_graphapp_install.png -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "neomap", 3 | "version": "0.5.1", 4 | "author": "Estelle Scifo", 5 | "private": false, 6 | "neo4jDesktop": { 7 | "apiVersion": ">=1.2.x <2.0.0", 8 | "licenseRequired": false 9 | }, 10 | "dependencies": { 11 | "@geoman-io/leaflet-geoman-free": "^2.11.2", 12 | "bootstrap": "^4.5.2", 13 | "downloadjs": "^1.4.7", 14 | "graph-app-kit": "^1.0.4", 15 | "leaflet": "^1.5.1", 16 | "leaflet-polylinedecorator": "^1.6.0", 17 | "leaflet.heat": "^0.2.0", 18 | "leaflet.markercluster": "^1.4.1", 19 | "neo4j-driver": "^4.1.1", 20 | "prettier": "^2.4.1", 21 | "react": "^16.13.1", 22 | "react-bootstrap": "^1.3.0", 23 | "react-color": "^2.18.1", 24 | "react-confirm-alert": "^2.6.1", 25 | "react-dom": "^16.13.1", 26 | "react-scripts": "^3.4.3", 27 | "react-select": "^3.1.0" 28 | }, 29 | "scripts": { 30 | "start": "react-scripts start", 31 | "build": "rm -rf dist && react-scripts build && mv build dist", 32 | "test": "react-scripts test", 33 | "test:debug": "react-scripts --inspect-brk test --runInBand --no-cache", 34 | "eject": "react-scripts eject" 35 | }, 36 | "files": [ 37 | "dist/", 38 | "package.json" 39 | ], 40 | "description": "A Neo4j Desktop application to visualize nodes with geographic attributes on a map.", 41 | "main": "index.js", 42 | "devDependencies": { 43 | "@testing-library/jest-dom": "^5.11.2", 44 | "@testing-library/react": "^10.4.8", 45 | "babel-eslint": "^10.1.0", 46 | "eslint-config-prettier": "^8.3.0", 47 | "eslint-plugin-jest": "^24.5.2", 48 | "eslint-plugin-prettier": "^4.0.0", 49 | "jest": "^24.9.0" 50 | }, 51 | "repository": "git://github.com/stellasia/neomap.git", 52 | "icons": [ 53 | { 54 | "src": "icon.png", 55 | "type": "png" 56 | } 57 | ], 58 | "keywords": [ 59 | "neo4j", 60 | "leaflet", 61 | "map", 62 | "gis" 63 | ], 64 | "bugs": { 65 | "url": "https://github.com/stellasia/neomap/issues" 66 | }, 67 | "licence": "SEE LICENSE IN ", 68 | "homepage": ".", 69 | "browserslist": { 70 | "production": [ 71 | ">0.2%", 72 | "not dead", 73 | "not op_mini all" 74 | ], 75 | "development": [ 76 | "last 1 chrome version", 77 | "last 1 firefox version", 78 | "last 1 safari version" 79 | ] 80 | }, 81 | "optionalDependencies": { 82 | "fsevents": "^2.3.2" 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stellasia/neomap/09fd7ca002c278699265b9f1b80db6265b2cd576/public/favicon.ico -------------------------------------------------------------------------------- /public/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stellasia/neomap/09fd7ca002c278699265b9f1b80db6265b2cd576/public/icon.png -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 18 | 19 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 36 | 37 | NeoMap 38 | 39 | 40 | 41 | 42 |
43 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "Neomap", 3 | "start_url": ".", 4 | "display": "standalone", 5 | "homepage": "http://github.com/stellasia/neomap", 6 | "apiVersion": ">=1.2.x <2.0.0" 7 | } 8 | -------------------------------------------------------------------------------- /release-notes.md: -------------------------------------------------------------------------------- 1 | # neomap release notes 2 | 3 | ## 0.5.1 (2020-08-08) 4 | 5 | - Fix overflow in side bar (layer configuration) 6 | - Publish package to NPM and update installation instructions 7 | 8 | ## 0.5.0 (2020-07-04) 9 | 10 | - Support for clusters in map rendering (#50) 11 | - Add support for Neo4j point built-in type (#58) 12 | - Better support for Neo4j Desktop versions (#53) 13 | - Support for Neo4j 4.x (#60) 14 | - Some code refactoring (#52 - #58) 15 | 16 | ## 0.4.0 (2020-02-27) 17 | 18 | - Performance improvements for map display (#32) 19 | - Use a color picker to choose marker color in the full palette (#11) 20 | - Change marker tooltips to popup (so that one can copy/paste the content) and icon markers to circle markers 21 | - Introduction of a "Polyline" rendering. So far, only supports single polyline (beta) 22 | - Added support for [neo4j-spatial plugin](https://github.com/neo4j-contrib/spatial) SimplePoint layers (#5) (beta) 23 | - Add "Save As" and "Open" basic functionality (beta) 24 | - Bug fix: enforce tooltip is a string (fix rendering issue in some weird cases) 25 | - Fix CI on GitHub 26 | - Code refactoring by introducing a neo4jService to isolate the DB queries 27 | 28 | ## 0.3.1 (2019-11-19) 29 | 30 | - Remove warning popup when changing the limit (#36); 31 | - Fix the tooltip input display (#34); 32 | - Improve map centering/zooming (now fit bounds); 33 | - Lat/lon/tooltip labels now selectable from list of available labels; 34 | 35 | ## 0.3.0 (2019-11-17) 36 | 37 | - Better error and warning handling: 38 | - Inform the user when query returns no result 39 | - Warning when switching from advanced to simple query 40 | - Warning before deleting a layer (definitive action) 41 | - Possibility to switch from simple to advanced layer with pre-filled query 42 | - Possibility to show the generated query for simple mode layer 43 | - Display the selected marker color in the layer header (left side bar) 44 | - Maximum number of points shown on the map is customizable (marker layer) 45 | -------------------------------------------------------------------------------- /src/App.css: -------------------------------------------------------------------------------- 1 | html, 2 | body, 3 | #root { 4 | padding: 0; 5 | margin: 0; 6 | height: 100%; 7 | } 8 | 9 | body { 10 | background: rgba(0, 0, 0, 0.75); 11 | color: #fff; 12 | } 13 | 14 | #wrapper { 15 | height: 100%; 16 | position: relative; 17 | margin: auto; 18 | width: 100%; 19 | } 20 | 21 | #sidebar { 22 | position: absolute; 23 | width: 30%; 24 | min-height: 100%; 25 | padding: 0; 26 | height: 100%; 27 | overflow-y: scroll; 28 | } 29 | 30 | .navbar { 31 | margin-top: 0; 32 | margin-bottom: 20px; 33 | background: darkgrey; 34 | color: #fff; 35 | padding-left: 5%; 36 | } 37 | 38 | #collapse-button { 39 | padding-right: 0; 40 | } 41 | 42 | #map { 43 | height: 100%; 44 | } 45 | 46 | #app-maparea { 47 | position: absolute; 48 | height: inherit; 49 | padding: 0; 50 | } 51 | 52 | .leaflet-pane { 53 | z-index: 1; 54 | } 55 | 56 | .leaflet-container { 57 | position: relative; 58 | width: 100%; 59 | height: inherit; 60 | min-height: 90em; 61 | box-shadow: 0 5px 5px 5px white; 62 | } 63 | 64 | .btn { 65 | margin-top: 20px; 66 | } 67 | 68 | .select { 69 | position: absolute; 70 | left: 0; 71 | width: 100%; 72 | height: 100%; 73 | top: 0; 74 | padding: 0; 75 | } 76 | 77 | .accordion { 78 | margin: 0 3%; 79 | } 80 | 81 | .card { 82 | background-color: inherit; 83 | border: 1px solid white; 84 | padding: 0 10px; 85 | } 86 | 87 | .accordion > .card { 88 | overflow: visible; 89 | } 90 | 91 | .disabled { 92 | color: grey; 93 | } 94 | 95 | .nav-tabs { 96 | margin-bottom: 20px; 97 | background-color: #aaa; 98 | color: black; 99 | } 100 | 101 | p.help { 102 | margin: 2px; 103 | font-style: italic; 104 | font-size: 0.8em; 105 | color: #999; 106 | } 107 | 108 | .form-label { 109 | margin-bottom: 0.5rem; 110 | font-weight: 500; 111 | line-height: 1.2; 112 | font-size: 1.25rem; 113 | } 114 | 115 | h4 { 116 | margin-top: 1.1em; 117 | color: #aaa; 118 | } 119 | 120 | .dropdown-item { 121 | position: relative; 122 | } 123 | 124 | .beta::after { 125 | content: "(beta)"; 126 | color: goldenrod; 127 | font-size: 12px; 128 | font-weight: bold; 129 | padding: 4px; 130 | position: absolute; 131 | bottom: 3px; 132 | } 133 | 134 | .leaflet-control-layers { 135 | font-size: 1.25rem; 136 | } 137 | 138 | .leaflet-control-layers section { 139 | padding: 5px 10px; 140 | } 141 | 142 | .modal-content { 143 | color: #111; 144 | } 145 | -------------------------------------------------------------------------------- /src/App.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import download from "downloadjs"; 3 | import { Map } from "./components/Map"; 4 | import { Menu } from "./components/Menu"; 5 | import { SideBar } from "./components/SideBar"; 6 | import { neo4jService } from "./services/neo4jService"; 7 | import "./App.css"; 8 | 9 | export const App = React.memo(() => { 10 | /** 11 | * Given the underlying neo4jDesktop drivers' dependency on global window context, 12 | * we need to import an instance here to the boot a service instance that reads 13 | * App.js window instance. The service is a singleton, 14 | * and subsequent windows will get the same instance with drivers created here. 15 | * 16 | * TODO: FIXME! Redesign neo4jService instantiation with full consideration for global window dependency 17 | */ 18 | neo4jService._getNeo4jDriver(); 19 | 20 | React.useEffect(() => { 21 | // on App component mount clear coordinates of shapes that could've been drawn during previous session 22 | localStorage.removeItem("rectangle_coordinates"); 23 | }, []); 24 | 25 | const defaultMapOffset = 30; 26 | const calcOffset = () => { 27 | // guarantees 60px wide sidebar 28 | return (60 / window.innerWidth) * 100 - defaultMapOffset; 29 | }; 30 | 31 | const [layers, setLayers] = React.useState([]); 32 | const [collapsed, setCollapse] = React.useState(false); 33 | const [hiddenSidebarOffset, setHiddenSidebarOffset] = React.useState(calcOffset()); 34 | 35 | const addLayer = (layer) => { 36 | setLayers([...layers, layer]); 37 | }; 38 | 39 | const updateLayer = (layer) => { 40 | const updatedLayers = layers.map((currentLayer) => { 41 | if (currentLayer.ukey === layer.ukey) { 42 | return layer; 43 | } 44 | return currentLayer; 45 | }); 46 | 47 | setLayers(updatedLayers); 48 | }; 49 | 50 | const removeLayer = (key) => { 51 | const filteredLayers = layers.filter((layer) => layer.ukey !== key); 52 | 53 | setLayers(filteredLayers); 54 | }; 55 | 56 | const saveConfigToFile = (e) => { 57 | const config = JSON.stringify(layers); 58 | const fileName = "neomap_config.json"; 59 | download(config, fileName, "application/json"); 60 | e.preventDefault(); 61 | }; 62 | 63 | const loadConfigFromFile = (e) => { 64 | const fileSelector = document.createElement("input"); 65 | fileSelector.setAttribute("type", "file"); 66 | fileSelector.click(); 67 | fileSelector.onchange = (ev) => { 68 | const file = ev.target.files[0]; 69 | const fileReader = new FileReader(); 70 | fileReader.onloadend = (e) => { 71 | const content = e.target.result; 72 | try { 73 | const loadedLayers = JSON.parse(content); 74 | setLayers(loadedLayers); 75 | } catch (err) { 76 | // TODO: Build error UI 77 | console.log("Failed to load and parse data from file", err); 78 | } 79 | }; 80 | fileReader.readAsText(file); 81 | }; 82 | e.preventDefault(); 83 | }; 84 | 85 | React.useEffect(() => { 86 | const handleResize = () => setHiddenSidebarOffset(calcOffset()); 87 | 88 | window.addEventListener("resize", handleResize); 89 | // Remove event listener on cleanup 90 | return () => window.removeEventListener("resize", handleResize); 91 | }, []); 92 | 93 | const sidebarOffset = collapsed ? hiddenSidebarOffset : 0; 94 | const mapOffset = defaultMapOffset + sidebarOffset; 95 | const mapWidth = 100 - mapOffset; 96 | 97 | const toggleCollapse = () => { 98 | setCollapse(!collapsed); 99 | }; 100 | 101 | return ( 102 |
103 | 112 |
113 | 114 |
115 |
116 | ); 117 | }); 118 | -------------------------------------------------------------------------------- /src/components/ColorPicker.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import reactCSS from "reactcss"; 3 | import { SketchPicker } from "react-color"; 4 | 5 | export const ColorPicker = React.memo(({ color, handleColorChange }) => { 6 | const [displayColorPicker, setDisplayColorPicker] = React.useState(false); 7 | 8 | const handleClick = () => { 9 | setDisplayColorPicker(!displayColorPicker); 10 | }; 11 | 12 | const handleClose = () => { 13 | setDisplayColorPicker(false); 14 | }; 15 | 16 | const selectColor = (proposedColor) => { 17 | handleColorChange(proposedColor.rgb); 18 | }; 19 | 20 | const selectedColor = color || { r: 0, g: 0, b: 255, a: 1 }; 21 | let rgba_color = `rgba(${selectedColor.r}, ${selectedColor.g}, ${selectedColor.b}, ${selectedColor.a})`; 22 | 23 | const styles = reactCSS({ 24 | default: { 25 | color: { 26 | padding: "5px", 27 | width: "50px", 28 | height: "20px", 29 | background: rgba_color, 30 | }, 31 | swatch: { 32 | marginLeft: "10px", 33 | display: "inline-block", 34 | cursor: "pointer", 35 | }, 36 | popover: { 37 | position: "absolute", 38 | zIndex: "2", 39 | bottom: "110px", 40 | left: "100px", 41 | }, 42 | cover: { 43 | position: "fixed", 44 | bottom: "10px", 45 | left: "0px", 46 | }, 47 | }, 48 | }); 49 | 50 | return ( 51 |
52 |
53 |
54 |
55 | {displayColorPicker ? ( 56 |
57 |
58 | 59 |
60 | ) : null} 61 |
62 | ); 63 | }); 64 | -------------------------------------------------------------------------------- /src/components/ColorPicker.test.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { render, cleanup } from "@testing-library/react"; 3 | import { ColorPicker } from "./ColorPicker"; 4 | 5 | describe("ColorPicker tests", () => { 6 | it("renders the color picker", () => { 7 | const picker = render( {})} />).container; 8 | 9 | expect(picker).toBeDefined(); 10 | }); 11 | 12 | afterEach(() => { 13 | cleanup(); 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /src/components/Geoman.js: -------------------------------------------------------------------------------- 1 | import "@geoman-io/leaflet-geoman-free"; 2 | 3 | export default function initGeoman(map) { 4 | map.pm.addControls({ 5 | drawRectangle: true, 6 | removalMode: true, 7 | editMode: true, 8 | dragMode: true, 9 | drawMarker: false, 10 | drawPolyline: false, 11 | drawCircle: false, 12 | drawCircleMarker: false, 13 | drawPolygon: false, 14 | cutPolygon: false, 15 | rotateMode: false, 16 | }); 17 | 18 | const setRectangleCoordinates = () => { 19 | const coords = map.pm 20 | .getGeomanDrawLayers(true) 21 | .toGeoJSON() 22 | .features.flatMap((f) => { 23 | return f.geometry.coordinates; 24 | }); 25 | localStorage.setItem("rectangle_coordinates", JSON.stringify(coords)); 26 | }; 27 | 28 | map.on("pm:drawstart", () => { 29 | const layers = map.pm.getGeomanDrawLayers(); 30 | if (layers.length > 1) { 31 | window.alert("Using more than two shapes leads to performance issues with Neo4j."); 32 | map.pm.disableDraw(); 33 | } 34 | }); 35 | 36 | // listen to `create` and `remove` events and update rectangle coordinates in local storage 37 | map.on("pm:create", (e) => { 38 | if (e.layer && e.layer.pm) { 39 | setRectangleCoordinates(); 40 | // also need to add listener for a new layer 41 | e.layer.on("pm:edit", () => { 42 | setRectangleCoordinates(); 43 | }); 44 | } 45 | }); 46 | 47 | map.on("pm:remove", () => { 48 | setRectangleCoordinates(); 49 | }); 50 | } 51 | -------------------------------------------------------------------------------- /src/components/Layer.js: -------------------------------------------------------------------------------- 1 | /**Layer definition. 2 | 3 | TODO: split into several files? 4 | */ 5 | import React, { Component } from "react"; 6 | import Select from "react-select"; 7 | import Accordion from "react-bootstrap/Accordion"; 8 | import Card from "react-bootstrap/Card"; 9 | import { Button, Form } from "react-bootstrap"; 10 | import { CypherEditor } from "graph-app-kit/components/Editor"; 11 | import { confirmAlert } from "react-confirm-alert"; // Import 12 | import { neo4jService } from "../services/neo4jService"; 13 | import { ColorPicker } from "./ColorPicker"; 14 | 15 | import "react-confirm-alert/src/react-confirm-alert.css"; // Import css 16 | // css needed for CypherEditor 17 | import "codemirror/lib/codemirror.css"; 18 | import "codemirror/addon/lint/lint.css"; 19 | import "codemirror/addon/hint/show-hint.css"; 20 | import "cypher-codemirror/dist/cypher-codemirror-syntax.css"; 21 | import { getMinMaxLatLongs } from "./utils"; 22 | import { 23 | LAYER_TYPE_LATLON, 24 | LAYER_TYPE_POINT, 25 | LAYER_TYPE_CYPHER, 26 | LAYER_TYPE_SPATIAL, 27 | RENDERING_MARKERS, 28 | RENDERING_POLYLINE, 29 | RENDERING_HEATMAP, 30 | RENDERING_CLUSTERS, 31 | RENDERING_RELATIONS, 32 | } from "./constants"; 33 | 34 | export class Layer extends Component { 35 | constructor(props) { 36 | super(props); 37 | 38 | this.state = props.layer; 39 | 40 | this.showQuery = this.showQuery.bind(this); 41 | this.handleNameChange = this.handleNameChange.bind(this); 42 | this.handleLayerTypeChange = this.handleLayerTypeChange.bind(this); 43 | this.handleNodeLabelChange = this.handleNodeLabelChange.bind(this); 44 | this.handleLatPropertyChange = this.handleLatPropertyChange.bind(this); 45 | this.handleLonPropertyChange = this.handleLonPropertyChange.bind(this); 46 | this.handlePointPropertyChange = this.handlePointPropertyChange.bind(this); 47 | this.handleTooltipPropertyChange = this.handleTooltipPropertyChange.bind(this); 48 | this.handleLimitChange = this.handleLimitChange.bind(this); 49 | this.handleColorChange = this.handleColorChange.bind(this); 50 | this.handleRenderingChange = this.handleRenderingChange.bind(this); 51 | this.handleRadiusChange = this.handleRadiusChange.bind(this); 52 | this.handleCypherChange = this.handleCypherChange.bind(this); 53 | this.handleSpatialLayerChanged = this.handleSpatialLayerChanged.bind(this); 54 | this.handleRelationshipLabelChange = this.handleRelationshipLabelChange.bind(this); 55 | this.handleRelationshipTooltipPropertyChange = this.handleRelationshipTooltipPropertyChange.bind(this); 56 | this.handleRelationshipColorChange = this.handleRelationshipColorChange.bind(this); 57 | } 58 | 59 | componentDidMount() { 60 | // list of available nodes 61 | this.getNodes(); 62 | this.getRelationshipLabels(); 63 | this.getPropertyNames(); 64 | this.hasSpatialPlugin(); 65 | this.getSpatialLayers(); 66 | } 67 | 68 | updateBounds = () => { 69 | /* Compute the map bounds based on `this.state.data` 70 | */ 71 | let arr = this.state.data || []; 72 | // TODO: delegate this job to leaflet 73 | let minLat = Number.MAX_VALUE; 74 | let maxLat = -Number.MAX_VALUE; 75 | let minLon = Number.MAX_VALUE; 76 | let maxLon = -Number.MAX_VALUE; 77 | if (arr.length > 0) { 78 | // TODO refactor/optimize 79 | if (Object.prototype.hasOwnProperty.call(arr[0], "start")) { 80 | arr.forEach((item) => { 81 | let startLat = item.start[0]; 82 | let startLon = item.start[1]; 83 | let endLat = item.end[0]; 84 | let endLon = item.end[1]; 85 | if (startLat > maxLat) { 86 | maxLat = startLat; 87 | } 88 | if (startLat < minLat) { 89 | minLat = startLat; 90 | } 91 | if (startLon > maxLon) { 92 | maxLon = startLon; 93 | } 94 | if (startLon < minLon) { 95 | minLon = startLon; 96 | } 97 | if (endLat > maxLat) { 98 | maxLat = endLat; 99 | } 100 | if (endLat < minLat) { 101 | minLat = endLat; 102 | } 103 | if (endLon > maxLon) { 104 | maxLon = endLon; 105 | } 106 | if (endLon < minLon) { 107 | minLon = endLon; 108 | } 109 | }); 110 | } else { 111 | arr.forEach((item) => { 112 | let lat = item.pos[0]; 113 | let lon = item.pos[1]; 114 | if (lat > maxLat) { 115 | maxLat = lat; 116 | } 117 | if (lat < minLat) { 118 | minLat = lat; 119 | } 120 | if (lon > maxLon) { 121 | maxLon = lon; 122 | } 123 | if (lon < minLon) { 124 | minLon = lon; 125 | } 126 | }); 127 | } 128 | } 129 | let bounds = [ 130 | [minLat, minLon], 131 | [maxLat, maxLon], 132 | ]; 133 | this.setState({ bounds }); 134 | 135 | // TODO: Should ths really have a side effect of creating / updating the layer? 136 | // The call to create / update layer should be explicit, from user intent 137 | 138 | // this.setState({bounds: bounds}, function () { 139 | // this.props.updateLayer(this.state); 140 | // }); 141 | }; 142 | 143 | getCypherQuery = () => { 144 | // TODO: check that the query is valid 145 | return this.state.cypher; 146 | }; 147 | 148 | getNodeFilter() { 149 | let filter = ""; 150 | // filter wanted node labels 151 | if (this.state.nodeLabel !== null && this.state.nodeLabel.length > 0) { 152 | let sub_q = "(false"; 153 | this.state.nodeLabel.forEach((value) => { 154 | let lab = value.label; 155 | // added backtics to support labels with spaces 156 | sub_q += ` OR n:\`${lab}\``; 157 | }); 158 | sub_q += ")"; 159 | filter += "\nAND " + sub_q; 160 | } 161 | return filter; 162 | } 163 | 164 | getRelationshipsFilter() { 165 | let filter = ""; 166 | // filter wanted node labels 167 | const { nodeLabel, relationshipLabel } = this.state; 168 | if (nodeLabel != null && nodeLabel.length > 0) { 169 | let sub_q = "(false"; 170 | nodeLabel.forEach((value) => { 171 | // added backtics to support labels with spaces 172 | sub_q += ` OR (n:\`${value.label}\` and m:\`${value.label}\`)`; 173 | }); 174 | sub_q += ")"; 175 | filter += "\nAND " + sub_q; 176 | } 177 | if (relationshipLabel != null && relationshipLabel.length > 0) { 178 | let sub_q = "(false"; 179 | relationshipLabel.forEach((value) => { 180 | sub_q += ` OR r:\`${value.label}\``; 181 | }); 182 | sub_q += ")"; 183 | filter += "\nAND " + sub_q; 184 | } 185 | return filter; 186 | } 187 | 188 | getNodesBoundsFilter() { 189 | const { value: latValue } = this.state.latitudeProperty; 190 | const { value: lonValue } = this.state.longitudeProperty; 191 | 192 | let filter = ""; 193 | const bounds = getMinMaxLatLongs(); 194 | if (bounds.length > 0) { 195 | filter += "\n AND (false OR ("; 196 | bounds.forEach((coords, idx) => { 197 | filter += `n.${latValue} > ${coords.minLat} AND n.${latValue} < ${coords.maxLat}`; 198 | filter += `\nAND n.${lonValue} > ${coords.minLon} AND n.${lonValue} < ${coords.maxLon})`; 199 | if (idx < bounds.length - 1) { 200 | filter += "\nOR ("; 201 | } 202 | }); 203 | filter += ")"; 204 | } 205 | return filter; 206 | } 207 | 208 | getRelationshipsBoundsFilter() { 209 | const { value: latValue } = this.state.latitudeProperty; 210 | const { value: lonValue } = this.state.longitudeProperty; 211 | 212 | let filter = ""; 213 | const bounds = getMinMaxLatLongs(); 214 | if (bounds.length > 0) { 215 | filter += "\n AND (false OR ("; 216 | bounds.forEach((coords, idx) => { 217 | filter += `n.${latValue} > ${coords.minLat} AND n.${latValue} < ${coords.maxLat}`; 218 | filter += `\nAND m.${latValue} > ${coords.minLat} AND m.${latValue} < ${coords.maxLat}`; 219 | filter += `\nAND m.${lonValue} > ${coords.minLon} AND m.${lonValue} < ${coords.maxLon}`; 220 | filter += `\nAND n.${lonValue} > ${coords.minLon} AND n.${lonValue} < ${coords.maxLon})`; 221 | if (idx < bounds.length - 1) { 222 | filter += "\nOR ("; 223 | } 224 | }); 225 | filter += ")"; 226 | } 227 | return filter; 228 | } 229 | 230 | getSpatialQuery() { 231 | let query = `CALL spatial.layer('${this.state.spatialLayer.value}') YIELD node `; 232 | query += "WITH node "; 233 | query += "MATCH (node)-[:RTREE_ROOT]-()-[:RTREE_CHILD*1..10]->()-[:RTREE_REFERENCE]-(n) "; 234 | query += "WHERE n.point.srid = 4326 "; 235 | query += "RETURN n.point.x as longitude, n.point.y as latitude "; 236 | if (this.state.tooltipProperty.value !== "") query += `, n.${this.state.tooltipProperty.value} as tooltip `; 237 | if (this.state.limit) query += `\nLIMIT ${this.state.limit}`; 238 | return query; 239 | } 240 | 241 | getNodesQuery() { 242 | const { layerType, limit } = this.state; 243 | const { value: latValue } = this.state.latitudeProperty; 244 | const { value: lonValue } = this.state.longitudeProperty; 245 | const { value: pointValue } = this.state.pointProperty; 246 | const { value: tooltipValue } = this.state.tooltipProperty; 247 | 248 | // lat lon query 249 | // TODO: improve this method... 250 | let query = "MATCH (n) WHERE true"; 251 | // filter wanted node labels 252 | query += this.getNodeFilter(); 253 | // filter out nodes with null latitude or longitude 254 | if (layerType === LAYER_TYPE_LATLON) { 255 | query += `\nAND exists(n.${latValue}) AND exists(n.${lonValue})`; 256 | query += this.getNodesBoundsFilter(); 257 | // return latitude, longitude 258 | query += `\nRETURN n.${latValue} as latitude, n.${lonValue} as longitude`; 259 | } else if (layerType === LAYER_TYPE_POINT) { 260 | query += `\nAND exists(n.${pointValue})`; 261 | // return latitude, longitude 262 | query += `\nRETURN n.${pointValue}.y as latitude, n.${pointValue}.x as longitude`; 263 | } 264 | 265 | // if tooltip is not null, also return tooltip 266 | if (tooltipValue !== "") query += `, n.${tooltipValue} as tooltip`; 267 | 268 | // TODO: is that really needed??? 269 | // limit the number of points to avoid browser crash... 270 | if (limit) query += `\nLIMIT ${limit}`; 271 | console.log(query); 272 | return query; 273 | } 274 | 275 | getQuery() { 276 | /*If layerType==cypher, query is inside the CypherEditor, 277 | otherwise, we need to build the query manually. 278 | */ 279 | const { layerType, rendering } = this.state; 280 | if (layerType === LAYER_TYPE_CYPHER) return this.getCypherQuery(); 281 | 282 | if (layerType === LAYER_TYPE_SPATIAL) return this.getSpatialQuery(); 283 | 284 | if (rendering === RENDERING_RELATIONS) return this.getRelationshipsQuery(); 285 | return this.getNodesQuery(); 286 | } 287 | 288 | getRelationshipsQuery() { 289 | // SUPPORTS ONLY LAT LON FOR NOW 290 | const { value: latValue } = this.state.latitudeProperty; 291 | const { value: lonValue } = this.state.longitudeProperty; 292 | const { value: tooltipValue } = this.state.relationshipTooltipProperty; 293 | const { limit } = this.state; 294 | // lat lon query 295 | // TODO: improve this method... 296 | let query = "MATCH (n)-[r]->(m) WHERE true"; 297 | // filter wanted node labels 298 | query += this.getRelationshipsFilter(); 299 | 300 | // filter out nodes with null latitude or longitude 301 | query += `\nAND exists(n.${latValue}) AND exists(n.${lonValue}) AND exists(m.${latValue}) AND exists(m.${lonValue})`; 302 | query += this.getRelationshipsBoundsFilter(); 303 | // return latitude, longitude 304 | query += `\nRETURN n.${latValue} as start_latitude, n.${lonValue} as start_longitude, m.${latValue} as end_latitude, m.${lonValue} as end_longitude`; 305 | 306 | // if tooltip is not null, also return tooltip 307 | if (tooltipValue !== "") query += `, r.${tooltipValue} as tooltip`; 308 | 309 | // TODO: is that really needed??? 310 | // limit the number of points to avoid browser crash... 311 | if (limit) query += `\nLIMIT ${limit}`; 312 | console.log(query); 313 | return query; 314 | } 315 | 316 | async updateData() { 317 | const { rendering } = this.state; 318 | 319 | let fun = null; 320 | if (rendering === RENDERING_RELATIONS) { 321 | fun = neo4jService.getRelationshipData; 322 | } else { 323 | fun = neo4jService.getData; 324 | } 325 | const { status, error, result } = await fun(this.getQuery(), {}); 326 | 327 | if (status === 200 && result != null) { 328 | this.setState({ data: result }, this.updateBounds); 329 | } else if (result) { 330 | // TODO: Add Error UX. This should probably block creating/updating layer 331 | console.log(error); 332 | 333 | let message = "Invalid cypher query."; 334 | if (this.state.layerType !== LAYER_TYPE_CYPHER) { 335 | message += "\nContact the development team"; 336 | } else { 337 | message += "\nFix your query and try again"; 338 | } 339 | message += "\n\n" + result; 340 | 341 | // Deprecate alert in favor of a less jarring error UX 342 | alert(message); 343 | } 344 | } 345 | 346 | handleNameChange(e) { 347 | this.setState({ name: e.target.value }); 348 | } 349 | 350 | handleLimitChange(e) { 351 | this.setState({ limit: e.target.value }); 352 | } 353 | 354 | handleLayerTypeChange(e) { 355 | let old_type = this.state.layerType; 356 | let new_type = e.target.value; 357 | if (old_type === new_type) { 358 | return; 359 | } 360 | if (new_type === LAYER_TYPE_CYPHER) { 361 | this.setState({ cypher: this.getQuery() }); 362 | } else if (old_type === LAYER_TYPE_CYPHER) { 363 | if (window.confirm("You will lose your cypher query, is that what you want?") === false) { 364 | return; 365 | } 366 | this.setState({ cypher: "" }); 367 | } 368 | this.setState({ layerType: e.target.value }); 369 | } 370 | 371 | handleLatPropertyChange(e) { 372 | this.setState({ latitudeProperty: e }); 373 | } 374 | 375 | handleLonPropertyChange(e) { 376 | this.setState({ longitudeProperty: e }); 377 | } 378 | 379 | handlePointPropertyChange(e) { 380 | this.setState({ pointProperty: e }); 381 | } 382 | 383 | handleTooltipPropertyChange(e) { 384 | this.setState({ tooltipProperty: e }); 385 | } 386 | 387 | handleNodeLabelChange(e) { 388 | this.setState({ nodeLabel: e }, function () { 389 | this.getPropertyNames(); 390 | }); 391 | } 392 | 393 | handleColorChange(color) { 394 | this.setState({ 395 | color: color, 396 | }); 397 | } 398 | 399 | handleSpatialLayerChanged(e) { 400 | this.setState({ 401 | spatialLayer: e, 402 | }); 403 | } 404 | 405 | handleRenderingChange(e) { 406 | this.setState({ rendering: e.target.value }); 407 | } 408 | 409 | handleRadiusChange(e) { 410 | this.setState({ radius: parseFloat(e.target.value) }); 411 | } 412 | 413 | handleCypherChange(e) { 414 | this.setState({ cypher: e }); 415 | } 416 | 417 | /** 418 | * Update an existing Layer. 419 | * Send data to parent which will propagate to the Map component 420 | */ 421 | updateLayer = async () => { 422 | await this.updateData(); 423 | this.props.updateLayer(this.state); 424 | }; 425 | 426 | /** 427 | * Create a new Layer. 428 | * Send data to parent which will propagate to the Map component 429 | */ 430 | createLayer = async () => { 431 | await this.updateData(); 432 | const proposedLayer = { ...this.state }; 433 | // Generate new ukey 434 | // proposedLayer.ukey = generateUkeyFromName(proposedLayer.name); 435 | 436 | this.props.addLayer(proposedLayer); 437 | }; 438 | 439 | deleteLayer = () => { 440 | if (window.confirm(`Delete layer ${this.state.name}? This action can not be undone.`) === false) { 441 | return; 442 | } 443 | 444 | this.props.removeLayer(this.state.ukey); 445 | }; 446 | 447 | showQuery(event) { 448 | confirmAlert({ 449 | message: this.getQuery(), 450 | buttons: [ 451 | { 452 | label: "OK", 453 | }, 454 | ], 455 | }); 456 | event.preventDefault(); 457 | } 458 | 459 | async hasSpatialPlugin() { 460 | const { status, error, result } = await neo4jService.hasSpatial(); 461 | 462 | if (status === 200 && result !== undefined) { 463 | this.setState({ hasSpatialPlugin: result }); 464 | } else { 465 | // TODO: Add Error UX. This should probably block creating/updating layer 466 | console.log(error); 467 | } 468 | } 469 | 470 | async getNodes() { 471 | /*This will be updated quite often, 472 | is that what we want? 473 | */ 474 | const { status, error, result } = await neo4jService.getNodeLabels(); 475 | 476 | if (status === 200 && result !== undefined) { 477 | this.setState({ nodes: result }); 478 | } else { 479 | // TODO: Add Error UX. This should probably block creating/updating layer 480 | console.log(error); 481 | } 482 | } 483 | 484 | async getPropertyNames() { 485 | const { status, error, result } = await neo4jService.getProperties(this.getNodeFilter()); 486 | 487 | if (status === 200 && result !== undefined) { 488 | const defaultNoTooltip = { value: "", label: "" }; 489 | this.setState({ propertyNames: [...result, defaultNoTooltip] }); 490 | } else { 491 | // TODO: Add Error UX. This should probably block creating/updating layer 492 | console.log(error); 493 | } 494 | } 495 | 496 | async getSpatialLayers() { 497 | const { status, error, result } = await neo4jService.getSpatialLayers(); 498 | 499 | if (status === 200 && result !== undefined) { 500 | this.setState({ spatialLayers: result }); 501 | } else { 502 | // TODO: Add Error UX. This should probably block creating/updating layer 503 | console.log(error); 504 | } 505 | } 506 | 507 | handleRelationshipTooltipPropertyChange(e) { 508 | this.setState({ relationshipTooltipProperty: e }); 509 | } 510 | 511 | handleRelationshipLabelChange(e) { 512 | this.setState({ relationshipLabel: e }); 513 | } 514 | 515 | handleRelationshipColorChange(color) { 516 | this.setState({ 517 | relationshipColor: color, 518 | }); 519 | } 520 | 521 | getRelationshipLabels() { 522 | neo4jService.getRelationshipLabels(this.driver).then((result) => { 523 | this.setState({ 524 | relationshipLabels: result, 525 | }); 526 | }); 527 | } 528 | 529 | renderConfigSpatial() { 530 | if (this.state.layerType !== LAYER_TYPE_SPATIAL) return ""; 531 | 532 | return ( 533 |
534 | 535 | Spatial layer 536 | 559 | 560 |
561 | ); 562 | } 563 | 564 | renderConfigCypher() { 565 | /*If layerType==cypher, then we display the CypherEditor 566 | */ 567 | if (this.state.layerType !== LAYER_TYPE_CYPHER) return ""; 568 | return ( 569 | 570 | Query 571 | 572 |

573 | Checkout{" "} 574 | 575 | the documentation 576 | {" "} 577 | (Ctrl+SPACE for autocomplete) 578 |

579 |

580 | Be careful, the browser can only display a limited number of nodes (less than a few 10000) 581 |

582 |
583 | 584 |
585 | ); 586 | } 587 | 588 | renderConfigPoint() { 589 | if (this.state.layerType !== LAYER_TYPE_POINT) return ""; 590 | return ( 591 |
592 | 593 | Node label(s) 594 | 614 | 615 | 616 | 678 | 700 | 701 | 702 | Longitude property 703 | 727 | 728 | 59 | 60 | Default Latitude property 61 | setDefaultLatProperty(e.target.value)} 65 | /> 66 | 67 | 68 | Default Longitude property 69 | setDefaultLonProperty(e.target.value)} 73 | /> 74 | 75 | 76 | Show directions 77 | setShowDirections(e.target.checked)} 81 | /> 82 | 83 | 84 | 87 | 90 | 91 | 92 | 93 | ); 94 | } 95 | -------------------------------------------------------------------------------- /src/components/SideBar.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import Accordion from "react-bootstrap/Accordion"; 3 | import { Layer } from "./Layer"; 4 | import { NEW_LAYER } from "./constants"; 5 | import { generateUkeyFromName } from "./utils"; 6 | 7 | export const SideBar = React.memo(({ layers, addLayer, updateLayer, removeLayer }) => { 8 | const renderLayers = () => { 9 | return [...layers, { ...NEW_LAYER }].map((layer) => { 10 | const isNew = layer.ukey === undefined; 11 | layer.ukey = layer.ukey || generateUkeyFromName(); 12 | return ( 13 | 22 | ); 23 | }); 24 | }; 25 | 26 | return {renderLayers()}; 27 | }); 28 | -------------------------------------------------------------------------------- /src/components/SideBar.test.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { render, cleanup } from "@testing-library/react"; 3 | import { SideBar } from "./SideBar"; 4 | import { NEW_LAYER } from "./constants"; 5 | 6 | const testLayer1 = { 7 | ukey: "tl1", 8 | name: "Test Layer 1", 9 | }; 10 | 11 | const testLayer2 = { 12 | ukey: "tl2", 13 | name: "Test Layer 2", 14 | }; 15 | 16 | jest.mock("./Layer", () => { 17 | return { 18 | Layer: ({ layer }) =>
{layer.name}
, 19 | }; 20 | }); 21 | 22 | // TODO: Define specs and add unit tests 23 | describe("SideBar tests", () => { 24 | it("always renders one create new layer", () => { 25 | const { container: sidebar, getByText } = render( 26 | {}} updateLayer={() => {}} removeLayer={() => {}} />, 27 | ); 28 | 29 | expect(sidebar).toBeDefined(); 30 | expect(getByText(NEW_LAYER.name)).toBeDefined(); 31 | }); 32 | 33 | it("renders multiple layers and the create new layer", () => { 34 | const { container: sidebar, getByText } = render( 35 | {}} updateLayer={() => {}} removeLayer={() => {}} />, 36 | ); 37 | 38 | expect(sidebar).toBeDefined(); 39 | expect(getByText(testLayer1.name)).toBeDefined(); 40 | expect(getByText(testLayer2.name)).toBeDefined(); 41 | expect(getByText(NEW_LAYER.name)).toBeDefined(); 42 | }); 43 | 44 | afterEach(() => { 45 | cleanup(); 46 | }); 47 | }); 48 | -------------------------------------------------------------------------------- /src/components/constants.js: -------------------------------------------------------------------------------- 1 | // layer type: either from node labels or cypher 2 | export const LAYER_TYPE_LATLON = "latlon"; 3 | export const LAYER_TYPE_POINT = "point"; 4 | export const LAYER_TYPE_CYPHER = "cypher"; 5 | export const LAYER_TYPE_SPATIAL = "spatial"; 6 | 7 | // TODO: move this into a separate configuration/constants file 8 | export const RENDERING_MARKERS = "markers"; 9 | export const RENDERING_POLYLINE = "polyline"; 10 | export const RENDERING_HEATMAP = "heatmap"; 11 | export const RENDERING_CLUSTERS = "clusters"; 12 | export const RENDERING_RELATIONS = "relations"; 13 | 14 | // default parameters for new layers 15 | export const NEW_LAYER = { 16 | ukey: undefined, 17 | name: "New layer", 18 | layerType: LAYER_TYPE_LATLON, 19 | latitudeProperty: { value: "lat", label: "lat" }, 20 | longitudeProperty: { value: "lon", label: "lon" }, 21 | pointProperty: { value: "point", label: "point" }, 22 | tooltipProperty: { value: "", label: "" }, 23 | relationshipTooltipProperty: { value: "", label: "" }, 24 | nodeLabel: [], 25 | propertyNames: [], 26 | spatialLayers: [], 27 | data: [], 28 | bounds: [], 29 | color: { r: 0, g: 0, b: 255, a: 1 }, 30 | limit: null, 31 | rendering: RENDERING_MARKERS, 32 | radius: 30, 33 | cypher: "", 34 | relationshipLabel: [], 35 | relationshipColor: { r: 0, g: 100, b: 255, a: 0.8 }, 36 | // TODO: this should not be in Layer state? 37 | hasSpatialPlugin: false, 38 | spatialLayer: { value: "", label: "" }, 39 | }; 40 | -------------------------------------------------------------------------------- /src/components/utils.js: -------------------------------------------------------------------------------- 1 | const names = [ 2 | "people", 3 | "history", 4 | "way", 5 | "art", 6 | "world", 7 | "information", 8 | "map", 9 | "family", 10 | "government", 11 | "health", 12 | "system", 13 | "computer", 14 | "meat", 15 | "year", 16 | "thanks", 17 | "music", 18 | "person", 19 | "reading", 20 | "method", 21 | "data", 22 | "food", 23 | "understanding", 24 | "theory", 25 | "law", 26 | "bird", 27 | "literature", 28 | "problem", 29 | "software", 30 | "control", 31 | "knowledge", 32 | "power", 33 | "ability", 34 | "economics", 35 | "love", 36 | "internet", 37 | "television", 38 | "science", 39 | "library", 40 | "nature", 41 | "fact", 42 | "product", 43 | "idea", 44 | "temperature", 45 | "investment", 46 | "area", 47 | "society", 48 | "activity", 49 | "story", 50 | "industry", 51 | "media", 52 | "thing", 53 | "oven", 54 | "community", 55 | "definition", 56 | "safety", 57 | "quality", 58 | "development", 59 | "language", 60 | "management", 61 | "player", 62 | "variety", 63 | "video", 64 | "week", 65 | "security", 66 | "country", 67 | "exam", 68 | "movie", 69 | "organization", 70 | "equipment", 71 | "physics", 72 | "analysis", 73 | "policy", 74 | "series", 75 | "thought", 76 | "basis", 77 | "boyfriend", 78 | "direction", 79 | "strategy", 80 | "technology", 81 | "army", 82 | "camera", 83 | "freedom", 84 | "paper", 85 | "environment", 86 | "child", 87 | "instance", 88 | "month", 89 | "truth", 90 | "marketing", 91 | "university", 92 | "writing", 93 | "article", 94 | "department", 95 | "difference", 96 | "goal", 97 | "news", 98 | "audience", 99 | "fishing", 100 | "growth", 101 | "income", 102 | "marriage", 103 | "user", 104 | "combination", 105 | "failure", 106 | "meaning", 107 | "medicine", 108 | "philosophy", 109 | "teacher", 110 | "communication", 111 | "night", 112 | "chemistry", 113 | "disease", 114 | "disk", 115 | "energy", 116 | "nation", 117 | "road", 118 | "role", 119 | "soup", 120 | "advertising", 121 | "location", 122 | "success", 123 | "addition", 124 | "apartment", 125 | "education", 126 | "math", 127 | "moment", 128 | "painting", 129 | "politics", 130 | "attention", 131 | "decision", 132 | "event", 133 | "property", 134 | "shopping", 135 | "student", 136 | "wood", 137 | "competition", 138 | "distribution", 139 | "entertainment", 140 | "office", 141 | "population", 142 | "president", 143 | "unit", 144 | "category", 145 | "cigarette", 146 | "context", 147 | "introduction", 148 | "opportunity", 149 | "performance", 150 | "driver", 151 | "flight", 152 | "length", 153 | "magazine", 154 | "newspaper", 155 | "relationship", 156 | "teaching", 157 | "cell", 158 | "dealer", 159 | "debate", 160 | "finding", 161 | "lake", 162 | "member", 163 | "message", 164 | "phone", 165 | "scene", 166 | "appearance", 167 | "association", 168 | "concept", 169 | "customer", 170 | "death", 171 | "discussion", 172 | "housing", 173 | "inflation", 174 | "insurance", 175 | "mood", 176 | "woman", 177 | "advice", 178 | "blood", 179 | "effort", 180 | "expression", 181 | "importance", 182 | "opinion", 183 | "payment", 184 | "reality", 185 | "responsibility", 186 | "situation", 187 | "skill", 188 | "statement", 189 | "wealth", 190 | "application", 191 | "city", 192 | "county", 193 | "depth", 194 | "estate", 195 | "foundation", 196 | "grandmother", 197 | "heart", 198 | "perspective", 199 | "photo", 200 | "recipe", 201 | "studio", 202 | "topic", 203 | "collection", 204 | "depression", 205 | "imagination", 206 | "passion", 207 | "percentage", 208 | "resource", 209 | "setting", 210 | "ad", 211 | "agency", 212 | "college", 213 | "connection", 214 | "criticism", 215 | "debt", 216 | "description", 217 | "memory", 218 | "patience", 219 | "secretary", 220 | "solution", 221 | "administration", 222 | "aspect", 223 | "attitude", 224 | "director", 225 | "personality", 226 | "psychology", 227 | "recommendation", 228 | "response", 229 | "selection", 230 | "storage", 231 | "version", 232 | "alcohol", 233 | "argument", 234 | "complaint", 235 | "contract", 236 | "emphasis", 237 | "highway", 238 | "loss", 239 | "membership", 240 | "possession", 241 | "preparation", 242 | "steak", 243 | "union", 244 | "agreement", 245 | "cancer", 246 | "currency", 247 | "employment", 248 | "engineering", 249 | "entry", 250 | "interaction", 251 | "limit", 252 | "mixture", 253 | "preference", 254 | "region", 255 | "republic", 256 | "seat", 257 | "tradition", 258 | "virus", 259 | "actor", 260 | "classroom", 261 | "delivery", 262 | "device", 263 | "difficulty", 264 | "drama", 265 | "election", 266 | "engine", 267 | "football", 268 | "guidance", 269 | "hotel", 270 | "match", 271 | "owner", 272 | "priority", 273 | "protection", 274 | "suggestion", 275 | "tension", 276 | "variation", 277 | "anxiety", 278 | "atmosphere", 279 | "awareness", 280 | "bread", 281 | "climate", 282 | "comparison", 283 | "confusion", 284 | "construction", 285 | "elevator", 286 | "emotion", 287 | "employee", 288 | "employer", 289 | "guest", 290 | "height", 291 | "leadership", 292 | "mall", 293 | "manager", 294 | "operation", 295 | "recording", 296 | "respect", 297 | "sample", 298 | "transportation", 299 | "boring", 300 | "charity", 301 | "cousin", 302 | "disaster", 303 | "editor", 304 | "efficiency", 305 | "excitement", 306 | "extent", 307 | "feedback", 308 | "guitar", 309 | "homework", 310 | "leader", 311 | "mom", 312 | "outcome", 313 | "permission", 314 | "presentation", 315 | "promotion", 316 | "reflection", 317 | "refrigerator", 318 | "resolution", 319 | "revenue", 320 | "session", 321 | "singer", 322 | "tennis", 323 | "basket", 324 | "bonus", 325 | "cabinet", 326 | "childhood", 327 | "church", 328 | "clothes", 329 | "coffee", 330 | "dinner", 331 | "drawing", 332 | "hair", 333 | "hearing", 334 | "initiative", 335 | "judgment", 336 | "lab", 337 | "measurement", 338 | "mode", 339 | "mud", 340 | "orange", 341 | "poetry", 342 | "police", 343 | "possibility", 344 | "procedure", 345 | "queen", 346 | "ratio", 347 | "relation", 348 | "restaurant", 349 | "satisfaction", 350 | "sector", 351 | "signature", 352 | "significance", 353 | "song", 354 | "tooth", 355 | "town", 356 | "vehicle", 357 | "volume", 358 | "wife", 359 | "accident", 360 | "airport", 361 | "appointment", 362 | "arrival", 363 | "assumption", 364 | "baseball", 365 | "chapter", 366 | "committee", 367 | "conversation", 368 | "database", 369 | "enthusiasm", 370 | "error", 371 | "explanation", 372 | "farmer", 373 | "gate", 374 | "girl", 375 | "hall", 376 | "historian", 377 | "hospital", 378 | "injury", 379 | "instruction", 380 | "maintenance", 381 | "manufacturer", 382 | "meal", 383 | "perception", 384 | "pie", 385 | "poem", 386 | "presence", 387 | "proposal", 388 | "reception", 389 | "replacement", 390 | "revolution", 391 | "river", 392 | "son", 393 | "speech", 394 | "tea", 395 | "village", 396 | "warning", 397 | "winner", 398 | "worker", 399 | "writer", 400 | "assistance", 401 | "breath", 402 | "buyer", 403 | "chest", 404 | "chocolate", 405 | "conclusion", 406 | "contribution", 407 | "cookie", 408 | "courage", 409 | "desk", 410 | "drawer", 411 | "establishment", 412 | "examination", 413 | "garbage", 414 | "grocery", 415 | "honey", 416 | "impression", 417 | "improvement", 418 | "independence", 419 | "insect", 420 | "inspection", 421 | "inspector", 422 | "king", 423 | "ladder", 424 | "menu", 425 | "penalty", 426 | "piano", 427 | "potato", 428 | "profession", 429 | "professor", 430 | "quantity", 431 | "reaction", 432 | "requirement", 433 | "salad", 434 | "sister", 435 | "supermarket", 436 | "tongue", 437 | "weakness", 438 | "wedding", 439 | "affair", 440 | "ambition", 441 | "analyst", 442 | "apple", 443 | "assignment", 444 | "assistant", 445 | "bathroom", 446 | "bedroom", 447 | "beer", 448 | "birthday", 449 | "celebration", 450 | "championship", 451 | "cheek", 452 | "client", 453 | "consequence", 454 | "departure", 455 | "diamond", 456 | "dirt", 457 | "ear", 458 | "fortune", 459 | "friendship", 460 | "funeral", 461 | "gene", 462 | "girlfriend", 463 | "hat", 464 | "indication", 465 | "intention", 466 | "lady", 467 | "midnight", 468 | "negotiation", 469 | "obligation", 470 | "passenger", 471 | "pizza", 472 | "platform", 473 | "poet", 474 | "pollution", 475 | "recognition", 476 | "reputation", 477 | "shirt", 478 | "speaker", 479 | "stranger", 480 | "surgery", 481 | "sympathy", 482 | "tale", 483 | "throat", 484 | "trainer", 485 | "uncle", 486 | "youth", 487 | "time", 488 | "work", 489 | "film", 490 | "water", 491 | "money", 492 | "example", 493 | "while", 494 | "business", 495 | "study", 496 | "game", 497 | "life", 498 | "form", 499 | "air", 500 | "day", 501 | "place", 502 | "number", 503 | "part", 504 | "field", 505 | "fish", 506 | "back", 507 | "process", 508 | "heat", 509 | "hand", 510 | "experience", 511 | "job", 512 | "book", 513 | "end", 514 | "point", 515 | "type", 516 | "home", 517 | "economy", 518 | "value", 519 | "body", 520 | "market", 521 | "guide", 522 | "interest", 523 | "state", 524 | "radio", 525 | "course", 526 | "company", 527 | "price", 528 | "size", 529 | "card", 530 | "list", 531 | "mind", 532 | "trade", 533 | "line", 534 | "care", 535 | "group", 536 | "risk", 537 | "word", 538 | "fat", 539 | "force", 540 | "key", 541 | "light", 542 | "training", 543 | "name", 544 | "school", 545 | "top", 546 | "amount", 547 | "level", 548 | "order", 549 | "practice", 550 | "research", 551 | "sense", 552 | "service", 553 | "piece", 554 | "web", 555 | "boss", 556 | "sport", 557 | "fun", 558 | "house", 559 | "page", 560 | "term", 561 | "test", 562 | "answer", 563 | "sound", 564 | "focus", 565 | "matter", 566 | "kind", 567 | "soil", 568 | "board", 569 | "oil", 570 | "picture", 571 | "access", 572 | "garden", 573 | "range", 574 | "rate", 575 | "reason", 576 | "future", 577 | "site", 578 | "demand", 579 | "exercise", 580 | "image", 581 | "case", 582 | "cause", 583 | "coast", 584 | "action", 585 | "age", 586 | "bad", 587 | "boat", 588 | "record", 589 | "result", 590 | "section", 591 | "building", 592 | "mouse", 593 | "cash", 594 | "class", 595 | "period", 596 | "plan", 597 | "store", 598 | "tax", 599 | "side", 600 | "subject", 601 | "space", 602 | "rule", 603 | "stock", 604 | "weather", 605 | "chance", 606 | "figure", 607 | "man", 608 | "model", 609 | "source", 610 | "beginning", 611 | "earth", 612 | "program", 613 | "chicken", 614 | "design", 615 | "feature", 616 | "head", 617 | "material", 618 | "purpose", 619 | "question", 620 | "rock", 621 | "salt", 622 | "act", 623 | "birth", 624 | "car", 625 | "dog", 626 | "object", 627 | "scale", 628 | "sun", 629 | "note", 630 | "profit", 631 | "rent", 632 | "speed", 633 | "style", 634 | "war", 635 | "bank", 636 | "craft", 637 | "half", 638 | "inside", 639 | "outside", 640 | "standard", 641 | "bus", 642 | "exchange", 643 | "eye", 644 | "fire", 645 | "position", 646 | "pressure", 647 | "stress", 648 | "advantage", 649 | "benefit", 650 | "box", 651 | "frame", 652 | "issue", 653 | "step", 654 | "cycle", 655 | "face", 656 | "item", 657 | "metal", 658 | "paint", 659 | "review", 660 | "room", 661 | "screen", 662 | "structure", 663 | "view", 664 | "account", 665 | "ball", 666 | "discipline", 667 | "medium", 668 | "share", 669 | "balance", 670 | "bit", 671 | "black", 672 | "bottom", 673 | "choice", 674 | "gift", 675 | "impact", 676 | "machine", 677 | "shape", 678 | "tool", 679 | "wind", 680 | "address", 681 | "average", 682 | "career", 683 | "culture", 684 | "morning", 685 | "pot", 686 | "sign", 687 | "table", 688 | "task", 689 | "condition", 690 | "contact", 691 | "credit", 692 | "egg", 693 | "hope", 694 | "ice", 695 | "network", 696 | "north", 697 | "square", 698 | "attempt", 699 | "date", 700 | "effect", 701 | "link", 702 | "post", 703 | "star", 704 | "voice", 705 | "capital", 706 | "challenge", 707 | "friend", 708 | "self", 709 | "shot", 710 | "brush", 711 | "couple", 712 | "exit", 713 | "front", 714 | "function", 715 | "lack", 716 | "living", 717 | "plant", 718 | "plastic", 719 | "spot", 720 | "summer", 721 | "taste", 722 | "theme", 723 | "track", 724 | "wing", 725 | "brain", 726 | "button", 727 | "click", 728 | "desire", 729 | "foot", 730 | "gas", 731 | "influence", 732 | "notice", 733 | "rain", 734 | "wall", 735 | "base", 736 | "damage", 737 | "distance", 738 | "feeling", 739 | "pair", 740 | "savings", 741 | "staff", 742 | "sugar", 743 | "target", 744 | "text", 745 | "animal", 746 | "author", 747 | "budget", 748 | "discount", 749 | "file", 750 | "ground", 751 | "lesson", 752 | "minute", 753 | "officer", 754 | "phase", 755 | "reference", 756 | "register", 757 | "sky", 758 | "stage", 759 | "stick", 760 | "title", 761 | "trouble", 762 | "bowl", 763 | "bridge", 764 | "campaign", 765 | "character", 766 | "club", 767 | "edge", 768 | "evidence", 769 | "fan", 770 | "letter", 771 | "lock", 772 | "maximum", 773 | "novel", 774 | "option", 775 | "pack", 776 | "park", 777 | "quarter", 778 | "skin", 779 | "sort", 780 | "weight", 781 | "baby", 782 | "background", 783 | "carry", 784 | "dish", 785 | "factor", 786 | "fruit", 787 | "glass", 788 | "joint", 789 | "master", 790 | "muscle", 791 | "red", 792 | "strength", 793 | "traffic", 794 | "trip", 795 | "vegetable", 796 | "appeal", 797 | "chart", 798 | "gear", 799 | "ideal", 800 | "kitchen", 801 | "land", 802 | "log", 803 | "mother", 804 | "net", 805 | "party", 806 | "principle", 807 | "relative", 808 | "sale", 809 | "season", 810 | "signal", 811 | "spirit", 812 | "street", 813 | "tree", 814 | "wave", 815 | "belt", 816 | "bench", 817 | "commission", 818 | "copy", 819 | "drop", 820 | "minimum", 821 | "path", 822 | "progress", 823 | "project", 824 | "sea", 825 | "south", 826 | "status", 827 | "stuff", 828 | "ticket", 829 | "tour", 830 | "angle", 831 | "blue", 832 | "breakfast", 833 | "confidence", 834 | "daughter", 835 | "degree", 836 | "doctor", 837 | "dot", 838 | "dream", 839 | "duty", 840 | "essay", 841 | "father", 842 | "fee", 843 | "finance", 844 | "hour", 845 | "juice", 846 | "luck", 847 | "milk", 848 | "mouth", 849 | "peace", 850 | "pipe", 851 | "stable", 852 | "storm", 853 | "substance", 854 | "team", 855 | "trick", 856 | "afternoon", 857 | "bat", 858 | "beach", 859 | "blank", 860 | "catch", 861 | "chain", 862 | "consideration", 863 | "cream", 864 | "crew", 865 | "detail", 866 | "gold", 867 | "interview", 868 | "kid", 869 | "mark", 870 | "mission", 871 | "pain", 872 | "pleasure", 873 | "score", 874 | "screw", 875 | "sex", 876 | "shop", 877 | "shower", 878 | "suit", 879 | "tone", 880 | "window", 881 | "agent", 882 | "band", 883 | "bath", 884 | "block", 885 | "bone", 886 | "calendar", 887 | "candidate", 888 | "cap", 889 | "coat", 890 | "contest", 891 | "corner", 892 | "court", 893 | "cup", 894 | "district", 895 | "door", 896 | "east", 897 | "finger", 898 | "garage", 899 | "guarantee", 900 | "hole", 901 | "hook", 902 | "implement", 903 | "layer", 904 | "lecture", 905 | "lie", 906 | "manner", 907 | "meeting", 908 | "nose", 909 | "parking", 910 | "partner", 911 | "profile", 912 | "rice", 913 | "routine", 914 | "schedule", 915 | "swimming", 916 | "telephone", 917 | "tip", 918 | "winter", 919 | "airline", 920 | "bag", 921 | "battle", 922 | "bed", 923 | "bill", 924 | "bother", 925 | "cake", 926 | "code", 927 | "curve", 928 | "designer", 929 | "dimension", 930 | "dress", 931 | "ease", 932 | "emergency", 933 | "evening", 934 | "extension", 935 | "farm", 936 | "fight", 937 | "gap", 938 | "grade", 939 | "holiday", 940 | "horror", 941 | "horse", 942 | "host", 943 | "husband", 944 | "loan", 945 | "mistake", 946 | "mountain", 947 | "nail", 948 | "noise", 949 | "occasion", 950 | "package", 951 | "patient", 952 | "pause", 953 | "phrase", 954 | "proof", 955 | "race", 956 | "relief", 957 | "sand", 958 | "sentence", 959 | "shoulder", 960 | "smoke", 961 | "stomach", 962 | "string", 963 | "tourist", 964 | "towel", 965 | "vacation", 966 | "west", 967 | "wheel", 968 | "wine", 969 | "arm", 970 | "aside", 971 | "associate", 972 | "bet", 973 | "blow", 974 | "border", 975 | "branch", 976 | "breast", 977 | "brother", 978 | "buddy", 979 | "bunch", 980 | "chip", 981 | "coach", 982 | "cross", 983 | "document", 984 | "draft", 985 | "dust", 986 | "expert", 987 | "floor", 988 | "god", 989 | "golf", 990 | "habit", 991 | "iron", 992 | "judge", 993 | "knife", 994 | "landscape", 995 | "league", 996 | "mail", 997 | "mess", 998 | "native", 999 | "opening", 1000 | "parent", 1001 | "pattern", 1002 | "pin", 1003 | "pool", 1004 | "pound", 1005 | "request", 1006 | "salary", 1007 | "shame", 1008 | "shelter", 1009 | "shoe", 1010 | "silver", 1011 | "tackle", 1012 | "tank", 1013 | "trust", 1014 | "assist", 1015 | "bake", 1016 | "bar", 1017 | "bell", 1018 | "bike", 1019 | "blame", 1020 | "boy", 1021 | "brick", 1022 | "chair", 1023 | "closet", 1024 | "clue", 1025 | "collar", 1026 | "comment", 1027 | "conference", 1028 | "devil", 1029 | "diet", 1030 | "fear", 1031 | "fuel", 1032 | "glove", 1033 | "jacket", 1034 | "lunch", 1035 | "monitor", 1036 | "mortgage", 1037 | "nurse", 1038 | "pace", 1039 | "panic", 1040 | "peak", 1041 | "plane", 1042 | "reward", 1043 | "row", 1044 | "sandwich", 1045 | "shock", 1046 | "spite", 1047 | "spray", 1048 | "surprise", 1049 | "till", 1050 | "transition", 1051 | "weekend", 1052 | "welcome", 1053 | "yard", 1054 | "alarm", 1055 | "bend", 1056 | "bicycle", 1057 | "bite", 1058 | "blind", 1059 | "bottle", 1060 | "cable", 1061 | "candle", 1062 | "clerk", 1063 | "cloud", 1064 | "concert", 1065 | "counter", 1066 | "flower", 1067 | "grandfather", 1068 | "harm", 1069 | "knee", 1070 | "lawyer", 1071 | "leather", 1072 | "load", 1073 | "mirror", 1074 | "neck", 1075 | "pension", 1076 | "plate", 1077 | "purple", 1078 | "ruin", 1079 | "ship", 1080 | "skirt", 1081 | "slice", 1082 | "snow", 1083 | "specialist", 1084 | "stroke", 1085 | "switch", 1086 | "trash", 1087 | "tune", 1088 | "zone", 1089 | "anger", 1090 | "award", 1091 | "bid", 1092 | "bitter", 1093 | "boot", 1094 | "bug", 1095 | "camp", 1096 | "candy", 1097 | "carpet", 1098 | "cat", 1099 | "champion", 1100 | "channel", 1101 | "clock", 1102 | "comfort", 1103 | "cow", 1104 | "crack", 1105 | "engineer", 1106 | "entrance", 1107 | "fault", 1108 | "grass", 1109 | "guy", 1110 | "hell", 1111 | "highlight", 1112 | "incident", 1113 | "island", 1114 | "joke", 1115 | "jury", 1116 | "leg", 1117 | "lip", 1118 | "mate", 1119 | "motor", 1120 | "nerve", 1121 | "passage", 1122 | "pen", 1123 | "pride", 1124 | "priest", 1125 | "prize", 1126 | "promise", 1127 | "resident", 1128 | "resort", 1129 | "ring", 1130 | "roof", 1131 | "rope", 1132 | "sail", 1133 | "scheme", 1134 | "script", 1135 | "sock", 1136 | "station", 1137 | "toe", 1138 | "tower", 1139 | "truck", 1140 | "witness", 1141 | "can", 1142 | "will", 1143 | "other", 1144 | "use", 1145 | "make", 1146 | "good", 1147 | "look", 1148 | "help", 1149 | "go", 1150 | "great", 1151 | "being", 1152 | "still", 1153 | "public", 1154 | "read", 1155 | "keep", 1156 | "start", 1157 | "give", 1158 | "human", 1159 | "local", 1160 | "general", 1161 | "specific", 1162 | "long", 1163 | "play", 1164 | "feel", 1165 | "high", 1166 | "put", 1167 | "common", 1168 | "set", 1169 | "change", 1170 | "simple", 1171 | "past", 1172 | "big", 1173 | "possible", 1174 | "particular", 1175 | "major", 1176 | "personal", 1177 | "current", 1178 | "national", 1179 | "cut", 1180 | "natural", 1181 | "physical", 1182 | "show", 1183 | "try", 1184 | "check", 1185 | "second", 1186 | "call", 1187 | "move", 1188 | "pay", 1189 | "let", 1190 | "increase", 1191 | "single", 1192 | "individual", 1193 | "turn", 1194 | "ask", 1195 | "buy", 1196 | "guard", 1197 | "hold", 1198 | "main", 1199 | "offer", 1200 | "potential", 1201 | "professional", 1202 | "international", 1203 | "travel", 1204 | "cook", 1205 | "alternative", 1206 | "special", 1207 | "working", 1208 | "whole", 1209 | "dance", 1210 | "excuse", 1211 | "cold", 1212 | "commercial", 1213 | "low", 1214 | "purchase", 1215 | "deal", 1216 | "primary", 1217 | "worth", 1218 | "fall", 1219 | "necessary", 1220 | "positive", 1221 | "produce", 1222 | "search", 1223 | "present", 1224 | "spend", 1225 | "talk", 1226 | "creative", 1227 | "tell", 1228 | "cost", 1229 | "drive", 1230 | "green", 1231 | "support", 1232 | "glad", 1233 | "remove", 1234 | "return", 1235 | "run", 1236 | "complex", 1237 | "due", 1238 | "effective", 1239 | "middle", 1240 | "regular", 1241 | "reserve", 1242 | "independent", 1243 | "leave", 1244 | "original", 1245 | "reach", 1246 | "rest", 1247 | "serve", 1248 | "watch", 1249 | "beautiful", 1250 | "charge", 1251 | "active", 1252 | "break", 1253 | "negative", 1254 | "safe", 1255 | "stay", 1256 | "visit", 1257 | "visual", 1258 | "affect", 1259 | "cover", 1260 | "report", 1261 | "rise", 1262 | "walk", 1263 | "white", 1264 | "junior", 1265 | "pick", 1266 | "unique", 1267 | "classic", 1268 | "final", 1269 | "lift", 1270 | "mix", 1271 | "private", 1272 | "stop", 1273 | "teach", 1274 | "western", 1275 | "concern", 1276 | "familiar", 1277 | "fly", 1278 | "official", 1279 | "broad", 1280 | "comfortable", 1281 | "gain", 1282 | "rich", 1283 | "save", 1284 | "stand", 1285 | "young", 1286 | "heavy", 1287 | "lead", 1288 | "listen", 1289 | "valuable", 1290 | "worry", 1291 | "handle", 1292 | "leading", 1293 | "meet", 1294 | "release", 1295 | "sell", 1296 | "finish", 1297 | "normal", 1298 | "press", 1299 | "ride", 1300 | "secret", 1301 | "spread", 1302 | "spring", 1303 | "tough", 1304 | "wait", 1305 | "brown", 1306 | "deep", 1307 | "display", 1308 | "flow", 1309 | "hit", 1310 | "objective", 1311 | "shoot", 1312 | "touch", 1313 | "cancel", 1314 | "chemical", 1315 | "cry", 1316 | "dump", 1317 | "extreme", 1318 | "push", 1319 | "conflict", 1320 | "eat", 1321 | "fill", 1322 | "formal", 1323 | "jump", 1324 | "kick", 1325 | "opposite", 1326 | "pass", 1327 | "pitch", 1328 | "remote", 1329 | "total", 1330 | "treat", 1331 | "vast", 1332 | "abuse", 1333 | "beat", 1334 | "burn", 1335 | "deposit", 1336 | "print", 1337 | "raise", 1338 | "sleep", 1339 | "somewhere", 1340 | "advance", 1341 | "consist", 1342 | "dark", 1343 | "double", 1344 | "draw", 1345 | "equal", 1346 | "fix", 1347 | "hire", 1348 | "internal", 1349 | "join", 1350 | "kill", 1351 | "sensitive", 1352 | "tap", 1353 | "win", 1354 | "attack", 1355 | "claim", 1356 | "constant", 1357 | "drag", 1358 | "drink", 1359 | "guess", 1360 | "minor", 1361 | "pull", 1362 | "raw", 1363 | "soft", 1364 | "solid", 1365 | "wear", 1366 | "weird", 1367 | "wonder", 1368 | "annual", 1369 | "count", 1370 | "dead", 1371 | "doubt", 1372 | "feed", 1373 | "forever", 1374 | "impress", 1375 | "repeat", 1376 | "round", 1377 | "sing", 1378 | "slide", 1379 | "strip", 1380 | "wish", 1381 | "combine", 1382 | "command", 1383 | "dig", 1384 | "divide", 1385 | "equivalent", 1386 | "hang", 1387 | "hunt", 1388 | "initial", 1389 | "march", 1390 | "mention", 1391 | "spiritual", 1392 | "survey", 1393 | "tie", 1394 | "adult", 1395 | "brief", 1396 | "crazy", 1397 | "escape", 1398 | "gather", 1399 | "hate", 1400 | "prior", 1401 | "repair", 1402 | "rough", 1403 | "sad", 1404 | "scratch", 1405 | "sick", 1406 | "strike", 1407 | "employ", 1408 | "external", 1409 | "hurt", 1410 | "illegal", 1411 | "laugh", 1412 | "lay", 1413 | "mobile", 1414 | "nasty", 1415 | "ordinary", 1416 | "respond", 1417 | "royal", 1418 | "senior", 1419 | "split", 1420 | "strain", 1421 | "struggle", 1422 | "swim", 1423 | "train", 1424 | "upper", 1425 | "wash", 1426 | "yellow", 1427 | "convert", 1428 | "crash", 1429 | "dependent", 1430 | "fold", 1431 | "funny", 1432 | "grab", 1433 | "hide", 1434 | "miss", 1435 | "permit", 1436 | "quote", 1437 | "recover", 1438 | "resolve", 1439 | "roll", 1440 | "sink", 1441 | "slip", 1442 | "spare", 1443 | "suspect", 1444 | "sweet", 1445 | "swing", 1446 | "twist", 1447 | "upstairs", 1448 | "usual", 1449 | "abroad", 1450 | "brave", 1451 | "calm", 1452 | "concentrate", 1453 | "estimate", 1454 | "grand", 1455 | "male", 1456 | "mine", 1457 | "prompt", 1458 | "quiet", 1459 | "refuse", 1460 | "regret", 1461 | "reveal", 1462 | "rush", 1463 | "shake", 1464 | "shift", 1465 | "shine", 1466 | "steal", 1467 | "suck", 1468 | "surround", 1469 | "bear", 1470 | "brilliant", 1471 | "dare", 1472 | "dear", 1473 | "delay", 1474 | "drunk", 1475 | "female", 1476 | "hurry", 1477 | "inevitable", 1478 | "invite", 1479 | "kiss", 1480 | "neat", 1481 | "pop", 1482 | "punch", 1483 | "quit", 1484 | "reply", 1485 | "representative", 1486 | "resist", 1487 | "rip", 1488 | "rub", 1489 | "silly", 1490 | "smile", 1491 | "spell", 1492 | "stretch", 1493 | "stupid", 1494 | "tear", 1495 | "temporary", 1496 | "tomorrow", 1497 | "wake", 1498 | "wrap", 1499 | "yesterday", 1500 | "Thomas", 1501 | "Tom", 1502 | "Lieuwe", 1503 | ]; 1504 | 1505 | const getRandomInt = (min, max) => { 1506 | return Math.floor(Math.random() * (max - min)) + min; 1507 | }; 1508 | 1509 | export const generateRandomName = () => { 1510 | return `${names[getRandomInt(0, names.length + 1)]} ${names[getRandomInt(0, names.length + 1)]}`; 1511 | }; 1512 | 1513 | export const generateUkeyFromName = (name) => { 1514 | let thisName = name || generateRandomName(); 1515 | return `${thisName.replace(/\s/g, "")}${getRandomInt(0, 100)}`; 1516 | }; 1517 | 1518 | export const getMinMaxLatLongs = () => { 1519 | const rawCoords = localStorage.getItem("rectangle_coordinates") || "[]"; 1520 | const coords = JSON.parse(rawCoords); 1521 | 1522 | const bounds = coords.map((shape) => { 1523 | const minLat = Math.min(...shape.map((latlon) => latlon[1])); 1524 | const minLon = Math.min(...shape.map((latlon) => latlon[0])); 1525 | const maxLat = Math.max(...shape.map((latlon) => latlon[1])); 1526 | const maxLon = Math.max(...shape.map((latlon) => latlon[0])); 1527 | return { minLat, minLon, maxLat, maxLon }; 1528 | }); 1529 | return bounds; 1530 | }; 1531 | -------------------------------------------------------------------------------- /src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | padding: 0; 4 | font-family: sans-serif; 5 | } 6 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom"; 3 | import { App } from "./App"; 4 | import "./index.css"; 5 | 6 | ReactDOM.render(, document.getElementById("root")); 7 | -------------------------------------------------------------------------------- /src/services/neo4jService.js: -------------------------------------------------------------------------------- 1 | import { driver as createDriver, auth } from "neo4j-driver"; 2 | 3 | class Neo4JService { 4 | _getNeo4jDriver = async () => { 5 | if (!this.driver) { 6 | try { 7 | /** 8 | * Hooks into the neo4jDesktopApi. 9 | * Note: this integration is going to be deprecated in desktop api 2.0 10 | */ 11 | const context = await window.neo4jDesktopApi.getContext(); 12 | 13 | const activeGraph = context.projects 14 | .map((project) => ({ 15 | graphs: project.graphs.filter((graph) => graph.status === "ACTIVE"), 16 | })) 17 | .reduce((acc, { graphs }) => acc.concat(graphs), [])[0]; 18 | 19 | if (activeGraph) { 20 | console.log(`Active graph is: ${activeGraph.name} - (${activeGraph.description})`); 21 | const { url, username, password } = activeGraph.connection.configuration.protocols.bolt; 22 | 23 | this.driver = createDriver(url, auth.basic(username, password)); 24 | await this._getAvailableDatabases(); 25 | } 26 | } catch (error) { 27 | console.log(error); 28 | } 29 | } 30 | 31 | return this.driver; 32 | }; 33 | 34 | _getAvailableDatabases = async () => { 35 | const records = await this._runQuery("SHOW DATABASES YIELD name RETURN name;"); 36 | const dbNames = records.map((rec) => rec._fields[0]).filter((name) => name !== "system"); 37 | localStorage.setItem("available_databases", dbNames); 38 | }; 39 | 40 | _runQuery = async (query, params = undefined) => { 41 | const driver = this.driver || (await this._getNeo4jDriver()); 42 | 43 | if (!driver) { 44 | throw new Error("Failed to get driver"); 45 | } 46 | 47 | const selectedDatabase = localStorage.getItem("selected_database") || "neo4j"; 48 | const session = driver.session({ database: selectedDatabase }); 49 | const records = (await session.run(query, params)).records; 50 | session.close(); 51 | 52 | return records || []; 53 | }; 54 | 55 | getNodeLabels = async () => { 56 | const query = "CALL db.labels() YIELD label RETURN label ORDER BY label"; 57 | 58 | try { 59 | const records = await this._runQuery(query); 60 | 61 | const result = records.map((record) => { 62 | return { 63 | value: record.get("label"), 64 | label: record.get("label"), 65 | }; 66 | }); 67 | 68 | return { status: 200, result }; 69 | } catch (error) { 70 | return { status: 500, error }; 71 | } 72 | }; 73 | 74 | getProperties = async (nodeFilter) => { 75 | const query = nodeFilter 76 | ? `MATCH (n) WHERE true ${nodeFilter} WITH n LIMIT 100 UNWIND keys(n) AS key RETURN DISTINCT key AS propertyKey ORDER BY key` 77 | : "CALL db.propertyKeys() YIELD propertyKey RETURN propertyKey ORDER BY propertyKey"; 78 | 79 | try { 80 | const records = await this._runQuery(query); 81 | 82 | const result = records.map((record) => { 83 | return { 84 | value: record.get("propertyKey"), 85 | label: record.get("propertyKey"), 86 | }; 87 | }); 88 | 89 | return { status: 200, result }; 90 | } catch (error) { 91 | return { status: 500, error }; 92 | } 93 | }; 94 | 95 | getRelationshipLabels = async () => { 96 | const query = 97 | "CALL db.relationshipTypes() YIELD relationshipType RETURN relationshipType ORDER BY relationshipType;"; 98 | const records = await this._runQuery(query); 99 | 100 | const res = records.map((record) => ({ 101 | value: record.get("relationshipType"), 102 | label: record.get("relationshipType"), 103 | })); 104 | return res; 105 | }; 106 | 107 | getRelationshipData = async (query, params) => { 108 | const records = await this._runQuery(query, params); 109 | let res = []; 110 | if (records === undefined || records.length === 0) { 111 | alert("No result found, please check your query"); 112 | return { 113 | status: "ERROR", 114 | result: query, 115 | }; 116 | } 117 | records.forEach((record) => { 118 | let el = { 119 | start: [record.get("start_latitude"), record.get("start_longitude")], 120 | end: [record.get("end_latitude"), record.get("end_longitude")], 121 | }; 122 | if (record.has("tooltip") && record.get("tooltip") != null) { 123 | // make sure tooltip is a string, otherwise leaflet is not happy AT ALL! 124 | el["tooltip"] = record.get("tooltip").toString(); 125 | } 126 | res.push(el); 127 | }); 128 | 129 | return { 130 | status: 200, 131 | result: res, 132 | }; 133 | }; 134 | 135 | hasSpatial = async () => { 136 | const query = "CALL spatial.procedures() YIELD name RETURN name LIMIT 1"; 137 | 138 | try { 139 | await this._runQuery(query); 140 | 141 | return { status: 200, result: true }; 142 | } catch (error) { 143 | return { status: 500, error }; 144 | } 145 | }; 146 | 147 | getSpatialLayers = async () => { 148 | const query = 149 | "MATCH (n:ReferenceNode)-[:LAYER]->(l)" + 150 | "WHERE l.layer_class = 'org.neo4j.gis.spatial.SimplePointLayer'" + 151 | "AND l.geomencoder = 'org.neo4j.gis.spatial.encoders.SimplePointEncoder'" + 152 | "RETURN l.layer as layer"; 153 | 154 | try { 155 | const records = await this._runQuery(query); 156 | 157 | const result = records.map((record) => { 158 | return { 159 | value: record.get("layer"), 160 | label: record.get("layer"), 161 | }; 162 | }); 163 | 164 | return { status: 200, result }; 165 | } catch (error) { 166 | return { status: 500, error }; 167 | } 168 | }; 169 | 170 | getData = async (query, params) => { 171 | try { 172 | const records = await this._runQuery(query, params); 173 | 174 | const result = records.map((record) => { 175 | const position = [record.get("latitude"), record.get("longitude")]; 176 | const tooltip = record.has("tooltip") && record.get("tooltip"); 177 | 178 | return { 179 | pos: position, 180 | tooltip: tooltip ? tooltip.toString() : undefined, 181 | }; 182 | }); 183 | 184 | return { status: 200, result }; 185 | } catch (error) { 186 | const customError = new Error(`${error.message}, please check your query`); 187 | return { status: 500, error: customError }; 188 | } 189 | }; 190 | } 191 | 192 | /** 193 | * Singleton Neo4JService 194 | */ 195 | export const neo4jService = (() => { 196 | let serviceInstance; 197 | 198 | if (!serviceInstance) { 199 | serviceInstance = new Neo4JService(); 200 | } 201 | 202 | return serviceInstance; 203 | })(); 204 | -------------------------------------------------------------------------------- /src/services/neo4jService.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Importing neo4jDesktopApi from __mocks__ adds a mock desktop api to the global window object 3 | * subsequent neo4jservice imports will use a mock api and driver * 4 | */ 5 | import "../../__mocks__/neo4jDesktopApi"; // eslint-disable-line jest/no-mocks-import 6 | 7 | import { neo4jService } from "./neo4jService"; 8 | import { neo4jService as neo4jServiceCopy } from "./neo4jService"; 9 | 10 | jest.mock("neo4j-driver", () => { 11 | const mockRecord = new Map([ 12 | ["name", "t-name"], 13 | ["label", "t-label"], 14 | ["layer", "t-layer"], 15 | ["tooltip", "t-tooltip"], 16 | ["propertyKey", "t-propertyKey"], 17 | ["longitude", "4321"], 18 | ["latitude", "1234"], 19 | ]); 20 | 21 | const mockSession = { 22 | // eslint-disable-next-line no-unused-vars 23 | run: jest.fn((_query, _params, _config) => { 24 | // eslint-disable-next-line no-unused-vars 25 | return new Promise((resolve, _reject) => { 26 | return resolve({ records: [mockRecord] }); 27 | }); 28 | }), 29 | close: jest.fn(), 30 | }; 31 | 32 | const mockDriver = { 33 | session: jest.fn((_args) => mockSession), // eslint-disable-line no-unused-vars 34 | }; 35 | 36 | return { 37 | auth: { 38 | basic: (_username, _password, _realm = undefined) => "AuthToken", // eslint-disable-line no-unused-vars 39 | }, 40 | driver: jest.fn((_url, _authToken, _config) => mockDriver), // eslint-disable-line no-unused-vars 41 | }; 42 | }); 43 | 44 | describe("neo4jService tests", () => { 45 | it("is a singelton", () => { 46 | expect(neo4jService).toEqual(neo4jServiceCopy); 47 | }); 48 | 49 | it("gets node labels", async () => { 50 | // Arrange 51 | const testNodeLabels = [ 52 | { 53 | value: "t-label", 54 | label: "t-label", 55 | }, 56 | ]; 57 | 58 | // Act 59 | const nodeLabels = await neo4jService.getNodeLabels(); 60 | 61 | // Assert 62 | expect(nodeLabels).toEqual({ status: 200, result: testNodeLabels }); 63 | }); 64 | 65 | it("gets properties", async () => { 66 | // Arrange 67 | const testProperties = [ 68 | { 69 | value: "t-propertyKey", 70 | label: "t-propertyKey", 71 | }, 72 | ]; 73 | 74 | // Act 75 | const properties = await neo4jService.getProperties(); 76 | 77 | // Assert 78 | expect(properties).toEqual({ status: 200, result: testProperties }); 79 | }); 80 | 81 | it("checks for spatial", async () => { 82 | // Act 83 | const hasSpatial = await neo4jService.hasSpatial(); 84 | 85 | // Assert 86 | expect(hasSpatial).toEqual({ status: 200, result: true }); 87 | }); 88 | 89 | it("gets spatial layers", async () => { 90 | // Arrange 91 | const testSpatialLayers = [ 92 | { 93 | value: "t-layer", 94 | label: "t-layer", 95 | }, 96 | ]; 97 | 98 | // Act 99 | const spatialLayers = await neo4jService.getSpatialLayers(); 100 | 101 | // Assert 102 | expect(spatialLayers).toEqual({ status: 200, result: testSpatialLayers }); 103 | }); 104 | 105 | it("gets corect data", async () => { 106 | // Arrange 107 | const testData = [ 108 | { 109 | pos: ["1234", "4321"], 110 | tooltip: "t-tooltip", 111 | }, 112 | ]; 113 | 114 | // Act 115 | const data = await neo4jService.getData(); 116 | 117 | // Assert 118 | expect(data).toEqual({ status: 200, result: testData }); 119 | }); 120 | }); 121 | --------------------------------------------------------------------------------