Git Product home page Git Product logo

aksem / biger Goto Github PK

View Code? Open in Web Editor NEW

This project forked from borkdominik/biger

0.0 1.0 0.0 2.14 MB

Entity Relationship Diagram modeling tool realized as a language server that is distributed as a VS Code extension.

Home Page: https://marketplace.visualstudio.com/items?itemName=BIGModelingTools.erdiagram

License: MIT License

JavaScript 3.70% TypeScript 34.49% Xtend 55.94% CSS 5.87%

biger's Introduction

bigER Modeling Tool

VS Code Extension to create Entity-Relationship (ER) diagrams and generate SQL code with a textual language

Features

๐Ÿ“ Textual Language to specify model elements and apply ER concepts
๐Ÿง  Smart Editing features for the language such as Syntax Highlighting or Auto Complete
๐Ÿ“Š Diagram View synchronized with textual changes and elements are laid out automatically
๐ŸŽจ Graphical Interactions to customize the diagram or modify the underlying model
๐Ÿ–จ๏ธ Code Generation to generate SQL statements

The tool is built based on web technologies and language features are communicated with the Language Server Protocol (LSP). This makes bigER highly reusable and simplifies implementation for other editors that also use the LSP. The language and editor features are realized as a language server with Xtext. Sprotty together with Sprotty Server is used to create the diagrams and both connect to VS Code by using Sprotty VS Code.

Download the extension from the VS Code Marketplace


Sections

โžœ Quick Example
โžœ Getting Started
โžœ Build Instructions
โžœ Known Issues
โžœ Contributers

Wiki

๐Ÿท๏ธ Feature Overview
๐Ÿ“– Language Documentation

โš ๏ธ The wiki pages are still in progress


Quick Example

Textual

university.erd (click to expand)
erdiagram University
generateSql

entity Person {
    full_name: string key
    birthday: datetime
    age: int derived
}

entity Student extends Person {
    matr_nr: int key
    undergraduate: boolean
}

entity Course {
    course_id: int key
    title: string
}

weak entity Lecture {
    lect_nr: int partial-key
}

weak relationship contains {
    Course[1] -> Lecture[N]
}

entity Professor extends Person {
    pers_nr: int key
}

entity Publication {
    pub_id: int key
    title: string
    research_area: string optional
}

relationship takes_exam {
    Course[N] -> Professor[1] -> Student[N]
    points: double
}

relationship publishes {
    Publication[N] -> Professor[N]
}

Diagram

Generated SQL Code

university.sql (click to expand)
CREATE TABLE Person (
	full_name varchar(255) NOT NULL, 		
	birthday datetime NOT NULL		
	
	PRIMARY KEY (full_name)
);

CREATE TABLE Student (
	undergraduate bit NOT NULL, 		
	matr_nr int NOT NULL		
	full_name varchar(255)
	
	PRIMARY KEY (matr_nr)
	FOREIGN KEY (full_name) REFERENCES Person(full_name)
);

CREATE TABLE Course (
	title varchar(255) NOT NULL, 		
	course_id int NOT NULL		
	
	PRIMARY KEY (course_id)
);

CREATE TABLE Professor (
	pers_nr int NOT NULL		
	full_name varchar(255)
	
	PRIMARY KEY (pers_nr)
	FOREIGN KEY (full_name) REFERENCES Person(full_name)
);

CREATE TABLE Publication (
	title varchar(255) NOT NULL, 		
	research_area varchar(255),  		
	pub_id int NOT NULL		
	
	PRIMARY KEY (pub_id)
);

CREATE TABLE Lecture ( 
	lect_nr int NOT NULL		
	course_id int NOT NULL
	
	PRIMARY KEY (lect_nr, course_id)
	FOREIGN KEY (course_id) REFERENCES Course(course_id) 
		ON DELETE CASCADE
);

CREATE TABLE takes_exam (
	course_id int,
	CONSTRAINT fk_course_id FOREIGN KEY (course_id)
		REFERENCES Course(course_id),
	pers_nr int,
	CONSTRAINT fk_pers_nr FOREIGN KEY (pers_nr)
		REFERENCES Professor(pers_nr)
	matr_nr int,
	CONSTRAINT fk_matr_nr FOREIGN KEY (matr_nr)
		REFERENCES Student(matr_nr)
);

CREATE TABLE publishes (
	pub_id int,
	CONSTRAINT fk_pub_id FOREIGN KEY (pub_id)
		REFERENCES Publication(pub_id),
	pers_nr int,
	CONSTRAINT fk_pers_nr FOREIGN KEY (pers_nr)
		REFERENCES Professor(pers_nr)
);

Getting Started

To start using the tool, download the extension from the VS Code Marketplace or clone this repository (see Build Instructions).

Open a file ending in .erd and refer to the minimal example below to specify a new ER model. The diagram view can then be opened with the button in the editor or from the context menu of the file.

example.erd

erdiagram Example
generateSql

entity Customer {
    id: int key
    name: string
}

entity Order {
    order_number: int key
    price: double
}

relationship Places {
    Customer[1] -> Order[N]
}

The first line always has to include the erdiagram keyword followed by a name.

The generateSql keyword in line 2 is optional and can be used to generate SQL statements. The ER model has to be valid and a src-gen folder will be created containing the generated code.

Build Instructions

The minimum requirements to to build and run the project are:

Download or clone the repository and in the root folder of the project execute the following commands:

language-server/gradlew -p language-server/ build   
yarn --cwd webview  
yarn --cwd extension

This builds the code for the language server, the webview and the extension. The fastest way to run the extension is to press F5 (or in the menu: Run -> Start Debugging). This starts a new extension host with the launch configuration provided in .vscode/launch.json.

The code is split into a client side (extension with webview) and a server side (language with LSP and diagram server). It is recommended to use VS Code for the client code, written in TypeScript and Eclipse for the server side, based on Java. Eclipse must be compatible with Xtext and Xtend (e.g. Eclipse IDE for Java and DSL Developers) and create a new workspace to avoid configuration issues. Import the language server as a Gradle project (File -> Import -> Existing Gradle Project) and override the workspace settings.

Known Issues

Fix

  • Code Generator can cause the language server to crash (e.g. weak entities)

Next steps

  • New ER concepts - partial/full participation, min-max Notation
  • New Diagram Features - Delete button, Support also renaming attributes and multiplicity
  • Improve Code Generator - Include all ER concepts, button in Diagram, multiple SQL dialects, fix crashes/bugs
  • Improve Layout and Styling (Light/Dark Theme)
  • Improve LSP features

Contributors

Philipp-Lorenz Glaser (Main developer)
Georg Hammerschmied
Dominik Bork

All Contributors

biger's People

Contributors

borkdominik avatar plglaser avatar schmiedhammer avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.