Returns a single result row with one 'svg' column holding a complete SVG diagram of the whole trust network of the nanopublication ecosystem, computed entirely from the current trust state. This is the query behind the 'Trust network overview' SVG view (gen:SvgView). Every agent in the trust state is drawn as one equally sized tilted square (a diamond, echoing the profile-picture mask), linking root-relatively (/user?id=...) to that agent's user page. Agents are grouped into horizontal bands by their minimum depth from the trust seed; within a band they are ordered by the number of agents they endorsed, descending, and laid out left-aligned at a fixed spacing, wrapping onto as many rows as the band needs. The highest-endorsing agents therefore sit at the left of each band. A line is drawn for every endorsement between two distinct agents, so the fan below an agent shows the agents it brought into the network. Node color encodes depth, with contested agents in red and skipped (rejected) agents in gray. The diagram carries no title, caption or labels: it is a pure node-and-link rendering meant to sit under the view's own heading, and its height adapts to the number of rows needed. The query reads npa:EndorsementLink nodes (npa:fromAgent / npa:toAgent) together with the npa:AccountState rows of the current trust state, so it needs no federated SERVICE call and no scan of the full repository. Per-pubkey duplicate rows are collapsed to one node per agent, self-endorsements across an agent's own keys are not drawn as edges, and positions come from rank subqueries, so the output is deterministic. The 'resource' parameter is the page the view is shown on; it is not used by the diagram, which always shows the whole network.
Get trust network overview diagram as SVG
prefix npa: <http://purl.org/nanopub/admin/> prefix xsd: <http://www.w3.org/2001/XMLSchema#> select (concat( " ", ?edgesvg, ?nodesvg, " ") as ?svg) where { bind(?_resource_iri as ?pageResource) { select (((30 + (?nd - 1) * 60) + ?totalRows * 16 + 20) as ?h) where { { select (sum(?rr) as ?totalRows) (count(*) as ?nd) where { { select ?dh (count(*) as ?ch) where { { select ?aH (min(?dH) as ?depH) where { npa:thisRepo npa:hasCurrentTrustState ?tsH . graph ?tsH { ?stH a npa:AccountState ; npa:agent ?aH ; npa:depth ?dH } } group by ?aH } bind(?depH as ?dh) } group by ?dh } bind(xsd:integer(ceil(?ch / 126)) as ?rr) } } } } { select (group_concat(?eline; separator="") as ?edgesvg) where { { select ?aF ?depF ?outF ((14 + (?rankF - 1 - ?rowF * 126) * 14 + 7) as ?xF) ((30 + (?depF - 1) * 60 + (?rowsBeforeF + ?rowF) * 16) as ?yF) where { { select ?aF ?depF ?outF (count(distinct ?a2F) as ?rankF) where { { select ?aFa (min(?dFa) as ?depFa) (count(distinct ?tFa) as ?outFa) where { npa:thisRepo npa:hasCurrentTrustState ?tsFa . graph ?tsFa { ?stFa a npa:AccountState ; npa:agent ?aFa ; npa:depth ?dFa } optional { graph ?tsFa { ?lFa a npa:EndorsementLink ; npa:fromAgent ?aFa ; npa:toAgent ?tFa } } } group by ?aFa } bind(str(1000 - ?outFa) as ?pnFa) bind(concat(substr(concat("0000", ?pnFa), strlen(?pnFa) + 1), str(?aFa)) as ?kFa) bind(?aFa as ?aF) bind(?depFa as ?depF) bind(?outFa as ?outF) { select ?aFb (min(?dFb) as ?depFb) (count(distinct ?tFb) as ?outFb) where { npa:thisRepo npa:hasCurrentTrustState ?tsFb . graph ?tsFb { ?stFb a npa:AccountState ; npa:agent ?aFb ; npa:depth ?dFb } optional { graph ?tsFb { ?lFb a npa:EndorsementLink ; npa:fromAgent ?aFb ; npa:toAgent ?tFb } } } group by ?aFb } bind(str(1000 - ?outFb) as ?pnFb) bind(concat(substr(concat("0000", ?pnFb), strlen(?pnFb) + 1), str(?aFb)) as ?kFb) bind(?aFb as ?a2F) filter(?depFb = ?depF && ?kFb <= ?kFa) } group by ?aF ?depF ?outF } bind(xsd:integer(floor((?rankF - 1) / 126)) as ?rowF) { select ?depRF (sum(?r2F) as ?rowsBeforeF) where { { select ?dAF (count(*) as ?cAF) where { { select ?aFp (min(?dFp) as ?depFp) where { npa:thisRepo npa:hasCurrentTrustState ?tsFp . graph ?tsFp { ?stFp a npa:AccountState ; npa:agent ?aFp ; npa:depth ?dFp } } group by ?aFp } bind(?depFp as ?dAF) } group by ?dAF } bind(?dAF as ?depRF) { select ?dBF (count(*) as ?cBF) where { { select ?aFq (min(?dFq) as ?depFq) where { npa:thisRepo npa:hasCurrentTrustState ?tsFq . graph ?tsFq { ?stFq a npa:AccountState ; npa:agent ?aFq ; npa:depth ?dFq } } group by ?aFq } bind(?depFq as ?dBF) } group by ?dBF } filter(?dBF <= ?depRF) bind(if(?dBF = ?depRF, 0, xsd:integer(ceil(?cBF / 126))) as ?r2F) } group by ?depRF } filter(?depRF = ?depF) } } { select ?aT ?depT ?outT ((14 + (?rankT - 1 - ?rowT * 126) * 14 + 7) as ?xT) ((30 + (?depT - 1) * 60 + (?rowsBeforeT + ?rowT) * 16) as ?yT) where { { select ?aT ?depT ?outT (count(distinct ?a2T) as ?rankT) where { { select ?aTa (min(?dTa) as ?depTa) (count(distinct ?tTa) as ?outTa) where { npa:thisRepo npa:hasCurrentTrustState ?tsTa . graph ?tsTa { ?stTa a npa:AccountState ; npa:agent ?aTa ; npa:depth ?dTa } optional { graph ?tsTa { ?lTa a npa:EndorsementLink ; npa:fromAgent ?aTa ; npa:toAgent ?tTa } } } group by ?aTa } bind(str(1000 - ?outTa) as ?pnTa) bind(concat(substr(concat("0000", ?pnTa), strlen(?pnTa) + 1), str(?aTa)) as ?kTa) bind(?aTa as ?aT) bind(?depTa as ?depT) bind(?outTa as ?outT) { select ?aTb (min(?dTb) as ?depTb) (count(distinct ?tTb) as ?outTb) where { npa:thisRepo npa:hasCurrentTrustState ?tsTb . graph ?tsTb { ?stTb a npa:AccountState ; npa:agent ?aTb ; npa:depth ?dTb } optional { graph ?tsTb { ?lTb a npa:EndorsementLink ; npa:fromAgent ?aTb ; npa:toAgent ?tTb } } } group by ?aTb } bind(str(1000 - ?outTb) as ?pnTb) bind(concat(substr(concat("0000", ?pnTb), strlen(?pnTb) + 1), str(?aTb)) as ?kTb) bind(?aTb as ?a2T) filter(?depTb = ?depT && ?kTb <= ?kTa) } group by ?aT ?depT ?outT } bind(xsd:integer(floor((?rankT - 1) / 126)) as ?rowT) { select ?depRT (sum(?r2T) as ?rowsBeforeT) where { { select ?dAT (count(*) as ?cAT) where { { select ?aTp (min(?dTp) as ?depTp) where { npa:thisRepo npa:hasCurrentTrustState ?tsTp . graph ?tsTp { ?stTp a npa:AccountState ; npa:agent ?aTp ; npa:depth ?dTp } } group by ?aTp } bind(?depTp as ?dAT) } group by ?dAT } bind(?dAT as ?depRT) { select ?dBT (count(*) as ?cBT) where { { select ?aTq (min(?dTq) as ?depTq) where { npa:thisRepo npa:hasCurrentTrustState ?tsTq . graph ?tsTq { ?stTq a npa:AccountState ; npa:agent ?aTq ; npa:depth ?dTq } } group by ?aTq } bind(?depTq as ?dBT) } group by ?dBT } filter(?dBT <= ?depRT) bind(if(?dBT = ?depRT, 0, xsd:integer(ceil(?cBT / 126))) as ?r2T) } group by ?depRT } filter(?depRT = ?depT) } } { select distinct ?aF ?aT where { npa:thisRepo npa:hasCurrentTrustState ?tsE . graph ?tsE { ?lE a npa:EndorsementLink ; npa:fromAgent ?aF ; npa:toAgent ?aT } filter(?aF != ?aT) } } bind(concat(" ") as ?eline) } } { select (group_concat(?nline; separator="") as ?nodesvg) where { { select ?aN ?depN ?outN ((14 + (?rankN - 1 - ?rowN * 126) * 14 + 7) as ?xN) ((30 + (?depN - 1) * 60 + (?rowsBeforeN + ?rowN) * 16) as ?yN) where { { select ?aN ?depN ?outN (count(distinct ?a2N) as ?rankN) where { { select ?aNa (min(?dNa) as ?depNa) (count(distinct ?tNa) as ?outNa) where { npa:thisRepo npa:hasCurrentTrustState ?tsNa . graph ?tsNa { ?stNa a npa:AccountState ; npa:agent ?aNa ; npa:depth ?dNa } optional { graph ?tsNa { ?lNa a npa:EndorsementLink ; npa:fromAgent ?aNa ; npa:toAgent ?tNa } } } group by ?aNa } bind(str(1000 - ?outNa) as ?pnNa) bind(concat(substr(concat("0000", ?pnNa), strlen(?pnNa) + 1), str(?aNa)) as ?kNa) bind(?aNa as ?aN) bind(?depNa as ?depN) bind(?outNa as ?outN) { select ?aNb (min(?dNb) as ?depNb) (count(distinct ?tNb) as ?outNb) where { npa:thisRepo npa:hasCurrentTrustState ?tsNb . graph ?tsNb { ?stNb a npa:AccountState ; npa:agent ?aNb ; npa:depth ?dNb } optional { graph ?tsNb { ?lNb a npa:EndorsementLink ; npa:fromAgent ?aNb ; npa:toAgent ?tNb } } } group by ?aNb } bind(str(1000 - ?outNb) as ?pnNb) bind(concat(substr(concat("0000", ?pnNb), strlen(?pnNb) + 1), str(?aNb)) as ?kNb) bind(?aNb as ?a2N) filter(?depNb = ?depN && ?kNb <= ?kNa) } group by ?aN ?depN ?outN } bind(xsd:integer(floor((?rankN - 1) / 126)) as ?rowN) { select ?depRN (sum(?r2N) as ?rowsBeforeN) where { { select ?dAN (count(*) as ?cAN) where { { select ?aNp (min(?dNp) as ?depNp) where { npa:thisRepo npa:hasCurrentTrustState ?tsNp . graph ?tsNp { ?stNp a npa:AccountState ; npa:agent ?aNp ; npa:depth ?dNp } } group by ?aNp } bind(?depNp as ?dAN) } group by ?dAN } bind(?dAN as ?depRN) { select ?dBN (count(*) as ?cBN) where { { select ?aNq (min(?dNq) as ?depNq) where { npa:thisRepo npa:hasCurrentTrustState ?tsNq . graph ?tsNq { ?stNq a npa:AccountState ; npa:agent ?aNq ; npa:depth ?dNq } } group by ?aNq } bind(?depNq as ?dBN) } group by ?dBN } filter(?dBN <= ?depRN) bind(if(?dBN = ?depRN, 0, xsd:integer(ceil(?cBN / 126))) as ?r2N) } group by ?depRN } filter(?depRN = ?depN) } } { select ?aN (min(?statN0) as ?statN) where { npa:thisRepo npa:hasCurrentTrustState ?tsN . graph ?tsN { ?stN0 a npa:AccountState ; npa:agent ?aN ; npa:trustStatus ?statN0 } } group by ?aN } bind(if(?statN = npa:contested, "#c8553d", if(?statN = npa:skipped, "#8a8a8a", if(?depN = 1, "#0d4f8b", if(?depN = 2, "#2f7fc4", if(?depN = 3, "#5fa3da", if(?depN = 4, "#8fc0e8", "#bcd9f0")))))) as ?fill) bind(concat( "", " ", "") as ?nline) } } }