User:Jeblad/wb

There are two working sets, one global for cached items and one for matched items. The matched items are local for the instance. All access loading an item puts the item into the global set.

The proposal assumes a XQuery-like API.

Path and identifiers
The identifier is a property if using the form "Pnum", an item if using the form "Qnum". A path consist of a sequence of identifiers, where an initial @ signifies a property or item used as a claim at the reified statement. Note that a claim is reified at several locations, most notable at the qualifiers, the references, and the values.

If path identifies a claim, and it is a "no value" or "unknown value", then it can't be traversed and will be silently removed if traversal goes further. Note that such a claim might have qualifiers and references.

Methods

 * find : This filter on the given path. Could be used as or   to do an implicit select of matched item. Returns self.
 * next : Matches any node one step forward from the current matched nodes. Note that as this steps on nodes a match on property or item could always fail. Could be used as,   or   to do an implicit select of matched item. Returns self.
 * nextItem : Matches any item node one step forward from the current matched nodes. Note that as this steps on nodes of type item and a match on property will always fail. Could be used as,   or   to do an implicit select of matched item. Returns self.
 * nextClaim : Matches any claim node one step forward from the current matched nodes. Note that as this steps on nodes of type claim and a match on item will always fail. Could be used as,   or   to do an implicit select of matched item. Returns self.
 * nextUntil : Matches any node forward from the current matched nodes. Will use all available expensive calls if misconfigured. Could be used as,   or   to do an implicit select of matched item. Returns self.
 * prev : Matches any node one step backward from the current matched nodes. Note that as this steps on nodes a match on property or item could always fail. Could be used as,   or   to do an implicit select of matched item. Returns self.
 * prevItem : Matches any item node one step backward from the current matched nodes. Note that as this steps on nodes of type item and a match on property will always fail. Could be used as,   or   to do an implicit select of matched item. Returns self.
 * prevClaim : Matches any claim node one step backward from the current matched nodes. Note that as this steps on nodes of type claim and a match on item will always fail. Could be used as,   or   to do an implicit select of matched item. Returns self.
 * prevUntil : Matches any node backward from the current matched nodes. Will use all available expensive calls if misconfigured. Could be used as,   or   to do an implicit select of matched item. Returns self.
 * hasClaim : This is a test. Returns boolean if any backtracked selected item has a claim.
 * hasQualifier : This is a test. Returns boolean if any backtracked selected item has a qualifier.
 * hasReference : This is a test. Returns boolean if any backtracked selected item has a reference.
 * isNovalue : This is a test. Returns boolean if any backtracked selected item is a "no value".
 * isUnknown : This is a test. Returns boolean if any backtracked selected item is a "unknown value".
 * each : This process the current nodes, and call the provided function for each entry. The provided functions return result is thrown away. Returns self.
 * filter : This process the current nodes, and filter by calling the provided function. The provided function should return a boolean result. Returns self.
 * types : This process the current nodes, and filter on the given type. Could be used as  or  . Returns the actual type or types.
 * items : This process the current nodes, if they are items, or unwinds them until an item is found, and filter on the given item id. Could be used as  or  . Returns the actual item or items.
 * claims : This process the current nodes, if they are claims, or unwinds them until a claim is found, and then filter on the given property id. Could be used as  or  . Returns the actual item or items.
 * qualifiers : This dives into the qualifiers for the current nodes, if they are claims, or unwinds them until a claim is found, and filter on the given property id. Could be used as  or  . Returns the actual qualifier or qualifiers.
 * references : This dives into the references for the current nodes, if they are claims, or unwinds them until a claim is found, and filter on the given property id. Could be used as  or  . Returns the actual reference or references.