-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed bug in node and edge creation, added more tests for Mermaid models
added new schema Schema__MGraph__Default__Types to Schema__Mermaid__Graph which will hold the types that should be created by default (removed default types from Schema__MGraph__Graph__Config) added respective Schema__Mermaid__Default__Types class
- Loading branch information
Showing
22 changed files
with
468 additions
and
223 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
mgraph_ai/mgraph/schemas/Schema__MGraph__Default__Types.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from typing import Type | ||
from osbot_utils.type_safe.Type_Safe import Type_Safe | ||
from mgraph_ai.mgraph.schemas.Schema__MGraph__Attribute import Schema__MGraph__Attribute | ||
from mgraph_ai.mgraph.schemas.Schema__MGraph__Edge import Schema__MGraph__Edge | ||
from mgraph_ai.mgraph.schemas.Schema__MGraph__Edge__Config import Schema__MGraph__Edge__Config | ||
from mgraph_ai.mgraph.schemas.Schema__MGraph__Graph__Config import Schema__MGraph__Graph__Config | ||
from mgraph_ai.mgraph.schemas.Schema__MGraph__Node import Schema__MGraph__Node | ||
from mgraph_ai.mgraph.schemas.Schema__MGraph__Node__Config import Schema__MGraph__Node__Config | ||
|
||
class Schema__MGraph__Default__Types(Type_Safe): | ||
attribute_type : Type[Schema__MGraph__Attribute ] | ||
edge_type : Type[Schema__MGraph__Edge ] | ||
edge_config_type : Type[Schema__MGraph__Edge__Config ] | ||
graph_config_type: Type[Schema__MGraph__Graph__Config] | ||
node_type : Type[Schema__MGraph__Node ] | ||
node_config_type : Type[Schema__MGraph__Node__Config ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
from typing import Dict, Type | ||
from mgraph_ai.mgraph.schemas.Schema__MGraph__Edge import Schema__MGraph__Edge | ||
from mgraph_ai.mgraph.schemas.Schema__MGraph__Graph__Config import Schema__MGraph__Graph__Config | ||
from mgraph_ai.mgraph.schemas.Schema__MGraph__Node import Schema__MGraph__Node | ||
from osbot_utils.type_safe.Type_Safe import Type_Safe | ||
from osbot_utils.helpers.Random_Guid import Random_Guid | ||
from typing import Dict, Type | ||
from mgraph_ai.mgraph.schemas.Schema__MGraph__Default__Types import Schema__MGraph__Default__Types | ||
from mgraph_ai.mgraph.schemas.Schema__MGraph__Edge import Schema__MGraph__Edge | ||
from mgraph_ai.mgraph.schemas.Schema__MGraph__Graph__Config import Schema__MGraph__Graph__Config | ||
from mgraph_ai.mgraph.schemas.Schema__MGraph__Node import Schema__MGraph__Node | ||
from osbot_utils.type_safe.Type_Safe import Type_Safe | ||
from osbot_utils.helpers.Random_Guid import Random_Guid | ||
|
||
class Schema__MGraph__Graph(Type_Safe): | ||
edges : Dict[Random_Guid, Schema__MGraph__Edge] | ||
graph_config: Schema__MGraph__Graph__Config | ||
graph_type : Type['Schema__MGraph__Graph'] | ||
nodes : Dict[Random_Guid, Schema__MGraph__Node] | ||
default_types: Schema__MGraph__Default__Types | ||
edges : Dict[Random_Guid, Schema__MGraph__Edge] | ||
graph_config : Schema__MGraph__Graph__Config | ||
graph_type : Type['Schema__MGraph__Graph'] | ||
nodes : Dict[Random_Guid, Schema__MGraph__Node] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
from typing import Type | ||
from mgraph_ai.mgraph.schemas.Schema__MGraph__Edge import Schema__MGraph__Edge | ||
from mgraph_ai.mgraph.schemas.Schema__MGraph__Node import Schema__MGraph__Node | ||
from osbot_utils.helpers.Random_Guid import Random_Guid | ||
from osbot_utils.type_safe.Type_Safe import Type_Safe | ||
|
||
class Schema__MGraph__Graph__Config(Type_Safe): | ||
default_edge_type: Type[Schema__MGraph__Edge] | ||
default_node_type: Type[Schema__MGraph__Node] | ||
graph_id : Random_Guid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
from mgraph_ai.providers.mermaid.schemas.Schema__Mermaid__Edge import Schema__Mermaid__Edge | ||
from mgraph_ai.providers.mermaid.schemas.Schema__Mermaid__Edge__Config import Schema__Mermaid__Edge__Config | ||
from mgraph_ai.mgraph.models.Model__MGraph__Edge import Model__MGraph__Edge | ||
|
||
|
||
class Model__Mermaid__Edge(Model__MGraph__Edge): | ||
data : Schema__Mermaid__Edge | ||
config: Schema__Mermaid__Edge__Config | ||
data : Schema__Mermaid__Edge |
34 changes: 14 additions & 20 deletions
34
mgraph_ai/providers/mermaid/models/Model__Mermaid__Graph.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,19 @@ | ||
from typing import Dict | ||
from mgraph_ai.providers.mermaid.models.Model__Mermaid__Node import Model__Mermaid__Node | ||
from mgraph_ai.providers.mermaid.schemas.Schema__Mermaid__Graph__Config import Schema__Mermaid__Graph__Config | ||
from mgraph_ai.mgraph.models.Model__MGraph__Edge import Model__MGraph__Edge | ||
from mgraph_ai.providers.mermaid.schemas.Schema__Mermaid__Graph import Schema__Mermaid__Graph | ||
from mgraph_ai.mgraph.models.Model__MGraph__Graph import Model__MGraph__Graph | ||
from mgraph_ai.mgraph.models.Model__MGraph__Node import Model__MGraph__Node | ||
from osbot_utils.helpers import Random_Guid | ||
|
||
class Model__Mermaid__Graph(Model__MGraph__Graph): | ||
edges : Dict[Random_Guid, Model__MGraph__Edge] | ||
nodes : Dict[Random_Guid, Model__MGraph__Node] | ||
config : Schema__Mermaid__Graph__Config | ||
data: Schema__Mermaid__Graph | ||
|
||
def add_node(self, **kwargs): | ||
new_node = Model__Mermaid__Node(**kwargs) | ||
self.nodes[new_node.node_id] = new_node | ||
return new_node | ||
|
||
def nodes(self): | ||
for node in self.model.nodes.values(): | ||
yield Model__Mermaid__Node(data = node) | ||
|
||
def edges(self): | ||
for node in self.model.edges.values(): | ||
yield Model__Mermaid__Node(data = node) | ||
# def add_node(self, **kwargs): | ||
# new_node = Model__Mermaid__Node(**kwargs) | ||
# self.nodes[new_node.node_id] = new_node | ||
# return new_node | ||
# | ||
# def nodes(self): | ||
# for node in self.model.nodes.values(): | ||
# yield Model__Mermaid__Node(data = node) | ||
# | ||
# def edges(self): | ||
# for node in self.model.edges.values(): | ||
# yield Model__Mermaid__Node(data = node) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
mgraph_ai/providers/mermaid/schemas/Schema__Mermaid__Default__Types.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from typing import Type | ||
from osbot_utils.type_safe.Type_Safe import Type_Safe | ||
from mgraph_ai.providers.mermaid.schemas.Schema__Mermaid__Edge import Schema__Mermaid__Edge | ||
from mgraph_ai.providers.mermaid.schemas.Schema__Mermaid__Edge__Config import Schema__Mermaid__Edge__Config | ||
from mgraph_ai.providers.mermaid.schemas.Schema__Mermaid__Graph__Config import Schema__Mermaid__Graph__Config | ||
from mgraph_ai.providers.mermaid.schemas.Schema__Mermaid__Node import Schema__Mermaid__Node | ||
from mgraph_ai.providers.mermaid.schemas.Schema__Mermaid__Node__Config import Schema__Mermaid__Node__Config | ||
from mgraph_ai.mgraph.schemas.Schema__MGraph__Attribute import Schema__MGraph__Attribute | ||
|
||
class Schema__Mermaid__Default__Types(Type_Safe): | ||
attribute_type : Type[Schema__MGraph__Attribute ] | ||
edge_type : Type[Schema__Mermaid__Edge ] | ||
edge_config_type : Type[Schema__Mermaid__Edge__Config ] | ||
graph_config_type: Type[Schema__Mermaid__Graph__Config] | ||
node_type : Type[Schema__Mermaid__Node ] | ||
node_config_type : Type[Schema__Mermaid__Node__Config ] |
14 changes: 8 additions & 6 deletions
14
mgraph_ai/providers/mermaid/schemas/Schema__Mermaid__Graph.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule OSBot-Utils
updated
8 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.