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

41
LINES

< > BotCompany Repo | #1012642 // AbstractThoughtSpace

JavaX fragment (include)

abstract sclass AbstractThoughtSpace implements AI_PostHandler {
  AbstractThoughtSpace parent;
  
  *() {}
  *(AbstractThoughtSpace *parent) {}
  
  // take unshortened queries
  abstract L<TripleRef<Symbol>> get(Symbol query);
  abstract L<TripleRef<Symbol>> get(Symbol query, int position);
  abstract L<TripleWeb> getTriples(Symbol query);
  abstract L<TripleWeb> getTriples(Symbol query, int position);
  
  abstract L<TripleWeb> getOneTwo(Symbol a, Symbol b);
  
  // existence of triple has already been checked
  public abstract GlobalID postTriple(T3<Symbol> t);

  abstract int size();
  
  // doesn't take variables
  public bool hasTriple(Symbol a, Symbol b, Symbol c) {
    ret findTriple(a, b, c) != null;
  }
  
  // doesn't take variables
  public TripleWeb findTriple(Symbol a, Symbol b, Symbol c) {
    L<TripleWeb> l = shortestList3(getTriples(a, 0), getTriples(b, 1), getTriples(c, 2));
    if (l != null) for (TripleWeb w : l)
      if (w != null && tripleEqic(w, a, b, c))
        ret w;
    null;
  }
  
  public bool hasTriple_verified(Symbol a, Symbol b, Symbol c) {
    L<TripleWeb> l = shortestList3(getTriples(a, 0), getTriples(b, 1), getTriples(c, 2));
    if (l != null) for (TripleWeb w : l)
      if (w != null && w.verified() && tripleEqic(w, a, b, c))
        true;
    false;
  }
}

Author comment

Began life as a copy of #1012640

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: #1012642
Snippet name: AbstractThoughtSpace
Eternal ID of this version: #1012642/24
Text MD5: 46c37aca4d30963386b2db1f08b9b66a
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-02-27 01:47:26
Source code size: 1356 bytes / 41 lines
Pitched / IR pitched: No / No
Views / Downloads: 464 / 1027
Version history: 23 change(s)
Referenced in: [show references]