Sie sind auf Seite 1von 7

Facebook ODA for BIRT

Version 1.0

Facebook ODA for BIRT User Guide v1.0


Authors: Debolina Ray Sylvan Sam Sugen S

10/14/2011

Page 1 of 7

Facebook ODA for BIRT

Version 1.0

1. Introduction
Facebook Query Language, or FQL, enables you to use a SQL-style interface to query the data exposed by the Facebook Graph Api. FB Oda Driver helps user to leverage this concept into a Birt Reports. Find the details of syntax, limitations, and features at http://developers.facebook.com/docs/reference/fql/ FQL supports 65 odd tables; each of them has a clearly documented with metadata explaining the columns in the table, its name, data type, significance of each column. For example http://developers.facebook.com/docs/reference/fql/album/ explains about the album table. With so many tables, the user has the freedom to generate any type of report or chart restricted only by imagination. Sample FQL: SELECT aid, owner, name, object_id FROM album WHERE aid="20531316728_324257" To try this query click https://api.facebook.com/method/fql.query?query=SELECT%20aid%2C%20owner%2C%2 0name%2C%20object_id%20FROM%20album%20WHERE%20aid%3D%2220531316728_ 324257%22&access_token=AAAAAAITEghMBAGFbR03lL974nwbAfa1oXZBlxDbECUfQZBIn bHNqkxW9aXrS1cYGIr6r9OER231xVgPHJfNSeGkK45X4QUJKKCuaIDXwZDZD Given below is the response for the FQL from facebook. This XML file does not appear to have any style information associated with it. The document tree is shown below. <fql_query_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3. org/2001/XMLSchema-instance" list="true"> <album> <aid>20531316728_324257</aid> <owner>20531316728</owner> <name>Happy Lunar New Year 2011</name> <object_id>10150146071791729</object_id> </album> </fql_query_response> FB Oda Driver converts this response to the Result Set which is configurable as BIRT Data Set.

10/14/2011

Page 2 of 7

Facebook ODA for BIRT

Version 1.0

2. Configuration Steps
2.1. Creating a New FB Data Source

Select the Facebook Data Source.

In the next tab, you configure properties for the Data Source.

10/14/2011

Page 3 of 7

Facebook ODA for BIRT

Version 1.0

Access Token (Optional parameter) is a connection token to Facebook. A connection to FB can either be an authenticated connection or an anonymous connection. Anonymous connection provides you the ability to access any public data available. For example visiting any page like http://www.facebook.com/cocacola does not require a facebook log in. Similarly to execute a FQL on public data u dont need an access token, Hence leave this property blank. For Example: SELECT name, fan_count FROM page WHERE username = 'Coca-Cola' Authenticated connection can be used to query non-public data. It's really easy with the Facebook Graph API. Sign in to Facebook and navigate to the Graph API Explorer app. Click the "Get Access Token" button. That's it! Read the section Not sure how to get an OAuth access token? in the link http://restfb.com/ When you generate a token, you will choose what all permissions you are granting for the query to work.

2.2.

Creating a New Data Set

Select the data source created in the step above and create a new data set as show below.

10/14/2011

Page 4 of 7

Facebook ODA for BIRT

Version 1.0

In the next page, you have to enter the FQL.

No authentication Queries ------------------------1)select uid, username, first_name, last_name from user where uid = 527712701 or uid = 701818496 or uid = 626835539 2) SELECT name, fan_count FROM page WHERE name = 'Coca-Cola'

Queries which need permission to access friends related info -------------------------------------------------------------1) SELECT uid1, uid2 FROM friend WHERE uid1 = 527712701 2) select uid, username, first_name, last_name from user where uid in (SELECT uid2 FROM friend WHERE uid1 = 527712701 )

10/14/2011

Page 5 of 7

Facebook ODA for BIRT

Version 1.0

Rest of the Data set connection is self explanatory, please follow the screen shots.

10/14/2011

Page 6 of 7

Facebook ODA for BIRT

Version 1.0

3. Developer Set up
Take a checkout from eclipse labs. Code & Project Details: Find source at http://code.google.com/a/eclipselabs.org/p/oda-driver-birt-fb/ You will find the source two eclipse plug in projects and a vendor library (RestFB). The two projects are com.birt.oda.fb and com.birt.oda.fb.ui The purposes of these projects are needless to be explained here. RestFB is an open source project which helps me execute FQL. If you want run this through eclipse you have to import this jar as a Plug in project.

4. Sample Reports
Find the compressed file SampleReports.zip at http://code.google.com/a/eclipselabs.org/p/oda-driver-birt-fb/downloads/list It contains Two Sample Report Design Files Corresponding sample queries Screenshots

10/14/2011

Page 7 of 7

Das könnte Ihnen auch gefallen