Skip to content

Data modeling add aura data importer support #74

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions servers/mcp-neo4j-data-modeling/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
### Fixed

### Changed
* Update tool name `export_to_arrows_json` to `export_to_arrows_json_str` to be more specific

### Added
* Add tools to import and export from Aura Data Import tool format

## v0.1.1

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,316 @@
"""
These are the models that make up the data model structure generated by the Aura Data Import console tool.
"""

from typing import List, Literal, Optional, TypedDict

AuraDataImportSupportedTypes = Literal[
"string", "integer", "float", "boolean"
] # supported types in Aura Data Import

Position = TypedDict(
"Position",
{
"x": float,
"y": float,
},
)


AuraDataImportVisualisationNode = TypedDict(
"AuraDataImportVisualisationNode",
{
"id": str,
"position": Position,
},
)


# Property and Type Definitions
PropertyType = TypedDict(
"PropertyType",
{
"type": AuraDataImportSupportedTypes,
},
)


Property = TypedDict(
"Property",
{
"$id": str,
"token": str,
"type": PropertyType,
"nullable": bool,
},
)


# Node and Relationship Schema Types
NodeLabel = TypedDict(
"NodeLabel",
{
"$id": str,
"token": str,
"properties": List[Property],
},
)


RelationshipType = TypedDict(
"RelationshipType",
{
"$id": str,
"token": str,
"properties": List[Property],
},
)


LabelRef = TypedDict(
"LabelRef",
{
"$ref": str,
},
)


NodeObjectType = TypedDict(
"NodeObjectType",
{
"$id": str,
"labels": List[LabelRef],
},
)


TypeRef = TypedDict(
"TypeRef",
{
"$ref": str,
},
)


NodeRef = TypedDict(
"NodeRef",
{
"$ref": str,
},
)


RelationshipObjectType = TypedDict(
"RelationshipObjectType",
{
"$id": str,
"type": TypeRef,
"from": NodeRef,
"to": NodeRef,
},
)


PropertyRef = TypedDict(
"PropertyRef",
{
"$ref": str,
},
)


# Constraint and Index Types
Constraint = TypedDict(
"Constraint",
{
"$id": str,
"name": str,
"constraintType": Literal["uniqueness", "existence", "node_key"],
"entityType": Literal["node", "relationship"],
"nodeLabel": Optional[LabelRef],
"relationshipType": Optional[TypeRef],
"properties": List[PropertyRef],
},
)


Index = TypedDict(
"Index",
{
"$id": str,
"name": str,
"indexType": str,
"entityType": Literal["node", "relationship"],
"nodeLabel": Optional[LabelRef],
"relationshipType": Optional[TypeRef],
"properties": List[PropertyRef],
},
)


# Graph Schema Types
GraphSchema = TypedDict(
"GraphSchema",
{
"nodeLabels": List[NodeLabel],
"relationshipTypes": List[RelationshipType],
"nodeObjectTypes": List[NodeObjectType],
"relationshipObjectTypes": List[RelationshipObjectType],
"constraints": List[Constraint],
"indexes": List[Index],
},
)


GraphSchemaRepresentation = TypedDict(
"GraphSchemaRepresentation",
{
"version": str,
"graphSchema": GraphSchema,
},
)


# Graph Schema Extensions
NodeKeyProperty = TypedDict(
"NodeKeyProperty",
{
"node": NodeRef,
"keyProperty": PropertyRef,
},
)


GraphSchemaExtensionsRepresentation = TypedDict(
"GraphSchemaExtensionsRepresentation",
{
"nodeKeyProperties": List[NodeKeyProperty],
},
)


# Data Source Schema Types
RecommendedType = TypedDict(
"RecommendedType",
{
"type": AuraDataImportSupportedTypes,
},
)


Field = TypedDict(
"Field",
{
"name": str,
"sample": str,
"recommendedType": RecommendedType,
},
)


TableSchema = TypedDict(
"TableSchema",
{
"name": str,
"fields": List[Field],
},
)


DataSourceSchema = TypedDict(
"DataSourceSchema",
{
"type": Literal["local", "remote"],
"tableSchemas": List[TableSchema],
},
)


# Mapping Types
PropertyMapping = TypedDict(
"PropertyMapping",
{
"property": PropertyRef,
"fieldName": str,
},
)


NodeMapping = TypedDict(
"NodeMapping",
{
"node": NodeRef,
"tableName": str,
"propertyMappings": List[PropertyMapping],
},
)


FieldMapping = TypedDict(
"FieldMapping",
{
"fieldName": str,
},
)


RelationshipMapping = TypedDict(
"RelationshipMapping",
{
"relationship": NodeRef,
"tableName": str,
"propertyMappings": List[PropertyMapping],
"fromMapping": FieldMapping,
"toMapping": FieldMapping,
},
)


GraphMappingRepresentation = TypedDict(
"GraphMappingRepresentation",
{
"dataSourceSchema": DataSourceSchema,
"nodeMappings": List[NodeMapping],
"relationshipMappings": List[RelationshipMapping],
},
)


# Configuration Types
Configurations = TypedDict(
"Configurations",
{
"idsToIgnore": List[str],
},
)


# Main Data Model Types
DataModelContent = TypedDict(
"DataModelContent",
{
"version": str,
"graphSchemaRepresentation": GraphSchemaRepresentation,
"graphSchemaExtensionsRepresentation": GraphSchemaExtensionsRepresentation,
"graphMappingRepresentation": GraphMappingRepresentation,
"configurations": Configurations,
},
)


Visualisation = TypedDict(
"Visualisation",
{
"nodes": List[AuraDataImportVisualisationNode],
},
)


AuraDataImportDataModel = TypedDict(
"AuraDataImportDataModel",
{
"version": str,
"visualisation": Visualisation,
"dataModel": DataModelContent,
},
)
Loading