Table of Contents

Class TripletsQueryProcessor

Namespace
Foundation.Data.Doublets.Cli
Assembly
Foundation.Data.Doublets.Cli.dll

Substitution queries over triplets: ((restriction) (substitution)), where every pattern has three parts, (index: type from to) or (type from to) (issue #151). The Rust counterpart is link_cli::process_triplets_query.

public static class TripletsQueryProcessor
Inheritance
TripletsQueryProcessor
Inherited Members

Remarks

  • A restriction pattern matches triplets; the patterns are a conjunction over their variables ($name), and * matches anything.
  • A substitution pattern whose index is the index of a matched triplet updates it, keeping its address; * in a part keeps that part.
  • A matched triplet no substitution pattern names is deleted, with the triplets that use it.
  • Any other substitution pattern creates a triplet: at its address, under its name, bound to its variable, or anywhere when it has no index.

So ((i: T f t)) ((i: T f t2)) moves the to-part of i, (() ((T f t))) creates, (((i: T f t)) ()) deletes and a query whose substitution repeats its restriction only reads.

Methods

MatchQuery<TLinkAddress>(ITriplets<TLinkAddress>, string, string)

The distinct values of a variable over the matches of one link of patterns, in the order found.

public static IReadOnlyList<TLinkAddress> MatchQuery<TLinkAddress>(ITriplets<TLinkAddress> triplets, string restriction, string variable) where TLinkAddress : struct, IUnsignedNumber<TLinkAddress>

Parameters

triplets ITriplets<TLinkAddress>
restriction string
variable string

Returns

IReadOnlyList<TLinkAddress>

Type Parameters

TLinkAddress

ProcessQuery<TLinkAddress>(ITriplets<TLinkAddress>, string)

Runs a substitution query and returns the changes it made, in order: creations and updates as the substitution lists them, then deletions.

public static IReadOnlyList<TripletChange<TLinkAddress>> ProcessQuery<TLinkAddress>(ITriplets<TLinkAddress> triplets, string query) where TLinkAddress : struct, IUnsignedNumber<TLinkAddress>

Parameters

triplets ITriplets<TLinkAddress>
query string

Returns

IReadOnlyList<TripletChange<TLinkAddress>>

Type Parameters

TLinkAddress