. . . . "Returns a single result row with one 'svg' column holding a complete SVG document rendering the ego trust network of an agent (the 'resource' parameter, typically the agent shown on a user page), computed dynamically from the nanopublication network. This is the query behind the 'Trust network' SVG view (gen:SvgView). The agent is shown as a central box; agents who endorse it (via npx:approvesOf on one of its introduction nanopublications) appear as boxes in a left-hand column with an arrow into the center, and agents it endorses appear in a right-hand column with arrows out of the center. Each side is capped at 15 boxes (ordered alphabetically by name), with a '+ N more' note when the cap is exceeded. Each neighbor box links root-relatively (/user?id=...) to that agent's user page and carries a colored dot reflecting the agent's status in the current trust state of the nanopublication network (green = approved, amber = contested, red = rejected, gray = not in the trust state), read via a federated SERVICE call to the trust repo. Below the diagram, a status line summarizes the central agent's own trust state: approval status, minimum depth from the trust seed, number of known keys, total trust paths, and network share (ratio). Names are taken from the canonical trust-state names where available, falling back to names in introduction nanopublications; long names wrap to two lines. Retracted endorsements are excluded via the invalidation check on the endorsing nanopublications. Positions are computed via rank subqueries, so the output is deterministic." . . . "Get ego trust network diagram as SVG" . . "prefix np: \nprefix npa: \nprefix npx: \nprefix foaf: \nselect (concat(\n '',\n if(?ltot > 0, 'endorsed by', ''),\n if(?rtot > 0, 'endorses', ''),\n ?frags,\n if(?ltot > 0, concat(\n ' ?cy, 36 + (?lshown - 1) * 38 + 15, ?cy)), '\" stroke=\"#444444\">',\n '',\n ''\n ), ''),\n if(?ltot > 15, concat('+ ', str(?ltot - 15), ' more'), ''),\n if(?rtot > 0, concat(\n '',\n ' ?cy, 36 + (?rshown - 1) * 38 + 15, ?cy)), '\" stroke=\"#444444\">'\n ), ''),\n if(?rtot > 15, concat('+ ', str(?rtot - 15), ' more'), ''),\n '',\n if(?cl2 = '',\n concat('', replace(replace(replace(?cl1, \"&\", \"&\"), \"<\", \"<\"), \">\", \">\"), ''),\n concat('', replace(replace(replace(?cl1, \"&\", \"&\"), \"<\", \"<\"), \">\", \">\"),\n '', replace(replace(replace(?cl2, \"&\", \"&\"), \"<\", \"<\"), \">\", \">\"), '')),\n '', ?statusLine, '',\n if(?statLine2 != '', concat('', ?statLine2, ''), ''),\n '') as ?svg) where {\n\n { select (group_concat(coalesce(?frag, \"\"); separator=\"\") as ?frags)\n (coalesce(max(if(?side = 0, ?tot, 0)), 0) as ?ltot)\n (coalesce(max(if(?side = 1, ?tot, 0)), 0) as ?rtot)\n (min(?centerName0) as ?centerName)\n (min(?tCName0) as ?tCName)\n (min(?minDepth0) as ?minDepth)\n (min(?paths0) as ?paths)\n (min(?ratio0) as ?ratio)\n (min(?nKeys0) as ?nKeys)\n (min(?clv0) as ?clv)\n where {\n\n # --- center agent's display name from its introduction nanopub(s)\n { select (min(?cnC) as ?centerName0) where {\n optional {\n graph npa:graph { ?npC np:hasAssertion ?aC . }\n graph ?aC { ?kdC npx:declaredBy ?_resource_iri . ?_resource_iri foaf:name ?cnC . }\n }\n } }\n\n # --- center agent's account state(s) in the current trust state\n { select (min(?dS) as ?minDepth0) (sum(coalesce(?pcS, 0)) as ?paths0) (max(?ratioS) as ?ratio0)\n (count(?accS) as ?nKeys0) (min(?cnS) as ?tCName0)\n (max(if(?stS in (npa:loaded, npa:toLoad), 2, if(?stS = npa:contested, 1, 0))) as ?clv0) where {\n service {\n graph npa:graph { npa:hasCurrentTrustState ?gS . }\n graph ?gS { ?accS npa:agent ?_resource_iri ; npa:depth ?dS ; npa:trustStatus ?stS . }\n optional { graph ?gS { ?accS npa:pathCount ?pcS . } }\n optional { graph ?gS { ?accS npa:ratio ?ratioS . } }\n optional { graph ?gS { ?_resource_iri foaf:name ?cnS . } }\n }\n } }\n\n # --- one row per rendered neighbor box: rank ?iy within its side, capped at 15\n optional {\n { select ?side ?nb ?nbName ?iy ?tot where {\n { select ?side ?nb ?nbName (count(*) as ?iy) where {\n { select (?side1 as ?side) (?nb1 as ?nb) (?nbName1 as ?nbName) where {\n {\n { select (0 as ?side1) ?nb1 (coalesce(min(?nI1), replace(str(?nb1), \"^.*/\", \"\")) as ?nbName1) where {\n graph npa:graph { ?npX1 np:hasAssertion ?aX1 . }\n graph ?aX1 { ?kdX1 npx:declaredBy ?_resource_iri . }\n graph npa:graph {\n ?npE1 npa:hasValidSignatureForPublicKeyHash ?pkE1 ; np:hasAssertion ?aE1 .\n filter not exists { ?npEi1 npx:invalidates ?npE1 ; npa:hasValidSignatureForPublicKeyHash ?pkE1 . }\n }\n graph ?aE1 { ?nb1 npx:approvesOf ?npX1 . }\n optional {\n graph npa:graph { ?npN1 np:hasAssertion ?aN1 . }\n graph ?aN1 { ?kdN1 npx:declaredBy ?nb1 . ?nb1 foaf:name ?nI1 . }\n }\n filter(?nb1 != ?_resource_iri)\n } group by ?nb1 }\n } union {\n { select (1 as ?side1) ?nb1 (coalesce(min(?nO1), replace(str(?nb1), \"^.*/\", \"\")) as ?nbName1) where {\n graph npa:graph {\n ?npA1 npa:hasValidSignatureForPublicKeyHash ?pkA1 ; np:hasAssertion ?aA1 .\n filter not exists { ?npAi1 npx:invalidates ?npA1 ; npa:hasValidSignatureForPublicKeyHash ?pkA1 . }\n }\n graph ?aA1 { ?_resource_iri npx:approvesOf ?intro1 . }\n graph npa:graph { ?intro1 np:hasAssertion ?aI1 . }\n graph ?aI1 { ?kdI1 npx:declaredBy ?nb1 . }\n optional { graph ?aI1 { ?nb1 foaf:name ?nO1 . } }\n filter(?nb1 != ?_resource_iri)\n } group by ?nb1 }\n }\n } }\n bind(concat(lcase(?nbName), \"|\", str(?nb)) as ?sk)\n { select (?side2 as ?sideR) (concat(lcase(?nbName2), \"|\", str(?nb2)) as ?skR) where {\n {\n { select (0 as ?side2) ?nb2 (coalesce(min(?nI2), replace(str(?nb2), \"^.*/\", \"\")) as ?nbName2) where {\n graph npa:graph { ?npX2 np:hasAssertion ?aX2 . }\n graph ?aX2 { ?kdX2 npx:declaredBy ?_resource_iri . }\n graph npa:graph {\n ?npE2 npa:hasValidSignatureForPublicKeyHash ?pkE2 ; np:hasAssertion ?aE2 .\n filter not exists { ?npEi2 npx:invalidates ?npE2 ; npa:hasValidSignatureForPublicKeyHash ?pkE2 . }\n }\n graph ?aE2 { ?nb2 npx:approvesOf ?npX2 . }\n optional {\n graph npa:graph { ?npN2 np:hasAssertion ?aN2 . }\n graph ?aN2 { ?kdN2 npx:declaredBy ?nb2 . ?nb2 foaf:name ?nI2 . }\n }\n filter(?nb2 != ?_resource_iri)\n } group by ?nb2 }\n } union {\n { select (1 as ?side2) ?nb2 (coalesce(min(?nO2), replace(str(?nb2), \"^.*/\", \"\")) as ?nbName2) where {\n graph npa:graph {\n ?npA2 npa:hasValidSignatureForPublicKeyHash ?pkA2 ; np:hasAssertion ?aA2 .\n filter not exists { ?npAi2 npx:invalidates ?npA2 ; npa:hasValidSignatureForPublicKeyHash ?pkA2 . }\n }\n graph ?aA2 { ?_resource_iri npx:approvesOf ?intro2 . }\n graph npa:graph { ?intro2 np:hasAssertion ?aI2 . }\n graph ?aI2 { ?kdI2 npx:declaredBy ?nb2 . }\n optional { graph ?aI2 { ?nb2 foaf:name ?nO2 . } }\n filter(?nb2 != ?_resource_iri)\n } group by ?nb2 }\n }\n } }\n filter(?sideR = ?side && ?skR <= ?sk)\n } group by ?side ?nb ?nbName }\n { select (?side3 as ?side) (count(*) as ?tot) where {\n {\n { select (0 as ?side3) ?nb3 (coalesce(min(?nI3), replace(str(?nb3), \"^.*/\", \"\")) as ?nbName3) where {\n graph npa:graph { ?npX3 np:hasAssertion ?aX3 . }\n graph ?aX3 { ?kdX3 npx:declaredBy ?_resource_iri . }\n graph npa:graph {\n ?npE3 npa:hasValidSignatureForPublicKeyHash ?pkE3 ; np:hasAssertion ?aE3 .\n filter not exists { ?npEi3 npx:invalidates ?npE3 ; npa:hasValidSignatureForPublicKeyHash ?pkE3 . }\n }\n graph ?aE3 { ?nb3 npx:approvesOf ?npX3 . }\n optional {\n graph npa:graph { ?npN3 np:hasAssertion ?aN3 . }\n graph ?aN3 { ?kdN3 npx:declaredBy ?nb3 . ?nb3 foaf:name ?nI3 . }\n }\n filter(?nb3 != ?_resource_iri)\n } group by ?nb3 }\n } union {\n { select (1 as ?side3) ?nb3 (coalesce(min(?nO3), replace(str(?nb3), \"^.*/\", \"\")) as ?nbName3) where {\n graph npa:graph {\n ?npA3 npa:hasValidSignatureForPublicKeyHash ?pkA3 ; np:hasAssertion ?aA3 .\n filter not exists { ?npAi3 npx:invalidates ?npA3 ; npa:hasValidSignatureForPublicKeyHash ?pkA3 . }\n }\n graph ?aA3 { ?_resource_iri npx:approvesOf ?intro3 . }\n graph npa:graph { ?intro3 np:hasAssertion ?aI3 . }\n graph ?aI3 { ?kdI3 npx:declaredBy ?nb3 . }\n optional { graph ?aI3 { ?nb3 foaf:name ?nO3 . } }\n filter(?nb3 != ?_resource_iri)\n } group by ?nb3 }\n }\n } group by ?side3 }\n filter(?iy <= 15)\n } }\n\n # --- neighbor trust status (single evaluation, natural join on ?nb)\n optional {\n { select ?nb (max(if(?stT in (npa:loaded, npa:toLoad), 2, if(?stT = npa:contested, 1, 0))) as ?lv)\n (min(?nmT) as ?tnm) where {\n service {\n graph npa:graph { npa:hasCurrentTrustState ?gT . }\n graph ?gT { ?accT npa:agent ?nb ; npa:trustStatus ?stT . }\n optional { graph ?gT { ?nb foaf:name ?nmT . } }\n }\n } group by ?nb }\n }\n\n bind(36 + (?iy - 1) * 38 as ?boxY)\n bind(?boxY + 15 as ?midY)\n bind(if(?side = 0, 20, 455) as ?boxX)\n bind(if(coalesce(?lv = 2, false), \"#2e7d32\", if(coalesce(?lv = 1, false), \"#b26a00\", if(bound(?lv), \"#b00020\", \"#999999\"))) as ?dotFill)\n\n # display name: prefer the canonical trust-state name; two-line wrap when wide\n bind(coalesce(?tnm, ?nbName) as ?dispName)\n bind(strlen(?dispName) > 25 && regex(?dispName, \"^.{1,17}\\\\s\") as ?wrap)\n bind(if(?wrap, replace(?dispName, \"^(.{1,17})\\\\s.*$\", \"$1\"), ?dispName) as ?l1)\n bind(if(?wrap, replace(?dispName, \"^.{1,17}\\\\s\", \"\"), \"\") as ?l2)\n\n bind(concat(\n if(?side = 0,\n concat(''),\n concat('',\n '')),\n '',\n '',\n '',\n if(?l2 = '',\n concat('', replace(replace(replace(?l1, \"&\", \"&\"), \"<\", \"<\"), \">\", \">\"), ''),\n concat('', replace(replace(replace(?l1, \"&\", \"&\"), \"<\", \"<\"), \">\", \">\"),\n '', replace(replace(replace(?l2, \"&\", \"&\"), \"<\", \"<\"), \">\", \">\"), '')),\n ''\n ) as ?frag)\n }\n } }\n\n bind(if(?ltot > 15, 15, ?ltot) as ?lshown)\n bind(if(?rtot > 15, 15, ?rtot) as ?rshown)\n bind(if(?ltot > 15, 16, ?ltot) as ?lrows)\n bind(if(?rtot > 15, 16, ?rtot) as ?rrows)\n bind(if(?lrows > ?rrows, ?lrows, ?rrows) as ?maxn0)\n bind(if(?maxn0 < 1, 1, ?maxn0) as ?maxn)\n bind(36 + (?maxn - 1) * 19 + 15 as ?cy)\n bind(36 + ?maxn * 38 + 40 as ?h)\n\n bind(coalesce(?tCName, ?centerName, replace(str(?_resource_iri), \"^.*/\", \"\")) as ?cname)\n bind(strlen(?cname) > 28 && regex(?cname, \"^.{1,20}\\\\s\") as ?cwrap)\n bind(if(?cwrap, replace(?cname, \"^(.{1,20})\\\\s.*$\", \"$1\"), ?cname) as ?cl1)\n bind(if(?cwrap, replace(?cname, \"^.{1,20}\\\\s\", \"\"), \"\") as ?cl2)\n\n bind(if(coalesce(?clv = 2, false), '✓ approved', if(coalesce(?clv = 1, false), '⚠ contested', if(bound(?clv), '✗ rejected', 'not in the trust network'))) as ?statusTxt)\n bind(if(coalesce(?clv = 2, false), '#2e7d32', if(coalesce(?clv = 1, false), '#b26a00', if(bound(?clv), '#b00020', '#666666'))) as ?statusCol)\n bind(concat(?statusTxt, coalesce(concat(' · depth ', str(?minDepth)), '')) as ?statusLine)\n bind(coalesce(concat(str(?nKeys), if(?nKeys = 1, ' key', ' keys'), ' · ',\n str(?paths), if(?paths = 1, ' trust path', ' trust paths'),\n ' · network share ', str(round(?ratio * 10000) / 100), '%'), '') as ?statLine2)\n}" . . "Tobias Kuhn" . "2026-08-12T19:22:38Z"^^ . . . . "Get ego trust network diagram as SVG" . . . . . "RSA" . "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCwUtewGCpT5vIfXYE1bmf/Uqu1ojqnWdYxv+ySO80ul8Gu7m8KoyPAwuvaPj0lvPtHrg000qMmkxzKhYknEjq8v7EerxZNYp5B3/3+5ZpuWOYAs78UnQVjbHSmDdmryr4D4VvvNIiUmd0yxci47dTFUj4DvfHnGd6hVe5+goqdcwIDAQAB" . "L9ShOemuYldcJdp05Az1g8XMvWizsSKl6vDj11cWaY0XiyT/TcVer1Fyf5xPKM++8duwkwKy2VY7nUHU/ngN6zC+7hB+X0bw3E18Cit55UXgOyxEx0b/Tsz8fPzlz16xsvg+6Q1JV76rwpkede9WNmEi570yxGFrqcjZgYX9LWM=" . . .