<docbook><section><title>VirtCartConfigTwitter</title><title> Twitter Cartridge - Configuration Guidelines and Implementation Notes</title> Twitter Cartridge - Configuration Guidelines and Implementation Notes
<bridgehead class="http://www.w3.org/1999/xhtml:h2"> Introduction</bridgehead>
<para>Virtuoso&#39;s Cartridges VAD includes two Sponger cartridges for Twitter, listed as &quot;Twitter&quot; and &quot;Twitter v2&quot; in Conductor&#39;s Sponger Configuration UI.
 The most recent of these, &quot;Twitter v2&quot; is written for the Twitter REST API and OAuth.
 The other earlier cartridge was written for a previous version of the Twitter API and uses basic HTTP authentication.
 It is disabled by default when the new cartridge is present.
 These notes, intended for a &#39;Sponger Administrator&#39;, provide configuration guidelines and brief implementation details for the new cartridge.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2">Registering the Sponger as a Twitter Application</bridgehead>
<para>Before you can obtain access tokens for the cartridge, you first need to register the Sponger as a Twitter application.</para>
<orderedlist spacing="compact"><listitem>Register the Sponger using the <ulink url="https://dev.twitter.com/">Twitter Developers Application</ulink>.
<figure><graphic fileref="VirtCartConfigTwitter/twt1.png" /></figure> </listitem>
<listitem>Click &quot;Create an app&quot;.
<figure><graphic fileref="VirtCartConfigTwitter/twt2.png" /></figure> </listitem>
<listitem>In the presented form: <orderedlist spacing="compact"><listitem>Specify application name, for example: &#39;Sponger_{your_host_name}&#39; ; </listitem>
<listitem>Specify your website ; </listitem>
<listitem>Specify callback URL: it must point to the Virtuoso /twitter_oauth Virtual Path defined when the <ulink url="https://virtuoso.openlinksw.com/download/">Cartridges</ulink> VAD package is installed, e.g.
 http://{<emphasis>your-virtuoso-host:port</emphasis>}/twitter_oauth ; </listitem>
<listitem>Hatch the &quot;Yes, I agree&quot; check-box; </listitem>
<listitem>Enter the &quot;CAPTCHA&quot; words: <figure><graphic fileref="VirtCartConfigTwitter/twt3.png" /></figure> <figure><graphic fileref="VirtCartConfigTwitter/twt4.png" /></figure> <figure><graphic fileref="VirtCartConfigTwitter/twt5.png" /></figure> </listitem>
<listitem>Finally click &quot;Create your Twitter application&quot; button.
</listitem>
</orderedlist></listitem>
<listitem>The application will be created and a Consumer key and secret will be generated: <figure><graphic fileref="VirtCartConfigTwitter/twt6.png" /></figure> <figure><graphic fileref="VirtCartConfigTwitter/twt8.png" /></figure> </listitem>
<listitem>Now go to your local Conductor at <ulink url="http://your-virtuoso-host:port/conductor">http://your-virtuoso-host:port/conductor</ulink> </listitem>
<listitem>Go to Linked Data -&gt; Sponger -&gt; Extractor Cartridges: <figure><graphic fileref="VirtCartConfigTwitter/twt7.png" /></figure> </listitem>
<listitem>Find &quot;Twitter v2&quot; and click on its link in order to edit its properties: </listitem>
<listitem>Should be presented the cartridge&#39;s configuration details at the bottom of the page list: <itemizedlist mark="bullet" spacing="compact"><listitem>The &#39;Cartridge name&#39; as DB.DBA.RDF_LOAD_TWITTER_V2; </listitem>
<listitem>Configuration options: <itemizedlist mark="bullet" spacing="compact"><listitem>consumer_key=xxx </listitem>
<listitem>consumer_secret=xxx </listitem>
<listitem>friends_n_followers_pg_limit=0 </listitem>
<listitem>friends_n_followers_item_limit=20 </listitem>
<listitem>favorites_pg_limit=1 </listitem>
<listitem>user_timeline_pg_limit=1 <figure><graphic fileref="VirtCartConfigTwitter/twt9.png" /></figure> </listitem>
</itemizedlist></listitem>
</itemizedlist></listitem>
<listitem>Enter the API key and Secret Key noted in the cartridge&#39;s &quot;Options&quot; field as values for options consumer <emphasis>key and consumer_secret: <figure><graphic fileref="VirtCartConfigTwitter/twt10.png" /></figure> </emphasis></listitem>
<listitem>Click &#39;Update&quot; to save the &quot;Options&quot; settings.</listitem>
</orderedlist><bridgehead class="http://www.w3.org/1999/xhtml:h2">Granting an Access Token</bridgehead>
<para>The Twitter user whose profile is to be fetched should first grant an OAuth access token.
 This can be done through the Twitter button displayed by http://{<emphasis>your-virtuoso-host:port</emphasis>}/sponger:</para>
<orderedlist spacing="compact"><listitem>Go to http://{your-virtuoso-host:port}/sponger : <figure><graphic fileref="VirtCartConfigTwitter/twt11.png" /></figure> </listitem>
<listitem>Click the Twitter button: <figure><graphic fileref="VirtCartConfigTwitter/twt12.png" /></figure> </listitem>
<listitem>Click the &quot;Authorize app&quot; button.
</listitem>
<listitem>As result a notification for successful OAuth access token generation should be displayed: <figure><graphic fileref="VirtCartConfigTwitter/twt13.png" /></figure></listitem>
</orderedlist><para> Although it is not mandatory that each user grants an access token, at least one must have been granted so that requests to the Twitter REST API can be signed and Twitter can authenticate the caller.
 Thus one user&#39;s access token can be used to fetch another Network Resource user&#39;s profile.</para>
<para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2">View the Retrieved Data</bridgehead>
<para>The cartridge is configured to trigger on the URI pattern http://twitter.com/.*, i.e.
 the expected starting point for sponging a Twitter user&#39;s profile is a URL of the form http://twitter.com/{<emphasis>screen_name</emphasis>}.
 For example:</para>
<para> </para>
<orderedlist spacing="compact"><listitem>Access <ulink url="http://uriburner.com/about/html/http://twitter.com/kidehen">http://uriburner.com/about/html/http://twitter.com/kidehen</ulink> : <figure><graphic fileref="VirtCartConfigTwitter/twt14.png" /></figure> <figure><graphic fileref="VirtCartConfigTwitter/twt15.png" /></figure> </listitem>
<listitem>Click the primary topic value link &quot;Kingsley Uyi Idehen&quot;: <figure><graphic fileref="VirtCartConfigTwitter/twt16.png" /></figure> <figure><graphic fileref="VirtCartConfigTwitter/twt17.png" /></figure> <figure><graphic fileref="VirtCartConfigTwitter/twt18.png" /></figure></listitem>
</orderedlist><para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2">Alternative Follow-Your-Nose friendly view of a Twitter Data Object that represents a Person</bridgehead>
<para>We can take a look at the /fct variant of the primaryTopic object page:</para>
<orderedlist spacing="compact"><listitem>Click the <emphasis>Facets</emphasis> link from the footer section &quot;Alternative Linked Data Views&quot; of the page from above: <figure><graphic fileref="VirtCartConfigTwitter/twt19.png" /></figure> <figure><graphic fileref="VirtCartConfigTwitter/twt20.png" /></figure> </listitem>
<listitem>Click &quot;Next&quot; to view the next of the Attributes and their Values: <figure><graphic fileref="VirtCartConfigTwitter/twt21.png" /></figure> </listitem>
<listitem>Click &quot;Last&quot; to view the last page of Attributes and their Values: <figure><graphic fileref="VirtCartConfigTwitter/twt22.png" /></figure></listitem>
</orderedlist><para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2">Paging Options</bridgehead>
<para>Because some Twitter API responses can return thousands of items, the following cartridge options are available to set configurable limits on the number of items returned.
 (A value of 0 indicates no limit)</para>
friends_n_followers_pg_limit: <itemizedlist mark="bullet" spacing="compact"><listitem>Limits the number of pages of friends or followers returned.
 Each page can contain up to 5000 items.
 (Default: 0)</listitem>
</itemizedlist>friends_n_followers_item_limit: <itemizedlist mark="bullet" spacing="compact"><listitem>Overrides friends_n_followers_pg_limit.
 Limits the number of friends or followers returned to the specified number where 1 &lt; friends_n_followers_limit &lt;= 5000.
 (Default: 100)</listitem>
</itemizedlist>favorites_pg_limit: <itemizedlist mark="bullet" spacing="compact"><listitem>Limits the number of pages of favorites returned.
 Each page can contain up to 20 items.
 (Default: 5)</listitem>
</itemizedlist>user_timeline_pg_limit: <itemizedlist mark="bullet" spacing="compact"><listitem>Limits the number of tweets returned as part of a user timeline.
 Each page can contain up to 20 items.
 (Default: 5)</listitem>
</itemizedlist><para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2">Related</bridgehead>
<itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="VirtSponger">Virtuoso Sponger</ulink> </listitem>
<listitem><ulink url="VirtConfigureCartridges">Configure Sponger Cartridges Guide</ulink> </listitem>
<listitem><ulink url="http://ode.openlinksw.com/">The OpenLink Data Explorer Extension</ulink> </listitem>
<listitem><ulink url="http://delicious.com/kidehen/goodrelations">Meshups (links and lookups across Web 2.0 Services and LOD Cloud</ulink> </listitem>
<listitem><ulink url="VirtSpongerCartridgeSupportedDataSources">OpenLink-supplied Virtuoso Sponger Cartridges</ulink> <itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="VirtSpongerCartridgeSupportedDataSourcesVendorNonRDF">Complete list of supported Vendor-specific Non-RDF Data Formats</ulink> </listitem>
<listitem><ulink url="VirtSpongerCartridgeSupportedDataSourcesNonRDF">Complete list of supported Standard Non-RDF Data Formats</ulink> </listitem>
<listitem><ulink url="VirtSpongerCartridgeSupportedDataSourcesMeta">Complete list of supported Meta Cartridges</ulink> <itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="VirtSpongerCartridgeSupportedDataSourcesMetaREST">Meta Cartridge Usage via REST Request</ulink></listitem>
</itemizedlist></listitem>
</itemizedlist></listitem>
</itemizedlist></section></docbook>