{"id":15679258,"url":"https://github.com/jexp/streaming-cypher","last_synced_at":"2025-05-07T09:28:22.598Z","repository":{"id":2998702,"uuid":"4015889","full_name":"jexp/streaming-cypher","owner":"jexp","description":"Neo4j Server Extension for Streaming Cypher Results","archived":false,"fork":false,"pushed_at":"2012-07-06T08:36:53.000Z","size":138,"stargazers_count":12,"open_issues_count":1,"forks_count":3,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-03-31T08:39:28.002Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jexp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-04-13T13:06:23.000Z","updated_at":"2016-11-04T17:46:29.000Z","dependencies_parsed_at":"2022-09-21T07:52:23.566Z","dependency_job_id":null,"html_url":"https://github.com/jexp/streaming-cypher","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jexp%2Fstreaming-cypher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jexp%2Fstreaming-cypher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jexp%2Fstreaming-cypher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jexp%2Fstreaming-cypher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jexp","download_url":"https://codeload.github.com/jexp/streaming-cypher/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252850390,"owners_count":21813957,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T16:27:51.059Z","updated_at":"2025-05-07T09:28:22.574Z","avatar_url":"https://github.com/jexp.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Streaming Cypher\n\nJust put the [jar](https://github.com/downloads/neo4j-contrib/streaming-cypher/streaming-cypher-extension-1.7.M03.jar) (streaming-cypher-extension-1.7.M03.jar) into neo4j-server/plugins and add this to the conf/neo4j-server.properties file\n\n    org.neo4j.server.thirdparty_jaxrs_classes=org.neo4j.server.extension.streaming.cypher=/streaming\n\nThen you can issue\n\n    curl -d'{\"query\":\"start n=node(*) return n\"}' -H accept:application/json -H content-type:application/json http://localhost:7474/streaming/cypher\n\nto query the graph and stream the results.\n\nNote, for rendering the existing format of the Neo4j-REST API (without the additional discoverable URLs) use `mode=compat`:\n\n    curl -d'{\"query\":\"start n=node(*) return n\"}' -H accept:application/json;mode=compat -H content-type:application/json http://localhost:7474/streaming/cypher\n\nA pretty printing result is acquired by adding `format=pretty to the Accept Header.\n\n    curl -d'{\"query\":\"start n=node(*) return n\"}' -H accept:application/json;format=pretty -H content-type:application/json http://localhost:7474/streaming/cypher\n\nA sample Parser/Client implementation is in org.neo4j.server.extension.streaming.cypher.CypherResultReader\n\nThe format is for a query like:\n\n    start n=node(*) match p=n-[r]-m return  n as first,r as rel,m as second,m.name? as name,r.foo? as foo,ID(n) as id, p as path , NODES(p) as all\n\n\t// columns\n\t{\"columns\":[\"first\",\"rel\",\"second\",\"name\",\"foo\",\"id\",\"path\",\"all\"],\n    // rows is an array of array of objects each object is { type : value }\n\t\"rows\":[\n\t    [{\"Node\":{\"id\":0,\"data\":{\"name\":42}}},\n         {\"Relationship\":{\"id\":0,\"start\":0,\"end\":1,\"type\":\"knows\",\"data\":{\"name\":\"rel1\"}}},\n         {\"Node\":{\"id\":1,\"data\":{\"name\":\"n2\"}}},\n         {\"String\":\"n2\"},\n         {\"Null\":null},\n         {\"Long\":0},\n         {\"Path\":\n             {\"length\":1,\n              \"start\":{\"id\":0,\"data\":{\"name\":42}},\n              \"end\":{\"id\":1,\"data\":{\"name\":\"n2\"}},\n              \"last_rel\":{\"id\":0,\"start\":0,\"end\":1,\"type\":\"knows\",\"data\":{\"name\":\"rel1\"}},\n              \"nodes\":[{\"id\":0,\"data\":{\"name\":42}},{\"id\":1,\"data\":{\"name\":\"n2\"}}],\n              \"relationships\":[{\"id\":0,\"start\":0,\"end\":1,\"type\":\"knows\",\"data\":{\"name\":\"rel1\"}}]}},\n         {\"Array\":[{\"id\":0,\"data\":{\"name\":42}},{\"id\":1,\"data\":{\"name\":\"n2\"}}]}]],\n    // number of rows\n\t\"count\":1,\n    // full runtime including streaming all the results\n\t\"time\":29}\n\n\nheader params/websocket format (in protocol field)\n\nmode=none\nmode=compact\nmode=compat\n\nformat=pretty\n\n## websocket protocol\n\n\n* array of commands\n* each command is: [opcode, selector, data]\n\n* opcodes: ADD|DELETE|UPDATE _NODES | ADD|DELETE|UPDATE _RELS | CYPHER\n\n* selector: id, [ids], ref, { index:key : value}, { index : query}, *\n  (selector after opcode or as start, end for relationships, traversals etc.)\n\n* ref is a lookup mechanism during command execution (in a context)\n\n* data is a map or a list of maps depending on command\n\n* streaming results\n\n    function init() { ws = new WebSocket(\"ws://localhost:8080/command\");ws.onmessage = function(evt) { console.log(evt.data);}}\n    ws.send(JSON.stringify([[\"ADD_NODES\",null,{data:{name:\"foo\"},ref:\"foo\", unique: { index: \"test\", key: \"name\", value:\"foo\"}}],[\"GET_NODES\",\"*\",null]]))\n\n### commands\n\n* ADD_NODES : data is single or array of { data : {props}, ref : \"ref\", index : {index: key: value:} | [{}], unique: {index: key: value:}}\n\n* ADD_RELS : data is single or array of { data : {props}, ref : \"ref\",type:\"type\", start: selector, end : selector, index : {index: key: value: } | [{}], unique: {index: key: value:}}\n\n* DELETE_NODES : uses selector , if data is { force : true } it also deletes the relationships\n* DELETE_RELS : uses selector\n\n* UPDATE_NODES, UPDATE_RELS : uses selector, data is array or single of { data : {props}, ref : \"ref\", index : {index: [key:] [value:] [old:]}}, null values delete properties and index entries, old index value will be removed\n* CYPHER : data is { query : \"query\" , [params : { params}], useContext: true, mergeResult : true } useContext -\u003e merges current context with params, merges cypher result with context","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjexp%2Fstreaming-cypher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjexp%2Fstreaming-cypher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjexp%2Fstreaming-cypher/lists"}