Skip to content

Commit 51f5931

Browse files
committed
Fix typos and grammar
1 parent 646b255 commit 51f5931

File tree

1 file changed

+20
-22
lines changed

1 file changed

+20
-22
lines changed

docs/02_Introduction_into_Metafacture-Flux.md

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ See the result below? It is `Hello, friend. I'am Metafacture!`.
3838
But what have we done here?
3939
We have a short text string `"Hello, friend. I'am Metafacture"`. That is printed with the modul `print`.
4040

41-
A Metafacture Workflow is nothing else than an incoming text string that is manipulated by one or multiple moduls that do something with the incoming string.
41+
A Metafacture Workflow is nothing else than an incoming text string that is manipulated by one or multiple modules that do something with the incoming string.
4242
However, the workflow does not have to start with a text string but can also be a variable that stands for the text string and needs to be defined before the workflow. As this:
4343

4444
```text
@@ -93,8 +93,7 @@ inputFile
9393
```
9494

9595
The inputFile is opened as a file (`open-file`) and then processed line by line (`as-line`).
96-
You can see that in this [sample](https://metafacture.org/playground/?flux=inputFile%0A%7Copen-file%0A%7Cas-lines%0A%7Cprint%0A%3B&data=Hello%2C+friend.+I%27am+Metafacture%21).
97-
https://metafacture.org/playground/?flux=inputFile%0A%7C+open-file%0A%7C+as-lines%0A%7C+print%0A%3B&data=Hello%2C+friend.+I%27am+Metafacture%21
96+
Have a look at this [sample](https://metafacture.org/playground/?flux=inputFile%0A%7Copen-file%0A%7Cas-lines%0A%7Cprint%0A%3B&data=Hello%2C+friend.+I%27am+Metafacture%21).
9897

9998
We usually do not start with any random text strings but with data. So lets play around with some data.
10099

@@ -108,7 +107,7 @@ You will see data that look like this:
108107

109108
This is data in JSON format. But it seems not very readable.
110109

111-
But all these fields tell something about a publication, a book, with 268 pages and title Ordinary Vices by Judith N. Shklar.
110+
All these fields tell us something about a publication, a book, with 268 pages and title "Ordinary Vices" by Judith N. Shklar.
112111

113112
Let's copy the JSON data into our `ìnputFile-content` field. [And run it again](https://metafacture.org/playground/?flux=inputFile%0A%7Copen-file%0A%7Cas-lines%0A%7Cprint%0A%3B&data=%7B%22publishers%22%3A+%5B%22Belknap+Press+of+Harvard+University+Press%22%5D%2C+%22identifiers%22%3A+%7B%22librarything%22%3A+%5B%22321843%22%5D%2C+%22goodreads%22%3A+%5B%222439014%22%5D%7D%2C+%22covers%22%3A+%5B413726%5D%2C+%22local_id%22%3A+%5B%22urn%3Atrent%3A0116301499939%22%2C+%22urn%3Asfpl%3A31223009984353%22%2C+%22urn%3Asfpl%3A31223011345064%22%2C+%22urn%3Acst%3A10017055762%22%5D%2C+%22lc_classifications%22%3A+%5B%22JA79+.S44+1984%22%2C+%22HM216+.S44%22%2C+%22JA79.S44+1984%22%5D%2C+%22key%22%3A+%22/books/OL2838758M%22%2C+%22authors%22%3A+%5B%7B%22key%22%3A+%22/authors/OL381196A%22%7D%5D%2C+%22ocaid%22%3A+%22ordinaryvices0000shkl%22%2C+%22publish_places%22%3A+%5B%22Cambridge%2C+Mass%22%5D%2C+%22subjects%22%3A+%5B%22Political+ethics.%22%2C+%22Liberalism.%22%2C+%22Vices.%22%5D%2C+%22pagination%22%3A+%22268+p.+%3B%22%2C+%22source_records%22%3A+%5B%22marc%3AOpenLibraries-Trent-MARCs/tier5.mrc%3A4020092%3A744%22%2C+%22marc%3Amarc_openlibraries_sanfranciscopubliclibrary/sfpl_chq_2018_12_24_run01.mrc%3A195791766%3A1651%22%2C+%22ia%3Aordinaryvices0000shkl%22%2C+%22marc%3Amarc_claremont_school_theology/CSTMARC1_barcode.mrc%3A137174387%3A3955%22%2C+%22bwb%3A9780674641754%22%2C+%22marc%3Amarc_loc_2016/BooksAll.2016.part15.utf8%3A115755952%3A680%22%2C+%22marc%3Amarc_claremont_school_theology/CSTMARC1_multibarcode.mrc%3A137367696%3A3955%22%2C+%22ia%3Aordinaryvices0000shkl_a5g0%22%2C+%22marc%3Amarc_columbia/Columbia-extract-20221130-001.mrc%3A328870555%3A1311%22%2C+%22marc%3Aharvard_bibliographic_metadata/ab.bib.01.20150123.full.mrc%3A156768969%3A815%22%5D%2C+%22title%22%3A+%22Ordinary+vices%22%2C+%22dewey_decimal_class%22%3A+%5B%22172%22%5D%2C+%22notes%22%3A+%7B%22type%22%3A+%22/type/text%22%2C+%22value%22%3A+%22Bibliography%3A+p.+251-260.\nIncludes+index.%22%7D%2C+%22number_of_pages%22%3A+268%2C+%22languages%22%3A+%5B%7B%22key%22%3A+%22/languages/eng%22%7D%5D%2C+%22lccn%22%3A+%5B%2284000531%22%5D%2C+%22isbn_10%22%3A+%5B%220674641752%22%5D%2C+%22publish_date%22%3A+%221984%22%2C+%22publish_country%22%3A+%22mau%22%2C+%22by_statement%22%3A+%22Judith+N.+Shklar.%22%2C+%22works%22%3A+%5B%7B%22key%22%3A+%22/works/OL2617047W%22%7D%5D%2C+%22type%22%3A+%7B%22key%22%3A+%22/type/edition%22%7D%2C+%22oclc_numbers%22%3A+%5B%2210348450%22%5D%2C+%22latest_revision%22%3A+16%2C+%22revision%22%3A+16%2C+%22created%22%3A+%7B%22type%22%3A+%22/type/datetime%22%2C+%22value%22%3A+%222008-04-01T03%3A28%3A50.625462%22%7D%2C+%22last_modified%22%3A+%7B%22type%22%3A+%22/type/datetime%22%2C+%22value%22%3A+%222024-12-27T16%3A46%3A50.181109%22%7D%7D).
114113

@@ -117,14 +116,12 @@ The output in result is the same as the input and it is still not very readable.
117116
Lets turn the one line of JSON data into YAML. YAML is another format for structured information which is a bit easier to read for human eyes.
118117
In order to change the serialization of the data we need to decode the data and then encode the data.
119118

120-
Metafacture has lots of decoder and encoder modules for specific data formats that can be used in an Flux workflow.
119+
Metafacture has lots of decoder and encoder modules for specific data formats that can be used in a Flux workflow.
121120

122121
Let's try this out. Add the module `decode-json` and `encode-yaml` to your Flux Workflow.
123122

124123
The Flux should now look like this:
125124

126-
Flux:
127-
128125
```text
129126
inputFile
130127
| open-file
@@ -227,19 +224,20 @@ Clear your playground and copy the following Flux workflow:
227224
;
228225
```
229226

230-
The [result in the playground](https://metafacture.org/playground/?flux=%22https%3A//openlibrary.org/books/OL2838758M.json%22%0A%7C+open-http%0A%7C+as-lines%0A%7C+decode-json%0A%7C+encode-yaml%0A%7C+print%0A%3B) should be the same as before without having to paste anything into the text field. We just used the module `open-http` and directly retrieved the data from the URL.
227+
The [result in the playground](https://metafacture.org/playground/?flux=%22https%3A//openlibrary.org/books/OL2838758M.json%22%0A%7C+open-http%0A%7C+as-lines%0A%7C+decode-json%0A%7C+encode-yaml%0A%7C+print%0A%3B) should be the same as before without having to paste anything into the text field. We just used the module `open-http` to directly retrieve the data from the URL.
231228

232-
Let's take a look what a Flux workflow does. The Flux workflow is combination of different moduls to process incoming structured data. In our example we have different things that we do with these modules:
229+
Let's take a look at what a Flux workflow does. The Flux workflow is a combination of different modules to process incoming structured data. In our example we have different things that we do with these modules:
233230

234231
1. We have a URL as input. The URL localizes the data on the web.
235-
2. We tell Metafacture to request the stated url using `open-http`.
232+
2. We tell Metafacture to request the stated URL using `open-http`.
236233
3. Then we define how to handle the incoming data: since the JSON is written in one line, we tell Metafacture to regard every new line as a new record with `as-lines`
237-
4. Afterwards we tell Metafacture to `decode-json` in order to translate the incoming data as json to the generic internal data model that is called metadata events
234+
4. Afterwards we tell Metafacture to `decode-json` in order to translate the incoming data as JSON to the generic internal data model that is called metadata events
238235
5. Then we instruct Metafacture to serialize the metadata events as YAML with `encode-yaml`
239236
6. Finally, we tell MF to `print` everything.
240237

241-
So let's have a small recap of what we done and learned so far: * We played around with the Metafacture Playground.
242-
* We learned that a Metafacture Flux workflow is a combination of modules with an inital text string or an variable.
238+
So let's have a small recap of what we've done and learned so far:
239+
* We've played around with the Metafacture Playground.
240+
* We've learned that a Metafacture Flux workflow is a combination of modules with an inital text string or a variable.
243241
* We got to know different modules like `open-http`, `as-lines`. `decode-json`, `encode-yaml`, `print`
244242

245243
More modules can be found in the [documentation of available flux commands](https://github.com/metafacture/metafacture-documentation/blob/master/flux-commands.html).
@@ -268,16 +266,16 @@ Now take some time and play around a little bit more and use some other modules.
268266
What you see with the modules `encode-formeta` and `write` is that modules can have further specification in brackets.
269267
These can eiter be a string in `"..."` or attributes that define options as with `style=`.
270268

271-
One last thing you should learn on an abstract level is to grasp the general idea of Metafacture Flux workflows is that they have many different moduls through which the data is flowing.
272-
The most abstract and most common process resemble the following steps:
269+
One last thing you should learn on an abstract level to grasp the general idea of Metafacture Flux workflows is that they have many different modules through which the data is flowing.
270+
The most abstract and most common process is resembled by the following steps:
273271

274272
**→ read → decode → transform → encode → write →**
275273

276-
This process is one that transforms incoming data in a way that is changed at the end.
274+
This process chain transforms incoming data.
277275
Each step can be done by one or a combination of multiple modules.
278276
Modules are small tools that do parts of the complete task we want to do.
279277

280-
Each modul demands a certain input and give a certain output. This is called signature.
278+
Each modul demands a certain input and gives a certain output. This is called signature.
281279
e.g.:
282280

283281
The first modul `open-file` expects a string and provides read data (called reader).
@@ -286,12 +284,12 @@ This reader data can be passed on to a modul that accepts reader data e.g. in ou
286284

287285
If you have a look at the flux modul/command documentation then you see under signature which data a modul expects and which data it outputs.
288286

289-
The combination of moduls is a Flux workflow.
287+
The combination of modules is called a "Flux workflow".
290288

291289
Each module is separated by a `|` and every workflow ends with a `;`.
292290
Comments can be added with `//`.
293291

294-
See:
292+
For example:
295293

296294
```
297295
//input string:
@@ -319,7 +317,7 @@ Add the option: <code>prettyPrinting="true"</code> to the <code>encode-json</cod
319317

320318

321319

322-
2) Have a look at documentation of [`decode-xml`](https://metafacture.org/metafacture-documentation/docs/flux/flux-commands.html#decode-xml) what is different to `decode-json`? And what input does it expect and what output does it create (Hint: signature)?
320+
2) Have a look at the documentation of [`decode-xml`](https://metafacture.org/metafacture-documentation/docs/flux/flux-commands.html#decode-xml). What is different to `decode-json`? And what input does it expect and what output does it create (hint: signature)?
323321

324322
<details>
325323
<summary>Answer</summary>
@@ -329,7 +327,7 @@ The signature of <code>decode-xml</code> and <code>decode-json</code> is quiet d
329327
<code>decode-json</code>: signature: String -> StreamReceiver
330328

331329
Explanation:
332-
<code>decode-xml</code> expects data from Reader output of <code>open-file</code> or <code>open-http</code>, and creates output that can be transformed by a specific xml <code>handler</code>. The xml parser of <code>decode-xml</code> works straight with read content of a file or a url.
330+
<code>decode-xml</code> expects data from Reader output of <code>open-file</code> or <code>open-http</code>, and creates output that can be transformed by a specific XML <code>handler</code>. The XML parser of <code>decode-xml</code> works straight by reading the content of a file or a URL.
333331

334332
<code>decode-json</code> expects data from output of a string like <code>as-lines</code> or <code>as-records</code> and creates output that could be transformed by <code>fix</code> or encoded with a module like <code>encode-xml</code>. For the most decoding you have to specify how (<code>as-lines</code> or <code>as-records</code>) the incoming data is read.
335333
</details>
@@ -354,7 +352,7 @@ Explanation:
354352

355353
As you surely already saw I mentioned transform as one step in a metafacture workflow.
356354

357-
But aside from changing the serialisation we did not play around with transformations yet.
355+
But aside from changing the serialization we did not play around with transformations yet.
358356
This will be the theme of the next session.
359357

360358
---------------

0 commit comments

Comments
 (0)