{"id":35663978,"url":"https://github.com/monticore/cd4analysis","last_synced_at":"2026-06-07T22:01:15.617Z","repository":{"id":38320852,"uuid":"316190304","full_name":"MontiCore/cd4analysis","owner":"MontiCore","description":"A MontiCore language for defining class diagrams and related tooling. Detailed documentation can be found here: https://github.com/MontiCore/cd4analysis/blob/master/cdlang/src/main/grammars/de/monticore/cd4analysis.md","archived":false,"fork":false,"pushed_at":"2026-06-06T17:54:07.000Z","size":109101,"stargazers_count":10,"open_issues_count":7,"forks_count":5,"subscribers_count":9,"default_branch":"dev","last_synced_at":"2026-06-06T19:20:33.331Z","etag":null,"topics":["class-diagram","uml"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MontiCore.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-11-26T10:04:29.000Z","updated_at":"2026-06-02T08:57:26.000Z","dependencies_parsed_at":"2023-12-24T05:53:40.377Z","dependency_job_id":"70c0a6f0-bd8f-44a2-9950-b00debae7d82","html_url":"https://github.com/MontiCore/cd4analysis","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"purl":"pkg:github/MontiCore/cd4analysis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MontiCore%2Fcd4analysis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MontiCore%2Fcd4analysis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MontiCore%2Fcd4analysis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MontiCore%2Fcd4analysis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MontiCore","download_url":"https://codeload.github.com/MontiCore/cd4analysis/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MontiCore%2Fcd4analysis/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34039495,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-07T02:00:07.652Z","response_time":124,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["class-diagram","uml"],"created_at":"2026-01-05T17:15:17.084Z","updated_at":"2026-06-07T22:01:15.609Z","avatar_url":"https://github.com/MontiCore.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- (c) https://github.com/MontiCore/monticore --\u003e\n\n\u003c!-- Beta-version: This is intended to become a MontiCore stable explanation. --\u003e\n\n# Class Diagram Languages: CD4A, CD4C\n\n\n\nThis introduction is \nintended for *modelers* who use the class diagram (CD)\nlanguages. We also provide a \n[detailed documentation of CD \nlanguages](cdlang/src/main/grammars/de/monticore/cd4analysis.md) \nfor *language engineers* using or\nextending one of the CD languages.\n\nThe CD languages are mainly intended for  \n1. analysis modeling (i.e., structures of the system context \n   as well as data structures of the system),\n2. (implementation-oriented) code modeling, including method signatures,\n3. generating code, data tables, transport functions and more.\n4. It is also possible to use CDs only as intermediate structures\n   to map from one or more other DSLs into an object-oriented \n   target language, such as Java or C++. \n   (e.g., the MontiCore generator maps grammars to CDs before generating code\n   from there).\n5. Finally, CDs can also be used as reported results from any other \n   generation or analysis process.\n\n## Downloads\n* [Download Link for the CD Tool][ToolDownload]\n* [Example Models][ExampleModels]\n* [Download Page for all of our public MontiCore Tools][MCDownloadPage]\n\n### Editor plugins\nThe latest editor plugins can be downloaded from the [Github releases page](https://github.com/MontiCore/cd4analysis/releases/tag/snapshot).\nThe Visual Studio Code plugin is provided as a `.vsix` file and can be installed as explained [here](https://code.visualstudio.com/docs/configure/extensions/extension-marketplace#_install-from-a-vsix).\nSimilarly, the IntelliJ plugin is provided as a `.zip` file and can be installed as explained [here](https://www.jetbrains.com/help/idea/managing-plugins.html#install_plugin_from_disk).\n\n## An Example Model\n\nThe following example CD [`MyCompany`](doc/MyCompany.cd) illustrates the textual \nsyntax of CDs:\n```\npackage corp;\nimport java.util.Date;\n\nclassdiagram MyCompany {\n\n  enum CorpKind { SOLE_PROPRIETOR, S_CORP, C_CORP, B_CORP, CLOSE_CORP, NON_PROFIT; }\n  abstract class Entity;\n  package people {\n    class Person extends Entity {\n      Date birthday;\n      List\u003cString\u003e nickNames;\n      -\u003e Address [*] {ordered};\n    }\n    class Address {\n      String city;\n      String street;\n      int number;\n    }\n  }\n  class Company extends Entity {\n    CorpKind kind;\n  }\n  class Employee extends people.Person {\n    int salary;\n  }\n  class Share {\n    int value;\n  }\n  association [1..*] Company (employer) \u003c-\u003e Employee [*];\n  composition [1] Company \u003c- Share [*];\n  association shareholding [1] Entity (shareholder) -- (owns) Share [*];\n\n}\n```\nThis example CD contains the following information:\n- The CD is contained in the package `corp` and is called `MyCompany`.\n- The package `corp` also serves as the default package for all classes in the CD.\n- The CD defines the six (6) classes `Entity`,`Person`, `Address`, `Company`, \n  `Employee`, and `Share`. \n- `Entity` is an abstract class, and therefore cannot be instantiated directly.\n- `Person` and `Address` are contained in the package `people`. \n  Packages can be used to structure the classes contained in a CD.\n- The class `Employee` extends the class `Person` (like in Java, implementation \n  of interfaces are also possible).\n- Each class may contain attributes, which have a type and name.\n- The CD uses available default types (which are basic types from Java), \n- imported types (like `Date`), and predefined forms of generic types (e.g., \n  `List\u003c.\u003e`),\n- Enums can also be defined (eg., `CorpKind` ).\n- The CD contains associations and compositions that are defined between two \n  classes.\n- An association can have a name and navigation information (e.g., `\u003c-\u003e`).\n- Each side of an association can have a role name, a cardinality (e.g., \n  `[0..1]`) and certain predefined tags/stereotypes (e.g., `{ordered}`).\n- Associations and attributes may also reference qualified types (e.g., \n  `[java.util.Date]`).\n\nMore examples can be found [here][ExampleModels].\n\nThe CD language infrastructure can be used as a command-line tool from shell or\ngradle, as well as a framework with direct Java API access.\n\n## Command Line Interface Tool\n \nThe tool provides typical functionality used when\nprocessing models, including:\n* parsing with coco-checking and symbol table creation, \n* pretty-printing, \n* storing symbols in symbol files, \n* loading symbols from symbol files, \n* transforming a CD into a graphical svg format\n* computing the semantic difference of 2 CDs, and\n* merging 2 CDs (iff the result is semantically sound)\n\nThe requirements for building and using the CD tool are that Java 21, Git, \nand Gradle are installed and available for use (e.g., in bash). \n\n### Downloading the Latest Version of the Tool\n\nA ready to use version of the tool can be downloaded in the form of an\nexecutable JAR file.\nYou can use [**this download link**][ToolDownload] for downloading the tool. \nAlternatively, the `wget` command can be used to download the latest version \ninto your working directory:\n```shell\nwget \"https://monticore.de/download/MCCD.jar\" -O MCCD.jar\n``` \n\n### Actions and Parameters of the Tool\n\nThe tool provides quite a number of executable actions and configurable\nparameters. \nThese commands are examples for calling the tool:\n\n```shell\njava -jar MCCD.jar -i src/MyCompany.cd -o out --gen\njava -jar MCCD.jar -i src/MyAddress.cd -s symbols/MyAddress.cdsym\njava -jar MCCD.jar -i src/MyLife.cd --path symbols -pp \n```\n\nTo try them out for yourself download and put the files\n[MyCompany.cd](doc/MyCompany.cd), [MyAddress.cd](doc/MyAddress.cd), and [MyLife.cd](doc/MyLife.cd) into your `src` directory. \nThe second command needs to be executed before the third.\n\nThe possible options are:\n\n| Option                           | Explanation                                                                                                                                                                                                                                                                                                                                                                                                                                            |\n|----------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `-ct,--configTemplate \u003cfile\u003e`    | Executes this template at the beginning of a generation with `--gen`. This allows configuration of the generation process (optional, `-fp` is needed to specify the template path).                                                                                                                                                                                                                                                                    |\n| `-d,--defaultpackage \u003cboolean\u003e`  | Configures if a default package should be created. Default: false. If `true`, all classes, that are not already in a package, are moved to the default package.                                                                                                                                                                                                                                                                                        |\n| `--difflimit \u003cint\u003e`              | Maximum number of shown witnesses when using `--semdiff` (optional; default is: 1, i.e. only one witness is shown).                                                                                                                                                                                                                                                                                                                                    |\n| `--diffsize \u003cint\u003e`               | Maximum number of objects in witnesses when comparing the semantic diff with `--semdiff` (optional; default is based on a heuristic, but at least 20). This constrains long searches.                                                                                                                                                                                                                                                                  |\n| `--fieldfromrole \u003cfieldfromrole\u003e` | Configures if explicit field symbols, which are typically used for implementing associations, should be added, if derivable from role symbols (default: none). Values: `none` is typical for modeling, `all` adds always on both classes, `navigable` adds only if the association is navigable.                                                                                                                                                       |\n| `-fp,--templatePath \u003cpathlist\u003e`  | Directories and jars for handwritten templates to integrate when using `--gen` (optional, but needed, when `-ct` is used).                                                                                                                                                                                                                                                                                                                             |\n| `--gen`                          | Generate .java-files corresponding to the classes defined in the input class diagram.                                                                                                                                                                                                                                                                                                                                                                  |\n| `-h,--help`                      | Prints short help; other options are ignored.                                                                                                                                                                                                                                                                                                                                                                                                          |\n| `-i,--input \u003cfile\u003e`              | Reads the source file and parses the contents as a CD. Alternatively, `--stdin` can be used to read the input CD from stdin. Using one of the two options is mandatory for all further operations.                                                                                                                                                                                                                                                     |\n| `--json`                         | Writes a \"Schema.json\" to the output directory.                                                                                                                                                                                                                                                                                                                                                                                                        |\n| `-nt,--nobuiltintypes`           | If this option is used, built-in-types will not be considered.                                                                                                                                                                                                                                                                                                                                                                                         |\n| `--merge \u003cfiles\u003e`                | Parses the files as additional CDs and merges them with the input CD (iff semantically sound). The result is stored in memory.                                                                                                                                                                                                                                                                                                                         |\n| `--mrg-config`                   | Parses a json-file containing a list of \\\"Merge Parameters\\\" that should be applied when using `--merge`. Unknown and unsupported parameters are ignored. The supported parameters are listed [here](cdmerge/index.md/#list-of-merge-parameters-supported-by-the-cd-tool). By default, `LOG_TO_CONSOLE` and `FAIL_AMBIGUOUS` are used.                                                                                                                 |\n| `-o,--output \u003cdir\u003e`              | Defines the path for generated files (optional; default is: `.`).                                                                                                                                                                                                                                                                                                                                                                                      |\n| `--open-world`                   | Compute the open-world difference of 2 class diagrams when using `--semdiff` (optional). The method is either `reduction-based` or `alloy-based` (default is: `reduction-based`).                                                                                                                                                                                                                                                                      |\n| `--path \u003cdirlist\u003e`               | Artifact path for importable symbols, separated by spaces (default is: `.`).                                                                                                                                                                                                                                                                                                                                                                           |\n| `-pp,--prettyprint \u003cfile\u003e`       | Prints the input CDs to stdout or to the specified file (optional). The output directory is specified by `-o`.                                                                                                                                                                                                                                                                                                                                         |\n| `-r,--report \u003cdir\u003e`              | Prints reports of the parsed artifact to the specified directory (optional) or the output directory specified by `-o` (default is: `.`) This includes e.g. all defined packages, classes, interfaces, enums, and associations. The file name is \"report.{CDName}\"                                                                                                                                                                                      |\n| `--rule-based`                   | Uses a rule-based approach to `--semdiff` instead of the model-checker Alloy to compute the diff witnesses. Improved performance.                                                                                                                                                                                                                                                                                                                      |\n| `-s,--symboltable \u003cfile\u003e`        | Stores the symbol table of the CD. The default value is `{CDName}.cdsym`. This option does not use the output directory specified by `-o`.                                                                                                                                                                                                                                                                                                             |\n| `--semdiff \u003cfile\u003e`               | Parses the file as a second CD and compares it semantically with the first CD that is currently in memory. Output: object diagrams (witnesses) that are valid in the first CD, but invalid in the second CD. This is a semantics-based, asymmetric diff. Details: https://www.se-rwth.de/topics/Semantics.php                                                                                                                                          |\n| `--show \u003cprint_option\u003e`          | Specifies the print option for `--syntaxdiff`: `diff` (default) prints only the differences in a color-coded format (red for deleted, yellow for changed, and green for newly added elements). `old` will print only the old CD with color-coded diffs and `new` only the new CD. `both` prints both CDs. `added` prints only the added CD-elements; `removed` prints only the removed CD-elements, and `changed` prints only the changed CD-elements. |\n| `--stdin`                        | Reads the input CD from stdin instead of the source file specified by `-i`. Using one of the two options is mandatory for all further operations.                                                                                                                                                                                                                                                                                                      |\n| `--syntaxdiff \u003cfile\u003e`            | Performs a syntactical difference analysis on the current CD in memory (new) and a second CD (old) and prints the result to stdout. Default: Outputs color-coded differences (red for deleted, yellow for changed, and green for newly added elements) to stdout.                                                                                                                                                                                      |\n| `--reference \u003cfile\u003e`             | Parses the file as a reference CD and checks if the the input CD specified by `-i` is conform to it.                                                                                                                                                                                                                                                                                                                                                   |\n| `--map \u003cstring\u003e`                 | Specifies the names of stereotypes that are used as incarnation mappings in the concrete model. Default: 'incarnates'                                                                                                                                                                                                                                                                                                                                  |\n| `--complete`                     | Completes a possible incomplete CD specified by `-i` such that it conforms to the reference CD specified by `--reference`.                                                                                                                                                                                                                                                                                                                             |\n| `--ref-param`                    | Specifies the conformance parameters to use for reference CD conformance checking and completion. Default: 'INHERITANCE, METHOD_OVERLOADING, SRC_TARGET_ASSOC_MAPPING, NAME_MAPPING, ALLOW_CARD_RESTRICTION, STEREOTYPE_MAPPING'                                                                                                                                                                                                                       |\n| `--anytype`                      | Specifies the placeholder type name used for underspecified types in the reference CD specified by `--reference`. Default: 'anytype'.                                                                                                                                                                                                                                                                                                                  |\n\n### Building the Tool from the Sources (if desired)\n \nAs alternative to a download, \nit is possible to build an executable JAR of the tool from the source files\nlocated in GitHub.\nMake sure you have installed the following dependencies:\n* Java 21 (check it with java -version)\n* Gradle 8.5 (check it with gradle --version)\n\nIn order to build an executable Jar of the tool with\nBash from the source files available in GitHub, execute the following commands.\n\nFirst, clone the repository:\n```shell\ngit clone https://github.com/MontiCore/cd4analysis.git\n```\nChange the directory to the root directory of the cloned sources:\n```shell\ncd cd4analysis\n```\nThen build the source files with gradle (if `gradle` is not \nrecognized as a command in your shell, please install \n[Gradle](https://gradle.org/releases/)).\nTo this effect, execute the following two commands:\n```shell\ngradle build\ngradle shadowJar\n```\nCongratulations! The  executable JAR file `MCCD.jar` is now in\nthe directory `cdtool/target/libs/`.\n\n## Tutorial: Getting Started Using the CD Tool\n\nThe following small tutorial should help to get an idea \nof how to use the CD tool given in `MCCD.jar`.\n\n### Step 1:\n\nExecuting the tool with the following command and no \noptions prints information on the available options:\n```shell\njava -jar MCCD.jar\n```\nYou may also use the option `-h, --help` for the same result:\n```shell\njava -jar MCCD.jar -h\n```\n\nFor any other action, the tool requires either the option `-i,--input \u003cfile\u003e`,\nwhich reads a file containing a CD model as input, or `--stdin`, \nwhich parses the input CD from `stdin` instead.\nIf no additional options are specified, the tool processes the model,\nbut does not produce any further output, except for error messages or \na message indicating success. Note that processing means that the tool parses\nthe model, builds its symbol table, and then checks whether the model satisfies\nall context conditions.\n\nIf you want to try this out yourself, copy the `MCCD.jar` into a directory of \nyour choice. Then create a text file `src/MyExample.cd` \n([also available here](doc/MyExample.cd)) in a `src` subdirectory of the\ndirectory where `MCCD.jar` is located containing e.g. the following simple CD \n(please note that, like in Java, filename and model name in the file have to be\nthe same):\n\n```\nimport java.lang.String;\n\nclassdiagram MyExample {\n  class Person {\n    int age;\n    String surname;\n  }\n\n  association Person -\u003e (friends) Person [*];\n}\n```\n\nNow execute the following command:\n```\njava -jar MCCD.jar -i src/MyExample.cd\n```\n\nYou may notice that the tool prints the following text to the console:\n```\nSuccessfully parsed src/MyExample.cd\nSuccessfully checked the CoCos for class diagram MyExample\n```\n\nThe contents of the input CD artifact can also be piped to the tool.\nFor this, execute the following command:\n\n```shell\ncat src/MyExample.cd | java -jar MCCD.jar --stdin\n``` \nThe output is the same as for the previous command.\n\n### Step 2: Pretty-Printing\n\nThe tool provides a pretty-printer for the CD language.\nA pretty-printer can be used, e.g., to fix the formatting of files containing \nCDs, but has its main application in printing internally constructed \nor transformed CDs.\n\nTo execute the pretty-printer, the `-pp,--prettyprint` option can be used.\nUsing the option without any arguments pretty-prints the model contained in the\ninput file to the console (stdout):\n\n```shell\njava -jar MCCD.jar -i src/MyExample.cd -pp\n```\nAfter executing the command, the following output should appear on your console:\n```\nimport java.lang.String;\n\nclassdiagram MyExample {\n  class Person {\n    int age;\n    String surname;\n  }\n  \n  association Person -\u003e (friends) Person [*];\n}\n```\n\nIt is possible to pretty-print the models contained in the input file to an \noutput file (here: `PPExample.cd`), missing directories are created \nautomatically:\n\n```shell\njava -jar MCCD.jar -i src/MyExample.cd -pp target/PPExample.cd\n```\n\n### Step 3: Storing Symbols\n\nIf the symbols of the `src/MyExample.cd` model should be available elsewhere,\nthey can be stored.\nThe symbol file will contain information about the classes and associations\ndefined in the CD.\nIt can be imported by other models in order to use these symbols.\n\nUsing the option `-s,--symboltable \u003cfile\u003e` builds the symbol table of the input\nmodel and stores it in the file path given as argument.\nProviding the file path is optional.\nIf no file path is provided, the tool stores the symbol table of the\ninput model in the file `{CDName}.cdsym`.\n\nFor storing the symbol file for `src/MyExample.cd`, we execute the following \ncommand (the context condition checks require using the path option):\n```shell\njava -jar MCCD.jar -i src/MyExample.cd -s\n```\nThe tool produces the file `MyExample.cdsym`, which can now be\nimported by other models, e.g., by models that need to\nuse some of the classes defined in the CD `MyExample`. The tool additionally\nindicates the correct generation by its outputs:\n```\nSuccessfully parsed src/MyExample\nSuccessfully checked the CoCos for MyExample\nCreation of symbol table src/MyExample.cdsym successful\n```\nThe symbol file contains a JSON representation of the symbols defined in the \nCD, which are type, association, interface, attribute and method symbols.\n\nE.g., for storing the symbols of `src/MyExample.cd` in the file \n`symbols/MyExample.cdsym`, execute the following command:\n```shell\njava -jar MCCD.jar -i src/MyExample.cd -s symbols/MyExample.cdsym\n```\n\n### Step 4: Adding `FieldSymbol`s corresponding to association roles\n\nBy default, the CD tool stores exactly the symbols that have been explicitly \ndefined. This is the typical modeling approach. However, code generation \nusually maps the `CDRoleSymbol`s defined in an association to attributes and \nthus implicitly adds `FieldSymbol`s into the classes that host an association. \nThese additional symbols can be made available in the symbol file in the two \nfollowing forms: \n\nForm 1: For each of the `CDRoleSymbol`s add a `FieldSymbol` in the source class\n   of the role. This can be used in languages, like OCL, \n   that always allow for the navigation in both directions.\nThese additional field symbols are stored with:\n```shell\njava -jar MCCD.jar -i src/MyExample.cd -s symbols/MyExample.cdsym --fieldfromrole all\n```\n\n* two additional `FieldSymbol`s were stored for both sides of the association\n\nForm 2: `FieldSymbol`s are added only for navigable roles.\n  This can be used in implementation oriented languages that have to cope\n  with the actual implementation restrictions:\n```shell\njava -jar MCCD.jar -i src/MyExample.cd -s symbols/MyExample.cdsym --fieldfromrole navigable\n```\n* only one additional `FieldSymbol` is stored for the navigable Role `friends`,\n  because the association is only unidirectional\n\n### Step 5: Importing Symbol Files Using a Path\n\nMontiCore is designed for modularity (both on the model and language level).\nThe CD languages are participating in the symbol exchange infrastructure.\nWe import a symbol file defining type symbols that are used by a CD.\n\nLet us now consider the example `MyLife` from above.\nPlease, copy the file [`MyLife.cd`](doc/MyLife.cd) and save it \nin a file `src/monticore/MyLife.cd`.\n\nExecute the following command for processing the file `MyLife.cd`:\n```shell\njava -jar MCCD.jar -i src/monticore/MyLife.cd\n```\n\nAfter executing the command, \nthe output states that a context condition is not satisfied by\nthe model: \n```\n[ERROR] MyLife.cd:\u003c18,9\u003e: 0xA0324 Cannot find symbol Address\n...\n```\n\nThe missing class `Address` is currently not imported.\n`MyLife` already has an `import` statement to another class diagram \nincluded ([available here](doc/MyAddress.cd)):\n\n(content of src/MyAddress.cd)\n```\nimport java.lang.String;\n\nclassdiagram MyAddress {\n  class Address {\n    String city;\n    String street;\n    int number;\n  }\n}\n```\n\nThe CD tool, however, does not directly load dependent models, but only \ntheir symbol files. This has several interesting advantages:\n\n* it allows us to use the CD language with any other language that defines\n  types, because it decouples the languages down to shared symbols,\n* the tools themselves also remain decoupled and independent, \n* the build process can be organized in an incremental effective way\n    (when using e.g. `gradle` or `make`, but not mvn). \n* even symbols from languages, such as Java, \n  that not are defined with MontiCore can be\n  integrated (e.g. we integrate handwritten code via their symbols).\n\nHowever, the tool has to be applied to the new additional model first:\n\n```shell\njava -jar MCCD.jar -i src/MyAddress.cd -s symbols/MyAddress.cdsym\n```\n\nWe then add the symbol file to the model path using `--path`:\n\n```shell\njava -jar MCCD.jar -i src/monticore/MyLife.cd --defaultpackage --path symbols\n```\n \nThe model path is used to identify the directory structure that contains the \nneeded symbol files. \nAs we provide the model path to the tool, it will successfully \nsearch for symbols in symbol files stored in the model path. \nThis means that it processes the model successfully without any context \ncondition violations.\nGreat! \n\n### Step 6: Create a Default Package in the Class Diagram\n\nThe class diagram languages support structuring the CD into packages (similar \nto Java).\nFor classes with no explicit defined package the tool can assume those classes \nto be in a default package. This default is calculated as follows:\n1. If the class diagram itself is defined in a package, this package is \n   propagated to the classes contained in the cd.\n2. If such a package is not explicitly given, the default 'de.monticore' \n   is used.\n\n### Step 7: Generating .java-Files\n\nBy using the option `--gen`, we can generate .java-files corresponding to the\ninput class diagram:\n```shell\njava -jar MCCD.jar -i src/MyExample.cd --gen\n```\nWith option `-o` we can specify the output directory; the default is `.`:\n```shell\njava -jar MCCD.jar -i src/MyExample.cd --gen -o out\n```\nNote that the option `--fieldfromrole` must be used with the appropriate\nargument in order to generate attributes for associations contained in the input CD. \nUse the following commands in order to generate .java-files for the CD \n`MyCompany`([available here](doc/MyCompany.cd)):\n\n```shell\njava -jar MCCD.jar -i src/MyCompany.cd -o out --gen --fieldfromrole navigable\n```\n\n### Step 8: The Semantic Difference of Two Class Diagrams\n\nWe define the semantic difference semdiff(CD1,CD2) of two class diagrams CD1 \nand CD2 as the set of all object diagrams that are valid in CD1 but invalid in \nCD2. These object diagrams are also referred to as diff-witnesses. We observe\nthat this difference is asymmetric. For more details on semantic differencing:\n\nhttps://www.se-rwth.de/topics/Semantics.php\n\nThe option `--semdiff \u003cfile\u003e` computes the semantic difference of the current \nCD in memory and the CD specified by the argument.\n\nFor the following examples, download the files \n[MyEmployees1.cd](doc/MyEmployees1.cd) and [MyEmployees2.cd](doc/MyEmployees2.cd) \nand save them in\n`src`:\n\n```shell\njava -jar MCCD.jar -i src/MyEmployees1.cd --semdiff scr/MyEmployees2.cd\n```\n\nWe can use the option `difflimit` to specify the maximum number of witnesses \nthat are generated in the output directory; the default is to generate one \ndiff-witness. Once again, the option `-o` can be used to specify the output \ndirectory; the default is `.`:\n\n```shell\njava -jar MCCD.jar -i src/MyEmployees1.cd  --semdiff src/MyEmployees2.cd --difflimit 20 -o out\n```\n\nNote that `--semdiff` does not use symbols from symbol files. \n\nMore on the available syntactic and semantic differencing operations for class\ndiagrams (including conformance checking to reference models) can be found \n[here](cddiff/index.md).\n\n### Step 9: Merging Two Class Diagrams\n\nThe option `--merge \u003cfiles\u003e` merges the input-CD with the CDs specified by the \nargument iff the two are semantically compatible \n[[LRSS23](https://www.se-rwth.de/publications/CDMerge-Semantically-Sound-Merging-of-Class-Diagrams-for-Software-Component-Integration.pdf)].\nThe result is stored in memory as the current CD.\n\nFor the following examples, download the files \n[Teaching.cd](doc/Teaching.cd) and [Management.cd](doc/Management.cd) and \nsave them in `src`:\n\n```shell\njava -jar MCCD.jar -i src/Teaching.cd --merge src/Management.cd -pp\n```\n\nIf `-pp` is used in conjunction with `--merge`, the name of the merged CD \nalways corresponds to the name of the file (without the suffix `.cd`):\n\n```shell\njava -jar MCCD.jar -i src/Teaching.cd --merge src/Management.cd -o out -pp UniversitySystem.cd\n```\n\nNote that `--merge` does not use symbols from symbol files. More information on \nconcepts behind as well as the capabilities of `CDMerge` can be found \n[here](cdmerge/index.md).\n\n[ExampleModels]: cdlang/src/test/resources/de/monticore/cd4analysis/examples\n[ToolDownload]: https://monticore.de/download/MCCD.jar\n[MCDownloadPage]: https://monticore.github.io/monticore/docs/Download/\n\n## Further Information\n* [Other MontiCore Tools][MCDownloadPage]\n* [Project root: MontiCore @github](https://github.com/MontiCore/monticore)\n* [MontiCore documentation](https://www.monticore.de/)\n* [**List of Languages**](https://github.com/MontiCore/monticore/blob/HEAD/docs/Languages.md)\n* [**MontiCore Core Grammar Library**](https://github.com/MontiCore/monticore/blob/HEAD/monticore-grammar/src/main/grammars/de/monticore/Grammars.md)\n* [Best Practices](https://github.com/MontiCore/monticore/blob/HEAD/docs/BestPractices.md)\n* [Publications about MBSE and MontiCore](https://www.se-rwth.de/publications/)\n* [Research Topics](https://www.se-rwth.de/topics)\n* [Licence definition](https://github.com/MontiCore/monticore/blob/HEAD/00.org/Licenses/LICENSE-MONTICORE-3-LEVEL.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonticore%2Fcd4analysis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmonticore%2Fcd4analysis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonticore%2Fcd4analysis/lists"}