You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/MF-in-5-min.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -93,7 +93,7 @@ $ cat yaml2json.flux
93
93
94
94
## FIX LANGUAGE
95
95
96
-
Many data conversions need a mapping from one field to another field plus optional conversions of the data inside these fields. Metafacture provides the transformation module `fix` that uses the Catmandu-inspired Fix language to assist in these mappings. See the [full list of Fix functions](fix/Fix-functions-and-Cookbook.html#functions).
96
+
Many data conversions need a mapping from one field to another field plus optional conversions of the data inside these fields. Metafacture provides the transformation module `fix` that uses the Catmandu-inspired Fix language to assist in these mappings. See the [full list of Fix functions](fix/Fix-functions.html#functions).
97
97
98
98
Fixes can be provided inline as text argument of the fix module in the Flux script, or as a pointer to a Fix script. A Fix script groups one or more fixes in a file.
Copy file name to clipboardExpand all lines: docs/fix/Fix-User-Guide.md
+41-3Lines changed: 41 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -230,8 +230,6 @@ vars.put("rights", "CC-0");
230
230
final Metafix metafix = new metafix("fixdef.fix", vars);
231
231
```
232
232
233
-
234
-
235
233
## Splitting Fixes for Reuse
236
234
237
235
In a complex project setting there may be several Fixes in use,
@@ -244,7 +242,7 @@ Another scenario would be to reduce the size of a single fix file and create sev
244
242
245
243
To accomodate for such reuse, Fix offers an include mechanism:
246
244
247
-
``````
245
+
```perl
248
246
# Setup adds maps, macros and vars once
249
247
do once("setup")
250
248
include ("./fix/maps.fix")
@@ -254,3 +252,43 @@ end
254
252
```
255
253
256
254
For performance reasons it is useful to integrate macros and maps that are used often in a `do once`bind.
255
+
256
+
## Cookbook
257
+
258
+
This page is a replication of the passages [Best practices and guidelines for working with Metafacture Fix](https://github.com/metafacture/metafacture-fix?tab=readme-ov-file#best-practices-and-guidelines-for-working-with-metafacture-fix) and [Glossary](https://github.com/metafacture/metafacture-fix?tab=readme-ov-file#glossary) of the Fix Readme.md. Status: [Fix Release 1.1.2](https://github.com/metafacture/metafacture-fix/releases/tag/1.1.2)
259
+
260
+
### Best practices and guidelines for working with Metafacture Fix
261
+
262
+
- We recommend to use double quotation marks for arguments andvalues in functions, binds and conditionals.
263
+
- If using a `list`bind with a variable, the `var` option requires quotation marks (`do list(path: "<sourceField>", "var": "<variableName>")`).
264
+
- Fix turns repeated fields into arrays internally but only marked arrays (with `[]` at the end of the field name) are also emitted as"arrays" (entities with indexed literals), all other arrays are emitted as repeated fields.
265
+
- Every Fix file should end with a final newline.
266
+
267
+
### Glossary
268
+
269
+
#### Array wildcards
270
+
271
+
Array wildcards resemble [Catmandu's concept of wildcards](http://librecat.org/Catmandu/#wildcards).
272
+
273
+
When working with arrays and repeated fields you can use wildcards instead of an index number to select elements of an array.
274
+
275
+
| Wildcard | Meaning |
276
+
|----------|:--------|
277
+
| `*` | Selects _all_ elements of an array. |
278
+
| `$first` | Selects only the _first_ element of an array. |
279
+
| `$last` | Selects only the _last_ element of an array. |
280
+
| `$prepend` | Selects the position _before_ the first element of an array. Can only be used when adding new elements to an array. |
281
+
| `$append` | Selects the position _after_ the last element of an array. Can only be used when adding new elements to an array. |
282
+
283
+
#### Path wildcards
284
+
285
+
Path wildcards resemble [Metamorph's concept of wildcards](https://github.com/metafacture/metafacture-core/wiki/Metamorph-User-Guide#addressing-pieces-of-data). They are not supported in Catmandu (it has [specialized Fix functions](https://librecat.org/Catmandu/#marc-mab-pica-paths) instead).
286
+
287
+
You can use path wildcards to select fields matching a pattern. They only match path _segments_ (field names), though, not _whole_ paths of nested fields. These wildcards cannot be used to add new elements.
288
+
289
+
| Wildcard | Meaning |
290
+
|----------|:--------|
291
+
| `*` | Placeholder for zero or more characters. |
Copy file name to clipboardExpand all lines: docs/fix/Fix-functions.md
+2-40Lines changed: 2 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,49 +1,11 @@
1
1
---
2
2
layout: default
3
-
title: Fix Functions and Cookbook
3
+
title: Fix Functions
4
4
parent: Fix
5
5
nav_order: 2
6
6
---
7
7
8
-
This page is a replication of the passage [Fix Functions and Cookbook](https://github.com/metafacture/metafacture-fix?tab=readme-ov-file#functions-and-cookbook) of the Fix Readme.md. Status: [Fix Release 1.1.2](https://github.com/metafacture/metafacture-fix/releases/tag/1.1.2)
9
-
10
-
## Functions and cookbook
11
-
12
-
### Best practices and guidelines for working with Metafacture Fix
13
-
14
-
- We recommend to use double quotation marks for arguments and values in functions, binds and conditionals.
15
-
- If using a `list` bind with a variable, the `var` option requires quotation marks (`do list(path: "<sourceField>", "var": "<variableName>")`).
16
-
- Fix turns repeated fields into arrays internally but only marked arrays (with `[]` at the end of the field name) are also emitted as "arrays" (entities with indexed literals), all other arrays are emitted as repeated fields.
17
-
- Every Fix file should end with a final newline.
18
-
19
-
### Glossary
20
-
21
-
#### Array wildcards
22
-
23
-
Array wildcards resemble [Catmandu's concept of wildcards](http://librecat.org/Catmandu/#wildcards).
24
-
25
-
When working with arrays and repeated fields you can use wildcards instead of an index number to select elements of an array.
26
-
27
-
| Wildcard | Meaning |
28
-
|----------|:--------|
29
-
|`*`| Selects _all_ elements of an array. |
30
-
|`$first`| Selects only the _first_ element of an array. |
31
-
|`$last`| Selects only the _last_ element of an array. |
32
-
|`$prepend`| Selects the position _before_ the first element of an array. Can only be used when adding new elements to an array. |
33
-
|`$append`| Selects the position _after_ the last element of an array. Can only be used when adding new elements to an array. |
34
-
35
-
#### Path wildcards
36
-
37
-
Path wildcards resemble [Metamorph's concept of wildcards](https://github.com/metafacture/metafacture-core/wiki/Metamorph-User-Guide#addressing-pieces-of-data). They are not supported in Catmandu (it has [specialized Fix functions](https://librecat.org/Catmandu/#marc-mab-pica-paths) instead).
38
-
39
-
You can use path wildcards to select fields matching a pattern. They only match path _segments_ (field names), though, not _whole_ paths of nested fields. These wildcards cannot be used to add new elements.
40
-
41
-
| Wildcard | Meaning |
42
-
|----------|:--------|
43
-
|`*`| Placeholder for zero or more characters. |
44
-
|`?`| Placeholder for exactly one character. |
45
-
|`\|`| Alternation of multiple patterns. |
46
-
|`[...]`| Enumeration of characters. |
8
+
This page is a replication of the passage [Functions](https://github.com/metafacture/metafacture-fix?tab=readme-ov-file#functions) of the Fix Readme.md. Status: [Fix Release 1.1.2](https://github.com/metafacture/metafacture-fix/releases/tag/1.1.2)
Copy file name to clipboardExpand all lines: docs/fix/fix.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ If you are using **Metafacture as a Java library**, create a Metafix object and
13
13
14
14
The transformation itself is declared in a fix-object which can be a file. For more information on how to declare transformations see [Metafix User Guide](Fix-User-Guide.html).
15
15
16
-
See [here a list for all available FIX functions and a cookbook for using fix](Fix-functions-and-Cookbook.html).
16
+
See [here a list for all available FIX functions](Fix-functions.html).
17
17
18
18
{: .note }
19
19
PS: There is also the transformation module MORPH. Have a look at [the old documentation](https://github.com/metafacture/metafacture-core/wiki/Metamorph-User-Guide) and the German cookbook by [Swissbib](https://swissbib.gitlab.io/metamorph-doku/).
0 commit comments