Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
http://www.w3.org/2005/10/Process-20051014/process.html#three-month-rule has "Each Working Group MUST publish a new draft of at least one of its active technical reports on the W3C technical reports index at least once every three months." The attached query is an attempt to encode to express this in SPARQL. Originally http://lists.w3.org/Archiv…
#
# For the groups that currently have an active technical report,
# return the date on which the group published their last report
#
# arq --data=http://www.w3.org/2000/04/mem-news/public-groups.rdf
# --data=http://www.w3.org/2002/01/tr-automation/tr.rdf
# --query=http://lists.w3.org/Archive/Public/www-archive/...
#
# This is not exactly right, it should return the maximum of the
# dates on which the group published the latest update to any of
# the their technical reports that were active three months ago.
#
# As a consequence, this will report the wrong date e.g. if the
# group had reports a,b active three months ago, and published
# no updates to them, but published a new report c; in this case
# the date of c will be reported, not max(a,b). Actually, I am
# not sure what the Process document requires here, and if a new
# technical report does not meet the updating requirement, how
# to encode that in the query. (I'd have thought it's possible,
# but any attempts of doing that result in ARQ returning garbage)
#
# Likewise, if a group had a,b,c active three months ago, and
# published all three of them as RECs, the result would not en-
# code that in the result as the group does not have active
# technical reports at the moment the query is run.
#
# ARQ-cvs currently does not support fn:current-date() and other
# functions that would be needed to encode the "three months",
# so the query just gives all active groups and dates.
#
PREFIX k: <http://opencyc.sourceforge.net/daml/cyc.daml#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX org: <http://www.w3.org/2001/04/roadmap/org#>
PREFIX mat: <http://www.w3.org/2002/05/matrix/vocab#>
PREFIX doc: <http://www.w3.org/2000/10/swap/pim/doc#>
PREFIX rec: <http://www.w3.org/2001/02pd/rec54#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX con: <http://www.w3.org/2000/10/swap/pim/contact#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX foa: <http://xmlns.com/foaf/0.1/>
SELECT DISTINCT $name $date
WHERE {
{
{ $document a rec:WD } UNION
{ $document a rec:CR } UNION
{ $document a rec:PR } UNION
{ $document a rec:PER } UNION
{ $document a rec:REC } UNION
{ $document a rec:NOTE } UNION
{ $document a rec:LastCall }
}
$document org:deliveredBy $x.
$x con:homePage $wg.
$document dc:date $date.
OPTIONAL {
{
{ $document2 a rec:WD } UNION
{ $document2 a rec:CR } UNION
{ $document2 a rec:PR } UNION
{ $document2 a rec:PER } UNION
# A PR might have become a REC, or a draft
# might have become a Working Group Note
{ $document2 a rec:REC } UNION
{ $document2 a rec:NOTE } UNION
{ $document2 a rec:LastCall }
}
$document2 dc:date $date2.
$document2 org:deliveredBy $x2.
$x2 con:homePage $wg.
FILTER(xsd:date($date) < xsd:date($date2))
}.
FILTER(!BOUND($document2))
$foo con:homePage $wg.
$foo org:name $name.
$foo k:startingDate $sDate.
# ignore expired groups; this only works because the
# data does not include startingDates for groups that
# do not currently exist; endingDate cannot be used
# as there are active expired groups...
FILTER(BOUND($sDate))
}
ORDER BY xsd:date($date) $wg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment