# $Id: lc-status-report-rules.n3,v 1.6 2004/10/14 02:48:42 connolly Exp $

@prefix s: <http://www.w3.org/2000/01/rdf-schema#> .

@prefix log: <http://www.w3.org/2000/10/swap/log#>.
@prefix str: <http://www.w3.org/2000/10/swap/string#>.

@prefix m:   <http://www.w3.org/2000/10/swap/pim/email#> .

@prefix lcr: <http://www.w3.org/2001/tag/2004lc/lc-comment-rules#>.
@prefix    : <http://www.w3.org/2001/tag/2004lc/lc-status-report-rules#>.

{  <lc-threads.n3> log:semantics ?KB } => { ?KB a :IssueKB }.


@forAll :OK, :CLOSED, :M, :R, :P,
	:WHAT, :WHEN, :WHEN2, :WHO, :FROMBOX,
	:TOCC.

# assign output keys to closed, open threads

"4.0" log:outputString """
<div><h2 id="closedThreads">Closed Threads</h2>
<ol>
""".

"4.9" log:outputString """</ol></div>
""".

{
 :TOCC s:subPropertyOf :toOrCc.
 [] a :IssueKB;
  log:includes {
    :M m:date_iso :WHEN;
      :TOCC [ m:mbox <mailto:public-webarch-comments@w3.org> ];
      lcr:threadRoot :M;
      lcr:threadTail [];
  }.

  ("4.1.closedByDate." :WHEN) str:concatenation ?KEY.
}
  => { :M :reportKey ?KEY }.


"3.0" log:outputString """
<div><h2 id="openThreads">Open Threads</h2>
<ol>
""".
"3.9" log:outputString """</ol></div>
""".

{
 :TOCC s:subPropertyOf :toOrCc.
 [] a :IssueKB;
  log:includes {
    :M m:date_iso :WHEN;
      :TOCC [ m:mbox <mailto:public-webarch-comments@w3.org> ];
      lcr:threadRoot :M
  };
  log:notIncludes { :M lcr:threadTail [] }.

  ("3.1.openByDate." :WHEN) str:concatenation ?KEY.
}
  => { :M :reportKey ?KEY }.



# make ordered lists of the thread roots

m:to s:subPropertyOf :toOrCc.
m:cc s:subPropertyOf :toOrCc.

{
 :TOCC s:subPropertyOf :toOrCc.
 [] a :IssueKB;
  log:includes {
    :M m:subject :WHAT;
      :TOCC [ m:mbox <mailto:public-webarch-comments@w3.org> ];
      lcr:threadRoot :M
  }.

  :M :reportKey ?KEY.
  ("<strong>%s</strong>\n" :WHAT) str:format ?MARKUP.

  (?KEY ".1A") str:concatenation ?KEY1A.
  (?KEY ".1B") str:concatenation ?KEY1B.
  (?KEY ".1C") str:concatenation ?KEY1C.
  (?KEY ".9") str:concatenation ?KEY9.
}
  => {
 ?KEY1A log:outputString "<li>".
 ?KEY1B log:outputString ?MARKUP.
 ?KEY1C log:outputString " <ul>\n".
 ?KEY9 log:outputString " </ul>\n</li>\n".
 }.



# note actions from telcons, e.g. 13 Sep


@prefix t13Sep: <http://www.w3.org/2001/tag/2004/telcon-13Sep#>.

t13Sep:minute :source <telcon-13Sep.n3>.
t13Sep:action :source <telcon-13Sep.n3>.
t13Sep:minute :reportLabel "minute"; :timeContext "2004-09-13T19:00:00Z".
t13Sep:action :reportLabel "ACTION"; :timeContext "2004-09-13T19:00:00Z".

@prefix t20Sep: <http://www.w3.org/2001/tag/2004/tel-20Sep#>.

t20Sep:minute :source <tel-20Sep.n3>.
t20Sep:action :source <tel-20Sep.n3>.
t20Sep:minute :reportLabel "minute"; :timeContext "2004-09-20T19:00:00Z".
t20Sep:action :reportLabel "ACTION"; :timeContext "2004-09-20T19:00:00Z".

{
 :P :reportLabel ?L; :timeContext :WHEN; :source ?RECORD.

 :M :reportKey ?KEY.

  ?RECORD.log:semantics log:includes {
    :M :P :WHAT
  }.

  ("<li>" :WHEN " " ?L ": <pre>" :WHAT "</pre></li>") str:concatenation ?HTML.
  (?KEY ".2." :WHEN) str:concatenation ?KEY15.

}
 => { ?KEY15 log:outputString ?HTML }.




# within those items, link to the messages in the thread
{
 :TOCC s:subPropertyOf :toOrCc.
 [] a :IssueKB;
  log:includes {
    :M
      m:date_iso :WHEN; m:date_iso :WHEN2; #@@was received_iso; why?
      m:from [ m:mbox :FROMBOX ];
      :TOCC [ m:mbox <mailto:public-webarch-comments@w3.org> ];
      lcr:threadRoot :R
  }.

  :R :reportKey ?KEY.

  ?ARCV log:uri ("http://www.w3.org/mid/"
    (:M.log:uri "mid:(.*)").str:scrape).str:concatenation.

  ("  <li><a href='%s'>%s from %s</a></li>\n"
    ?ARCV.log:uri :WHEN
    (:FROMBOX.log:uri "mailto:([^@]+)").str:scrape ) str:format ?MARKUP.
  (?KEY ".2." :WHEN2) str:concatenation ?KEY2.
}
  => { ?KEY2 log:outputString ?MARKUP }.



"0.head" log:outputString """
<html xmlns='http://www.w3.org/1999/xhtml'>
<head><title>WebArch Last Call Comment Status</title></head>
<body>
<div class='nav'><a href="http://www.w3.org/2001/tag/">TAG</a></div>
<h1>Last Call Comment Status</h1>
<address>$Revision: 1.6 $ of $Date: 2004/10/14 02:48:42 $ by $Author: connolly $ generated from <a href="http://lists.w3.org/Archives/Public/public-webarch-comments/">public-webarch-comments archive</a> and various other records; see <a href='Makefile'>Makefile</a> for details</address>

<p>contents:
<a href="#openThreads">open threads</a>,
<a href="#closedThreads">closed threads</a>.</p>

""".

"9.foot" log:outputString """
</body>
</html>
""".


#####
# $Log: lc-status-report-rules.n3,v $
# Revision 1.6  2004/10/14 02:48:42  connolly
# exploit replyTo as well as references; handle space-mangled subjects; use rsync and MASE data
#
# Revision 1.5  2004/09/28 17:18:44  connolly
# open threads first
#
# Revision 1.4  2004/09/27 15:53:59  connolly
# a few more minutes noting RF action; date in report
#
# Revision 1.3  2004/09/22 21:32:43  connolly
# updated per 20Sep telcon
#
# Revision 1.2  2004/09/13 21:51:55  connolly
# integrating telcon minutes
#
# Revision 1.1  2004/09/09 14:52:30  connolly
# got a report working
#
# Revision 1.8  2003/07/02 18:22:53  connolly
# tweaks
#
# Revision 1.7  2003/06/21 16:21:42  connolly
# tweak report: exact time of telcon, pre for minutes
#
# Revision 1.6  2003/06/21 03:22:03  connolly
# sorted by date; handled clodes typos; used .rdf rather than .n3 when possible
#
# Revision 1.5  2003/06/18 16:34:12  connolly
# added revision info to report
#
# Revision 1.4  2003/06/18 16:22:18  connolly
# mixed in 29May comments from JimH and 12Jun telcon records
#
# Revision 1.3  2003/06/18 15:33:19  connolly
# open and closed threads separated
#

