{"id":28182735,"url":"https://github.com/rcythr/simple-triplestore","last_synced_at":"2026-05-16T13:32:28.570Z","repository":{"id":250211414,"uuid":"833806319","full_name":"rcythr/simple-triplestore","owner":"rcythr","description":"A triplestore implementation which can be used as a flexible graph database with support for custom node and edge properties.","archived":false,"fork":false,"pushed_at":"2024-08-09T18:36:11.000Z","size":156,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-01T10:24:04.768Z","etag":null,"topics":["database","graph","rdf","rust","triple"],"latest_commit_sha":null,"homepage":"http://richardlaughlin.com","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rcythr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"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,"zenodo":null},"funding":{"github":["rcythr"]}},"created_at":"2024-07-25T19:37:51.000Z","updated_at":"2026-02-01T07:12:32.000Z","dependencies_parsed_at":"2025-05-16T04:13:42.389Z","dependency_job_id":"fe0f59e6-bbd7-4a97-b8cd-6f66cf9b268f","html_url":"https://github.com/rcythr/simple-triplestore","commit_stats":null,"previous_names":["rcythr/simple_triplestore","rcythr/simple-triplestore"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rcythr/simple-triplestore","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rcythr%2Fsimple-triplestore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rcythr%2Fsimple-triplestore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rcythr%2Fsimple-triplestore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rcythr%2Fsimple-triplestore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rcythr","download_url":"https://codeload.github.com/rcythr/simple-triplestore/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rcythr%2Fsimple-triplestore/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33104453,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-16T04:41:52.686Z","status":"ssl_error","status_checked_at":"2026-05-16T04:41:52.009Z","response_time":115,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["database","graph","rdf","rust","triple"],"created_at":"2025-05-16T04:13:29.624Z","updated_at":"2026-05-16T13:32:28.553Z","avatar_url":"https://github.com/rcythr.png","language":"Rust","funding_links":["https://github.com/sponsors/rcythr"],"categories":[],"sub_categories":[],"readme":"# simple-triplestore \u0026emsp; [![Latest Docs]][docs.rs] [![Latest Crate]][crates.io]\n[Latest Docs]: https://img.shields.io/docsrs/simple-triplestore/0.0.2?label=docs\n[Latest Crate]: https://img.shields.io/crates/v/simple-triplestore\n[docs.rs]: https://docs.rs/simple-triplestore/latest/\n[crates.io]: https://crates.io/crates/simple-triplestore\n\nA [triplestore](https://en.wikipedia.org/wiki/Triplestore) implementation which can be used as a flexible graph database with support for custom node and edge properties.\n\n## Data Model\nEach vertex and edge (collectively called `nodes`) are associated with an id (i.e. `u64` or [Ulid](https://docs.rs/ulid/latest/ulid/struct.Ulid.html)). \n\nProperty data is stored as \n  * `Id -\u003e NodeProps`\n  * `Id -\u003e EdgeProps`.\n\nGraph relationships are stored three times as \u003ccode\u003e(Id, Id, Id) -\u003e Id\u003c/code\u003e with the following sort orders:\n  * Subject, Predicate, Object\n  * Predicate, Object, Subject\n  * Object, Subject, Predicate\n\nThis allows for any graph query to be decomposed into a range query on the lookup with the ideal ordering. For example,\n\n* `query!{ a -b-\u003e ? }` becomes a query on the subject-predicate-object table.\n* `query!{ ? -a-\u003e b }` becomes a query on the position-object-subject table.\n* `query!{ a -?-\u003e b }` becomes a query on the object-subject-position table.\n\n## Supported Key-Value Backends\n  * [Memory](https://docs.rs/simple-triplestore/latest/simple_triplestore/struct.MemTripleStore.html)\n  * [Sled](https://docs.rs/simple-triplestore/latest/simple_triplestore/struct.SledTripleStore.html) ( with the `sled` feature )\n\n## Example\n\nPull in various includes we need:\n```rust\nuse ulid::Ulid;\nuse simple_triplestore::prelude::*;\nlet mut db = MemTripleStore::new(UlidIdGenerator::new());\n```\n\nGet some identifiers. In real applications these will come from an index or another lookup table.\n```rust\nlet node_1 = Ulid(123);\nlet node_2 = Ulid(456);\nlet node_3 = Ulid(789);\nlet edge = Ulid(999);\n```\n\nInsert nodes and edges with user-defined property types. For a given TripleStore we can have one type for Nodes and one for Edges.\n```\ndb.insert_node(node_1, \"foo\".to_string())?;\ndb.insert_node(node_2, \"bar\".to_string())?;\ndb.insert_node(node_3, \"baz\".to_string())?;\ndb.insert_edge(Triple{sub: node_1, pred: edge, obj: node_2}, Vec::from([1,2,3]))?;\ndb.insert_edge(Triple{sub: node_1, pred: edge, obj: node_3}, Vec::from([4,5,6]))?;\n```\n\nWe can now query for edges which end at `node_3`, and find that there is only one.\n\n```rust\nassert_eq!(\n  db.run(query!{ ? -?-\u003e [node_3] })?\n    .iter_edges(EdgeOrder::default())\n    .map(|r| r.expect(\"ok\"))\n    .collect::\u003cVec\u003c_\u003e\u003e(),\n  [\n    (Triple{sub: node_1, pred: edge, obj: node_3}, Vec::from([4,5,6])),\n  ]\n);\n```\n\nWe can also query for all edges which have the predicate `edge`, and find both of the edges we added:\n```rust\nassert_eq!(\n  db.run(query!{ ? -[edge]-\u003e ? })?\n    .iter_edges(EdgeOrder::default())\n    .map(|r| r.expect(\"ok\"))\n    .collect::\u003cVec\u003c_\u003e\u003e(),\n  [\n    (Triple{sub: node_1, pred: edge, obj: node_2}, Vec::from([1,2,3])),\n    (Triple{sub: node_1, pred: edge, obj: node_3}, Vec::from([4,5,6])),\n  ]\n);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frcythr%2Fsimple-triplestore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frcythr%2Fsimple-triplestore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frcythr%2Fsimple-triplestore/lists"}