{"__v":0,"_id":"57d3b9287124040e00bc3352","category":{"project":"566c97797831040d003eb3bc","version":"566c97797831040d003eb3bf","_id":"57cd74d2873de50e00724a2f","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-09-05T13:36:18.948Z","from_sync":false,"order":5,"slug":"extending-neo4j","title":"Extending Neo4j"},"parentDoc":null,"project":"566c97797831040d003eb3bc","user":"57167c775d90dc170060ef97","version":{"__v":10,"_id":"566c97797831040d003eb3bf","project":"566c97797831040d003eb3bc","createdAt":"2015-12-12T21:54:01.970Z","releaseDate":"2015-12-12T21:54:01.970Z","categories":["566c977a7831040d003eb3c0","5716338cb5af590e00a0ff1d","57163947893cbe0e002d75fc","57163f41b5af590e00a0ff35","57cd74d2873de50e00724a2f","57cd7de8baaee30e0093ecc3","57d6ada046dcc30e007dd15e","57fdc2b31646dc0e0010480a","57fdd8b86c9d141900d87bf1","58767da4d89ef20f003b6f1e"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-09-10T07:41:28.489Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"Procedures are the preferred means for extending Neo4j. It allows Neo4j to be extended by writing custom code which can be invoked directly from Cypher.\n\nTo know more about how to write and call procedures, please visit the  [Neo4j procedures documentation](http://neo4j.com/docs/java-reference/current/#procedures).\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"Stored procedures are available in 3.0.0 or higher versions of Neo4j. You can check your Neo4j version if you navigate to the Overview page of your database.\",\n  \"title\": \"Note\"\n}\n[/block]\n## Adding stored procedures\n\nFollow these instructions to add a stored procedure to your database:\n\n1. Navigate to the *Extensions* tab of your database dashboard, and click on the *New stored procedure* button in the dropdown menu *New extension*.\n2. Name your stored procedure in order to be able to identify it afterwards.\n3. Select the .jar file from your local path and click on *Add stored procedure*. There is a size limit of 100MB.\n4. **Do not close the browser window!** The upload will stop if you close your browser. If the upload fails, you can click on the *Retry* button to start it again. \n5. When the upload completes successfully, you will see a new row in your Extensions list with the status *ENABLED - PENDING*.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/8bd2538-extensions_enable.png\",\n        \"extensions_enable.png\",\n        959,\n        191,\n        \"#5d9ab3\"\n      ]\n    }\n  ]\n}\n[/block]\n6. Before the stored procedure can be available for use, it is necessary to restart the database. To perform this operation, click on the *Apply changes* button.\n7. A new window will show you a list of the changes you are going to perform. Please review them and click on Apply changes.\n\nYou can enable/disable your stored procedures in your extensions list by clicking on the appropriate button next to each stored procedure. Remember that you should click on* Apply changes* button to confirm all of these changes.\n\nOnce the changes are applied, you will see the final status (*ENABLED or DISABLED*) in the list.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Note\",\n  \"body\": \"You can enable/disable more than one extension at once. Click on the Enable/Disable button of the different extensions.\"\n}\n[/block]\n## Adding APOC\n\nAPOC is a generally usable library of procedures by Michael Hunger that covers different aspects that are currently not available on Cypher. It contains more than 200 procedures of different areas. You can read more [here](https://github.com/neo4j-contrib/neo4j-apoc-procedures).\n\nTo add APOC to your database, just download the APOC jar file from the[ latest release on GitHub](https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases/latest) and select the file while [adding a new stored procedure](#section-adding-stored-procedures).\n\n\nIf you want to check that APOC are available in your database, you can use the following built-in procedure and get a list:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"CALL dbms.procedures() YIELD name\\nRETURN head(split(name,\\\".\\\")) as package, count(*), collect(name) as procedures;\",\n      \"language\": \"cypher\"\n    }\n  ]\n}\n[/block]\n## Removing stored procedures\n\nTo remove your stored procedures, navigate to the Extensions tab of your database dashboard,  and just click on the *Remove* link next to the stored procedure.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/4d8646f-extensions_disabled.png\",\n        \"extensions_disabled.png\",\n        941,\n        176,\n        \"#e5e7e6\"\n      ]\n    }\n  ]\n}\n[/block]\n**Only disabled stored procedures can be removed**. Make sure you disable the procedure before attempting to remove it. You can disable the procedure by clicking on the *Disable* button.\n[block:callout]\n{\n  \"type\": \"danger\",\n  \"body\": \"This action cannot be undone and will delete your stored procedure permanently.\",\n  \"title\": \"Danger\"\n}\n[/block]","excerpt":"","slug":"stored-procedures","type":"basic","title":"Stored procedures"}
Procedures are the preferred means for extending Neo4j. It allows Neo4j to be extended by writing custom code which can be invoked directly from Cypher. To know more about how to write and call procedures, please visit the [Neo4j procedures documentation](http://neo4j.com/docs/java-reference/current/#procedures). [block:callout] { "type": "info", "body": "Stored procedures are available in 3.0.0 or higher versions of Neo4j. You can check your Neo4j version if you navigate to the Overview page of your database.", "title": "Note" } [/block] ## Adding stored procedures Follow these instructions to add a stored procedure to your database: 1. Navigate to the *Extensions* tab of your database dashboard, and click on the *New stored procedure* button in the dropdown menu *New extension*. 2. Name your stored procedure in order to be able to identify it afterwards. 3. Select the .jar file from your local path and click on *Add stored procedure*. There is a size limit of 100MB. 4. **Do not close the browser window!** The upload will stop if you close your browser. If the upload fails, you can click on the *Retry* button to start it again. 5. When the upload completes successfully, you will see a new row in your Extensions list with the status *ENABLED - PENDING*. [block:image] { "images": [ { "image": [ "https://files.readme.io/8bd2538-extensions_enable.png", "extensions_enable.png", 959, 191, "#5d9ab3" ] } ] } [/block] 6. Before the stored procedure can be available for use, it is necessary to restart the database. To perform this operation, click on the *Apply changes* button. 7. A new window will show you a list of the changes you are going to perform. Please review them and click on Apply changes. You can enable/disable your stored procedures in your extensions list by clicking on the appropriate button next to each stored procedure. Remember that you should click on* Apply changes* button to confirm all of these changes. Once the changes are applied, you will see the final status (*ENABLED or DISABLED*) in the list. [block:callout] { "type": "info", "title": "Note", "body": "You can enable/disable more than one extension at once. Click on the Enable/Disable button of the different extensions." } [/block] ## Adding APOC APOC is a generally usable library of procedures by Michael Hunger that covers different aspects that are currently not available on Cypher. It contains more than 200 procedures of different areas. You can read more [here](https://github.com/neo4j-contrib/neo4j-apoc-procedures). To add APOC to your database, just download the APOC jar file from the[ latest release on GitHub](https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases/latest) and select the file while [adding a new stored procedure](#section-adding-stored-procedures). If you want to check that APOC are available in your database, you can use the following built-in procedure and get a list: [block:code] { "codes": [ { "code": "CALL dbms.procedures() YIELD name\nRETURN head(split(name,\".\")) as package, count(*), collect(name) as procedures;", "language": "cypher" } ] } [/block] ## Removing stored procedures To remove your stored procedures, navigate to the Extensions tab of your database dashboard, and just click on the *Remove* link next to the stored procedure. [block:image] { "images": [ { "image": [ "https://files.readme.io/4d8646f-extensions_disabled.png", "extensions_disabled.png", 941, 176, "#e5e7e6" ] } ] } [/block] **Only disabled stored procedures can be removed**. Make sure you disable the procedure before attempting to remove it. You can disable the procedure by clicking on the *Disable* button. [block:callout] { "type": "danger", "body": "This action cannot be undone and will delete your stored procedure permanently.", "title": "Danger" } [/block]