{"action":"created","comment":{"url":"https://api.github.com/repos/Originate/scalypher/pulls/comments/31380350","id":31380350,"diff_hunk":"@@ -0,0 +1,159 @@\n+package test.query\n+\n+import com.originate.scalypher.path.AnyNode\n+import com.originate.scalypher.path.CypherNode\n+import com.originate.scalypher.path.KindRelationship\n+import com.originate.scalypher.MergeQuery\n+\n+import org.scalatest._\n+\n+class MergeQuerySpec extends WordSpec with Matchers {\n+\n+  val startNode = CypherNode(\"label1\")\n+  val createRelationship = KindRelationship(\"label\")\n+  val endNode = CypherNode(\"label2\")\n+  val matchPath = startNode -- endNode\n+  val createPath = startNode -- createRelationship -- endNode\n+  val where = startNode.property(\"id\") <> \"test\"\n+\n+  \"only a merge path is given\" must {\n+\n+    \"produce a query that merges a node\" in {\n+      val create = MergeQuery(startNode)\n+      create.toQuery shouldBe \"MERGE (:label1)\"\n+    }\n+\n+  }\n+\n+  \"a match and merge path is given\" must {\n+\n+    \"use simple identifiers for references in the merge path\" in {\n+      val create = matchPath merge createPath\n+      create.toQuery shouldBe \"MATCH (a1:label1)--(a2:label2) MERGE (a1)-[:label]-(a2)\"\n+    }\n+\n+    \"include a return statement if provided\" in {\n+      val create = matchPath merge createPath returnDistinct startNode\n+      create.toQuery shouldBe \"\"\"MATCH (a1:label1)--(a2:label2) MERGE (a1)-[:label]-(a2) RETURN DISTINCT a1\"\"\"\n+    }\n+\n+    \"add identifier to reference if it appears in the return statement\" in {\n+      val create = matchPath merge createPath returnDistinct createRelationship\n+      val query = create.toQuery\n+      query should include (\")-[a1:label]-(\")","path":"src/test/scala/query/MergeQuerySpec.scala","position":43,"original_position":43,"commit_id":"324d3848af262c64f6e277e7cfb7126a2c5e6e0f","original_commit_id":"324d3848af262c64f6e277e7cfb7126a2c5e6e0f","user":{"login":"matthandlersux","id":72524,"avatar_url":"https://avatars.githubusercontent.com/u/72524?v=3","gravatar_id":"","url":"https://api.github.com/users/matthandlersux","html_url":"https://github.com/matthandlersux","followers_url":"https://api.github.com/users/matthandlersux/followers","following_url":"https://api.github.com/users/matthandlersux/following{/other_user}","gists_url":"https://api.github.com/users/matthandlersux/gists{/gist_id}","starred_url":"https://api.github.com/users/matthandlersux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthandlersux/subscriptions","organizations_url":"https://api.github.com/users/matthandlersux/orgs","repos_url":"https://api.github.com/users/matthandlersux/repos","events_url":"https://api.github.com/users/matthandlersux/events{/privacy}","received_events_url":"https://api.github.com/users/matthandlersux/received_events","type":"User","site_admin":false},"body":"![getinsertpic.com](http://media4.giphy.com/media/idvCLedhkZwxa/200.gif)","created_at":"2015-05-30T12:43:46Z","updated_at":"2015-05-30T12:43:46Z","html_url":"https://github.com/Originate/scalypher/pull/1#discussion_r31380350","pull_request_url":"https://api.github.com/repos/Originate/scalypher/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/Originate/scalypher/pulls/comments/31380350"},"html":{"href":"https://github.com/Originate/scalypher/pull/1#discussion_r31380350"},"pull_request":{"href":"https://api.github.com/repos/Originate/scalypher/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/Originate/scalypher/pulls/1","id":36345147,"html_url":"https://github.com/Originate/scalypher/pull/1","diff_url":"https://github.com/Originate/scalypher/pull/1.diff","patch_url":"https://github.com/Originate/scalypher/pull/1.patch","issue_url":"https://api.github.com/repos/Originate/scalypher/issues/1","number":1,"state":"open","locked":false,"title":"Mh add create queries","user":{"login":"matthandlersux","id":72524,"avatar_url":"https://avatars.githubusercontent.com/u/72524?v=3","gravatar_id":"","url":"https://api.github.com/users/matthandlersux","html_url":"https://github.com/matthandlersux","followers_url":"https://api.github.com/users/matthandlersux/followers","following_url":"https://api.github.com/users/matthandlersux/following{/other_user}","gists_url":"https://api.github.com/users/matthandlersux/gists{/gist_id}","starred_url":"https://api.github.com/users/matthandlersux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthandlersux/subscriptions","organizations_url":"https://api.github.com/users/matthandlersux/orgs","repos_url":"https://api.github.com/users/matthandlersux/repos","events_url":"https://api.github.com/users/matthandlersux/events{/privacy}","received_events_url":"https://api.github.com/users/matthandlersux/received_events","type":"User","site_admin":false},"body":"@a-wortman\r\na bunch of changes rolled together :/...\r\n\r\n* rename types so that there is no \"ThingType\" (NodeType => Node, RelationshipType => Relationship, etc)\r\n* break Query file into several parts and move files to folder\r\n* add subclasses of Query (MergeQuery, CreateQuery, MatchQuery)\r\n\r\ni'll comment inline for the things i could actually use some feedback on","created_at":"2015-05-27T20:28:48Z","updated_at":"2015-05-30T12:43:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"308fb3a87cc2f271f311374215085dfb1902d918","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Originate/scalypher/pulls/1/commits","review_comments_url":"https://api.github.com/repos/Originate/scalypher/pulls/1/comments","review_comment_url":"https://api.github.com/repos/Originate/scalypher/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Originate/scalypher/issues/1/comments","statuses_url":"https://api.github.com/repos/Originate/scalypher/statuses/324d3848af262c64f6e277e7cfb7126a2c5e6e0f","head":{"label":"Originate:mh-add-create-queries","ref":"mh-add-create-queries","sha":"324d3848af262c64f6e277e7cfb7126a2c5e6e0f","user":{"login":"Originate","id":1627168,"avatar_url":"https://avatars.githubusercontent.com/u/1627168?v=3","gravatar_id":"","url":"https://api.github.com/users/Originate","html_url":"https://github.com/Originate","followers_url":"https://api.github.com/users/Originate/followers","following_url":"https://api.github.com/users/Originate/following{/other_user}","gists_url":"https://api.github.com/users/Originate/gists{/gist_id}","starred_url":"https://api.github.com/users/Originate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Originate/subscriptions","organizations_url":"https://api.github.com/users/Originate/orgs","repos_url":"https://api.github.com/users/Originate/repos","events_url":"https://api.github.com/users/Originate/events{/privacy}","received_events_url":"https://api.github.com/users/Originate/received_events","type":"Organization","site_admin":false},"repo":{"id":34873365,"name":"scalypher","full_name":"Originate/scalypher","owner":{"login":"Originate","id":1627168,"avatar_url":"https://avatars.githubusercontent.com/u/1627168?v=3","gravatar_id":"","url":"https://api.github.com/users/Originate","html_url":"https://github.com/Originate","followers_url":"https://api.github.com/users/Originate/followers","following_url":"https://api.github.com/users/Originate/following{/other_user}","gists_url":"https://api.github.com/users/Originate/gists{/gist_id}","starred_url":"https://api.github.com/users/Originate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Originate/subscriptions","organizations_url":"https://api.github.com/users/Originate/orgs","repos_url":"https://api.github.com/users/Originate/repos","events_url":"https://api.github.com/users/Originate/events{/privacy}","received_events_url":"https://api.github.com/users/Originate/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Originate/scalypher","description":"a DSL for building neo4j cypher queries in scala","fork":false,"url":"https://api.github.com/repos/Originate/scalypher","forks_url":"https://api.github.com/repos/Originate/scalypher/forks","keys_url":"https://api.github.com/repos/Originate/scalypher/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Originate/scalypher/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Originate/scalypher/teams","hooks_url":"https://api.github.com/repos/Originate/scalypher/hooks","issue_events_url":"https://api.github.com/repos/Originate/scalypher/issues/events{/number}","events_url":"https://api.github.com/repos/Originate/scalypher/events","assignees_url":"https://api.github.com/repos/Originate/scalypher/assignees{/user}","branches_url":"https://api.github.com/repos/Originate/scalypher/branches{/branch}","tags_url":"https://api.github.com/repos/Originate/scalypher/tags","blobs_url":"https://api.github.com/repos/Originate/scalypher/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Originate/scalypher/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Originate/scalypher/git/refs{/sha}","trees_url":"https://api.github.com/repos/Originate/scalypher/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Originate/scalypher/statuses/{sha}","languages_url":"https://api.github.com/repos/Originate/scalypher/languages","stargazers_url":"https://api.github.com/repos/Originate/scalypher/stargazers","contributors_url":"https://api.github.com/repos/Originate/scalypher/contributors","subscribers_url":"https://api.github.com/repos/Originate/scalypher/subscribers","subscription_url":"https://api.github.com/repos/Originate/scalypher/subscription","commits_url":"https://api.github.com/repos/Originate/scalypher/commits{/sha}","git_commits_url":"https://api.github.com/repos/Originate/scalypher/git/commits{/sha}","comments_url":"https://api.github.com/repos/Originate/scalypher/comments{/number}","issue_comment_url":"https://api.github.com/repos/Originate/scalypher/issues/comments{/number}","contents_url":"https://api.github.com/repos/Originate/scalypher/contents/{+path}","compare_url":"https://api.github.com/repos/Originate/scalypher/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Originate/scalypher/merges","archive_url":"https://api.github.com/repos/Originate/scalypher/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Originate/scalypher/downloads","issues_url":"https://api.github.com/repos/Originate/scalypher/issues{/number}","pulls_url":"https://api.github.com/repos/Originate/scalypher/pulls{/number}","milestones_url":"https://api.github.com/repos/Originate/scalypher/milestones{/number}","notifications_url":"https://api.github.com/repos/Originate/scalypher/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Originate/scalypher/labels{/name}","releases_url":"https://api.github.com/repos/Originate/scalypher/releases{/id}","created_at":"2015-04-30T19:48:59Z","updated_at":"2015-05-29T09:55:26Z","pushed_at":"2015-05-28T19:22:49Z","git_url":"git://github.com/Originate/scalypher.git","ssh_url":"git@github.com:Originate/scalypher.git","clone_url":"https://github.com/Originate/scalypher.git","svn_url":"https://github.com/Originate/scalypher","homepage":null,"size":268,"stargazers_count":1,"watchers_count":1,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":1,"default_branch":"master"}},"base":{"label":"Originate:master","ref":"master","sha":"016e4457b9887c7ee71895560ee9076709bd24e9","user":{"login":"Originate","id":1627168,"avatar_url":"https://avatars.githubusercontent.com/u/1627168?v=3","gravatar_id":"","url":"https://api.github.com/users/Originate","html_url":"https://github.com/Originate","followers_url":"https://api.github.com/users/Originate/followers","following_url":"https://api.github.com/users/Originate/following{/other_user}","gists_url":"https://api.github.com/users/Originate/gists{/gist_id}","starred_url":"https://api.github.com/users/Originate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Originate/subscriptions","organizations_url":"https://api.github.com/users/Originate/orgs","repos_url":"https://api.github.com/users/Originate/repos","events_url":"https://api.github.com/users/Originate/events{/privacy}","received_events_url":"https://api.github.com/users/Originate/received_events","type":"Organization","site_admin":false},"repo":{"id":34873365,"name":"scalypher","full_name":"Originate/scalypher","owner":{"login":"Originate","id":1627168,"avatar_url":"https://avatars.githubusercontent.com/u/1627168?v=3","gravatar_id":"","url":"https://api.github.com/users/Originate","html_url":"https://github.com/Originate","followers_url":"https://api.github.com/users/Originate/followers","following_url":"https://api.github.com/users/Originate/following{/other_user}","gists_url":"https://api.github.com/users/Originate/gists{/gist_id}","starred_url":"https://api.github.com/users/Originate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Originate/subscriptions","organizations_url":"https://api.github.com/users/Originate/orgs","repos_url":"https://api.github.com/users/Originate/repos","events_url":"https://api.github.com/users/Originate/events{/privacy}","received_events_url":"https://api.github.com/users/Originate/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Originate/scalypher","description":"a DSL for building neo4j cypher queries in scala","fork":false,"url":"https://api.github.com/repos/Originate/scalypher","forks_url":"https://api.github.com/repos/Originate/scalypher/forks","keys_url":"https://api.github.com/repos/Originate/scalypher/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Originate/scalypher/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Originate/scalypher/teams","hooks_url":"https://api.github.com/repos/Originate/scalypher/hooks","issue_events_url":"https://api.github.com/repos/Originate/scalypher/issues/events{/number}","events_url":"https://api.github.com/repos/Originate/scalypher/events","assignees_url":"https://api.github.com/repos/Originate/scalypher/assignees{/user}","branches_url":"https://api.github.com/repos/Originate/scalypher/branches{/branch}","tags_url":"https://api.github.com/repos/Originate/scalypher/tags","blobs_url":"https://api.github.com/repos/Originate/scalypher/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Originate/scalypher/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Originate/scalypher/git/refs{/sha}","trees_url":"https://api.github.com/repos/Originate/scalypher/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Originate/scalypher/statuses/{sha}","languages_url":"https://api.github.com/repos/Originate/scalypher/languages","stargazers_url":"https://api.github.com/repos/Originate/scalypher/stargazers","contributors_url":"https://api.github.com/repos/Originate/scalypher/contributors","subscribers_url":"https://api.github.com/repos/Originate/scalypher/subscribers","subscription_url":"https://api.github.com/repos/Originate/scalypher/subscription","commits_url":"https://api.github.com/repos/Originate/scalypher/commits{/sha}","git_commits_url":"https://api.github.com/repos/Originate/scalypher/git/commits{/sha}","comments_url":"https://api.github.com/repos/Originate/scalypher/comments{/number}","issue_comment_url":"https://api.github.com/repos/Originate/scalypher/issues/comments{/number}","contents_url":"https://api.github.com/repos/Originate/scalypher/contents/{+path}","compare_url":"https://api.github.com/repos/Originate/scalypher/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Originate/scalypher/merges","archive_url":"https://api.github.com/repos/Originate/scalypher/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Originate/scalypher/downloads","issues_url":"https://api.github.com/repos/Originate/scalypher/issues{/number}","pulls_url":"https://api.github.com/repos/Originate/scalypher/pulls{/number}","milestones_url":"https://api.github.com/repos/Originate/scalypher/milestones{/number}","notifications_url":"https://api.github.com/repos/Originate/scalypher/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Originate/scalypher/labels{/name}","releases_url":"https://api.github.com/repos/Originate/scalypher/releases{/id}","created_at":"2015-04-30T19:48:59Z","updated_at":"2015-05-29T09:55:26Z","pushed_at":"2015-05-28T19:22:49Z","git_url":"git://github.com/Originate/scalypher.git","ssh_url":"git@github.com:Originate/scalypher.git","clone_url":"https://github.com/Originate/scalypher.git","svn_url":"https://github.com/Originate/scalypher","homepage":null,"size":268,"stargazers_count":1,"watchers_count":1,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Originate/scalypher/pulls/1"},"html":{"href":"https://github.com/Originate/scalypher/pull/1"},"issue":{"href":"https://api.github.com/repos/Originate/scalypher/issues/1"},"comments":{"href":"https://api.github.com/repos/Originate/scalypher/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/Originate/scalypher/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/Originate/scalypher/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Originate/scalypher/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/Originate/scalypher/statuses/324d3848af262c64f6e277e7cfb7126a2c5e6e0f"}}}}