another pretty print table example
Recall some of the data from the other day. Well, let's pretty print some of that.
-- load up the data:
sa: load foaf-example-in-sw.sw
-- first, we need a list of objects of interest:
sa: |list> => |Dan> + |Libby> + |Craig> + |Liz> + |Kathleen> + |Damian> + |Martin> + |organisation: ILRT> + |organisation: Netgates>
-- now show the table:
sa: table[name,where-live,lives-with,email,works-for,website] "" |list>
+------------------------+---------------------------+--------------+----------------------------------+------------------------+---------------------------------+
| name | where-live | lives-with | email | works-for | website |
+------------------------+---------------------------+--------------+----------------------------------+------------------------+---------------------------------+
| Dan | UK: Bristol: Zetland road | Libby, Craig | email: danbri@w3.org | organisation: ILRT | |
| Libby | | | email: libby.miller@bris.ac.uk | organisation: ILRT | |
| Craig | | | email: craig@netgates.co.uk | organisation: Netgates | |
| Liz | UK: Bristol | Kathleen | | organisation: Netgates | |
| Kathleen | | | | organisation: Netgates | |
| Damian | UK: London | | | | |
| Martin | | | email: m.l.poulter@bristol.ac.uk | | |
| organisation: ILRT | | | | | url: http://ilrt.org/ |
| organisation: Netgates | | | | | url: http://www.netgates.co.uk/ |
+------------------------+---------------------------+--------------+----------------------------------+------------------------+---------------------------------+
-- another example:
sa: |people list> => |Dan> + |Libby> + |Craig> + |Liz> + |Kathleen> + |Damian> + |Martin>
sa: table[name,wife,where-live,lives-with,knows-quite-well] "" |people list>
+----------+------+---------------------------+--------------+---------------------------+
| name | wife | where-live | lives-with | knows-quite-well |
+----------+------+---------------------------+--------------+---------------------------+
| Dan | | UK: Bristol: Zetland road | Libby, Craig | |
| Libby | | | | |
| Craig | Liz | | | |
| Liz | | UK: Bristol | Kathleen | |
| Kathleen | | | | |
| Damian | | UK: London | | |
| Martin | | | | Craig, Damian, Dan, Libby |
+----------+------+---------------------------+--------------+---------------------------+
And I guess that is about it for this example. Though I guess we could again make the observation that even if we have no data on an operator applied to a ket, the code handles it gracefully.
Home
previous: pretty print some data about australian cities
next: sorting in the bko scheme
updated: 19/12/2016
by Garry Morrison
email: garry -at- semantic-db.org