{"id":20750111,"url":"https://github.com/outworkers/reactiveneo","last_synced_at":"2025-04-28T12:53:18.618Z","repository":{"id":19743601,"uuid":"23000271","full_name":"outworkers/reactiveneo","owner":"outworkers","description":"[DISCONTINUED] Reactive type-safe Scala driver for Neo4J","archived":false,"fork":false,"pushed_at":"2015-09-20T21:02:14.000Z","size":554,"stargazers_count":69,"open_issues_count":3,"forks_count":7,"subscribers_count":7,"default_branch":"develop","last_synced_at":"2025-03-30T09:41:25.116Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://outworkers.github.io/reactiveneo","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/outworkers.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-15T19:17:52.000Z","updated_at":"2021-06-21T14:51:57.000Z","dependencies_parsed_at":"2022-08-25T00:12:19.865Z","dependency_job_id":null,"html_url":"https://github.com/outworkers/reactiveneo","commit_stats":null,"previous_names":["websudos/reactiveneo"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outworkers%2Freactiveneo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outworkers%2Freactiveneo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outworkers%2Freactiveneo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outworkers%2Freactiveneo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/outworkers","download_url":"https://codeload.github.com/outworkers/reactiveneo/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251318855,"owners_count":21570419,"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-11-17T08:25:47.770Z","updated_at":"2025-04-28T12:53:18.569Z","avatar_url":"https://github.com/outworkers.png","language":"Scala","readme":"# reactiveneo [![Build Status](https://travis-ci.org/websudos/reactiveneo.svg?branch=develop)](https://travis-ci.org/websudos/reactiveneo) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.websudos/reactiveneo_2.10/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.websudos/reactiveneo_2.10)\n\nReactive type-safe Scala DSL for Neo4j\n\n\n# Table of contents\n\n\u003col\u003e\n  \u003cli\u003e\u003ca href=\"#getting-it\"\u003eGetting it\u003c/a\u003e\u003c/li\u003e\n  \u003cli\u003e\u003ca href=\"#graph-modelling\"\u003eGraph modelling\u003c/a\u003e\u003c/li\u003e\n  \u003cli\u003e\u003ca href=\"#nodes\"\u003eNodes\u003c/a\u003e\u003c/li\u003e\n  \u003cli\u003e\u003ca href=\"#relationships\"\u003eRelationships\u003c/a\u003e\u003c/li\u003e\n  \u003cli\u003e\u003ca href=\"#indexes\"\u003eIndexes\u003c/a\u003e\u003c/li\u003e\n  \u003cli\u003e\u003ca href=\"#querying\"\u003eQuerying\u003c/a\u003e\u003c/li\u003e\n\u003c/ol\u003e\n\n\nThe library enforces strong type checks that imposes some restrictions on query format. Every node and relationship\nused in the query needs to be defined and named.\nE.g. this kind of query is not supported:\n```\nMATCH (wallstreet { title:'Wall Street' })\u003c-[r:ACTED_IN]-(actor)\nRETURN r\n```\nInstead you will need to use proper labels for nodes to produce the following query:\n```\nMATCH (wallstreet:Movie { title:'Wall Street' })\u003c-[r:ACTED_IN]-(actor:Actor)\nRETURN r\n```\n\n\n\n# Getting it\n\n```scala\nlibraryDependencies ++= Seq(\n  \"com.websudos\" %% \"reactiveneo-dsl\" % \"0.3.0\",\n  \"com.websudos\" %% \"reactiveneo-testing\" % \"0.3.0\"\n)\n```\n\n# Graph modelling\n\u003ca href=\"#table-of-contents\"\u003eBack to top\u003c/a\u003e\n\n## Nodes\n\u003ca href=\"#table-of-contents\"\u003eBack to top\u003c/a\u003e\n\nDomain model class\n```\ncase class Person(name: String, age: Int)\n```\n\nReactiveneo node definition\n```\nimport com.websudos.reactiveneo.dsl._\n\nclass PersonNode extends Node[PersonNode, Person] {\n  \n  object name extends StringAttribute with Index\n  \n  object age extends IntegerAttribute\n  \n  def fromNode(data: QueryRecord): Person = {\n    Person(name[String](data), age[Int](data))  \n  }\n  \n}\n```\n\n## Relationships\n\u003ca href=\"#table-of-contents\"\u003eBack to top\u003c/a\u003e\n\nReactiveneo relationship definition\n```\nimport com.websudos.reactiveneo.dsl._\n\nclass PersonRelation extends Relationship[PersonRelation, Person] {\n  \n  object name extends StringAttribute with Index\n  \n  object age extends IntegerAttribute\n  \n  def fromNode(data: QueryRecord): Person = {\n    Person(name[String](data), age[Int](data))  \n  }\n  \n}\n```\n\n## Indexes\n\u003ca href=\"#table-of-contents\"\u003eBack to top\u003c/a\u003e\n\n\n\n# Querying\n\u003ca href=\"#table-of-contents\"\u003eBack to top\u003c/a\u003e\n\n## Connection\n\nPrerequisite to making Neo4j requests is REST endpoint definition. This is achived using RestConnection class.\n\n```\nscala\u003e implicit val service = RestConnection(\"localhost\", 7474)\nservice: RestConnection\n```\n\n## Making requests\n\nIn this example all nodes of Person type are returned.\n```\nscala\u003e val personNodes = Person().returns(case p ~~ _ =\u003e p).execute\npersonNodes: Future[Seq[Person]]\n```\n\nThe strange construct in the returns function is execution of extractor in the pattern. Pattern defines set of objects\nthat participate in the query. The objects are nodes and relationships.\n\nYou can also query for specific attributes of a node.\n```\nscala\u003e val personNames = Person().returns(case p ~~ _ =\u003e p.name).execute\npersonNames: Future[Seq[String]]\n```\n\nA query that involves attributes matching.\n```\nscala\u003e val personNodes = Person(_.name := \"Tom\").returns(case p ~~ _ =\u003e p).execute\npersonNodes: Future[Seq[Person]]\n```\n\nQuery for a person that has a relationship to another person\n```\nscala\u003e val personNodes = (Person() :-\u003e: Person())\n                         .returns(case p1 ~~ _ =\u003e p).execute\npersonNodes: Future[Seq[Person]]\n```\n\nQuery for a person that has a relationship to another person with given name\n```\nscala\u003e val personNodes = (Person() :-\u003e: Person(_.name := \"James\"))\n                         .returns(case p ~~ _ =\u003e p).execute\npersonNodes: Future[Seq[Person]]\n```\n\n\nQuery for a person that has a relationship to another person\n```\nscala\u003e val personNodes = (Person() :\u003c-: WorkRelationship() :-\u003e: Person())\n                         .returns(case p1 ~~ r ~~ p2 ~~ _ =\u003e p1).execute\npersonNodes: Future[Seq[Person]]\n```\n\n\nQuery for a person that has a relationship to another person with given name\n```\nscala\u003e val personNodes = (Person() :-: WorkRelationship(_.company := \"ABC\") :-\u003e: Person(_.name := \"John\"))\n                         .returns(case p1 ~~ _ =\u003e p1).execute\npersonNodes: Future[Seq[Person]]\n```\n\n## An arbitrary Cypher query\nCypher is a rich language and whenever you need to use it directly escaping the abstraction layer it's still possible\nwith ReactiveNeo. Use the same REST connection object with an arbitrary Cypher query.\n```\nscala\u003e val query = \"MATCH (n:Person) RETURN n\"\nquery: String\nimplicit val parser: Reads[Person] = ((__ \\ \"name\").read[String] and (__ \\ \"age\").read[Int])(Person)\n\nparser: Reads[Person]\nval result = service.makeRequest[Person](query).execute\nresult: Future[Seq[Person]]\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foutworkers%2Freactiveneo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foutworkers%2Freactiveneo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foutworkers%2Freactiveneo/lists"}