relpipe-data/examples-hello-world.xml
author František Kučera <franta-hg@frantovo.cz>
Mon, 21 Feb 2022 00:43:11 +0100
branchv_0
changeset 329 5bc2bb8b7946
parent 317 fce3d6290c40
permissions -rw-r--r--
Release v0.18
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
23
0d2729ed16ed zkouška interního odkazu
František Kučera <franta-hg@frantovo.cz>
parents: 18
diff changeset
     1
<stránka
0d2729ed16ed zkouška interního odkazu
František Kučera <franta-hg@frantovo.cz>
parents: 18
diff changeset
     2
	xmlns="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/strana"
0d2729ed16ed zkouška interního odkazu
František Kučera <franta-hg@frantovo.cz>
parents: 18
diff changeset
     3
	xmlns:m="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/makro">
0d2729ed16ed zkouška interního odkazu
František Kučera <franta-hg@frantovo.cz>
parents: 18
diff changeset
     4
	
244
d4f401b5f90c examples: move each example to a separate page + add generated list of examples
František Kučera <franta-hg@frantovo.cz>
parents: 241
diff changeset
     5
	<nadpis>Hello Wordl!</nadpis>
d4f401b5f90c examples: move each example to a separate page + add generated list of examples
František Kučera <franta-hg@frantovo.cz>
parents: 241
diff changeset
     6
	<perex>generating relational data from CLI arguments</perex>
d4f401b5f90c examples: move each example to a separate page + add generated list of examples
František Kučera <franta-hg@frantovo.cz>
parents: 241
diff changeset
     7
	<m:pořadí-příkladu>00100</m:pořadí-příkladu>
4
1bb39595a51c genrování hlavní nabídky #1
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
     8
2
ab9099ff88fa vkládání zápatí, jmenné prostory, saxon
František Kučera <franta-hg@frantovo.cz>
parents: 1
diff changeset
     9
	<text xmlns="http://www.w3.org/1999/xhtml">
176
46042297e0d6 relpipe-tr-validator: specification and examples
František Kučera <franta-hg@frantovo.cz>
parents: 140
diff changeset
    10
		
185
6cd2e54d90ea examples: relpipe-in-cli
František Kučera <franta-hg@frantovo.cz>
parents: 184
diff changeset
    11
		<p>
195
65138c5d5a7c examples: fstab - another check
František Kučera <franta-hg@frantovo.cz>
parents: 187
diff changeset
    12
			Let's start with an obligatory Hello World example.
185
6cd2e54d90ea examples: relpipe-in-cli
František Kučera <franta-hg@frantovo.cz>
parents: 184
diff changeset
    13
		</p>
6cd2e54d90ea examples: relpipe-in-cli
František Kučera <franta-hg@frantovo.cz>
parents: 184
diff changeset
    14
		
317
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    15
		<m:pre jazyk="bash"><![CDATA[relpipe-in-cli \
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    16
		--relation "relation_from_cli" \
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    17
			--attribute "a" "integer" \
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    18
			--attribute "b" "string" \
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    19
			--attribute "c" "boolean" \
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    20
			--record "1" "Hello" "true" \
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    21
			--record "2" "World!" "false"]]></m:pre>
185
6cd2e54d90ea examples: relpipe-in-cli
František Kučera <franta-hg@frantovo.cz>
parents: 184
diff changeset
    22
	
6cd2e54d90ea examples: relpipe-in-cli
František Kučera <franta-hg@frantovo.cz>
parents: 184
diff changeset
    23
		<p>
6cd2e54d90ea examples: relpipe-in-cli
František Kučera <franta-hg@frantovo.cz>
parents: 184
diff changeset
    24
			This command generates relational data.
6cd2e54d90ea examples: relpipe-in-cli
František Kučera <franta-hg@frantovo.cz>
parents: 184
diff changeset
    25
			In order to see them, we need to convert them to some other format.
317
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    26
			For now, we will use the „tabular“ format and pipe relational data to the <code>relpipe-out-tabular</code>.
185
6cd2e54d90ea examples: relpipe-in-cli
František Kučera <franta-hg@frantovo.cz>
parents: 184
diff changeset
    27
		</p>
6cd2e54d90ea examples: relpipe-in-cli
František Kučera <franta-hg@frantovo.cz>
parents: 184
diff changeset
    28
		
317
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    29
		<m:pre jazyk="bash"><![CDATA[relpipe-in-cli \
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    30
		--relation "relation_from_cli" \
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    31
			--attribute "a" "integer" \
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    32
			--attribute "b" "string" \
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    33
			--attribute "c" "boolean" \
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    34
			--record "1" "Hello" "true" \
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    35
			--record "2" "World!" "false" \
185
6cd2e54d90ea examples: relpipe-in-cli
František Kučera <franta-hg@frantovo.cz>
parents: 184
diff changeset
    36
	| relpipe-out-tabular]]></m:pre>
6cd2e54d90ea examples: relpipe-in-cli
František Kučera <franta-hg@frantovo.cz>
parents: 184
diff changeset
    37
	
6cd2e54d90ea examples: relpipe-in-cli
František Kučera <franta-hg@frantovo.cz>
parents: 184
diff changeset
    38
		<p>Output:</p>
6cd2e54d90ea examples: relpipe-in-cli
František Kučera <franta-hg@frantovo.cz>
parents: 184
diff changeset
    39
6cd2e54d90ea examples: relpipe-in-cli
František Kučera <franta-hg@frantovo.cz>
parents: 184
diff changeset
    40
		<pre><![CDATA[relation_from_cli:
6cd2e54d90ea examples: relpipe-in-cli
František Kučera <franta-hg@frantovo.cz>
parents: 184
diff changeset
    41
 ╭─────────────┬────────────┬─────────────╮
6cd2e54d90ea examples: relpipe-in-cli
František Kučera <franta-hg@frantovo.cz>
parents: 184
diff changeset
    42
 │ a (integer) │ b (string) │ c (boolean) │
6cd2e54d90ea examples: relpipe-in-cli
František Kučera <franta-hg@frantovo.cz>
parents: 184
diff changeset
    43
 ├─────────────┼────────────┼─────────────┤
6cd2e54d90ea examples: relpipe-in-cli
František Kučera <franta-hg@frantovo.cz>
parents: 184
diff changeset
    44
 │           1 │ Hello      │        true │
6cd2e54d90ea examples: relpipe-in-cli
František Kučera <franta-hg@frantovo.cz>
parents: 184
diff changeset
    45
 │           2 │ World!     │       false │
6cd2e54d90ea examples: relpipe-in-cli
František Kučera <franta-hg@frantovo.cz>
parents: 184
diff changeset
    46
 ╰─────────────┴────────────┴─────────────╯
6cd2e54d90ea examples: relpipe-in-cli
František Kučera <franta-hg@frantovo.cz>
parents: 184
diff changeset
    47
Record count: 2
6cd2e54d90ea examples: relpipe-in-cli
František Kučera <franta-hg@frantovo.cz>
parents: 184
diff changeset
    48
]]></pre>
6cd2e54d90ea examples: relpipe-in-cli
František Kučera <franta-hg@frantovo.cz>
parents: 184
diff changeset
    49
6cd2e54d90ea examples: relpipe-in-cli
František Kučera <franta-hg@frantovo.cz>
parents: 184
diff changeset
    50
		<p>
317
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    51
			The syntax is simple as we see above. We specify the name of the relation
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    52
			and the names and types of attributes
185
6cd2e54d90ea examples: relpipe-in-cli
František Kučera <franta-hg@frantovo.cz>
parents: 184
diff changeset
    53
			followed by the data.
6cd2e54d90ea examples: relpipe-in-cli
František Kučera <franta-hg@frantovo.cz>
parents: 184
diff changeset
    54
		</p>
196
8dd5b7ecb736 examples: multiple relations in a single stream
František Kučera <franta-hg@frantovo.cz>
parents: 195
diff changeset
    55
8dd5b7ecb736 examples: multiple relations in a single stream
František Kučera <franta-hg@frantovo.cz>
parents: 195
diff changeset
    56
		<p>
8dd5b7ecb736 examples: multiple relations in a single stream
František Kučera <franta-hg@frantovo.cz>
parents: 195
diff changeset
    57
			A single stream may contain multiple relations:
8dd5b7ecb736 examples: multiple relations in a single stream
František Kučera <franta-hg@frantovo.cz>
parents: 195
diff changeset
    58
		</p>		
8dd5b7ecb736 examples: multiple relations in a single stream
František Kučera <franta-hg@frantovo.cz>
parents: 195
diff changeset
    59
		
317
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    60
		<m:pre jazyk="bash"><![CDATA[(relpipe-in-cli --relation "a" --attribute "x" string --record "hello"; \
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    61
 relpipe-in-cli --relation "b" --attribute "y" string --record "world") \
196
8dd5b7ecb736 examples: multiple relations in a single stream
František Kučera <franta-hg@frantovo.cz>
parents: 195
diff changeset
    62
	| relpipe-out-tabular]]></m:pre>
8dd5b7ecb736 examples: multiple relations in a single stream
František Kučera <franta-hg@frantovo.cz>
parents: 195
diff changeset
    63
			
8dd5b7ecb736 examples: multiple relations in a single stream
František Kučera <franta-hg@frantovo.cz>
parents: 195
diff changeset
    64
		<p>
8dd5b7ecb736 examples: multiple relations in a single stream
František Kučera <franta-hg@frantovo.cz>
parents: 195
diff changeset
    65
			Thus we can combine various commands or files and pass the result to a single relational output filter (<code>relpipe-out-tabular</code> in this case) and get:
8dd5b7ecb736 examples: multiple relations in a single stream
František Kučera <franta-hg@frantovo.cz>
parents: 195
diff changeset
    66
		</p>
8dd5b7ecb736 examples: multiple relations in a single stream
František Kučera <franta-hg@frantovo.cz>
parents: 195
diff changeset
    67
		
8dd5b7ecb736 examples: multiple relations in a single stream
František Kučera <franta-hg@frantovo.cz>
parents: 195
diff changeset
    68
		<pre><![CDATA[a:
8dd5b7ecb736 examples: multiple relations in a single stream
František Kučera <franta-hg@frantovo.cz>
parents: 195
diff changeset
    69
 ╭────────────╮
8dd5b7ecb736 examples: multiple relations in a single stream
František Kučera <franta-hg@frantovo.cz>
parents: 195
diff changeset
    70
 │ x (string) │
8dd5b7ecb736 examples: multiple relations in a single stream
František Kučera <franta-hg@frantovo.cz>
parents: 195
diff changeset
    71
 ├────────────┤
8dd5b7ecb736 examples: multiple relations in a single stream
František Kučera <franta-hg@frantovo.cz>
parents: 195
diff changeset
    72
 │ hello      │
8dd5b7ecb736 examples: multiple relations in a single stream
František Kučera <franta-hg@frantovo.cz>
parents: 195
diff changeset
    73
 ╰────────────╯
8dd5b7ecb736 examples: multiple relations in a single stream
František Kučera <franta-hg@frantovo.cz>
parents: 195
diff changeset
    74
Record count: 1
8dd5b7ecb736 examples: multiple relations in a single stream
František Kučera <franta-hg@frantovo.cz>
parents: 195
diff changeset
    75
b:
8dd5b7ecb736 examples: multiple relations in a single stream
František Kučera <franta-hg@frantovo.cz>
parents: 195
diff changeset
    76
 ╭────────────╮
8dd5b7ecb736 examples: multiple relations in a single stream
František Kučera <franta-hg@frantovo.cz>
parents: 195
diff changeset
    77
 │ y (string) │
8dd5b7ecb736 examples: multiple relations in a single stream
František Kučera <franta-hg@frantovo.cz>
parents: 195
diff changeset
    78
 ├────────────┤
8dd5b7ecb736 examples: multiple relations in a single stream
František Kučera <franta-hg@frantovo.cz>
parents: 195
diff changeset
    79
 │ world      │
8dd5b7ecb736 examples: multiple relations in a single stream
František Kučera <franta-hg@frantovo.cz>
parents: 195
diff changeset
    80
 ╰────────────╯
8dd5b7ecb736 examples: multiple relations in a single stream
František Kučera <franta-hg@frantovo.cz>
parents: 195
diff changeset
    81
Record count: 1]]></pre>
317
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    82
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    83
		<p>
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    84
			In the example above, we call <code>relpipe-in-cli</code> twice and let the shell combine their outputs.
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    85
			This approach is useful when we want to combine relational data from various sources: different <code>relpipe-in-*</code> tools, files etc.
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    86
			But when we work with <code>relpipe-in-cli</code> only, we can ask it to create several relations during one run:
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    87
		</p>
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    88
		
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    89
		<m:pre jazyk="bash"><![CDATA[relpipe-in-cli \
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    90
		--relation "a" --attribute "x" string --record "hello" \
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    91
		--relation "b" --attribute "y" string --record "world" \
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    92
	| relpipe-out-tabular]]></m:pre>
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    93
	
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    94
		<p>
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    95
			The result will be the same.
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    96
			We can also use the <code>--records</code> option instead of the <code>--record</code> option – then the rest of the CLI arguments is treated as data of given relation.
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    97
			Obviously this option can be used only once for the last relation.
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    98
		</p>
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    99
		
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
   100
		<m:pre jazyk="bash"><![CDATA[relpipe-in-cli \
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
   101
		--relation "relation_from_cli" \
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
   102
			--attribute "a" "integer" \
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
   103
			--attribute "b" "string" \
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
   104
			--attribute "c" "boolean" \
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
   105
			--records \
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
   106
				"1" "Hello" "true" \
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
   107
				"2" "World!" "false" \
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
   108
	| relpipe-out-tabular]]></m:pre>
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
   109
	
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
   110
		<p>
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
   111
			It will generate the same <code>relation_from_cli</code> table as above.
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
   112
			If we have more data (especially from external sources), we can use the <code>--records-on-stdin</code> option and pass them through the <m:a href="examples-cli-stdin">STDIN</m:a>.
fce3d6290c40 Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
   113
		</p>
185
6cd2e54d90ea examples: relpipe-in-cli
František Kučera <franta-hg@frantovo.cz>
parents: 184
diff changeset
   114
		
87
25dec6931f18 Lepší odsazení, tabulátory.
František Kučera <franta-hg@frantovo.cz>
parents: 23
diff changeset
   115
	</text>
4
1bb39595a51c genrování hlavní nabídky #1
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
   116
1
a05c6f3cbc3e základ, první verze
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   117
</stránka>