{"id":16886511,"url":"https://github.com/reneklacan/cayley-ruby","last_synced_at":"2025-03-22T08:30:53.418Z","repository":{"id":18723791,"uuid":"21934970","full_name":"reneklacan/cayley-ruby","owner":"reneklacan","description":"A Ruby library for working with Google's Cayley graph database.","archived":true,"fork":false,"pushed_at":"2014-10-19T19:41:40.000Z","size":176,"stargazers_count":23,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-14T22:45:03.231Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/reneklacan.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":"2014-07-17T08:49:05.000Z","updated_at":"2024-11-11T13:58:11.000Z","dependencies_parsed_at":"2022-09-02T22:00:22.795Z","dependency_job_id":null,"html_url":"https://github.com/reneklacan/cayley-ruby","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/reneklacan%2Fcayley-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reneklacan%2Fcayley-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reneklacan%2Fcayley-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reneklacan%2Fcayley-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reneklacan","download_url":"https://codeload.github.com/reneklacan/cayley-ruby/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244931414,"owners_count":20534005,"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-13T16:40:03.758Z","updated_at":"2025-03-22T08:30:53.100Z","avatar_url":"https://github.com/reneklacan.png","language":"Ruby","readme":"# cayley-ruby\n\nA ruby library for working with\n[Google's Cayley](https://github.com/google/cayley)\ngraph database.\n\n## Installation\n\nYou can install it via gem\n\n```bash\ngem install cayley\n```\n\n## Usage\n\nStart your Cayley\n\n```bash\n# example using 30kmoviedata from cayley's repository\n./cayley http --dbpath=30kmoviedata.nq.gz\n```\n\nYou can use methods from\n[Gremlin API documentation](https://github.com/google/cayley/blob/master/docs/GremlinAPI.md), just translate method names to snake style equivalent.\n\nAs a first step you need to create your client\n\n```ruby\nrequire 'cayley'\n\ngraph = Cayley::Graph.new\n\n# or\n\ngraph = Cayley::Graph.new(host: 'localhost', port: 64210)\n```\n\nThen using **30kmovies.nt** db from cayley's repository you can do this\n\n```ruby\ngraph.vertex.get_limit(5)\n\ngraph.vertex('Humphrey Bogart').all\n\ngraph.v('Humphrey Bogart').all\n\ngraph.v('Humphrey Bogart').in('name').all\n\ngraph.v('Casablanca').in('name').all\n\ngraph.v.has('name', 'Casablanca').all\n```\n\nYou can also use morphism\n\n```\nfilm_to_actor = graph.morphism\n                     .out('/film/film/starring')\n                     .out('/film/performance/actor')\ngraph.v\n     .has('name', 'Casablanca')\n     .follow(film_to_actor)\n     .out('name').all\n```\n\nFor more info take a look at\n[Cayley's repository](https://github.com/google/cayley)\n\n## Advanced\n\nBy default result of your queries are wrapped in Hashie::Mash so you can\ndo things like these\n\n```ruby\ngraph.v.all.each do |result|\n  puts result.id # instead of result['id']\nend\n```\n\nIf you want to use plain ruby hashes you can disable wrapping by\n\n```ruby\ngraph = Cayley::Graph.new(result_wrapper: nil)\n```\n\nOr you can use some custom wrapper if you put class instead of nil.\n\n## Debugging\n\nIf you are not sure why you are getting nil as a result of your query\nand you are not able to find out the solution you can turn on debug mode\nwhere used Gremlin query is printed out.\n\n```ruby\ngraph = Cayley::Graph.new(debug: true)\n```\n\n## TODO\n\n* logger\n* tests\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freneklacan%2Fcayley-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freneklacan%2Fcayley-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freneklacan%2Fcayley-ruby/lists"}