OK: I’ve got a preliminary design that might be livable.
theLink (predicate).facet
theLink (target,predicate).facet
Predicate is any boolean expression. When evaluated, the current link is bound to the link being tested. For example:
theLink(destination==“/data/example”).comment
Returns the link comment for the link from this note to /data/example. If no such link exists, the expression returns the empty string. If several links exist, the expression returns the result for one of those links.
Facet is one of: id, source, destination, linkType, comment, color, and so forth. The facet “id” is the number of the link in the list of outbound links of its source.
Reading properties of links in this way should be moderately straightforward.
$MyString=theLink(source==this).comment
Writing properties of links in this way will be a moderately-sized bear, but can be done.
Either way, performance in large documents might be a problem since we might need to examine every link. For example:
Agent Name: Notes With Links Needing Further Contemplation
Query: theLink(comment.contains(“Fix Me”)).source==$Path
That agent needs to scan every link in the document and every note in the document, and it performs a regular expression match on each link comment and a string match for each note. My sense is that this will be fine for most documents but it might not be great in documents with many thousands of notes and numerous links. And those might be the very documents for which the feature might be useful.
Better ideas welcome!