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

28
LINES

< > BotCompany Repo | #1011763 // webs_toTripleFile

JavaX fragment (include)

static void webs_toTripleFile(Collection<Web> webs, PrintWriter out) {
  new L<S> names;
  new Map<S, Int> index;
  new StringBuilder buf;
  for (Web web : webs) {
    T3<S> t = ai_webToTriple(web);
    if (t == null) fail("Not tripelizable: " + webToStringShort(web));
    S moreInfo = quote(unnull(web.globalID())) + " " + quote(unnull(web.title)) + " " + quote(unnull(web.source)) + " " + (web.unverified ? "u" : "v") + " " + web.created;
    buf.append(
      webs_toTripleFile_indexGet(names, index, t.a) + " " +
      webs_toTripleFile_indexGet(names, index, t.b) + " " +
      webs_toTripleFile_indexGet(names, index, t.c) + " " + moreInfo + "\n");
  }
  //out.println(struct(names));
  for (S s : names) out.println(quoteUnlessIdentifierOrInteger(s));
  out.println();
  out.print(buf);
}

static int webs_toTripleFile_indexGet(L<S> names, Map<S, Int> index, S s) {
  Int i = index.get(s);
  if (i == null) {
    i = l(names);
    names.add(s);
    index.put(s, i);
  }
  ret i;
}

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: #1011763
Snippet name: webs_toTripleFile
Eternal ID of this version: #1011763/9
Text MD5: 0830de3184f5e7e7ae150ff06c9f4ab0
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-29 00:44:02
Source code size: 1015 bytes / 28 lines
Pitched / IR pitched: No / No
Views / Downloads: 478 / 502
Version history: 8 change(s)
Referenced in: [show references]