Skip to content

Design: filter and find/search as functions and parameters on functions #1114

Open
@Affie

Description

@Affie

Whats necessary to close this ticket:

  • Work session on verbs
    • filter
    • find
    • search
    • list,
  • Link the design artifact
  • Ensure definitions exist in verbNoun dictionary

Details

This issue is to discuss filters and find/search as functions and parameters on functions such as listVariables and getVariables

We can retrieve the objects or the labels with (We currently have filters on some get and list functions)

  • get[Plural] returns a vector of object with optional filter
  • list returns a vector of labels with optional filter

find[all] can be aliased to list if we wanted
findfirst can be used for a more efficient list()[1] (but list is not that expensive)

The main difference in findfirst and list will be the return type and error behaviour. list always returns a vector while with findfirst you would want the first element in the vector and nothing (julia way) if empty.

Then there is also search as an option, but I see that more for a bigger scope such as searching across all graphs in the DB.

What I think is still missing is an efficient and clear findfirst then get
We can just use get[Plural][1] to retrieve the first match with potentially bad performance.

We currently have getBlobEntryFirst that takes a filter on the label and returns the first match, similar to findfirst followed by a get or getBlobEntries[1] (with a filter)


Maybe use verb retrieve for findfirst + get verb combination.

With findall returning labels of matches and findfirst returning the first match or nothing.
From julia docs:

findfirst(A) Return the index or key of the first true value in A. Return nothing if no such value is found.


tasks:

  • extra parameter / new verb / adjective
  • list + filter vs findall - no find, aliased, or no filter in ls.
  • get[Plural] + filter vs new verb
  • findfirst + get with get[Plural] or new verb

xref #1085

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions