The social graph – known as the ‘Plex’ – is the core database used by Plexus. I have been working on some modules over the past few days that will allow you to bootstrap your own Plex based on two existing social graphs – Google and Twitter.
First, download the new repo. Now go to the directory. You’ve got a few tools available to you to help build your Plex. If you do have a Gmail account (with associated Google Contacts), invoke the module inplex_google.py in the following way:
python inplex_google.py --user firstname.lastname@example.org --pw password
Where you fill in your correct username and password credentials. If all of that works, the module will log into your Google Contacts, and begin retrieving the whole lot (I have about a thousand, you could have many more), creating entries in the Plex for each one that has a proper name attached to an email address. In the interests of clarity, it will not add a contact to the Plex that has an email address without a corresponding proper name. When the module is finished running, the file db/plex.db should contain a basic social graph of your Google Contacts.
To add your Twitter social graph (the people you follow on Twitter) to this, use the module inplex_twitter.py, invoked as follows:
If you do not have OAuth credentials, the tool will take you through OAuth authorization. Once you have authorized access to your Twitter account, the module will retrieve all of your Twitter ‘friends’ – that is, the contacts whom you follow, not the ones who follow you – and add them all to the Plex by proper name and Twitter screen name. Where there is a proper name that matches an entry already in the Plex, this contact is added as a ‘connection’ to the Plex.
Now, if you want to see what you’ve got inside your Plex, you can run the export module plex2vcard.py, which exports the Plex as a series of Plexus-style ‘vcards’. (These vcards are actually JSON-serialized objects, not in standard vCard format, but containing the same information.) You might want to export the output to a file, invoking the module like this:
python plex2vcard.py > plex.vcards
This will create an output file, plex.vcards, which has the exported content of all of the entries in your social graph.
Conversely, if you want to take a vcard file and import it to the Plex – either creating a Plex from scratch, or adding new vcards to an existing plex, you would use the module vcard2plex.py. If we wanted to import our exported vcards into a Plex (perhaps restoring after trashing our database), we could do it as follows:
cat plex.vcards | python vcard2plex.py
You can then run plex2vcard.py to check to see if all of the vcards have been added to the Plex.