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

@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-comment-rules#>.


#
# email threading rules
# (+ closed/moved)
#
{
  ?MSG m:subject [
    str:notMatches "^\\[(close|Close|move|cosed|clodes)",
                   "^R[Ee] *:" ];
    m:date_iso [ str:notLessThan "2004-08-16" ] # 2nd last call date
	# wish the search engine could filter by date. cf
	# client/server module and other wishes
	# # From: Olivier Thereaux <ot@xxxxxxx>
	# Date: Wed, 26 Sep 2001 18:51:43 +0900
	# http://www.namazu.org/ml/namazu-devel-en/msg00034.html
	# and
	# http://www.w3.org/2002/02/mail-search-help#date
}
 => { ?MSG :threadRoot ?MSG }.

{ ?M m:references [ :threadRoot ?R ] } => { ?M :threadRoot ?R }.

# should be inReplyTo, no?
{ ?M m:replyTo [ :threadRoot ?R ] } => { ?M :threadRoot ?R }.



#
# thread closing conventions
#
{
  ?M m:subject [ str:matches "^\\[(close|Close|move|clodes|cosed)"];
     :threadRoot ?R.
}
 => { ?R :threadTail ?M }.

