Skip to content

Commit

Permalink
include another example (Multiple files in a specification)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefjoosten committed Dec 11, 2023
1 parent 0d7b703 commit 86e4abb
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 7 deletions.
21 changes: 21 additions & 0 deletions docs/Examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,27 @@ description: Examples of Ampersand programs and fragments
This page is a collection of examples, meant for learning and explaining the language Ampersand.
TODO: refactor this documentation to match the latest syntax.

## Example: Multiple files
This example illustrates how an Ampersand specification can consist of multiple files.

In this example, we have two files. File `foo.adl` contains the following text:
```Ampersand
CONTEXT MultifileDemo
INCLUDE "bar.adl"
RELATION r[A*B]
RULE r |- s
ENDCONTEXT
```
and file `bar.adl` contains:
```Ampersand
CONTEXT MultifileDemo
INCLUDE "bar.adl"
RELATION s[A*B]
ENDCONTEXT
```
Without the `INCLUDE` statement, file `foo.adl` does not compile because relation `s` is undefined.
The `INCLUDE` statement causes all definitions of `bar.adl` to be included in the context of `foo.adl`, so this example compiles without errors.

## Example: Client {#interfaces-example-client}

This example illustrates the structure of [interfaces in Ampersand](reference-material/syntax-of-ampersand#the-interface-statement)
Expand Down
1 change: 1 addition & 0 deletions docs/landingpage/2-student.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ You can learn about the language Ampersand, and learn how to make a prototype of
- Do the [tutorial](../tutorial-rap4), to get an idea of an Ampersand application
- Learn about the [syntax of Ampersand](../reference-material/syntax-of-ampersand), to write correct Ampersand code.
- Learn about [relation algebra](https://en.wikipedia.org/wiki/Relational_algebra) on Wikipedia, to understand more about this fascinating field of mathematics.
- Find [examples](../examples.md) of Ampersand specifications, to get started making your own.
- Find [exercises](../exercises.md) that help you improve your skills in specifying information systems.
1 change: 1 addition & 0 deletions docs/landingpage/3-ampersand-user.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ This page will help you build a working prototype of your information system and
## Get started

- Do the [tutorial](../tutorial-rap4), to get an idea of an Ampersand application
- Find [examples](../examples.md) of Ampersand specifications, to get started making your own.
- Understand the [architecture of an Ampersand application](../reference-material/architecture-of-an-ampersand-application), so you can build, deploy, and maintain your Ampersand application better.
- Learn about the [syntax of Ampersand](../reference-material/syntax-of-ampersand), to write correct Ampersand code.
- Learn about [relation algebra](https://en.wikipedia.org/wiki/Relational_algebra) on Wikipedia, to understand more about this fascinating field of mathematics.
Expand Down
4 changes: 2 additions & 2 deletions docs/reference-material/interfaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,5 +276,5 @@ When running an application in your browser, you are watching one user interface

The next sections contain two examples:

- a [client interface](../Examples.md#interfaces-example-client) to allow clients of a web shop to change their name and address and show them status information of their orders;
- a [login interface](../Examples.md#interfaces-example-login) to demonstrate how to get different interface structures under varying conditions.
- a [client interface](../examples.md#interfaces-example-client) to allow clients of a web shop to change their name and address and show them status information of their orders;
- a [login interface](../examples.md#interfaces-example-login) to demonstrate how to get different interface structures under varying conditions.
8 changes: 4 additions & 4 deletions docs/reference-material/syntax-of-ampersand.md
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ Interfaces are meant to expose functionality and data from a [context](#the-cont

#### Description

An interface is a component of an information system that exposes functionality and data from a [context](#the-context-statement), to let users or information systems interact by creating, reading, updating, and deleting data. The first [example](../Examples.md#example-interface-structure) introduces a simple interface informally. Another [example](../Examples.md#interface-introductory-example) introduces the main features of an interface with nested interfaces.
An interface is a component of an information system that exposes functionality and data from a [context](#the-context-statement), to let users or information systems interact by creating, reading, updating, and deleting data. The first [example](../examples.md#example-interface-structure) introduces a simple interface informally. Another [example](../examples.md#interface-introductory-example) introduces the main features of an interface with nested interfaces.

A _interface_ is a component of an information system. During the time that this interface can actually be used, we say it is _deployed_. We also call this the _lifetime_ of a interface. A typical instance of a interface is a user interface based on HTML-CSS that runs in a browser. But an application program interface \(API\) that serves other computers with web services is a perfectly valid instance as well.

Expand Down Expand Up @@ -859,8 +859,8 @@ When running an application in your browser, you are watching one user interface

Further examples:

- a [client interface](../Examples.md#interfaces-example-client) to allow clients of a web shop to change their name and address and show them status information of their orders;
- a [login interface](../Examples.md#interfaces-example-login) to demonstrate how to get different interface structures under varying conditions.
- a [client interface](../examples.md#interfaces-example-client) to allow clients of a web shop to change their name and address and show them status information of their orders;
- a [login interface](../examples.md#interfaces-example-login) to demonstrate how to get different interface structures under varying conditions.

### CRUD annotations

Expand Down Expand Up @@ -1498,7 +1498,7 @@ RULE <label> <term> <meaning>* <message>* <violation>?
The [RULE syntax](#the-rule-statement) is the same as for ordinary rules.
However, the violations are specified differently.
We will define the specifics by examples.
Most of the examples are taken from the demo script [Project Administration Example](https://github.com/AmpersandTarski/ampersand-models/tree/master/Examples/ProjectAdministration). You can compile and run this script, and reproduce several of the examples that follow.
Most of the examples are taken from the demo script [Project Administration Example](https://github.com/AmpersandTarski/ampersand-models/tree/master/examples/ProjectAdministration). You can compile and run this script, and reproduce several of the examples that follow.

#### Example \(`InsPair` and `DelPair`\)

Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial/interfaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ TODO

## Assignment

Compile and run the script [Project Administration Example](https://github.com/AmpersandTarski/ampersand-models/tree/master/Examples/ProjectAdministration). Start by reproducing everything that is shown above. It is quite likely that you will be trying out your own ideas before you get to the end... Have fun!
Compile and run the script [Project Administration Example](https://github.com/AmpersandTarski/ampersand-models/tree/master/examples/ProjectAdministration). Start by reproducing everything that is shown above. It is quite likely that you will be trying out your own ideas before you get to the end... Have fun!

## What have you learned?

Expand Down

0 comments on commit 86e4abb

Please sign in to comment.