Skip to content
Alpha: see what works today →
Menu

Named question about record

What needs review

Records whose current revision the source's change time did not decide, for a person to look at: the confession that current is derived and never stored. A record is listed once for each other candidate it holds at another version, beside its current revision (?revision, the state shown) and that candidate (?otherRevision, a state not shown): the clocks fell to the observation time, and the shown one was "observed later", or to the least IRI, with "no basis", which is also the reason where a ClockDiscounted leaves either carrying no observation time. A candidate a later live pull of the same source follows in ancestry is not listed: ancestry orders the two. A record is also listed for each Before of its revisions that a cycle of Befores cancels, with the two revisions it orders. Either is fixed by one Before. A finding that a source reported older states is listed as one line, ?finding, saying how many of the records that went back are not yet answered and the last date the source reported later states, expanding to each record, with its current revision and the revision holding the older state, until a person files a Before between that revision and one the source contradicted, or an acknowledgement of that kind naming the record, the document of the older state and the document of every state of the record the finding says it contradicts, each of which answers that record (two people's acknowledgements each naming some of those documents do not add up). A finding that a writer's clock was behind is listed with each revision it names, until a person files an acknowledgement of that kind naming the act that generated the revision, or discounts the act's clock.

The query

PREFIX cascade: <https://ns.cascadeprotocol.org/cascade#>
PREFIX oa: <http://www.w3.org/ns/oa#>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT DISTINCT ?record ?recordLabel ?needs ?finding ?revision ?revisionLabel ?otherRevision ?otherRevisionLabel
# bound: ?record
WHERE {
  { { SELECT ?record ?otherRevision
      WHERE {
        ?record cascade:currentRevisionCandidate ?otherRevision .
        FILTER NOT EXISTS { ?later cascade:laterInAncestryThan ?otherRevision }
      } }
    ?record cascade:currentRevision ?revision .
    ?revision cascade:version ?version ; cascade:observedAsOf ?seen .
    ?otherRevision cascade:version ?otherVersion ; cascade:observedAsOf ?otherSeen .
    FILTER (?otherVersion != ?version)
    OPTIONAL { ?revision cascade:observationTimeDiscountedBy ?discount }
    OPTIONAL { ?otherRevision cascade:observationTimeDiscountedBy ?otherDiscount }
    BIND (IF(?seen > ?otherSeen && !BOUND(?discount) && !BOUND(?otherDiscount), "observed later", "no basis") AS ?needs)
    OPTIONAL { ?record rdfs:label ?recordLabel }
    OPTIONAL { ?revision rdfs:label ?revisionLabel }
    OPTIONAL { ?otherRevision rdfs:label ?otherRevisionLabel } }
  UNION
  { ?revision cascade:judgedBeforeRevisionOfSameRecord ?otherRevision ; cascade:revisionOf ?record .
    FILTER EXISTS { ?otherRevision cascade:judgedBeforeRevisionOfSameRecord+ ?revision }
    FILTER (STR(?revision) < STR(?otherRevision) || !EXISTS { ?otherRevision cascade:judgedBeforeRevisionOfSameRecord ?revision })
    BIND ("Befores that form a cycle" AS ?needs)
    OPTIONAL { ?record rdfs:label ?recordLabel }
    OPTIONAL { ?revision rdfs:label ?revisionLabel }
    OPTIONAL { ?otherRevision rdfs:label ?otherRevisionLabel } }
  UNION
  { { { SELECT ?finding (COUNT(?older) AS ?wentBack)
        WHERE {
          ?finding oa:hasBody cascade:SourceReportedOlderStates ; oa:hasTarget ?older .
          FILTER NOT EXISTS {
            ?older cascade:judgedBefore|^cascade:judgedBefore ?answered .
            ?finding cascade:contradictedEarlierRevision ?answered .
          }
          MINUS {
            { SELECT ?finding ?older
              WHERE {
                { SELECT ?finding ?older ?wentBack ?olderDocument
                  WHERE {
                    ?finding oa:hasBody cascade:SourceReportedOlderStates ; oa:hasTarget ?older .
                    ?older cascade:revisionOf ?wentBack ; prov:wasDerivedFrom ?olderDocument
                  } }
                { SELECT ?finding ?wentBack ?contradictedDocument
                  WHERE {
                    ?finding oa:hasBody cascade:SourceReportedOlderStates ; cascade:contradictedEarlierRevision ?contradicted .
                    ?contradicted cascade:revisionOf ?wentBack ; prov:wasDerivedFrom ?contradictedDocument
                  } }
                ?acknowledgement cascade:countsUnderLens true ; cascade:verdict cascade:Acknowledged ;
                                 cascade:answersWarningOfKind cascade:SourceReportedOlderStates ;
                                 prov:hadMember ?wentBack , ?olderDocument .
                OPTIONAL { ?acknowledgement prov:hadMember ?contradictedDocument . BIND (?contradictedDocument AS ?named) }
              }
              GROUP BY ?finding ?older ?acknowledgement
              HAVING (COUNT(DISTINCT ?named) = COUNT(DISTINCT ?contradictedDocument)) }
          }
        }
        GROUP BY ?finding }
      FILTER (BOUND(?finding)) }
    { { SELECT ?finding (MAX(?reported) AS ?lastReported)
        WHERE {
          ?finding oa:hasBody cascade:SourceReportedOlderStates ; cascade:contradictedEarlierRevision ?earlier .
          ?earlier cascade:observedAsOf ?reported .
        }
        GROUP BY ?finding }
      FILTER (BOUND(?finding)) }
    ?finding oa:hasTarget ?otherRevision .
    ?otherRevision cascade:revisionOf ?record .
    ?record cascade:currentRevision ?revision .
    FILTER NOT EXISTS {
      ?otherRevision cascade:judgedBefore|^cascade:judgedBefore ?contradicted .
      ?finding cascade:contradictedEarlierRevision ?contradicted .
    }
    MINUS {
      { SELECT ?finding ?otherRevision
        WHERE {
          { SELECT ?finding ?otherRevision ?wentBack ?olderDocument
            WHERE {
              ?finding oa:hasBody cascade:SourceReportedOlderStates ; oa:hasTarget ?otherRevision .
              ?otherRevision cascade:revisionOf ?wentBack ; prov:wasDerivedFrom ?olderDocument
            } }
          { SELECT ?finding ?wentBack ?contradictedDocument
            WHERE {
              ?finding oa:hasBody cascade:SourceReportedOlderStates ; cascade:contradictedEarlierRevision ?contradicted .
              ?contradicted cascade:revisionOf ?wentBack ; prov:wasDerivedFrom ?contradictedDocument
            } }
          ?acknowledgement cascade:countsUnderLens true ; cascade:verdict cascade:Acknowledged ;
                           cascade:answersWarningOfKind cascade:SourceReportedOlderStates ;
                           prov:hadMember ?wentBack , ?olderDocument .
          OPTIONAL { ?acknowledgement prov:hadMember ?contradictedDocument . BIND (?contradictedDocument AS ?named) }
        }
        GROUP BY ?finding ?otherRevision ?acknowledgement
        HAVING (COUNT(DISTINCT ?named) = COUNT(DISTINCT ?contradictedDocument)) }
    }
    BIND (CONCAT("this source reports ", STR(?wentBack), IF(?wentBack = 1, " record", " records"),
                 " at states older than it reported on ", SUBSTR(STR(?lastReported), 1, 10)) AS ?needs)
    OPTIONAL { ?record rdfs:label ?recordLabel }
    OPTIONAL { ?revision rdfs:label ?revisionLabel }
    OPTIONAL { ?otherRevision rdfs:label ?otherRevisionLabel } }
  UNION
  { ?finding oa:hasBody cascade:ClockBehind ; oa:hasTarget ?revision ; cascade:writerClockBehindByAtLeastDays ?days .
    ?revision cascade:revisionOf ?record ; prov:wasGeneratedBy ?act .
    MINUS { ?acknowledgement cascade:countsUnderLens true ; cascade:verdict cascade:Acknowledged ;
                             cascade:answersWarningOfKind cascade:ClockBehind ; prov:hadMember ?act }
    FILTER NOT EXISTS { ?revision cascade:observationTimeDiscountedBy ?discount }
    BIND (CONCAT("this writer's clock was at least ", STR(?days), IF(?days = 1, " day", " days"), " behind") AS ?needs)
    OPTIONAL { ?record rdfs:label ?recordLabel }
    OPTIONAL { ?revision rdfs:label ?revisionLabel } }
}
ORDER BY ?needs ?finding ?recordLabel ?record ?revision ?otherRevision

Terms it reads

cascade:Acknowledged · cascade:ClockBehind · cascade:SourceReportedOlderStates · cascade:answersWarningOfKind · cascade:contradictedEarlierRevision · cascade:countsUnderLens · cascade:currentRevision · cascade:currentRevisionCandidate · cascade:judgedBefore · cascade:judgedBeforeRevisionOfSameRecord · cascade:laterInAncestryThan · cascade:observationTimeDiscountedBy · cascade:observedAsOf · cascade:revisionOf · cascade:verdict · cascade:version · cascade:writerClockBehindByAtLeastDays · oa:hasBody · oa:hasTarget · prov:hadMember · prov:wasDerivedFrom · prov:wasGeneratedBy · rdfs:label

Rules and decision notes that name it

Its rows on Alex Rivera's pod

Alex Rivera's pod gives this question no rows. Open it in Alex Rivera's explorer.

queries/questions/record/What needs review.rq on GitHub ↗