Cache v2 format
From TrustLet, a free, collaborative project for collecting and analyzing information about trust metrics.
Contents |
[edit] Cache v2-3 (.c2 files)
Cache v2 uses Python pickle package to store python object. cache v2 is implemented in helpers.py file (save and load functions). It identify data from a unique key (a dictionary, e.g. {'network':'Wiki','lang':'it','date':'2008-06-26'}) in addition to the file path.
[edit] How to read files
In [15]: import pickle
In [16]: from gzip import GzipFile
In [17]: d = pickle.load(GzipFile('path/filename.c2'))
or
In [9]: from trustlet import *
In [10]: dictionary = read_c2('path/filename.c2')
[edit] Networks
The Python object that rappresent a Network is a tuple (nodes,edges): the first element is a list of strings; the second is again a list, each entry is a tuple (a,b,c), where a and b are nodes, and c is the weight of the edge.
Sometimes you can find a serialized instance of Network class instead (In WikiPredGraph, or other generic Network). We should standardize this. Moreover both the format are supported by trustlet.
[edit] WikiNetwork
WikiNetwork can born only in c2 format (the scripts function generate it from xml in c2 format) but can be converted by conversion module of trustlet in other format (dot or pajek)
[edit] Cache Key
The dictionary key that identify a WikiNetwork has the following keys:
- network (always is 'Wiki')
- lang (using Wikipedia format {lang}.wikipedia.org)
- date
An example
{'network':'Wiki', 'lang':'eml', 'date':'2008-06-26'}
[edit] Other Network
The other network (Advogato-like) can born in dot, or c2 or pajek format. All this format had to be converted in c2, in order to use it with trustlet. For advogato-like network, the conversion can be made automatically when you try to load a dot (automatic conversion is supported only for dot).
[edit] Cache Key
The dictionary key that identify a generic Network has the following keys:
- network (name of the network had to be capital case and must exclude 'Network' ex. KaitiakiNetwork has name Kaitiaki )
- date
An example
{'network':'Advogato', 'date':'2008-06-26'}
[edit] Other information
In a WikiNetwork c2 file there are other information in addition of network's nodes and edges.
- List of bots
- {'lang':lang, 'list':'bots'}
- List of Blocked Users
- {'lang':lang, 'list':'blockedusers'}
- Number of all Wikipedia users
- {'lang':lang, 'info':'number of users'}
You can also use c2 format to store all types of data that support pickling, simply using "save" and "load" function in trustlet.helpers module.

