# $Id: Makefile,v 1.48 2007/05/07 20:44:36 eric Exp $

MKDIR=mkdir
XSLTPROC=xsltproc
XPLANET=xplanet
PYTHON=python
PERL=perl
CURL=curl
RSYNC=rsync

W=../../..
SWAP=$(W)/2000/10/swap
CWM=$(SWAP)/cwm.py

DCAMS=$(W)/2004/04dc-ams

all: ,telcon-times.n3 unreg

sparqlDefs.n3: mathmlRules.xsl mathml-rules.xml
	$(XSLTPROC) mathmlRules.xsl mathml-rules.xml >$@

amsTravel: amsTravel-img.png


#============
XPLANETOPTS=-num_times 1 -date "20040714.120000" -label

ftf2-img.png: ftf2-arcs ftf2-marks xplanet_opts_san origin_san
	$(XPLANET) $(XPLANETOPTS) -config xplanet_opts_san -origin earth -origin_file origin_san \
		-output $@

FORMAL=rdf

ftf2-arcs: ftf2-formal.$(FORMAL) $(SWAP)/pim/itinArcs.n3
	$(PYTHON) $(CWM) ftf2-formal.$(FORMAL) $(SWAP)/pim/itinArcs.n3 --think --strings >$@

ftf2-marks: ftf2-formal.$(FORMAL) $(SWAP)/pim/itinMarks.n3
	$(PYTHON) $(CWM) ftf2-formal.$(FORMAL) $(SWAP)/pim/itinMarks.n3 --think --strings >$@

ftf2-formal.$(FORMAL): ,who.rdf groupMeeting.n3 $(SWAP)/pim/cityLookup.n3
	$(PYTHON) $(CWM) --chatty=20 ,who.rdf groupMeeting.n3 $(SWAP)/pim/cityLookup.n3 --think --data --$(FORMAL) >$@


#============
XPLANETOPTS=-num_times 1 -date "20040420.120000" -label

amsTravel-img.png: amsTravel-arcs amsTravel-marks xplanet_opts origin
	$(XPLANET) $(XPLANETOPTS) -config xplanet_opts -origin earth -origin_file origin \
		-output $@

amsTravel-arcs: amsTravel.n3 $(SWAP)/pim/itinArcs.n3
	$(PYTHON) $(CWM) amsTravel.n3 $(SWAP)/pim/itinArcs.n3 --think --strings >$@

amsTravel-marks: amsTravel.n3 $(SWAP)/pim/itinMarks.n3
	$(PYTHON) $(CWM) amsTravel.n3 $(SWAP)/pim/itinMarks.n3 --think --strings >$@

amsTravel.n3: ,who.rdf groupMeeting.n3 $(SWAP)/pim/cityLookup.n3
	$(PYTHON) $(CWM) --chatty=20 ,who.rdf groupMeeting.n3 $(SWAP)/pim/cityLookup.n3 --think --data >$@

#==========

unreg: ,dawg-mem.html ,dawg-ftf-reg.html notReg.xsl
	$(XSLTPROC) --novalid --stringparam Reg ,dawg-ftf-reg.html \
		notReg.xsl ,dawg-mem.html

,who.rdf: grokWho.xsl Overview.html
	$(XSLTPROC) --novalid --stringparam GroupHome http://www.w3.org/2001/sw/DataAccess/ -o $@ grokWho.xsl Overview.html

TELDATE=2005-03-22
TELTIME=14:30Z
PREVRECORD=http://lists.w3.org/Archives/Public/public-rdf-dawg/2004OctDec/0394.html
GRPHOME=http://www.w3.org/2001/sw/DataAccess/
,telcon-times.n3: ,who-where.n3 telconLocalTimes.n3
	$(PYTHON) $(CWM) telconLocalTimes.n3 ,who-where.n3 --think --data --with $(TELDATE)T$(TELTIME) >$@

,who-where.n3: ,who.rdf $(SWAP)/pim/cityLookup.n3
	$(PYTHON) $(CWM) ,who.rdf $(SWAP)/pim/cityLookup.n3 --think --data >$@

,agenda-convene.html: agendaAdminFmt.n3 ,agenda.rdf
	$(PYTHON) $(CWM) agendaAdminFmt.n3 ,agenda.rdf --think --strings >$@

,agenda.txt: agendaFmt.n3 ,agenda.rdf
	$(PYTHON) $(CWM) agendaFmt.n3 ,agenda.rdf --think --strings >$@

#@@RFE: incorporate ,agn7Dec.n3 agenda exceptions, ,rec2004-11-30.n3 formalized record
,agenda.rdf: ,telres.rdf agendaBuild.n3 
	$(PYTHON) $(CWM) agendaBuild.n3 ,telres.rdf --think --data --rdf --with $(TELDATE)T$(TELTIME) $(GRPHOME) $(PREVRECORD) >$@

,telres.rdf:
	$(CURL) -o $@ --basic --user $(CREDS) 'http://www.w3.org/Guide/1998/08/teleconference.rdf'

# set CREDS on the command-line ala
# make CREDS=me:mypwd ,dawg-mem.html
,dawg-mem.html:
	$(CURL) -o $@ --basic --user $(CREDS) 'http://www.w3.org/2000/09/dbwg/details?group=35463&order=org'

,dawg-ftf-reg.html:
	$(CURL) -o $@ --basic --user $(CREDS) 'http://www.w3.org/2002/09/wbs/35463/AmsterdamDAWGF2F/results'

dbview-wbs:
	echo on swada, start python dbview.py db.w3.org 3306 USER PASS swada.w3.org 9000 w3c
	echo where USER and PASS are taken from WWW/Systems/Http/Apache/config/1.3.6/dbinfo.phi
	echo then touch $@
	exit 1

##########
#
# issues list

issues-formal.rdf: issues.html grokIssues.xsl
	$(XSLTPROC) --novalid --output $@ grokIssues.xsl issues.html

#####
# ftf5 record, formalized

ftf5-actions.txt: ftf5-formal.rdf actions-txt.xsl
	$(XSLTPROC) actions-txt.xsl ftf5-formal.rdf >$@

ftf5-formal.rdf: ftf5-bos.html grokftf.xsl
	$(XSLTPROC) --novalid grokftf.xsl ftf5-bos.html >$@


###
# ftf4 record, formalized
#

ftf4-formal.rdf: ftf4.html grokftf.xsl
	$(XSLTPROC) --novalid grokftf.xsl ftf4.html >$@

,ftf4-summ.html: ftf4-formal.rdf agendaActionSummary.xsl 
	$(XSLTPROC) agendaActionSummary.xsl ftf4-formal.rdf >$@

ftf4-actions.txt: ftf4-formal.rdf actions-txt.xsl
	$(XSLTPROC) actions-txt.xsl ftf4-formal.rdf >$@

###
# ftf3 record, formalized
#

ftf3-brs-formal.rdf: ftf3-brs.html grokftf.xsl
	$(XSLTPROC) --novalid grokftf.xsl ftf3-brs.html >$@

######
#
# Last call comment tracking

W=../../..
SWAP=$(W)/2000/10/swap
CHATTY=15

lc-status-report.html: ,lc-merge.rdf fmtCommentStatus.xsl
	$(XSLTPROC) --output $@ --novalid fmtCommentStatus.xsl ,lc-merge.rdf

,lc-merge.rdf: lc-threads.rdf issues-formal.rdf
	$(PYTHON) $(SWAP)/cwm.py lc-threads.rdf issues-formal.rdf --rdf --data >$@

lc-status-report-f.n3: lc-status-report-rules.n3 lc-threads.rdf issues-formal.rdf lc-actions.n3
	$(PYTHON) $(SWAP)/cwm.py --chatty=$(CHATTY) lc-status-report-rules.n3 issues-formal.rdf lc-actions.n3 --n3 --think --data >$@


lc-status.n3: lc-threads.rdf lc-audit.n3
	$(PYTHON) $(SWAP)/cwm.py --chatty=$(CHATTY) lc-audit.n3 --think --data >$@

# let's hope we don't need mase-ref-fix.n3 
lc-threads.rdf: lc-comment-rules.n3 sparql-lc-comments.rdf  lc-thread-patches.rdf
	$(PYTHON) $(SWAP)/cwm.py --chatty=$(CHATTY) lc-comment-rules.n3  sparql-lc-comments.rdf lc-thread-patches.rdf --think --data --rdf >$@

# leave out the dependency on sparql-lc-comments
# because this step is slow, and usually the old data is enough
#lc-thread-patches.rdf: sparql-lc-comments.rdf implicit-refs.n3
lc-thread-patches.rdf: implicit-refs.n3
	$(PYTHON) $(SWAP)/cwm.py --chatty=$(CHATTY) implicit-refs.n3 --think --data --rdf  --with sparql-lc-comments.rdf >$@


all-lc-status-report.html: ,all-lc-merge.rdf fmtCommentStatus.xsl
	$(XSLTPROC) --output $@ --novalid fmtCommentStatus.xsl ,all-lc-merge.rdf

,all-lc-merge.rdf: all-lc-threads.rdf issues-formal.rdf
	$(PYTHON) $(SWAP)/cwm.py all-lc-threads.rdf issues-formal.rdf --rdf --data >$@

all-lc-threads.rdf: lc-comment-rules.n3 all-sparql-lc-comments.rdf  lc-thread-patches.rdf
	$(PYTHON) $(SWAP)/cwm.py --chatty=$(CHATTY) lc-comment-rules.n3  all-sparql-lc-comments.rdf lc-thread-patches.rdf --think --data --rdf >$@


# @@MASE/RDF bug?
#  <mbox rdf:resource="mailto:&#60;Patrick.Stickler@nokia.com&#62;"/>
#sparql-lc-comments.rdf:
#	$(PYTHON) $(SWAP)/cwm.py --base=bogus: 'http://www.w3.org/Search/Mail/Public/advanced_search?keywords=dawg&hdr-1-name=subject&hdr-1-query=&hdr-2-name=from&hdr-2-query=&hdr-3-name=message-id&hdr-3-query=&resultsperpage=2000&sortby=date&index-grp=Public__FULL&index-type=t&type-index=public-rdf-dawg-comments' --rdf \
#	| $(PERL) -pe 's/&#60;([^@]+@[^&]+)&#62;/$$1/g'>$@


LCSTART=2007-03-26
sparql-lc-comments.rdf: sparql-comments.timestamp sparql-comments-last-month $(W)/2000/04/maillog2rdf/aboutMsg.py
	PYTHONPATH=$(SWAP) $(PYTHON) $(W)/2000/04/maillog2rdf/aboutMsg.py --since $(LCSTART) \
	sparql-comment-mboxes/2007-03.mbx \
	sparql-comment-mboxes/2007-04.mbx \
	sparql-comment-mboxes/2007-05.mbx >$@

ALLLCSTART=2005-07-21
all-sparql-lc-comments.rdf: all-sparql-comments.timestamp sparql-comments-last-month $(W)/2000/04/maillog2rdf/aboutMsg.py
	PYTHONPATH=$(SWAP) $(PYTHON) $(W)/2000/04/maillog2rdf/aboutMsg.py --since $(ALLLCSTART) \
	sparql-comment-mboxes/2005-07.mbx \
	sparql-comment-mboxes/2005-08.mbx \
	sparql-comment-mboxes/2005-09.mbx \
	sparql-comment-mboxes/2005-10.mbx \
	sparql-comment-mboxes/2005-11.mbx \
	sparql-comment-mboxes/2005-12.mbx \
	sparql-comment-mboxes/2006-01.mbx \
	sparql-comment-mboxes/2006-02.mbx \
	sparql-comment-mboxes/2006-03.mbx \
	sparql-comment-mboxes/2006-04.mbx \
	sparql-comment-mboxes/2006-05.mbx \
	sparql-comment-mboxes/2006-06.mbx \
	sparql-comment-mboxes/2006-07.mbx \
	sparql-comment-mboxes/2006-08.mbx \
	sparql-comment-mboxes/2006-09.mbx \
	sparql-comment-mboxes/2006-10.mbx \
	sparql-comment-mboxes/2006-11.mbx \
	sparql-comment-mboxes/2006-12.mbx \
	sparql-comment-mboxes/2007-01.mbx \
	sparql-comment-mboxes/2007-02.mbx \
	sparql-comment-mboxes/2007-03.mbx \
	sparql-comment-mboxes/2007-04.mbx \
	sparql-comment-mboxes/2007-05.mbx >$@

sparql-comments.timestamp:
	$(CURL) -o sparql-comment-mboxes/2007-03.mbx --basic --user $(CREDS) http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/mboxes/2007-03.mbx
	$(CURL) -o sparql-comment-mboxes/2007-04.mbx --basic --user $(CREDS) http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/mboxes/2007-04.mbx
	@touch sparql-comments.timestamp

sparql-comments-last-month:
	$(MKDIR) -p sparql-comment-mboxes
	$(CURL) -o sparql-comment-mboxes/2007-05.mbx --basic --user $(CREDS) http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/mboxes/2007-05.mbx

all-sparql-comments.timestamp: sparql-comments.timestamp
	$(CURL) -o sparql-comment-mboxes/2005-07.mbx --basic --user $(CREDS) http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/mboxes/2005-07.mbx
	$(CURL) -o sparql-comment-mboxes/2005-08.mbx --basic --user $(CREDS) http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/mboxes/2005-08.mbx
	$(CURL) -o sparql-comment-mboxes/2005-09.mbx --basic --user $(CREDS) http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/mboxes/2005-09.mbx
	$(CURL) -o sparql-comment-mboxes/2005-10.mbx --basic --user $(CREDS) http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/mboxes/2005-10.mbx
	$(CURL) -o sparql-comment-mboxes/2005-11.mbx --basic --user $(CREDS) http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/mboxes/2005-11.mbx
	$(CURL) -o sparql-comment-mboxes/2005-12.mbx --basic --user $(CREDS) http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/mboxes/2005-12.mbx
	$(CURL) -o sparql-comment-mboxes/2006-01.mbx --basic --user $(CREDS) http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/mboxes/2006-01.mbx
	$(CURL) -o sparql-comment-mboxes/2006-02.mbx --basic --user $(CREDS) http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/mboxes/2006-02.mbx
	$(CURL) -o sparql-comment-mboxes/2006-03.mbx --basic --user $(CREDS) http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/mboxes/2006-03.mbx
	$(CURL) -o sparql-comment-mboxes/2006-04.mbx --basic --user $(CREDS) http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/mboxes/2006-04.mbx
	$(CURL) -o sparql-comment-mboxes/2006-05.mbx --basic --user $(CREDS) http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/mboxes/2006-05.mbx
	$(CURL) -o sparql-comment-mboxes/2006-06.mbx --basic --user $(CREDS) http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/mboxes/2006-06.mbx
	$(CURL) -o sparql-comment-mboxes/2006-07.mbx --basic --user $(CREDS) http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/mboxes/2006-07.mbx
	$(CURL) -o sparql-comment-mboxes/2006-08.mbx --basic --user $(CREDS) http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/mboxes/2006-08.mbx
	$(CURL) -o sparql-comment-mboxes/2006-09.mbx --basic --user $(CREDS) http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/mboxes/2006-09.mbx
	$(CURL) -o sparql-comment-mboxes/2006-10.mbx --basic --user $(CREDS) http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/mboxes/2006-10.mbx
	$(CURL) -o sparql-comment-mboxes/2006-11.mbx --basic --user $(CREDS) http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/mboxes/2006-11.mbx
	$(CURL) -o sparql-comment-mboxes/2006-12.mbx --basic --user $(CREDS) http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/mboxes/2006-12.mbx
	$(CURL) -o sparql-comment-mboxes/2007-01.mbx --basic --user $(CREDS) http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/mboxes/2007-01.mbx
	$(CURL) -o sparql-comment-mboxes/2007-02.mbx --basic --user $(CREDS) http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/mboxes/2007-02.mbx
	@touch all-sparql-comments.timestamp


##
# use cases doc
tidy:
	tidy -m -utf8 -q -i -wrap 78 UseCases.html
ci:
	cvs ci UseCases.html

clean:
	- rm *~

pub: tidy ci
