Derivation
narrative-texts-as-trimmed-lines
The current version of each note, document or report with a narrative text gives its text as trimmed lines: each run of spaces, tabs and carriage returns in a line one space, each line trimmed, and blank lines dropped. The matcher's note rules compare these, so the text is worked out once per version and not again in every comparison, bound or not. No other kind's text is: the matcher never reads it, and a lab result's would be worked out for every version.
The query
PREFIX cascade: <https://ns.cascadeprotocol.org/cascade#>
PREFIX pav: <http://purl.org/pav/>
CONSTRUCT { ?version cascade:narrativeTextAsTrimmedLines ?lines }
WHERE {
VALUES ?kind { "Report" "Note or document" }
?record cascade:recordKind ?kind ; pav:hasCurrentVersion ?version .
?version cascade:narrativeText ?written .
BIND (REPLACE(REPLACE(REPLACE(STR(?written), "[ \t\r]+", " "), " ?\n[ \n]*", "\n"), "^[ \n]+|[ \n]+$", "") AS ?lines)
}
Terms it reads
cascade:narrativeText · cascade:narrativeTextAsTrimmedLines · cascade:recordKind · pav:hasCurrentVersion
Rules and decision notes that name it
No rule or decision note writes its path.
queries/derivations/narrative-texts-as-trimmed-lines.rq on GitHub ↗