{"id":19838968,"url":"https://github.com/objectionary/deog","last_synced_at":"2025-05-01T18:31:46.897Z","repository":{"id":63201051,"uuid":"562850967","full_name":"objectionary/deog","owner":"objectionary","description":"Decoration Graph of EO objects","archived":false,"fork":false,"pushed_at":"2024-10-29T11:27:32.000Z","size":150,"stargazers_count":4,"open_issues_count":18,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-29T13:22:32.737Z","etag":null,"topics":["eolang","java"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/objectionary.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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}},"created_at":"2022-11-07T11:49:01.000Z","updated_at":"2024-05-09T00:14:45.000Z","dependencies_parsed_at":"2023-10-12T23:08:59.399Z","dependency_job_id":"eaa17605-8130-40b2-abd9-a533b5d81f2a","html_url":"https://github.com/objectionary/deog","commit_stats":{"total_commits":29,"total_committers":2,"mean_commits":14.5,"dds":0.3448275862068966,"last_synced_commit":"43cabaa54919360aa4190169f35cfb3687ba4e0f"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/objectionary%2Fdeog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/objectionary%2Fdeog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/objectionary%2Fdeog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/objectionary%2Fdeog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/objectionary","download_url":"https://codeload.github.com/objectionary/deog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224270897,"owners_count":17283874,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["eolang","java"],"created_at":"2024-11-12T12:19:46.189Z","updated_at":"2025-05-01T18:31:46.891Z","avatar_url":"https://github.com/objectionary.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg alt=\"logo\" src=\"https://www.objectionary.com/cactus.svg\" height=\"100px\" /\u003e\n\n[![EO principles respected here](https://www.elegantobjects.org/badge.svg)](https://www.elegantobjects.org)\n[![DevOps By Rultor.com](http://www.rultor.com/b/objectionary/eo-files)](http://www.rultor.com/p/objectionary/deog)\n[![We recommend IntelliJ IDEA](https://www.elegantobjects.org/intellij-idea.svg)](https://www.jetbrains.com/idea/)\n\n[//]: # ([![mvn]\u0026#40;https://github.com/objectionary/deog/actions/workflows/build.yml/badge.svg?branch=master\u0026#41;]\u0026#40;https://github.com/objectionary/deog/actions/workflows/build.yml\u0026#41;)\n[//]: # ([![Hits-of-Code]\u0026#40;https://hitsofcode.com/github/objectionary/deog\u0026#41;]\u0026#40;https://hitsofcode.com/view/github/objectionary/deog\u0026#41;)\n[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/objectionary/deog/blob/master/LICENSE.txt)\n\n### Decoration graph of EO program\n\nDEOG is a JVM API for building decoration graph of EO program.\n\nDEOG takes a path to a collection of `.xmir` files and constructs a decoration graph, connecting all the EO objects.\nWith this graph you can access the list of all the attributes present in an object in constant time.\n\n\n### Usage\n\n#### Installation\nJust add this to your pom.xml file\n```\n\u003cdependency\u003e\n  \u003cgroupId\u003eorg.eolang\u003c/groupId\u003e\n  \u003cartifactId\u003edeog\u003c/artifactId\u003e\n  \u003cversion\u003e0.0.3\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### API\n\nYou can build a graph like this:\n```\nDeogLauncher.launchDeog(PATH_TO_XMIR_SOURCES, \"postfix\")\n```\nBy default, DEOG will generate a new directory with a name `${PATH_TO_XMIR_SOURCES}_deog`, but you can change the postfix with the `postfix` parameter.\n\n`launchDeog` returns a `DeogGraph` object, which has a number of useful attributes, i.g. you can look at the set of nodes of a graph via `deogGraph.dgNodes`\n\nNodes are represented by `DGraphNode` object with parameters such as\n* `name` - EO object name\n* `packageName` - EO package name\n* `attributes` - representing eo attributes\n* `children` and `parents` in the graph\n* `body` - corresponding `org.w3c.dom.Node`\n\nEach EO attribute is represented by `DGraphAttr` object with parameters such as\n* `name` - EO object name\n* `parentDistance` - distance in the decoration tree to the object in which the attribute was initially defined\n* `body` - corresponding `org.w3c.dom.Node`\n\nBelow you can see a usage example:\n```\nval graph = DeogLauncher.launchDeog(PATH_TO_XMIR_SOURCES, \"deog\")\ngraph.dgNodes.forEach { node -\u003e          // traversing each node\n    if (node.name?.startsWith(\"a\")) {    // checking if node name starts with \"a\"\n        node.attributes.forEach {        // traversing node attributes\n            println(it.name)             // printlng out attribute name\n        }\n    }\n}\n```\n\n`AttributesUtil` file provides a useful API for getting quick access to `org.w3c.dom.Node` objects' attributes.\n\nFor instance, this is how you would access the `line` attribute of EO object: `line(node)`\nYou also can find which abstract object the `ref` attribute points to like this:\n```\nfindRef(\n    node,                       // node, ref of which you want to find\n    deogGraph.initialObjects,   // initial set of org.w3c.dom.Node objects\n    deogGraph                   // graph\n)\n```\n\n### Graph overview:\n\nConsider the following EO program.\n\n```\n[] \u003e animal\n  [] \u003e live\n    [] \u003e eat\n      stdout \u003e @\n        \"Animal is eating\"\n    stdout \u003e @\n      \"Animal is alive\"\n  [t] \u003e talk\n    live \u003e @\n\n[] \u003e mouse\n  animal \u003e @\n  [] \u003e mouse_live\n    ^.live \u003e @\n\n[] \u003e cat\n  animal \u003e @\n  [m] \u003e meow\n    ^.talk \"Meow\" \u003e @\n```\n\nThe resulting graph can be considered to look like below. Each node is represented by a rectangle.\nAll the attributes of the node are listed in the rectangle.\n\n![](assets/diag.drawio.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobjectionary%2Fdeog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fobjectionary%2Fdeog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobjectionary%2Fdeog/lists"}