Accessing and Analyzing Twitter Feeds with Oracle Stream Analytics (Part 1)

Oracle Stream Analytics

The new release of Oracle Stream Analytics (OSA) contains a host of new features some of which are connection capability to Twitter, geo-spatial Exploration display and machine learning based data analysis. In combination those features make OSA an excellent tool for implementing a Twitter sentiment monitoring application. This is Part 1 of a 3 part series demonstrating how to use OSA to monitor a Twitter data stream and analyze the stream for geographical and sentiment information. Part 1 will show how to create a connection to Twitter and stream tweets into OSA. Part 2 will show how to display geographical origin of tweets. Part 3 will show how to analyze the tweet stream for sentiment information.

Accessing Twitter

The Twitter developer platform provides a REST API, OAuth authentication, Twitter widgets to embed in Web and mobile apps etc. To define the OSA connection to Twitter, create OAuth credentials at Twitter. Then use the built in Twitter adapter provided in OSA 12.2.1 to access a tweet stream.

At Twitter create an application definition

twitter app management-create new app

click the “Create New App” button to create the app. Fill in Name, Description and Website fields – agree to the developer agreement and click “Create your Twitter application” button at the bottom of the page. The new application will have a Consumer Key and Consumer Secret, you will also need Access Token and Access Token Secret so click the “Create my access token” button.

twitter app keys

Record the four key strings as shown above.

OSA Connection

In OSA create the connection definitionOSA catalog create connection

provide a Name and select Twitter for the connection type. On the next dialog page paste the key strings recorded earlier from the Twitter application and click “Save”.

twitter connection keys

OSA Stream

Once the connection is defined it is used to create a stream. Select “Stream” from the “Create New Item” menu and enter Name, Description, Tags and pick Twitter from the Stream Type drop down list.You can also select the “Create Exploration” check box to automatically start the Exploration dialog. On the next page of the stream dialog select the just created connection and enter a comma separated list of Twitter hashtags for the stream.

OSA stream create

On the last page of the stream dialog select “TwitterShape” from the “Select Existing Shape” drop down list.

OSA stream twitter shape

OSA Exploration

The create exploration dialog will open after the stream is created. Enter a Name, Description and Tags for the exploration. Select the newly created Stream as the Source and click the Create button.

OSA exploration create

The exploration will show the raw data for the Tweets on the hashtag.

OSA exploration tweets

Next

In part 2 we’ll look at using the geographical data in the stream (latitude/longitude of tweeter) to create a spatial exploration displaying where tweets originate.

Add Your Comment