Adding Google data and watching a bot connect it to the Facebook data

/docs/developers/tutorials-mesh/docker-mock/import-google-mock-data/

Introduction

In this section:

  • we will add some (mock) Google data to the (mock) Facebook data you imported previously in Importing (mock) Facebook data into the UBOS Personal Data Mesh;

  • automatically, a Bot will integrate the new Google data with the previous Facebook data, attempting to identify the same people on the two services, to create an “uber” address book that contains all people that our fictitious user William Smith knows on either Facebook or Google, with a single address book record each.

Import the mock Google data

The process is the same as in Importing (mock) Facebook data into the UBOS Personal Data Mesh: get the (mock) data from “Google”, convert it into the universal UBOS Personal Data Mesh format, construct a delta, and pass that on to the UBOS Personal Data Mesh.

The mock Google data is at http://depot.ubos.net/mockdata/google/. Look for file google-williamsmith.zip and download it into the shared directory. (The sources for the file are here.)

Then, in the container shell:

% cd ~/shared
% mesh-converter --in google-williamsmith.zip --out google-williamsmith.mesh
% mesh-differencer --in google-williamsmith.mesh --baselineempty --out google-williamsmith.peertalk
% mesh-peertalk push --in google-williamsmith.peertalk

Again that takes a little bit of time.

You can revisit Importing (mock) Facebook data into the UBOS Personal Data Mesh to remind yourself what those steps do.

Browse the mock Google data

Go back to the front page of the UBOS Personal Data Mesh at http://localhost:1080/ (not: 8080 as in the screenshot.) You’ll see that new categories of data have shown up. Feel free to click around.

Note

Currently the coverage of the Google importer is very minimal, it really only imports profile information of the user, and parts of their Google address book. (Want to help? The parser code is here and open source!)

Enter the bot

While you were performing the mesh-peertalk push command, a little Bot was watching the Transaction Log of the main MeshBase of the UBOS Personal Data Mesh. Actually, it watches it all the time, not just then. Every time a Transaction commits successfully, all registered Bots run to figure out whether they need to do something.

Insight

Making changes to the data in a MeshBase requires a Transaction, just like a database would. Unlike a typical database, code can subscribe to Transaction events, and be notified when a Transaction is done committing. That’s what the Bot uses to know when it is time to run.

The Docker container you are using in this tutorial runs a single Bot, called the “Person Aggregation Bot”.

When the Google (mock) data import succeeded, the “Person Aggregation Bot” looked at the newly created data, specifically any MeshObjects related to people, and tried to figure out whether people with these names are known already on the UBOS Personal Data Mesh. If so, it would create relationships between newly imported data and existing data about the same person.

Here is an example. Go to the front page of the UBOS Personal Data Mesh, select “Person”, then “Rosie”. It now says that she has two on-line profiles, one from Google and one from Facebook. The Bot matched her by name.

But it wasn’t too sneaky about it. If you open up the Property Sheet for Rosie ( from the “Views” popup on the right), you see, further down, that the Person Aggregation Bot notes in the RoleAttributes section that it created this relationship:

  • name: bot-created, value: net.ubos.bot.personaggregation.PersonAggregationBot.

This value makes it easy to tell which data that has been created by a Bot.

The end of this tutorial

You have made it to the end of this tutorial! Here are some ideas for next steps:

  • To stop your container, enter ^C (control-C) in the shell where you are running docker-compose. This will:

    • delete the (mock) data you uploaded to the UBOS Personal Data Mesh
    • but not the converted files in the shared directory.

    When running the container again, you can always load the data again with:

    % mesh-peertalk push --in facebook-williamsmith.peertalk
    % mesh-peertalk push --in google-williamsmith.peertalk
    
  • Try the tutorial: Running the UBOS Mesh with Docker and your own data

  • Please file issues with anything odd you encounter.