content
| - %META:TOPICPARENT{name="VirtCartConfigGooglePlus"}%
%TOC%
---+Google+ Cartridge - Configuration Guidelines
Virtuoso's Sponger cartridge for Google+ allows you to fetch a Google+ user's profile and the Activities they post. These notes, intended for a 'Sponger Administrator', provide brief configuration guidelines for the cartridge.
The cartridge is written to the [[https://developers.google.com/+/api/][Google+ API]]. At the current time (October 2011) only public data is available from the API, consequently the only prerequisite is a Google API key. (This will likely change as the API and support for OAuth evolves).
#AncObtainApiKey
---++Obtain API Key
Before you can obtain an API key for the cartridge, you first need to register the Sponger as a Google+ application.
1 Register the Sponger using the [[https://code.google.com/apis/console][Google APIs Console]]
1 Click "Create project ...".
%BR%%BR%
%BR%%BR%
1 Set in "Services" Menu the service "Google+ API" to "on":
%BR%%BR%
%BR% %BR%%BR%
1 Accept the Google+ Platform Terms of Services by hatching the "I agree to these terms" check-box:
%BR%%BR% %BR%%BR%
1 Click "Accept".
1 As result the "Services" Menu will show "Google+ API" service with status "on":
%BR%%BR% %BR%%BR%
1 Go to "API Access" Menu item:
%BR%%BR% %BR%%BR%
1 Click "Generate new key ..."
%BR%%BR% %BR%%BR%
1 Confirm the key generation by clicking the "Generate new key" button:
%BR%%BR% %BR%%BR%
1 Now go to your local Conductor at http://your-virtuoso-host:port/conductor
1 Go to Linked Data -> Sponger -> Extractor Cartridges:
%BR%%BR% %BR%%BR%
1 Find "Google+" and click on its link in order to edit its properties.
1 As result the cartridge's configuration details should be shown at the bottom of the page list and the 'Cartridge name' will be presented as DB.DBA.RDF_LOAD_GOOGLE_PLUS:
%BR%%BR% %BR%%BR%
1 Enter the API key that was generated from above:
%BR%%BR% %BR%%BR%
1 Click 'Update" to save the "Options" settings.
---++View the Retrieved data
The cartridge is configured to trigger on the URI pattern https://plus.google.com/.* , i.e. the expected starting point for sponging a Google+ user's profile is a URL of the form https://plus.google.com/{user-id}. For example:
1 Access [[http://uriburner.com/about/html/https://plus.google.com/112399767740508618350][http://uriburner.com/about/html/https://plus.google.com/112399767740508618350]]:
%BR%%BR%
%BR% %BR%%BR%
1 Click the primary topic value link "Kingsley Idehen":
%BR%
%BR%
%BR%
%BR% %BR%%BR%
---++Alternative Follow-Your-Nose friendly view of a Google Data Object that represents a Person
We can take a look at the /fct variant of the primaryTopic object page:
1 Click the Facets link from the footer section "Alternative Linked Data Views" of the page from above:
%BR%
%BR%
%BR%
%BR% %BR%%BR%
1 Click "Next" to view the rest of the Attributes and their Values:
%BR%
%BR% %BR%%BR%
---++Paging Options
Because some Google+ user profiles can include hundreds of Activities and associated Comments, the following cartridge options are available to set configurable limits on the number of items returned.
items_per_activity_page:
* Sets the maximum number of activities returned per page of activities, where 1 <= items_per_activity_page <= 100. (Default: 50)
max_activity_pages:
* Limits the number of pages of activities returned. (Default: 1)
* A value of 0 indicates no limit; all the user's activities will be returned.
* A value of -1 turns off fetching of activities.
items_per_comment_page:
* Sets the maximum number of comments returned per page of comments, where 1 <= items_per_comment_page <= 100. (Default: 50)
max_comment_pages:
* Limits the number of pages of comments returned for a particular activity. (Default: 1)
* A value of 0 indicates no limit; all available activity comments will be returned.
* A value of -1 turns off fetching of activity comments.
---++Configuring Google+ User ID Detection
Default installations of a Virtuoso Sponger instance include a Sponger front page, located at http://{virtuoso-host}/sponger, which includes a number of buttons for generating sample Sponger links for particular, typically social site, cartridges.
%BR%%BR% %BR%%BR%
Some of these sites use OAuth as the mechanism to allow a user to grant access to their profile and associated data - posts, images etc. The Sponger front page buttons for these sites enable a user to grant an access token, to allow the Sponger access to their profile in the course of generating the sample Sponger links. Google provides such an OAuth service.
Configuring the Google+ cartridge to use the Google OAuth service is optional. If not configured, the Google+ button requires a user to enter their Google+ ID in order to generate the sample Sponger links.
%BR%%BR% %BR%%BR%
When configured, the user's Google+ ID can be determined automatically. The user must simply log into Google (if not already) and grant the Sponger access to their profile.
---+++Google Access Token Retention and Use
In most cases, OAuth-enabled Sponger cartridges retain access tokens for future use to allow an incremental sponge or complete re-sponge of the user's data (i.e. those portions of their data the user has granted access to). The Google+ cartridge, however, doesn't retain tokens. Google access tokens are always expiring tokens (even if offline access is specified when requesting a token) and must be refreshed through refresh tokens. Consequently, the Google+ cartridge uses an API key (as described above) for the actual sponging of user's public data, rather than expiring access tokens, to free the cartridge from the burden of having to make token refresh requests. Access tokens obtained by the Google+ button on the Sponger front page are used only for the initial profile retrieval to build the sample Sponger URIs and are not saved for future use by the cartridge. The Google tokens typically expire after 1 hour.
---+++Configuring Sponger / Google OAuth Handshaking
In order to take advantage of OAuth, the Sponger must first be registered as a web application in the [[https://code.google.com/apis/console][Google API console]]. This should already have been done when obtaining an API key for simple API access, as described above in the section [[#AncObtainApiKey][Obtain API Key]]. In the API console, select the 'API Access' menu option, then the 'Create an OAuth 2.0 client ID' button under the 'Authorized API Access' heading. Follow the instructions to generate a client ID, ensuring that the Redirect URI is of the form http://{virtuoso-host}/google_oauth.
Note the generated Client ID and Client Secret before signing out of the console.
%BR%%BR% %BR%%BR%
Next, the Client ID and Client Secret must be saved as option values in the Google+ cartridge configuration. Select the Google+ cartridge from the Extractor Cartridges tab under the Linked Data / Sponger tab in the Conductor UI. In the Options text area at the bottom of the screen, enter options client_id=xxx client_secret=yyy, substituting the Client ID and Client Secret values just noted. Click the 'Update' button to save the new options.
%BR%%BR% %BR%%BR%
The Google+ cartridge should now be configured with OAuth support. When a user clicks on the Google+ button on the Sponger front page, they should be prompted to log into Google and asked to grant access to the Sponger. If granted, the Sponger accesses their profile, determines their Google+ ID and generates sample Sponger links for the Google+ cartridge.
---++Related
* [[VirtSponger][Virtuoso Sponger]]
* [[VirtConfigureCartridges][Configure Sponger Cartridges Guide]]
* [[http://ode.openlinksw.com/][The OpenLink Data Explorer Extension]]
* [[http://ode.openlinksw.com/GooglePersonProfile.html][Google to Linked Data Transformation Examples]]
* [[http://delicious.com/kidehen/goodrelations][Meshups (links and lookups across Web 2.0 Services and LOD Cloud]]
* [[VirtSpongerCartridgeSupportedDataSources][OpenLink-supplied Virtuoso Sponger Cartridges]]
* [[VirtSpongerCartridgeSupportedDataSourcesVendorNonRDF][Complete list of supported Vendor-specific Non-RDF Data Formats]]
* [[VirtSpongerCartridgeSupportedDataSourcesNonRDF][Complete list of supported Standard Non-RDF Data Formats]]
* [[VirtSpongerCartridgeSupportedDataSourcesMeta][Complete list of supported Meta Cartridges]]
* [[VirtSpongerCartridgeSupportedDataSourcesMetaREST][Meta Cartridge Usage via REST Request]]
* [[VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamples][Parametrized Examples of Meta Cartridge Usage via REST Request]] |