Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/stephengoldbaum/morphir i…
Browse files Browse the repository at this point in the history
…nto docs-build
  • Loading branch information
James McLeod committed Jan 6, 2023
2 parents 8d903d7 + a3386e5 commit 3095a3e
Show file tree
Hide file tree
Showing 8 changed files with 355 additions and 29 deletions.
34 changes: 5 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,15 @@ Defines a standard format for storing and sharing business logic. A clear set of

> _Morphir’s automated processing helps disseminate information which otherwise may not be understood or shared at all, a useful tool when brining elements of business logic to conversation outside of its immediate audience (i.e developers)._
## FINOS Morphir Resources

[Morphir Resource Centre](https://resources.finos.org/morphir/)
## Documentation
If you want to start using Morphir, start with the [Documentation](docs/).

| Episode | Description |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| <a href="https://resources.finos.org/znglist/morphir-showcase/?c=cG9zdDoxNTYx"><img width="250" src="https://resources.finos.org/wp-content/uploads/2022/03/introduction-to-the-morphir-show.jpg"></a> | <a href="https://resources.finos.org/znglist/morphir-showcase/?c=cG9zdDoxNTYx">Introduction to the Morphir Showcase</a> |
| <a href="https://resources.finos.org/znglist/morphir-showcase/?c=cG9zdDoxNTYz"><img width="250" src="https://resources.finos.org/wp-content/uploads/2022/03/what-morphir-is-with-stephen-gol.jpg"></a> | <a href="https://resources.finos.org/znglist/morphir-showcase/?c=cG9zdDoxNTYz">What Morphir is with Stephen Goldbaum</a> |
| <a href="https://resources.finos.org/znglist/morphir-showcase/?c=cG9zdDoxNTY2"><img width="250" src="https://resources.finos.org/wp-content/uploads/2022/03/how-morphir-works-with-attila-mi-1.jpg"></a> | <a href="https://resources.finos.org/znglist/morphir-showcase/?c=cG9zdDoxNTY2">How Morphir works with Attila Mihaly</a> |
| <a href="https://resources.finos.org/znglist/morphir-showcase/?c=cG9zdDoxNTY4"><img width="250" src="https://resources.finos.org/wp-content/uploads/2022/03/why-morphir-is-important-with-co.jpg"></a> | <a href="https://resources.finos.org/znglist/morphir-showcase/?c=cG9zdDoxNTY4">Why Morphir is Important – with Colin, James & Stephen</a> |
| <a href="https://resources.finos.org/znglist/morphir-showcase/?c=cG9zdDoxNTcw"><img width="250" src="https://resources.finos.org/wp-content/uploads/2022/03/Screenshot-2022-03-02-at-14.35.18.png"></a> | <a href="https://resources.finos.org/znglist/morphir-showcase/?c=cG9zdDoxNTcw">The Benefits & Use Case of Morphir with Jane, Chris & Stephen</a> |
| <a href="https://resources.finos.org/znglist/morphir-showcase/?c=cG9zdDoxNTcy"><img width="250" src="https://resources.finos.org/wp-content/uploads/2022/03/how-to-get-involved-closing-pane.jpg"></a> | <a href="https://resources.finos.org/znglist/morphir-showcase/?c=cG9zdDoxNTcy">How to get involved – Closing Panel Q&A</a> |
| <a href="https://resources.finos.org/znglist/morphir-showcase/?c=cG9zdDoxNTU5"><img width="250" src="https://resources.finos.org/wp-content/uploads/2022/03/morphir-showcase-full-show.jpg"></a> | <a href="https://resources.finos.org/znglist/morphir-showcase/?c=cG9zdDoxNTU5">Morphir Showcase – Full Show</a> |
## Other Resources
[List of media](docs/media.md)

# An ecosystem of innovative features

Supporting the development of your business' needs in an ever-developing ecosystem based on firm standards and the integration of new languages.

Check out [Stephen Goldbaum's Morphir Examples on GitHub](https://github.com/stephengoldbaum/morphir-examples/tree/master/tutorial)

# Further reading
### Further reading

| Introduction & Background | Using Morphir | Applicability |
| :------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------- |
Expand All @@ -70,18 +58,6 @@ Check out [Stephen Goldbaum's Morphir Examples on GitHub](https://github.com/ste
| [What's it all about?](./docs/whats_it_about.md) | [Modeling Decision Tables](https://github.com/finos/morphir-examples/tree/master/src/Morphir/Sample/Rules) | |
| [Why we use Functional Programming?](./docs/why_functional_programming.md) | [Modeling for database developers](./docs/modeling/modeling-for-database-developers.md) |

# Development setup

Morphir is a collection of tools. Each tool is in its own repo with its own installation instructions. The main development tools, and the best place to get started, are currently in [Morphir Elm](https://github.com/finos/morphir-elm).

## Usage example

Morphir tools can be used to optimize a wide range of development tasks. For example, Morphir can be used to define and automated development of an entire service. The [Morphir Dapr](https://github.com/finos/morphir-dapr) project is example of this.

Another good use of Morphir is to define shared rules than can be used across heterogeneous systems. This can be useful for initiatives like open-source Reg Tech models that are shared across firms. [Morphir LCR](https://github.com/finos/morphir-examples/tree/main/tests/Morphir/Sample/Reg/LCR) presents a good example of this.

More Morphir examples can be found at [Morphir Examples](https://github.com/finos/morphir-examples/).

## Roadmap

List the roadmap steps; alternatively link the Confluence Wiki page where the project roadmap is published.
Expand Down
13 changes: 13 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Morphir Documentation
The purpose of the document is to provide a detailed explanation of how various Morphir code artefacts work.
It also documents the standard coding practices adopted for the Morphir project.
Finally, it provides a step by step walk-throughs on how various Morphir components are build.

## Who this Guide Designed For
Morphir has different components for different users.

1. **[Morphir User's Guide](users-guide)** - Business users who would like to learn how to use Morphir for modelling business logic.
2. **[Morphir Developer's Guide](developers-guide)** - New joiners to the Morphir project to get up to speed the various building blocks of Morphir.
3. **[Morphir Contributor's Guide](contribution-guide)** - Existing team members intending to improve their abilities on Language Design concepts.


14 changes: 14 additions & 0 deletions docs/media.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Media About Morphir

If you're interested in learning more about the project, [Morphir Resource Centre](https://resources.finos.org/morphir/), has many links.

| Episode | Description |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| <a href="https://resources.finos.org/znglist/morphir-showcase/?c=cG9zdDoxNTYx"><img width="250" src="https://resources.finos.org/wp-content/uploads/2022/03/introduction-to-the-morphir-show.jpg"></a> | <a href="https://resources.finos.org/znglist/morphir-showcase/?c=cG9zdDoxNTYx">Introduction to the Morphir Showcase</a> |
| <a href="https://resources.finos.org/znglist/morphir-showcase/?c=cG9zdDoxNTYz"><img width="250" src="https://resources.finos.org/wp-content/uploads/2022/03/what-morphir-is-with-stephen-gol.jpg"></a> | <a href="https://resources.finos.org/znglist/morphir-showcase/?c=cG9zdDoxNTYz">What Morphir is with Stephen Goldbaum</a> |
| <a href="https://resources.finos.org/znglist/morphir-showcase/?c=cG9zdDoxNTY2"><img width="250" src="https://resources.finos.org/wp-content/uploads/2022/03/how-morphir-works-with-attila-mi-1.jpg"></a> | <a href="https://resources.finos.org/znglist/morphir-showcase/?c=cG9zdDoxNTY2">How Morphir works with Attila Mihaly</a> |
| <a href="https://resources.finos.org/znglist/morphir-showcase/?c=cG9zdDoxNTY4"><img width="250" src="https://resources.finos.org/wp-content/uploads/2022/03/why-morphir-is-important-with-co.jpg"></a> | <a href="https://resources.finos.org/znglist/morphir-showcase/?c=cG9zdDoxNTY4">Why Morphir is Important – with Colin, James & Stephen</a> |
| <a href="https://resources.finos.org/znglist/morphir-showcase/?c=cG9zdDoxNTcw"><img width="250" src="https://resources.finos.org/wp-content/uploads/2022/03/Screenshot-2022-03-02-at-14.35.18.png"></a> | <a href="https://resources.finos.org/znglist/morphir-showcase/?c=cG9zdDoxNTcw">The Benefits & Use Case of Morphir with Jane, Chris & Stephen</a> |
| <a href="https://resources.finos.org/znglist/morphir-showcase/?c=cG9zdDoxNTcy"><img width="250" src="https://resources.finos.org/wp-content/uploads/2022/03/how-to-get-involved-closing-pane.jpg"></a> | <a href="https://resources.finos.org/znglist/morphir-showcase/?c=cG9zdDoxNTcy">How to get involved – Closing Panel Q&A</a> |
| <a href="https://resources.finos.org/znglist/morphir-showcase/?c=cG9zdDoxNTU5"><img width="250" src="https://resources.finos.org/wp-content/uploads/2022/03/morphir-showcase-full-show.jpg"></a> | <a href="https://resources.finos.org/znglist/morphir-showcase/?c=cG9zdDoxNTU5">Morphir Showcase – Full Show</a> |

79 changes: 79 additions & 0 deletions docs/users-guide/Custom Attributes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Custom attributes user guide
The contents of this document detail how to structure and load optional "sidecar" files for the purposes of adding custom attributes to Morphir types and values. Custom attributes can assign extra information to business concepts that is otherwise not included in the Morphir IR.

**Contents:**
- [File format and naming convention](#file-format-and-naming-convention)
- [Config file](#config-file)
- [Attribute file](#attribute-file)
- [Loading and updating the attribute files](#loading-and-updating-the-attribute-files)




## File format, and naming convention
To define a custom attribute, we need at least three JSON files.

1. A config file named `attribute.conf.json` that lists the attribute ID's, and maps them to display names.
2. At least one attribute file named `<someAttributeId>.json` in the `attributes`.
3. An IR containing a type definitions

### Config file
```
{
"test-id-1": {
"displayName" : "MS.Sensitivity"
, "entryPoint" : "Morphir.Attribute.Model.Sensitivity.Sensitivity"
, "ir" : "attributes/sensitivity.ir.json"
}
"test-id-2": {
...
}
}
```
The above example is a sample config file structure. The config file should contain key-value pairs in a JSON format, where the key is the attribute name, and the value is the attribute description.
The attribute description should include an entrypoint in the form of an [FQName](https://package.elm-lang.org/packages/finos/morphir-elm/latest/Morphir.IR.FQName) (this is the type describing your custom attribute), a display name, and a path to the IR file containing your type model

### Attribute file
```
{
"Morphir.Reference.Model.Issues.Issue401:bar": {
"MNPI": false,
"PII": true
},
"Morphir.Reference.Model.Issues.Issue401:foo": {
"MNPI": false,
"PII": false
}
}
```
The above example is a sample attribute file structure. The attribute file should be a dictionary in a JSON format, where the keys are Morphir [FQName](https://package.elm-lang.org/packages/finos/morphir-elm/latest/Morphir.IR.FQName)s, and the values are any valid JSON object.


## Loading and updating the attribute files
We currently provide the following APIs.

***GET /server/attributes/***
Returns the a JSON file with a very similar structure to the config file, but amended with `data` fields containing the actual custom attribute values, and the `ir` field containing the actual IR instead of a path pointing to it

```
{
"test-id-1": {
"displayName" : <displayName>
, "entryPoint" : <FQName>
, "ir" : "<a Morphir IR>"
, "data" : <custom attribute dictionary>
}
"test-id-2": {
...
}
}
```

***POST /server/updateattribute/\<yourattributename>***
```
{
"nodeId" : <fqname>,
"newAttribute: <JSON>
}
```
Updates the given node with the given new attribute.
78 changes: 78 additions & 0 deletions docs/users-guide/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Morphir Users' Guide
Morphir's core purpose is to collect and store the vital business logic of an application. To fulfull that goal,
Morphir provides tools to write business logic, visualize and interac with it, and use it to generate useful things.

## Who this Guide Designed For
This guide is for business users, analysts, and developers who want to use Morphir to tap the potential in their business logic.

## Content
1. [Getting Setup](#)
1. [Installation](installation.md)
1. [Editor Setup](editor_setup.md)
1. [The Morphir Tools](command_line_tools.md)
1. [Compile](command_line_tools.md#Compile)
1. [Visualize](command_line_tools.md#Visualize)
1. [Generate](command_line_tools.md#Generate)
<br/>
<br/>

[//]: # (1. [Quick Start]&#40;&#41;)

[//]: # ( 1. [Thinking in Morphir]&#40;&#41;)

[//]: # ( 1. [Describing the Business Domain]&#40;&#41;)

[//]: # ( 1. [Adding Logic]&#40;&#41;)

[//]: # ( 1. [Ensuring Correctness]&#40;&#41;)

[//]: # ( 1. [Testing]&#40;&#41;)

[//]: # ( 1. [Building, Executing, and Deploying]&#40;&#41;)

[//]: # (<br/>)

[//]: # (<br/>)

[//]: # ()
[//]: # (1. [Advanced Topics]&#40;#&#41;)

[//]: # ( 1. [More On Writing Business Logic]&#40;#&#41;)

[//]: # ( 1. [What Makes a Good Model]&#40;#&#41;)

[//]: # ( 1. [Modelling an Application]&#40;#&#41;)

[//]: # ( 1. [Modelling an API]&#40;#&#41;)

[//]: # ( 1. [Modelling the Local State]&#40;#&#41;)

[//]: # ( 1. [Modelling Remote State Dependencies]&#40;#&#41;)

[//]: # ( 1. [Modelling Decision Tables]&#40;#&#41;)

[//]: # ( 1. [Modelling for Database Developers]&#40;#&#41;)

[//]: # ( 1. [Execution]&#40;#&#41;)

[//]: # ( 1. [Complete Examples]&#40;#&#41;)

[//]: # ( 1. [A Simple Walkthrough - The Surfing Board Model]&#40;#&#41;)

[//]: # ( 1. [Overview]&#40;#&#41;)

[//]: # ( 1. [Installing Morphir]&#40;#&#41;)

[//]: # ( 1. [The First Logic]&#40;#&#41;)

[//]: # ( 1. [Generating Code]&#40;#&#41;)

[//]: # ( 1. [Use Case: US LCR]&#40;#&#41;)

[//]: # ( 1. [Modelling LCR]&#40;#&#41;)

[//]: # ( 1. [Modelling Calculations]&#40;#&#41;)

[//]: # ( 1. [Modelling Collection Operations]&#40;#&#41;)

[//]: # ( 1. [Modellng Structures]&#40;#&#41;)
106 changes: 106 additions & 0 deletions docs/users-guide/command_line_tools.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Morphir Command Line Tools

## Compile (Elm)
Morphir revolves around the Intermediate Representation (IR), which is the data format for storing logic.
Morphir users compile their business logic into the IR using morphir's compiler tools. For Elm-authored logic,
is done through the following:

```shell
morphir-elm make
```

Options include:
```shell
Usage: morphir-elm make [options]

Translate Elm sources to Morphir IR

Options:
-p, --project-dir <path> Root directory of the project where morphir.json is located. (default: ".")
-o, --output <path> Target file location where the Morphir IR will be saved. (default: "morphir-ir.json")
-t, --types-only Only include type information in the IR, no values. (default: false)
-f, --fallback-cli Full rebuild. (default: false)
-h, --help display help for command
```

## Visualize
Morphir contains tools to interact with, learn, and test Morphir applications. This can be invoked via:

```shell
morphir-elm develop
```

Options include:
```shell
Usage: morphir-elm develop [options]

Start up a web server and expose developer tools through a web UI

Options:
-p, --port <port> Port to bind the web server to. (default: "3000")
-o, --host <host> Host to bind the web server to. (default: "0.0.0.0")
-i, --project-dir <path> Root directory of the project where morphir.json is located. (default: ".")
-h, --help display help for command
```

Note that the default http://0.0.0.0:3000 sometimes needs to be replaced with http://localhost:3000
depending on the host environment.


## Generate
Morphir provides tools to generate useful things from a Morphir IR.

```shell
morphir-elm gen
```

Options include:
```shell
Usage: morphir-elm gen [options]

Generate code from Morphir IR

Options:
-i, --input <path> Source location where the Morphir IR will be loaded from. (default: "morphir-ir.json")
-o, --output <path> Target location where the generated code will be saved. (default: "./dist")
-t, --target <type> Language to Generate (Scala | SpringBoot | cypher | triples | TypeScript). (default: "Scala")
-m, --modules-to-include <comma.separated,list.of,module.names> Limit the set of modules that will be included.
-h, --help display help for command
```

### Generate Scala
```shell
morphir-elm gen -t Scala
```

Options include:
```shell
-e, --target-version <version> Scala language version to Generate. (default: "2.11")
-c, --copy-deps Copy the dependencies used by the generated code to the output path. (default: false)
```

### Generate Json Schema
```shell
morphir-elm gen -t JsonSchema
```

Options include:
```shell
-s, --include-codecs Generate JSON codecs (default: false)
-f, --filename <filename> Filename of the generated JSON Schema. (default: "")
```

### Generate TypeScript
```shell
morphir-elm gen -t TypeScript
```

### Generate Turtle for semantic web technologies
```shell
morphir-elm gen -t semantic
```

### Generate Cypher for graph databases
```shell
morphir-elm gen -t cypher
```
Loading

0 comments on commit 3095a3e

Please sign in to comment.