Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

31
LINES

< > BotCompany Repo | #1009834 // web_allForwardRelated

JavaX fragment (include)

static L<WebNode> web_allForwardRelated(WebNode node, S relationLabel) {
  ret web_allForwardRelated(node.web, node, relationLabel);
}

static L<WebNode> web_allForwardRelated(Web web, WebNode node, S relationLabel) {
  ret web_allForwardRelated(web, node, web.parseLabel(relationLabel));
}

static L<WebNode> web_allForwardRelated(Web web, WebNode node, Lisp relationLabel) {
  new L<WebNode> l;
  for (Pair<WebNode> p : web_relations(web))
    if (p.a == node) {
      WebNode rel = web.getRelationOpt(p);
      if (rel.hasLabel(relationLabel))
        l.add(p.b);
    }
  ret l;
}

static L<WebNode> web_allForwardRelated(WebNode node) {
  ret pairList_forwardLookup(web_relations(node.web), node);
}

static L<WebNode> web_allForwardRelated(Web web, S a, S relationLabel) {
  Lisp name = web.parseLabel(a);
  Lisp rel = web.parseLabel(relationLabel);
  new HashSet<WebNode> l;
  for (WebNode node : web_allNodesNamed(web, name))
    l.addAll(web_allForwardRelated(web, node, rel));
  ret asList(l);
}

Author comment

Began life as a copy of #1009833

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1009834
Snippet name: web_allForwardRelated
Eternal ID of this version: #1009834/9
Text MD5: dd5bf9ed4c1c9ecaab55249e4dac7eb3
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-11-27 11:28:45
Source code size: 1034 bytes / 31 lines
Pitched / IR pitched: No / No
Views / Downloads: 540 / 548
Version history: 8 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1010214 - web_forwardRelationsTextPlusNodes
#1010243 - web_forwardRelated - synonym of web_allForwardRelated
#1010585 - web_allBackwardRelated
#1010749 - web_allForwardRelated_multiRel