{"id":13800280,"url":"https://github.com/pmikstacki/SliccDB","last_synced_at":"2025-05-13T09:31:27.784Z","repository":{"id":39406800,"uuid":"425579249","full_name":"pmikstacki/SliccDB","owner":"pmikstacki","description":"Light Embedded Graph Database for .net ","archived":false,"fork":false,"pushed_at":"2023-03-29T07:17:09.000Z","size":32893,"stargazers_count":144,"open_issues_count":2,"forks_count":14,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-08T14:52:17.198Z","etag":null,"topics":["database","graph"],"latest_commit_sha":null,"homepage":"","language":"C#","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/pmikstacki.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-11-07T18:08:05.000Z","updated_at":"2025-04-16T21:21:40.000Z","dependencies_parsed_at":"2023-02-17T23:01:25.836Z","dependency_job_id":"fa9e07ef-22a3-40dc-8f95-80dfc6e2093c","html_url":"https://github.com/pmikstacki/SliccDB","commit_stats":{"total_commits":72,"total_committers":3,"mean_commits":24.0,"dds":0.05555555555555558,"last_synced_commit":"18dbd478631f7d6de36a54c8887d081754c40f2b"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmikstacki%2FSliccDB","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmikstacki%2FSliccDB/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmikstacki%2FSliccDB/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmikstacki%2FSliccDB/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pmikstacki","download_url":"https://codeload.github.com/pmikstacki/SliccDB/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253913088,"owners_count":21983255,"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":["database","graph"],"created_at":"2024-08-04T00:01:11.063Z","updated_at":"2025-05-13T09:31:27.333Z","avatar_url":"https://github.com/pmikstacki.png","language":"C#","funding_links":[],"categories":["DataBase","Database"],"sub_categories":[],"readme":"# SliccDB\n![C#](https://img.shields.io/badge/c%23-%23239120.svg?style=for-the-badge\u0026logo=c-sharp\u0026logoColor=white) ![.Net](https://img.shields.io/badge/.NET-5C2D91?style=for-the-badge\u0026logo=.net\u0026logoColor=white) ![Visual Studio](https://img.shields.io/badge/Visual%20Studio-5C2D91.svg?style=for-the-badge\u0026logo=visual-studio\u0026logoColor=white)\n![Version](https://img.shields.io/badge/Version-0.1.1-brightgreen?style=for-the-badge)\n\nLight Embedded Graph Database for .net\n\u003cimg src=\"https://raw.githubusercontent.com/pmikstacki/SliccDB/master/SliccDB/SLICC_128.png\" width=\"128\" height=\"128\" align=\"right\"\u003e\n\n## What is it?\nThink of it like SQLite for graph databases. There were some efforts to build something like this (such as Graph Engine) but Microsoft decided to abandon all of their graph database related projects. Be aware that I have no intention to make this some sort of Neo4J .net Clone. It will be not fully compliant with features of mentioned database.\n\n## Installation\nYou have three options to get this package.\n### Nuget Package\nYou can download nuget package from [here](https://www.nuget.org/packages/SliccDB/) or by using this command\n```\nNuGet\\Install-Package SliccDB\n```\n\n### Unstable Builds\nIf you feel adventurous, you can download SliccDB as a build artifact from github actions. Note that these are not official releases, so they may contain bugs. \nBut, they can also contain features not yet found on nuget... you never know ¯\\_(ツ)_/¯\n\n### Compiling from source\nYou can always just clone this repo, open the solution with visual studio and compile it yourself. The build will produce both the dll and nuget package. \nYou can also just build it with dotnet tool thingy. You're the boss here!\n\n\n### Examples\nHere are some simple examples:\n\n#### Basic Operations\n\n##### Create Node Programatically \n\n```Csharp\nDatabaseConnection connection = new DatabaseConnection(\"filename\");\nvar properties = new Dictionary\u003cstring, string\u003e();\nvar labels = new HashSet\u003cstring\u003e();\nproperties.Add(\"Name\", \"Alice\");\nlabels.Add(\"Person\");\n\nvar nodeOne = connection.CreateNode(properties, labels);\nproperties.Clear();\nlabels.Clear();\nproperties.Add(\"Name\", \"Steve\");\nlabels.Add(\"Person\");\n\nvar nodeTwo = connection.CreateNode(properties, labels);\n```\n\n##### Create Relations between two nodes\nNote that relations also have ability to hold data like Properties and Labels\n```Csharp\nvar properties = new Dictionary\u003cstring, string\u003e();\nvar labels = new HashSet\u003cstring\u003e();\nproperties.Add(\"How Much\", \"Very Much\");\nlabels.Add(\"Label on a node!\");\nconnection.CreateRelation(\n\"Likes\", \nsn =\u003e sn.First(x =\u003e x.Hash == nodeOne.Hash), tn =\u003e tn.First(a =\u003e a.Hash == nodeTwo.Hash), properties, labels);\n```\n\n#### Queries\n\nYou can query nodes and relations as you would any collection (With Linq). \n\n###### Query Nodes\n\n```Csharp\nvar selectedNode = Connection.Nodes().Properties(\"Name\".Value(\"Tom\")).Labels(\"Person\").FirstOrDefault();\n```\n\n###### Query Relations\n\n```Csharp\nvar queriedRelation = Connection.Relations().Properties(\"Property\".Value(\"PropertyValue\"))\n                .Labels(\"RelationLabel\");\n```\n\n\n#### Mutations\n\n##### Updates\n\n```Csharp\n var relation = Connection.Relations(\"Likes\").ToList().First();\n            relation.Properties[\"How Much\"] = \"Not So Much\";\n            relation.Labels.Add(\"Love Hate Relationship\");\n\nConnection.Update(relation);\n            \n...\n\n var node = Connection.Nodes().Properties(\"Name\".Value(\"Steve\")).First();\n            node.Properties[\"Name\"] = \"Steve2\";\n\nConnection.Update(node);\n```\n\n###### Deletions\n\n```CSharp\nvar toDelete = Connection.CreateNode(\n                new Dictionary\u003cstring, string\u003e() { { \"Name\", \"Tom\" } },\n                new HashSet\u003cstring\u003e() { \"Person\" }\n            );\n\nvar queryToDelete = Connection.Nodes().Properties(\"Name\".Value(\"Tom\")).Labels(\"Person\").FirstOrDefault();\n\nConnection.Delete(queryToDelete);\n```\n```CSharp\n var testNode1 = Connection.CreateNode(\n                new Dictionary\u003cstring, string\u003e() { { \"Name\", \"C\" } },\n                new HashSet\u003cstring\u003e() { \"S\" }\n            );\n\n            var testNode2 = Connection.CreateNode(\n                new Dictionary\u003cstring, string\u003e() { { \"Name\", \"A\" } },\n                new HashSet\u003cstring\u003e() { \"S\" }\n            );            \n\nvar properties = new Dictionary\u003cstring, string\u003e();\nvar labels = new HashSet\u003cstring\u003e();\nproperties.Add(\"Test\", \"Test\");\nlabels.Add(\"Test on a node!\");\nConnection.CreateRelation(\"Test\", sn =\u003e sn.First(x =\u003e x.Hash == testNode1.Hash), tn =\u003e tn.First(a =\u003e a.Hash == testNode2.Hash), properties, labels);\n\nvar queriedRelation = Connection.Relations(\"Test\").FirstOrDefault();\n\nConnection.Delete(queriedRelation);\n```\n\n#### Schemas and Mappings\nSince 0.1.1 SliccDb features object - graph entity mapping, allowing to treat Relations and Nodes like regular poco classes.\nTo ensure correct mapping for both types and property names it was neccessary to implement some sort of **schema enforcement**.Therefore, schemas were born.\n\n##### Schemas\nSchemas are like recipes for your graph entities, they enforce the existence of certain fields and allow to specify to which type these fields should be mapped. \nSchemas are strongly related to labels. Schemas are defined per label. \n\nExample: \n```Csharp\nschema = Connection.CreateSchema(\"Person\",\n                    new List\u003cProperty\u003e() { new() { FullTypeName = \"System.String\", Name = \"Name\" }, new() { FullTypeName = \"System.Double\", Name = \"Age\" } });\n```\n\nNow when we label any entity with \"Person\", missing fields will be automatically added to it. In this example, when we add a label \"Person\" to a node or relation it will create Fields \"Name\" and \"Age\" if those do not exist.\n\n##### Mapper\nMapper allows us to manipulate graph by manipulating regular POCOs. \nLet's say we have two classes, representing Trains, Stations and a class RidesTo which represents relation between train and station: \n```Csharp\npublic class Train\n{\n    public string SerialNumber { get; set; }\n}\npublic class Station\n{\n    public string City { get; set; }\n}\npublic class RidesTo\n{ \n    public int Platform { get; set; }\n}\n```\n\nBy passing an object as an argument to method CreateNode we can create node with properties equal to the properties of an object:\n```Csharp\n  Connection.CreateNode(new Train() { SerialNumber = \"CE2332\" });\n  Connection.CreateNode(new Train() { SerialNumber = \"CE2356\" });\n  Connection.CreateNode(new Station() { City = \"Katowice\" });\n  Connection.CreateNode(new Station() { City = \"Warsaw\" });\n```\nWe can also create a relation connecting two stations (by a query) with a train: \n\n```Csharp\nConnection.CreateRelation(n =\u003e\n                Connection.Nodes().Properties(\"SerialNumber\".Value(\"CE2332\")).FirstOrDefault(),\n                a =\u003e Connection.Nodes().Properties(\"SerialNumber\".Value(\"CE2356\")).FirstOrDefault(),\n                new RidesTo(){ Platform = 2 });\n```\n\n### Why it exists?\nI just need embedded Graph Database Solution that supports Cypher Language.\nGraph DBMS is a perfect solution for some gamedev ai-related stuff (Procedural Behaviour Design, Perception and context awareness storage), but every solution needs a server. Imagine that in order to play your game you must install Neo4J's server in the first place, or every time your npc makes a decision it queries Azure Cloud to check how much he likes pizza. It's unreliable and forces you to host a game server for the entirety of a game's lifetime even though your game is singleplayer. Sounds stupid? Well, ask EA about Simcity 2013 - they thought it's a great idea! But really, Graph DBMS has other use cases. [Watch this video to know more about Graph DBMS](https://www.youtube.com/watch?v=GekQqFZm7mA)\n\n### SliccDB Studio\nYou can download SliccDB Studio [here](https://github.com/pmikstacki/SliccDBStudio).\n\nSliccDB Studio is a companion app currently used for interaction with database. It allows for CRUD operations on the database to test its' functionalities. \n\n![SliccDB Studio Screenshot](https://raw.githubusercontent.com/pmikstacki/SliccDBStudio/main/Screenshot.png)\n\n\n\n**DB Explorer is now considered obsolete, but you can still get the source code [here](https://github.com/pmikstacki/SliccDB.Explorer/)**\n\n### Progress\nBelow you'll find a list of features that will be included in the 1st milestone release of SliccDB:\n- [x] Basic Structures (Relations, Nodes)\n- [x] Serialization (Reading and Writing)\n- [x] Queries\n- [x] Basic Debugger App (Ability to add, remove, edit nodes and relations)\n- [x] Schemas for Nodes and Relations\n- [x] ORM (Object Relational Mapper) for Nodes and Relations\n- [x] New Companion App\n### Can I help?\nOf course! Any help with the SliccDB will be appreciated. \n#### Special Thanks!\n- [Oleitao](https://github.com/oleitao) He wrote first unit tests of the database!\n- [HoLLy-Hacker (cool name tho) ](https://github.com/HoLLy-HaCKeR) - He performance tested key functionalities of SliccDB and found a few ~~errors~~ bugs. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpmikstacki%2FSliccDB","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpmikstacki%2FSliccDB","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpmikstacki%2FSliccDB/lists"}