How to query for notes shown in Hyperbolic view

Hey!
Is there any way to set the agent to look for all the notes that are linked to or from a specific note (like in Hyperbolic view)? It’s easy to find a group of notes that is directly linked to my “focus” note, but I don’t know how to query notes that are linked indirectly, and thereby far from the “focus” note in Hyperbolic view.
Arek

Yes, this has been thought of with a set of operators available. Look at neighbors2Within(). You may have to experiment with the N distance to get all the items you want. There are other operators in the group (see full op listing): neighbors(), neighbors2(), neighborsWithin(). It shakes out like this:

  • the neighbors() basic op looks at outbound links only (all Tinderbox internal links are implemented as one-way)
  • the ‘2’ variants look a both outbound and inbound links
  • the basic neighbors() op finds all notes exactly N links from the current locus (N is a user-set required parameter).
  • the ‘Within’ variant reports all items up to and including a distance of N links from the current locus.

So hyperbolic view can be thought of as a graph of neighbors2Within(this,N) where N is unbounded so as not to exclude any linked notes.

Thanks again for your help, I really appreciate it!

Instruction how I’ve done it for other fellow users who may come here in the future guided by the same question in mind :
First, you need to create a list using neighbors2Within(), I called it $ListOfNeighbors. Next, copy $Path of every note you want query later to the List data type attribute. I’ve done it through running rule/edict $PathList=$Path; in their Prototype Notes. The last step is to set $AgentQuery, my code: $PathList(this).intersect($ListOfNeighbors(agent))& $IsPrototype==false

Maybe there is a better way to do it, but I’m still not an ActionCode power user :wink:

1 Like

Everything seemed to work well at first until I set the number of links (N argument) to 3. I believe prototype links are not ignored and are counted by the neighbors2Within() operator. Why do I think so? Because my list of notes’ paths created by this operator contains paths of notes that don’t have any visible inbound or outbound links. Is it a bug (that’s what I suspect it to be) or it works as intended and I should adjust the parameters of the item/group designator to filter out the prototype link?
Thanks
Arek

I’m just a user so can’t speak as to the design intent. But prototype relationships are implemented as links, so unless the documentation explicitly says prototype links aren’t included it is reasonable to assume they will be as (testing) it appears they are.

But all this group of filters allow link type filters, and those are implemented as regex as well as literal strings. So this:

$Text=neighbors2Within(this,3).format("\n")

will list any in-scope prototypes. But this:

$Text=neighbors2Within(this,3,"[^prototype]").format("\n")

…doesn’t! So, problem fixed, I think.

2 Likes

Thank you, It works perfectly!

1 Like

Hi Arek

Would you mind putting a sample file demo with your steps included. I think it would help the community especially early adopters to Hyperbolic View or scripting.

For Example; “First, you need to create a list using neighbors2Within(), I called it $ListOfNeighbors.” …

This is great work.

Tom

It shouldn’t really matter. Make a list, put it where you want. For instance:

$ListOfNeighbours = neighbors2Within(this,3,"[^prototype]");

can be used in a stamp or rule/edict. But for agent, recall you are acting on an alias so this would be the alias of a note. thus you might want to use original not this (N.B latter not tested but a pointer in the right direction). But then again, think: why would you want be doing this in the context of an agent? This is where code examples get complex. Think first what you are doing. Trying to hack an example for a different context into a different one, tends so be an exercise in frustration. :slight_smile:

I made a new topic with results of my work, you can check it here. Hope you will find it useful.

1 Like