1 | static new ThreadLocal<Bool> ai_postTriple_verified; |
2 | static new ThreadLocal<Bool> ai_postTriple_recursion; |
3 | |
4 | static S ai_postTriple(T3<S> triple) {
|
5 | // check, clean |
6 | |
7 | ping(); |
8 | if (triple_anyPartNull(triple)) null; |
9 | triple = trimTriple(triple); |
10 | if (!ai_tripleAllowedToPost(triple)) null; // fail("No");
|
11 | |
12 | // existing? |
13 | |
14 | if (has(triple)) null; |
15 | |
16 | // invalid? |
17 | |
18 | if (has(ai_tripleToInvalid(triple))) null; |
19 | |
20 | // post verified? |
21 | |
22 | bool ver = !isFalse(ai_postTriple_verified!); |
23 | |
24 | // post handler? |
25 | |
26 | AI_PostHandler handler = ai_postHandler(); |
27 | T3<Symbol> striple = toSymbolTriple(triple); |
28 | if (handler != null && !isTrue(ai_postTriple_recursion!)) {
|
29 | ai_postTriple_recursion.set(true); |
30 | try {
|
31 | ret strOrNull(handler.postTriple(striple, ver)); |
32 | } finally {
|
33 | ai_postTriple_recursion.set(null); |
34 | } |
35 | } else {
|
36 | // post web the normal way |
37 | Web web = webFromTriple(striple); |
38 | web.unverified = !ver; |
39 | postSoftwareMadeWeb(web); |
40 | ret web.globalID(); |
41 | } |
42 | } |
43 | |
44 | static S ai_postTriple(S a, S b, S c) {
|
45 | ret ai_postTriple(t3(a, b, c)); |
46 | } |
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: | #1011399 |
| Snippet name: | ai_postTriple - posts if triple not in cache yet - returns web.globalID - posts verified unless specified by ai_postTriple_verified |
| Eternal ID of this version: | #1011399/31 |
| Text MD5: | ec847f06d37188b26a7a69f8cdd1b660 |
| Author: | stefan |
| Category: | javax / a.i. |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-12-16 13:56:21 |
| Source code size: | 1124 bytes / 46 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 879 / 916 |
| Version history: | 30 change(s) |
| Referenced in: | [show references] |