1 | static void webs_toTripleFile(Collection<Web> webs, PrintWriter out) { |
2 | new L<S> names; |
3 | new Map<S, Int> index; |
4 | new StringBuilder buf; |
5 | for (Web web : webs) { |
6 | T3<S> t = ai_webToTriple(web); |
7 | if (t == null) fail("Not tripelizable: " + webToStringShort(web)); |
8 | S moreInfo = quote(unnull(web.globalID())) + " " + quote(unnull(web.title)) + " " + quote(unnull(web.source)) + " " + (web.unverified ? "u" : "v") + " " + web.created; |
9 | buf.append( |
10 | webs_toTripleFile_indexGet(names, index, t.a) + " " + |
11 | webs_toTripleFile_indexGet(names, index, t.b) + " " + |
12 | webs_toTripleFile_indexGet(names, index, t.c) + " " + moreInfo + "\n"); |
13 | } |
14 | //out.println(struct(names)); |
15 | for (S s : names) out.println(quoteUnlessIdentifierOrInteger(s)); |
16 | out.println(); |
17 | out.print(buf); |
18 | } |
19 | |
20 | static int webs_toTripleFile_indexGet(L<S> names, Map<S, Int> index, S s) { |
21 | Int i = index.get(s); |
22 | if (i == null) { |
23 | i = l(names); |
24 | names.add(s); |
25 | index.put(s, i); |
26 | } |
27 | ret i; |
28 | } |
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: | 479 / 503 |
Version history: | 8 change(s) |
Referenced in: | [show references] |