relpipe-data/examples.xml
branchv_0
changeset 238 6383a4457833
parent 237 2adb6465eadd
child 240 d81c623de788
equal deleted inserted replaced
237:2adb6465eadd 238:6383a4457833
   801 		</p>
   801 		</p>
   802 		
   802 		
   803 		<p>
   803 		<p>
   804 			Tip: if we are looking for files in the current directory and want omit the „.“ we just call: <code>find -printf '%P\0'</code> instead of <code>find -print0</code>.
   804 			Tip: if we are looking for files in the current directory and want omit the „.“ we just call: <code>find -printf '%P\0'</code> instead of <code>find -print0</code>.
   805 		</p>
   805 		</p>
       
   806 		
       
   807 		
       
   808 		<h2>Using relpipe-in-filesystem to read extended attributes</h2>
       
   809 		
       
   810 		<p>
       
   811 			Extended attributes (xattr) are additional <em>key=value</em> pairs that can be attached to our files.
       
   812 			They are not stored inside the files, but on the filesystem.
       
   813 			Thus they are independent of particular file format (which might not support metadata)
       
   814 			and we can use them e.g. for tagging, cataloguing or adding some notes to our files.
       
   815 			Some tools like GNU Wget use extended attributes to store metadata like the original URL from which the file was downloaded.
       
   816 		</p>
       
   817 		
       
   818 		<m:pre jazyk="bash"><![CDATA[wget --recursive --level=1 https://relational-pipes.globalcode.info/
       
   819 find -type f -printf '%P\0' \
       
   820 	| relpipe-in-filesystem --file path --file size --xattr user.xdg.origin.url  \
       
   821 	| relpipe-out-tabular
       
   822 ]]></m:pre>
       
   823 
       
   824 		<p>And now we know, where the files on our disk come from:</p>
       
   825 
       
   826 		<pre><![CDATA[filesystem:
       
   827  ╭───────────────────────────┬────────────────┬────────────────────────────────────────────────────────────────────╮
       
   828  │ path             (string) │ size (integer) │ user.xdg.origin.url                                       (string) │
       
   829  ├───────────────────────────┼────────────────┼────────────────────────────────────────────────────────────────────┤
       
   830  │ index.html                │          12159 │ https://relational-pipes.globalcode.info/v_0/                      │
       
   831  │ v_0/atom.xml              │           4613 │ https://relational-pipes.globalcode.info/v_0/atom.xml              │
       
   832  │ v_0/rss.xml               │           4926 │ https://relational-pipes.globalcode.info/v_0/rss.xml               │
       
   833  │ v_0/js/skript.js          │           2126 │ https://relational-pipes.globalcode.info/v_0/js/skript.js          │
       
   834  │ v_0/css/styl.css          │           2988 │ https://relational-pipes.globalcode.info/v_0/css/styl.css          │
       
   835  │ v_0/css/relpipe.css       │           1095 │ https://relational-pipes.globalcode.info/v_0/css/relpipe.css       │
       
   836  │ v_0/css/syntaxe.css       │           3584 │ https://relational-pipes.globalcode.info/v_0/css/syntaxe.css       │
       
   837  │ v_0/index.xhtml           │          12159 │ https://relational-pipes.globalcode.info/v_0/index.xhtml           │
       
   838  │ v_0/grafika/logo.png      │           3298 │ https://relational-pipes.globalcode.info/v_0/grafika/logo.png      │
       
   839  │ v_0/principles.xhtml      │          17171 │ https://relational-pipes.globalcode.info/v_0/principles.xhtml      │
       
   840  │ v_0/roadmap.xhtml         │          11097 │ https://relational-pipes.globalcode.info/v_0/roadmap.xhtml         │
       
   841  │ v_0/faq.xhtml             │          11080 │ https://relational-pipes.globalcode.info/v_0/faq.xhtml             │
       
   842  │ v_0/specification.xhtml   │          12983 │ https://relational-pipes.globalcode.info/v_0/specification.xhtml   │
       
   843  │ v_0/implementation.xhtml  │          10810 │ https://relational-pipes.globalcode.info/v_0/implementation.xhtml  │
       
   844  │ v_0/examples.xhtml        │          76958 │ https://relational-pipes.globalcode.info/v_0/examples.xhtml        │
       
   845  │ v_0/license.xhtml         │          65580 │ https://relational-pipes.globalcode.info/v_0/license.xhtml         │
       
   846  │ v_0/screenshots.xhtml     │           5708 │ https://relational-pipes.globalcode.info/v_0/screenshots.xhtml     │
       
   847  │ v_0/download.xhtml        │           5204 │ https://relational-pipes.globalcode.info/v_0/download.xhtml        │
       
   848  │ v_0/contact.xhtml         │           4940 │ https://relational-pipes.globalcode.info/v_0/contact.xhtml         │
       
   849  │ v_0/classic-example.xhtml │           9539 │ https://relational-pipes.globalcode.info/v_0/classic-example.xhtml │
       
   850  ╰───────────────────────────┴────────────────┴────────────────────────────────────────────────────────────────────╯
       
   851 Record count: 20]]></pre>
       
   852 
       
   853 		<p>
       
   854 			If we like the BeOS/Haiku style, we can create empty files with some attributes attached and use our filesystem as a simple database
       
   855 			and query it using relational tools.
       
   856 			It will lack indexing, but for basic scenarios like <em>address book</em> it will be fast enough
       
   857 			and we can feel a bit of BeOS/Haiku atmosphere in our contemporary GNU/Linux systems.
       
   858 			But be careful with that because some editors delete and recreate files while saving them, which destroys the xattrs.
       
   859 			Tools like <code>rsync</code> or <code>tar</code> with <code>--xattrs</code> option will backup our attributes securely.
       
   860 		</p>
   806 
   861 
   807 		
   862 		
   808 	</text>
   863 	</text>
   809 
   864 
   810 </stránka>
   865 </stránka>