#  n3
#
#  Categorized stuff
#
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix s: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
@prefix string: <http://www.w3.org/2000/10/swap/string#>.
@prefix math: <http://www.w3.org/2000/10/swap/math#>.
@prefix q:  <http://www.w3.org/2000/10/swap/pim/qif#>.

@prefix os: <http://www.w3.org/2000/10/swap/os#>.
@prefix tax:  <http://www.w3.org/2000/10/swap/pim/tax.n3#>.

#
@prefix : <#>.
@prefix foo: <#>.

this log:forAll :c, :d, :k, :l, :p, :s, :t, :x, :y, :z.

# Select subclasses of TaxCategories.
#  Must be at least one entry, and must have a label

{ [] a :c. :c a q:Cat; s:label []; s:subClassOf :t.
  :t a tax:Category;  log:notEqualTo tax:Null, tax:Unclassified
} log:implies { :c a :toBeDisplayed }.
 


"00" log:outputString
"""<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>Tax-related transactions by category</title>
  <link type="text/css" rel="stylesheet" href="report.css" />
</head>

<body>
<h1>Tax-related</h1>
""".


{   :y a :toBeDisplayed; s:label :l.
    ( :l "0000") string:concatenation :k.
    ( "<h2>" :l """</h2><table>
 <tbody>
  <tr><th>Date</th>
   <th>Details ("payee")</th>
   <th>Amount</th></tr>""" ) string:concatenation :s
    } log:implies {
    :l log:outputString :s
}.

# Each line:

{  
    [] a :y; q:payee :p; q:amount :x; q:date :d.
    :y a :toBeDisplayed; s:label :l.
    ( :l :d ) string:concatenation :k.
    (  "<tr><td class='date'>" :d
#       "</td><td class='cat'>" :l
       "</td><td class='payee'>" :p
       "</td><td class='amount'>" :x "</td></tr>\n") string:concatenation :s
} log:implies {
   :k log:outputString :s
}.

# end section:

{   :y a :toBeDisplayed; s:label :l.
    ( :l "9999") string:concatenation :k.
} log:implies {
    :l log:outputString "</table>\n"
}.




"zz" log:outputString """</body>
</html>
""".

#ends

