SDMLib is a lightweight modeling library

Related tags

Spring Boot SDMLib
Overview

Fulib

In 2019 we did a major refactoring of SDMLib and moved it to https://github.com/fujaba/fulib now. Please visit https://github.com/fujaba/fulib for recent updates.

SDMLib

master : Build Status Scrutinizer Code Quality

develop: Build Status Scrutinizer Code Quality

SDMLIB-PM

Welcome to SDMLib

SDMLib is a lightweight modeling library. SDMLib intentionally comes without any tool or editor.

The idea is that you code your model:

ClassModel model = new ClassModel("org.sdmlib.sample");

Clazz uni = model.createClazz("University");

Clazz student = model.createClazz("Student")
    .withAttribute("studentID", DataType.STRING);

uni.withBidirectional(student, "students", Cardinality.MANY, "almaMater", Cardinality.ONE);

model.generate();

By running model.generate() SDMLib will generate source code from your class model. If you extend your model later on and regenerate, the code generation will identify already existing classes and fields and attributes and leave them untouched. Only new elements will be inserted, carefully.

In the example above, the generated code will be placed in package org.sdmlib.sample, which does not need to be pre-existing.

Gradle and Maven

For stable version add to your build.gradle :

repositories {
    jcenter()
}

dependencies {
    compile 'org.sdmlib:SDMLib:2.+'
    // compile 'org.sdmlib:SDMLib:2.3.204'  // did work when 2.3.+ failed
     
}

or for SNAPSHOT-Builds:

repositories {
	maven {
        url "https://oss.sonatype.org/content/repositories/snapshots/"
    }
}

dependencies {
    compile 'org.sdmlib:SDMLib:2.+'
}

In order to get started, just add the following Maven dependency:


   
    
    
     org.sdmlib
    
    
    
     SDMLib
    
    
    
     2.3.+
    

   

In addition to class models, SDMLib will also support object diagrams, storyboards and model transformations.

Find documentation from the code repository here

In addition to class models, SDMLib will also support object diagrams, story pages and model transformations.

SDMLib comes with [MIT licence]

JProfiler optimized

Have fun

The [SDMLib team]

Comments
  • Working with SDMLib in Android App

    Working with SDMLib in Android App

    I have been spending some time trying to make the SDMLib work on a simple "Hello World" Android application, but I keep getting the following errors:

    Error:Gradle: POCreator.java:105-106: Lambda coming from jar file need their interfaces on the classpath to be compiled, unknown interfaces are java.util.function.Consumer
    Error:Gradle: ReachabilityGraph.java:438-439: Lambda coming from jar file need their interfaces on the classpath to be compiled, unknown interfaces are java.util.Comparator
    Error:Gradle: com.android.jack.JackAbortException
    Error:Gradle: Execution failed for task ':app:transformClassesWithPreJackPackagedLibrariesForDebug.
     com.android.build.api.transform.TransformException: com.android.jack.api.v01.CompilationException
    

    My build.gradleof the app (not of the project) is declared as:

    apply plugin: 'com.android.application'
    android {
        compileSdkVersion 25
        buildToolsVersion "25.0.0"
        defaultConfig {
            applicationId "com.example.shelby.appforsdmlib"
            minSdkVersion 15
            targetSdkVersion 25
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
            jackOptions {
                enabled true
            }
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
        dexOptions {
            incremental true
        }
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
    }
    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
            exclude group: 'com.android.support', module: 'support-annotations'
        })
        compile 'com.android.support:appcompat-v7:25.0.0'
        testCompile 'junit:junit:4.12'
        compile 'org.sdmlib:SDMLib:2.2.+'
    }
    

    To use the SDMLib in android I used this model : https://github.com/fujaba/SDMLib/blob/develop/src/test/java/org/sdmlib/simple/FeatureTest.java I have no errors on my Test class and I'm able to import the libraries to use SDMlib. My problem is when I try to build and run the app I get the errors that I mentioned above. If you have any suggestions about what to do or what I'm doing wrong it would be appreciated because I have been trying this for days. Also, when I Google the error with Lambada I get to this Google issue that is not resolved for now: https://code.google.com/p/android/issues/detail?id=211386

    opened by ededej 2
  • Mark SDMlib as dead and link to fulib

    Mark SDMlib as dead and link to fulib

    I suggest, clearly marking this project as dead, closing issue submission, and linking to its successor fulib. I think I could eventually do that myself - any objections? I think there are still a lot of papers and classes out there linking here, so there should be an update.

    question 
    opened by ulno 1
  • Incorrect Associations for subclasses of interfaces

    Incorrect Associations for subclasses of interfaces

    When Class B and C implement interface A and B has a one to many Association to C, then an additional uni directional one to one Association from B to C is generated.

    opened by PCopei 1
  • Generate Abtract Classes

    Generate Abtract Classes

    Related issue: #3

    Consider this code that generates a model:

    package de.uks.sdmlibtest;
    
    import org.sdmlib.models.classes.ClassModel;
    
    import de.uniks.networkparser.graph.Cardinality;
    import de.uniks.networkparser.graph.Clazz;
    import de.uniks.networkparser.graph.Modifier;
    
    public class ModelGenerator
    {
        public static void main(String[] args)
        {
            ClassModel model = new ClassModel("de.uks.sdmlibtest");
    
            Clazz unit = model.createClazz("Unit");
    
            Clazz extension = model.createClazz("Extension");
            extension.with(Modifier.ABSTRACT);
    
            unit.withBidirectional(extension, "extensions", Cardinality.MANY, "unit", Cardinality.ONE);
    
            model.generate();
        }
    }
    

    model.generate() emits the following invalid code:

    // Extension.java
    //...
       public Unit createUnit();
    
    // Unit.java
    //...
       public Extension createExtensions()
       {
          Extension value = new Extension();
          withExtensions(value);
          return value;
       } 
    

    If extension.with(Modifier.ABSTRACT); is omitted, the generated model is valid Java code. However, this is not what I want to achieve.

    SDMLib version: 2.2.963 NetworkParser version: 4.4.241

    opened by nikeee 1
  • Abstract clazzes don't work with associations.

    Abstract clazzes don't work with associations.

    Whenever a clazz is flagged 'abstract' and is used within an association, the generated model has errors. It's attempted to create new instances when linking two classes.

    opened by pitman-87 1
  • ReadOnly Collection

    ReadOnly Collection

    Add Readonly Flag to getter of Collection

    Example: public StudentSet getStudent() { if (this.student == null) { return StudentSet.EMPTY_SET; } return this.student.clone().withFlag(StudentSet.READONLY); }

    opened by StefanLindel 1
  • Default return value for datatype

    Default return value for datatype "char" is "null"

    public char getLastKey() { if (this.getPattern().getHasMatch()) { return ((BombermanPlayer) getCurrentMatch()).getLastKey(); } return null; }

    was produced from SDMLib by generating the following classmodel:

    package sdmlib;

    import org.junit.Test; import org.sdmlib.models.classes.Card; import org.sdmlib.models.classes.ClassModel; import org.sdmlib.models.classes.Clazz; import org.sdmlib.models.classes.DataType; import org.sdmlib.models.classes.Parameter;

    public class ModelGenerator {

    @Test
    public void generateModel() {
        ClassModel cm = new ClassModel("de.uniks.se.dpss15.cor");
    
        Clazz bPlayer = cm
                .createClazz("BombermanPlayer")
                .withAttribute("xPosition", DataType.INT)
                .withAttribute("yPosition", DataType.INT)
                .withAttribute("numberOfBombs", DataType.INT)
                .withAttribute("lastKey", DataType.CHAR)
                .withMethod("keyPress", DataType.VOID,
                        new Parameter("key", DataType.STRING));
    
        Clazz bStrategy = cm.createClazz("BombermanStrategy")
                .withAbztract(true).withMethod("handleMove", DataType.VOID);
    
        bStrategy.createKidClazz("MoveUp");
        bStrategy.createKidClazz("MoveDown");
        bStrategy.createKidClazz("MoveLeft");
        bStrategy.createKidClazz("MoveRight");
        bStrategy.createKidClazz("Blast");
        bStrategy.createKidClazz("Stay");
    
        bStrategy.withUniDirectionalAssoc(bStrategy, "successor", Card.ONE);
        // bStrategy.withAssoc(bStrategy, "suc", Card.ONE, "pre", Card.ONE);
    
        cm.generate();
        cm.dumpHTML("classdiag");
    }
    

    }

    opened by marcusschmidt 1
  • Create objects of abstract classes

    Create objects of abstract classes

    SDMLib currently creates objects for abstract classes which associetes to themselfs.

    Try this for example:

    package sdmlib;

    import org.junit.Test; import org.sdmlib.models.classes.Card; import org.sdmlib.models.classes.ClassModel; import org.sdmlib.models.classes.Clazz; import org.sdmlib.models.classes.DataType; import org.sdmlib.models.classes.Parameter;

    public class ModelGenerator {

    @Test
    public void generateModel() {
        ClassModel cm = new ClassModel("de.uniks.se.dpss15.cor");
    
        Clazz bPlayer = cm
                .createClazz("BombermanPlayer")
                .withAttribute("xPosition", DataType.INT)
                .withAttribute("yPosition", DataType.INT)
                .withAttribute("numberOfBombs", DataType.INT)
                .withAttribute("lastKey", DataType.CHAR)
                .withMethod("keyPress", DataType.VOID,
                        new Parameter("key", DataType.STRING));
    
        Clazz bStrategy = cm.createClazz("BombermanStrategy")
                .withAbztract(true).withMethod("handleMove", DataType.VOID);
    
        bStrategy.createKidClazz("MoveUp");
        bStrategy.createKidClazz("MoveDown");
        bStrategy.createKidClazz("MoveLeft");
        bStrategy.createKidClazz("MoveRight");
        bStrategy.createKidClazz("Blast");
        bStrategy.createKidClazz("Stay");
    
        bStrategy.withUniDirectionalAssoc(bStrategy, "successor", Card.ONE);
        // bStrategy.withAssoc(bStrategy, "suc", Card.ONE, "pre", Card.ONE);
    
        cm.generate();
        cm.dumpHTML("classdiag");
    }
    

    }

    This will create: public BombermanStrategy createSuccessor() { BombermanStrategy value = new BombermanStrategy(); withSuccessor(value); return value; }

    in BombermanStragy.java although BombermanStrategy is an abstract class

    --Marcus

    opened by marcusschmidt 1
  • Ulrich

    Ulrich

    • Why should the class creation be a test? You can do this code where ever you want, e.g. in a main method. For storyboards I usually prefer tests as you may have more than one test in a class but only one main method. Thus, I do the model creation code into a test just because I use tests in all other storyboards. However, many people mentioned this. In addition, it is not cool to have the model creation code and some storyboard using the same model in one class. If the generated model code does not compile or you have just deleted it in order to generate a fresh new version, the class containing storyboard and model creation code will no longer compile and you have difficulties to generate the model code again.
    • Can I rename scenario into storyboard? Yes. Go for it. Hm, shall we offer both possibilities? Just refactored - no scenario left.
    • Why does addObjectDiag need a jsonIDMap? -> why can't we do just a dump like in the classdiagram? Yes you can.
    • Why should creators be separated? Matter of taste. I just did not want to pollute the directory containing the core model classes with all the helper classes.
    • Why can't we specify real types as parameters in withAttribute? Hm, how do I access the real type of "int". Ah, you may write int.class. Yes, we might add this.
    • StudyRight: why neighbors and not from/to (or fromRooms, toRooms)? Tricky one: well, if you use the same role name for both directions, the implementation becomes totally symmetric. That is cool. If you use fromRooms--toRooms and you have rooms math and arts and you do math.addToToRooms(arts) you navigate from math to arts via math.getToRooms() but arts.getToRoom() is the empty set. Then you may either add a reverse link or on navigation you always need to query for both directions.
    • What is this: in GenerateClasses.java: duplicate name found in definition for org.sdmlib.examples.studyrightWithAssignments.Student at line 61
      Attribute motivation : int In GenerateClasses in line 116 you add the attribute motivation to the clazz Student a second time. Still getting: in GenerateClasses.java duplicate name found in definition for org.sdmlib.examples.studyrightWithAssignments.Room at line 84
      Role door many in GenerateClasses.java duplicate name found in definition for org.sdmlib.examples.studyrightWithAssignments.Room at line 84
      Role door many This is a feature as discussed in neighbors?
    • Why: Room mathRoom = university.createRooms() .withRoomNo("math") .withCredits(42)
      .withStudents(karli) .withAssignments(a1) .withAssignments(a2) .withAssignments(a3); And not: Room mathRoom = university.createRooms() .withRoomNo("math") .withCredits(42)
      .withStudents(karli) .withAssignments(a1,a2,a3); ? Pretty cool. We should do that.
    • Why is the number-id in an object diagram unique? Why is there not r1 and a1? It is very confusing, if you refer to them from the scenario text as they never have the same name as in the code (why not?).. First of all it is simple to implement: just one counter and not one counter per first letter. If we use one counter per first letter, we still run into problems if we have two classes with the same first letter, e.g. Player and Pawn. Well, I always wanted to enable the storyboard coder to provide names to be used in the object diagrams. I think this is possible, have to find it. Would that help? Yes!
    • How can I limit the objects printed in an object-diagram? You can use a Filter attached to a JsonIdMap. However, I always need to ask Stefan Lindel how to use these. There should be some examples in the TTCHelloWorld cases.
    • Why is there no text wrapping for Text added to the scenario? Currently the text is added using
       tags. Thus no wrapping. Hm, we might change that.
    • Why are integer with value 0 not displayed (pretty sad not to see that Karli has no creditpoints)? Generally, attributes having their default values are not shown. Keeps the diagram smaller. JsonIdMap does not contain such entries in the Json description (to save space) and thus the object diagram dumper does not get this information. A workaround might be to give the attribute an initial value like -1. Than a 0 is shown. This is not a nice solution. We should find a better way for dumping object diagrams.
    • How can I regenerate the code for class diagrams? Changing names adds instead replaces, so it's safer to re-generate. You may add something like model.removeAllGeneratedCode(rootDir, srcDir, helpersDir); to your model creation code just before model.generate()

    Remarks: -New workflow -> teaching-paper for ICSE

    question 
    opened by Zasch 1
  • Generated removePropertyChangeListener()-methods produce NullPointerException

    Generated removePropertyChangeListener()-methods produce NullPointerException

    Member method removePropertyChangeListener(PropertyChangeListener listener) of generated classes produce NullPointerException when invoked before listeners were registered for the first time:

    public boolean removePropertyChangeListener(PropertyChangeListener listener) {
        if (listeners == null) {    // Should be listeners != null
            listeners.removePropertyChangeListener(listener);
        }
        listeners.removePropertyChangeListener(listener);    // Should be removed
        return true;
    }
    

    Method removePropertyChangeLister(String propertyName, PropertyChangeListener listener) works as expected:

    public boolean removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
        if (listeners != null) {
            listeners.removePropertyChangeListener(propertyName, listener);
        }
        return true;
    }
    
    opened by schw4rzlicht 0
  • Faulty Selfassociations on master branch

    Faulty Selfassociations on master branch

    When generating a selfassociation such as "next-prev" "prev-next" the generator creates "prev-next" "next-next" instead. This Issue needs to be fixed before the start of the next term.

    opened by PCopei 0
  • Getting more done in GitHub with ZenHub

    Getting more done in GitHub with ZenHub

    Hola! @azuendorf has created a ZenHub account for the fujaba organization. ZenHub is the only project management tool integrated natively in GitHub – created specifically for fast-moving, software-driven teams.


    How do I use ZenHub?

    To get set up with ZenHub, all you have to do is download the browser extension and log in with your GitHub account. Once you do, you’ll get access to ZenHub’s complete feature-set immediately.

    What can ZenHub do?

    ZenHub adds a series of enhancements directly inside the GitHub UI:

    • Real-time, customizable task boards for GitHub issues;
    • Multi-Repository burndown charts, estimates, and velocity tracking based on GitHub Milestones;
    • Personal to-do lists and task prioritization;
    • Time-saving shortcuts – like a quick repo switcher, a “Move issue” button, and much more.

    Add ZenHub to GitHub

    Still curious? See more ZenHub features or read user reviews. This issue was written by your friendly ZenHub bot, posted by request from @azuendorf.

    ZenHub Board

    opened by azuendorf 0
  • Option not to emit license in file

    Option not to emit license in file

    In our current project, we don't want any license information in the generated files (Copyright (c) 2016 user) as we are shipping with our own license. Therefore, we have to strip the license text out of the generated files every time a new class model gets generated. Would it be possible to declare this as a feature that can be exlcuded using something like this?

    ClassModel model = //...
    model.withoutFeature(Feature.License);
    mode.generate();
    
    opened by nikeee 0
  • Overloading Functions

    Overloading Functions

    If I want to create a class with a function, that shoud be overloaded, e.g:

    ClassModel model = new ClassModel("de.uks.dpss16.sdmlibtest");
    
    Clazz testClass = model.createClazz("ClassWithOverloadedFunctions");
    testClass.createMethod("overloadMe");
    testClass.createMethod("overloadMe", new Parameter(DataType.STRING).with("stringParam1"));
    testClass.createMethod("overloadMe", new Parameter(DataType.STRING).with("stringParam1"),
                    new Parameter(DataType.STRING).with("stringParam2"));
    testClass.createMethod("overloadMe", new Parameter(DataType.INT).with("intParam1"));
    
    model.generate();
    

    It only creates a overloadMe function without Parameters:

    public void overloadMe(  )
    {
    
    }
    
    opened by BiggA94 0
Releases(latest)
Owner
Fujaba Tool Suite
Fujaba Tool Suite
A suite of software tools and services created to support activity planning and sequencing needs of missions with modeling, simulation, scheduling and validation capabilities

Aerie A suite of software tools and services created to support activity planning and sequencing needs of missions with modeling, simulation, scheduli

NASA Advanced Multi-Mission Operations System 31 Jan 3, 2023
FEM for Students is a program of modeling and structural analysis by Finite Element Method

FEM For Students FEM for Students is a software for modeling and structural analysis by Finite Element Method. This software was developed by me in my

André de Sousa 4 Jun 23, 2022
A Toolkit for Modeling and Simulation of Resource Management Techniques in Internet of Things, Edge and Fog Computing Environments

The iFogSimToolkit (with its new release iFogSim2) for Modeling and Simulation of Resource Management Techniques in Internet of Things, Edge and Fog Computing Environments. In the new release Mobili Management, Microservice Management, and Dynamic Clustering mechanisms are added as new features.

The Cloud Computing and Distributed Systems (CLOUDS) Laboratory 69 Dec 17, 2022
Source Code for TransRot, molecular modeling software for simulated annealing Monte Carlo geometry optimizations of atomic and molecular clusters.

TransRot Version 1.5.3 Steven L. Topper and Robert Q. Topper School of Engineering The Cooper Union   for the Advancement of Science and Art New York,

Steven Topper 5 Dec 14, 2022
A lightweight messaging library that simplifies the development and usage of RabbitMQ with the AMQP protocol.

kryo-messaging This library contains a simple MessagingService which simplifies the setup and work with RabbitMQ and the AMQP protocol. Usage Gradle r

Kryonite Labs 3 Jan 10, 2022
A lightweight and extensible library to resolve application properties from various external sources.

Externalized Properties A lightweight and extensible library to resolve application properties from various external sources. Twelve Factor Methodolog

Joel Jeremy Marquez 20 Nov 29, 2022
The lightweight library for compress image, video, and audio with an awesome experience

Would you like to support me? react-native-compressor Compress videos, images and audio before upload react-native-compressor package is a set of func

Shobbak 265 Jan 1, 2023
A lightweight j(a)son library.

Argo Opus #18 A lightweight J(a)son library. Description This library converts json to Java's map/list object structure and vice-versa. It is designed

Kenzie 3 Nov 6, 2022
A lightweight and extensible library to resolve application properties from various external sources.

Externalized Properties A lightweight and extensible library to resolve application properties from various external sources. Twelve Factor Methodolog

Joel Jeremy Marquez 20 Nov 29, 2022
Lightweight React Native UI Components inspired on Vant

vant-react-native Install yarn add vant-react-native Or npm install vant-react-native Usage import React, { Component } from 'react'; import { View, T

洛竹 51 Sep 29, 2022
ESA ServiceKeeper is a lightweight service governance framework.

ServiceKeeper ServiceKeeper is a lightweight service governance framework that provides many awesome features such as rate limit, concurrent limit, ci

ESA Stack 22 Aug 11, 2022
Simple and lightweight application which is checking status of your web services and send a notification if it is down.

rose-uptimer Simple and lightweight application which is checking status of your web services and send a notification if it is down. Example configura

RoseSapphire 3 Sep 25, 2022
A libre lightweight streaming front-end for Android.

NewPipe A libre lightweight streaming frontend for Android. Screenshots • Description • Features • Installation and updates • Contribution • Donate •

Team NewPipe 22.4k Jan 3, 2023
Lightweight service-based PubSub, RPC and public APIs in Java

kite - service-based RPC, public APIs and PubSub in Java kite is a collection of reactive application messaging libraries that aim at providing high l

teris.io 3 Feb 17, 2022
Rivr is a lightweight open-source dialogue engine enabling Java developers to easily create enterprise-grade VoiceXML applications.

Overview Rivr is a lightweight open-source dialogue engine enabling Java developers to easily create enterprise-grade VoiceXML applications. Read our

Nu Echo Inc. 57 Jun 27, 2022
PipelinR is a lightweight command processing pipeline ❍ ⇢ ❍ ⇢ ❍ for your Java awesome app.

PipelinR PipelinR is a lightweight command processing pipeline ❍ ⇢ ❍ ⇢ ❍ for your awesome Java app. PipelinR has been battle-proven on production, as

Eduards Sizovs 288 Jan 8, 2023
RESTX, the lightweight Java REST framework

RESTX - the lightweight Java REST framework RESTX is a full lightweight disrupting stack, which includes Swagger-like ui & considers REST specs tests

null 437 Oct 22, 2022
Ethylene is a open-source, lightweight, general-purpose compatibility layer standing between the developer and the chaotic world of configuration file formats.

Ethylene Ethylene is a open-source, lightweight, general-purpose compatibility layer standing between the developer and the chaotic world of configura

Steank 7 Aug 9, 2022
A fast, lightweight and more productive microservices framework

A fast, lightweight and cloud-native microservices framework. Stack Overflow | Google Group | Gitter Chat | Subreddit | Youtube Channel | Documentatio

null 3.5k Jan 5, 2023