From: Arne Babenhauserheide <arne_bab@web.de>
To: David Thompson <dthompson2@worcester.edu>
Cc: guile-user@gnu.org
Subject: [potluck dish] crawling the Freenet WoT with sxml and match
Date: Tue, 16 Feb 2016 23:37:41 +0100 [thread overview]
Message-ID: <87povwqo22.fsf@web.de> (raw)
In-Reply-To: <877fi4fmeq.fsf@izanagi.i-did-not-set--mail-host-address--so-tickle-me>
[-- Attachment #1.1: Type: text/plain, Size: 1530 bytes --]
Hi Guilers,
I’d like to contribute a small dish, I’ve been working on during the
past two weeks.
A first script downloads xml files of anonymous identities in Freenet,
extracts trust given to other identities and downloads these, too. A
second script parses the identities and turns them into a csv file which
social network researchers can use to investigate the effects of
anonymity on social interaction (at least that’s the goal). A third and
fourth script anonymize and deduplicate the results.
What I like best is using match and sxml to extract the relevant
identifiers, though I’m using mutation to separate the match in
the let-recursion and a final cons which saves the filename:
(define (parse-trust-values filename)
(let* ((port (open-input-file filename))
(sxml (non-breaking-sxml-reader port))
(closed (close-port port))
(trust '()))
(let extract-trust ((sxml sxml))
(match sxml
(('Trust ('@ ('Value value) ('Identity uri) rest ...))
(set! trust
(cons (cons (wot-uri-key uri)
(string->number value))
trust)))
((a b ...)
(map extract-trust sxml))
(else '())))
(cons (wot-file-key filename) trust)))
I attached a network visualization generated from the data. Some
explanation is available from my website:
http://draketo.de/english/freenet/social-graph-snapshot
[-- Attachment #1.2: Sone social graph in Reingold Layout --]
[-- Type: image/png, Size: 976091 bytes --]
[-- Attachment #1.3: Type: text/plain, Size: 604 bytes --]
The code is available in the guile-freenet repository on
https://notabug.org/arnebab/guile-freenet and on Bitbucket
https://bitbucket.org/ArneBab/freenet-guile and from a static clone:
http://draketo.de/proj/guile-freenet/
Happy Hacking!
Arne Babenhauserheide
PS: I wrote this code without wisp to make it possible to run it with
Guile out-of-the-box. To be suitable for programs I share, I’d need
either guildhall integrated into Guile (to provide wisp with just a
single command) or wisp itself in Guile.
--
Unpolitisch sein
heißt politisch sein
ohne es zu merken
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 298 bytes --]
prev parent reply other threads:[~2016-02-16 22:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-16 20:08 [potluck dish] simple syntax highlighter David Thompson
2016-02-16 22:37 ` Arne Babenhauserheide [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87povwqo22.fsf@web.de \
--to=arne_bab@web.de \
--cc=dthompson2@worcester.edu \
--cc=guile-user@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).