design-first / system-designer

A low-code development platform for creating systems 🇺🇦#standwithUkraine
https://designfirst.io/systemdesigner/
Apache License 2.0
930 stars 136 forks source link

Graph Database #110

Closed davidmw closed 5 years ago

davidmw commented 5 years ago

I've been hunting for a design solution to help with modelling graph databases. There really isn't much available in the space beyond illustration / charting tools.

I haven't found a good way to bend system-designer to that task but it may not be much of a stretch.

Visually on the final output, links need labels and properties visible. Perhaps this is a special link type called 'edge' or 'relationship.' I need multiple edge types (often grouped in like-type collections) defined ('is child of', 'contains part', etc). Edges have ids, custom properties, direction / bi-directional, and connect to two nodes.

Nodes need to support an array of edges in and an array out. I won't keep rambling - but do really enjoy system-designer!

ecarriou commented 5 years ago

Thanks for your suggestions !

In fact, for the moment, the generated graph is quite simple in order to edit then after if you need a more complex graph. Example:

But I can add helpers to do what you want without the need to edit the Graph. To do so:

Example:

  "author": {
    "description": "author of the book",
    "kind": "aggregation",
    "type": "Author",
    "readOnly": false,
    "mandatory": false,
    "default": ""
  }

Remember also that systems created with System Designer are NoSQL-oriented because all components are stored in memory in a NoSQL database at runtime. So maybe some concepts are still missing for doing a complete Graph database design. I have to investigate.

ecarriou commented 5 years ago
davidmw commented 5 years ago

Just - Wow! Looking forward to the update as the plan looks great!

ecarriou commented 5 years ago

The implementation of the task is done. I have to create a doc to explain how to use it in System Designer, but basically:

That's all. You will see then your system in 3 different diagrams: Class, Component and Graph diagrams to have a complete overview of your system.

To request your graph system you will need to query the NoSQL repository like that:

// get all relationships of class MyRelation that have a specific component 
this.require('db').collections().MyRelation.find({
  'incoming': {
    '$eq': 'id_of_the_component'
  }
});
component-diagram graph-diagram
davidmw commented 5 years ago

The OSX app update was downloaded from the AppStore. I imported the graph example and see Node & Relationship schemas.

App doesn't let me directly "create models that extend these 2 models" so I need to create schemas. When I open the Node and Relationship schemas / models I don't see the new 'kind' property. Perhaps no default was intended.

I created a new schema for my first node collection type of 'account' and 'inherit' the default Node schema, then do the same for my first relationship. Then create components with my new model, link the relationship up - the diagrams are not what I expected from your examples above.

Maybe I do need documentation or a video example.

ecarriou commented 5 years ago

I have just finished the documentation that you can find here: https://designfirst.io/systemdesigner/documentation/docs/create-a-graph-system.html.

For incoming and outgoing links there is no kind property because because these links will be displayed the same in the Components diagram. I can make these 2 links use the kind property but do you have an example where we need to change the look of these links? Just to understand better the need.

kind property will work for all other link / collection. And can have for values: normal, dependency, aggregation or composition.

If you have any feedback on the documentation I have created, do not hesitate.

davidmw commented 5 years ago

I don't have current plans for kind and was just commenting that I don't see it in use. If there is a documented example I've missed it in my time crunch.

Forgetting to override incoming and outgoing links in a relationship model is perhaps always an error. So maybe they should be added to the model by default? Otherwise I get something like:

screen shot 2018-09-05 at 12 11 29 am

Auto generated IDs would better match my implementation if created in a GUID format.

Linking up components using default IDs is a bit painful, requiring use of the tabbed interface to find the correct object. The relationship model already defines which models are to be linked so maybe when the edge component is created you should show a list of available components and a summary of properties when setting up both inbound and outbound.

I'd like a option to not sort properties - maintain my property order in schema, model, and diagrams.

LInk and component appearance on the Component Diagram is the same for nodes and relationships. I won't suggest that relationship be a diamond shape but maybe use a dashed or light border?

ecarriou commented 5 years ago

some comment about the actual behavior:

autocomplete

I plan to add:

ecarriou commented 5 years ago

Many improvements have been made on System Designer v3.1.2. I close this issue as the task as been completed. If you find issues / needs some improvements, please create another tasks.