{"id":15705055,"url":"https://github.com/jnunemaker/tao","last_synced_at":"2025-07-02T12:35:22.493Z","repository":{"id":65988490,"uuid":"95793761","full_name":"jnunemaker/tao","owner":"jnunemaker","description":"Nothing serious or finished, just playing with facebook tao concepts","archived":false,"fork":false,"pushed_at":"2020-01-06T16:45:38.000Z","size":45,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-12T18:15:39.419Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jnunemaker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-29T15:49:22.000Z","updated_at":"2020-09-01T04:56:14.000Z","dependencies_parsed_at":"2023-03-20T12:32:51.809Z","dependency_job_id":null,"html_url":"https://github.com/jnunemaker/tao","commit_stats":{"total_commits":32,"total_committers":1,"mean_commits":32.0,"dds":0.0,"last_synced_commit":"37643fa91705f3b39af3e66b78e31a704f0278c7"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jnunemaker/tao","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jnunemaker%2Ftao","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jnunemaker%2Ftao/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jnunemaker%2Ftao/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jnunemaker%2Ftao/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jnunemaker","download_url":"https://codeload.github.com/jnunemaker/tao/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jnunemaker%2Ftao/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263141178,"owners_count":23420018,"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-03T20:14:41.287Z","updated_at":"2025-07-02T12:35:22.467Z","avatar_url":"https://github.com/jnunemaker.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tao\n\nNothing to see here. Just playing around.\n\n## Setup\n\n### The Tables\n\n```ruby\nActiveRecord::Base.establish_connection({\n  adapter: \"postgresql\",\n  database: \"tao_test\",\n})\nActiveRecord::Base.connection.execute(\"DROP TABLE IF EXISTS tao_objects\")\nActiveRecord::Base.connection.execute(\"DROP TABLE IF EXISTS tao_associations\")\nActiveRecord::Base.connection.execute(\u003c\u003c-SQL)\n  CREATE TABLE tao_objects (\n    id BIGSERIAL NOT NULL,\n    type CHARACTER VARYING(255) NOT NULL,\n    value JSONB NOT NULL DEFAULT '{}'::jsonb,\n    PRIMARY KEY (id)\n  )\nSQL\nActiveRecord::Base.connection.execute(\u003c\u003c-SQL)\n  CREATE TABLE tao_associations (\n    id1 BIGINT NOT NULL,\n    type CHARACTER VARYING(255) NOT NULL,\n    id2 BIGINT NOT NULL,\n    created_at TIMESTAMP WITHOUT TIME ZONE NOT NULL,\n    value JSONB NOT NULL DEFAULT '{}'::jsonb,\n    PRIMARY KEY (id1, type, id2)\n  )\nSQL\nActiveRecord::Base.connection.execute(\u003c\u003c-SQL)\n  CREATE INDEX index_tao_associations_on_time ON tao_associations(id1, type, created_at)\nSQL\n```\n\n### The Code\n\n```ruby\nrequire 'tao'\nclient = Tao::Client.new\njohn = client.objects.create(\"user\", \"name\" =\u003e \"John\").value!\nsteve = client.objects.create(\"user\", \"name\" =\u003e \"Steve\").value!\nhoyt = client.objects.create(\"user\", \"name\" =\u003e \"Hoyt\").value!\nbrandon = client.objects.create(\"user\", \"name\" =\u003e \"Brandon\").value!\nmatt = client.objects.create(\"user\", \"name\" =\u003e \"Matt\").value!\n\n# make some friends\n[steve, hoyt, brandon, matt].each do |user|\n  client.associations.create(john.id, \"friend\", user.id).value!\n  client.associations.create(user.id, \"friend\", john.id).value!\nend\n\n# count some friends\np client.associations.count(john.id, \"friend\").value!  # =\u003e 4\np client.associations.count(steve.id, \"friend\").value! # =\u003e 1\n\n# query some friends\np client.associations.range(john.id, \"friend\").value!\np client.associations.range(john.id, \"friend\", offset: 3, limit: 10).value!\n```\n\n## Links\n\n* https://www.facebook.com/notes/facebook-engineering/tao-the-power-of-the-graph/10151525983993920/\n* https://www.usenix.org/conference/atc13/technical-sessions/presentation/bronson\n* https://blog.acolyer.org/2015/05/19/tao-facebooks-distributed-data-store-for-the-social-graph/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjnunemaker%2Ftao","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjnunemaker%2Ftao","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjnunemaker%2Ftao/lists"}