relpipe-data/examples-hello-world.xml
branchv_0
changeset 317 fce3d6290c40
parent 244 d4f401b5f90c
--- a/relpipe-data/examples-hello-world.xml	Fri Sep 25 14:38:24 2020 +0200
+++ b/relpipe-data/examples-hello-world.xml	Thu Oct 22 01:51:32 2020 +0200
@@ -12,25 +12,27 @@
 			Let's start with an obligatory Hello World example.
 		</p>
 		
-		<m:pre jazyk="bash"><![CDATA[relpipe-in-cli generate "relation_from_cli" 3 \
-	"a" "integer" \
-	"b" "string" \
-	"c" "boolean" \
-	"1" "Hello" "true" \
-	"2" "World!" "false"]]></m:pre>
+		<m:pre jazyk="bash"><![CDATA[relpipe-in-cli \
+		--relation "relation_from_cli" \
+			--attribute "a" "integer" \
+			--attribute "b" "string" \
+			--attribute "c" "boolean" \
+			--record "1" "Hello" "true" \
+			--record "2" "World!" "false"]]></m:pre>
 	
 		<p>
 			This command generates relational data.
 			In order to see them, we need to convert them to some other format.
-			For now, we will use the "tabular" format and pipe relational data to the <code>relpipe-out-tabular</code>.
+			For now, we will use the „tabular“ format and pipe relational data to the <code>relpipe-out-tabular</code>.
 		</p>
 		
-		<m:pre jazyk="bash"><![CDATA[relpipe-in-cli generate "relation_from_cli" 3 \
-		"a" "integer" \
-		"b" "string" \
-		"c" "boolean" \
-		"1" "Hello" "true" \
-		"2" "World!" "false" \
+		<m:pre jazyk="bash"><![CDATA[relpipe-in-cli \
+		--relation "relation_from_cli" \
+			--attribute "a" "integer" \
+			--attribute "b" "string" \
+			--attribute "c" "boolean" \
+			--record "1" "Hello" "true" \
+			--record "2" "World!" "false" \
 	| relpipe-out-tabular]]></m:pre>
 	
 		<p>Output:</p>
@@ -46,8 +48,8 @@
 ]]></pre>
 
 		<p>
-			The syntax is simple as we see above. We specify the name of the relation, number of attributes,
-			and then their definitions (names and types),
+			The syntax is simple as we see above. We specify the name of the relation
+			and the names and types of attributes
 			followed by the data.
 		</p>
 
@@ -55,8 +57,8 @@
 			A single stream may contain multiple relations:
 		</p>		
 		
-		<m:pre jazyk="bash"><![CDATA[(relpipe-in-cli generate a 1 x string hello; \
- relpipe-in-cli generate b 1 y string world) \
+		<m:pre jazyk="bash"><![CDATA[(relpipe-in-cli --relation "a" --attribute "x" string --record "hello"; \
+ relpipe-in-cli --relation "b" --attribute "y" string --record "world") \
 	| relpipe-out-tabular]]></m:pre>
 			
 		<p>
@@ -77,6 +79,38 @@
  │ world      │
  ╰────────────╯
 Record count: 1]]></pre>
+
+		<p>
+			In the example above, we call <code>relpipe-in-cli</code> twice and let the shell combine their outputs.
+			This approach is useful when we want to combine relational data from various sources: different <code>relpipe-in-*</code> tools, files etc.
+			But when we work with <code>relpipe-in-cli</code> only, we can ask it to create several relations during one run:
+		</p>
+		
+		<m:pre jazyk="bash"><![CDATA[relpipe-in-cli \
+		--relation "a" --attribute "x" string --record "hello" \
+		--relation "b" --attribute "y" string --record "world" \
+	| relpipe-out-tabular]]></m:pre>
+	
+		<p>
+			The result will be the same.
+			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.
+			Obviously this option can be used only once for the last relation.
+		</p>
+		
+		<m:pre jazyk="bash"><![CDATA[relpipe-in-cli \
+		--relation "relation_from_cli" \
+			--attribute "a" "integer" \
+			--attribute "b" "string" \
+			--attribute "c" "boolean" \
+			--records \
+				"1" "Hello" "true" \
+				"2" "World!" "false" \
+	| relpipe-out-tabular]]></m:pre>
+	
+		<p>
+			It will generate the same <code>relation_from_cli</code> table as above.
+			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>.
+		</p>
 		
 	</text>