hackalive Posted June 3, 2012 Share Posted June 3, 2012 How does Facebook store graph objects (https://developers.facebook.com/docs/reference/api/)? What some technical details? Are they all in a flat/generic schema? Is the graph API abstracting out a bunch of data stores? Quote Link to comment https://forums.phpfreaks.com/topic/263589-graph-objects/ Share on other sites More sharing options...
smoseley Posted June 3, 2012 Share Posted June 3, 2012 Likely a combination of database (e.g. MySQL), cache (e.g. Couchbase), and search server (e.g. Sphinx) Quote Link to comment https://forums.phpfreaks.com/topic/263589-graph-objects/#findComment-1350863 Share on other sites More sharing options...
hackalive Posted June 3, 2012 Author Share Posted June 3, 2012 Likely a combination of database (e.g. MySQL), cache (e.g. Couchbase), and search server (e.g. Sphinx) Im trying to figure out how I can achieve this myself in MySQL/PHP, so if you can offer any more advice on maybe how I can construct it. Cheers Quote Link to comment https://forums.phpfreaks.com/topic/263589-graph-objects/#findComment-1350880 Share on other sites More sharing options...
smoseley Posted June 3, 2012 Share Posted June 3, 2012 You mean you want to develop an API? Not something I can teach you in one post, but not overly complex if you understand software development. Quote Link to comment https://forums.phpfreaks.com/topic/263589-graph-objects/#findComment-1350894 Share on other sites More sharing options...
hackalive Posted June 4, 2012 Author Share Posted June 4, 2012 Oh no I can build the API - Im just curious how you guys might suggest I do the "global unique ID" like they have. I was thinking like a master and central object table that then through PHP would reference to a page, event, photo, etc table. Was hoping you guys might have some better ways of doing it. Quote Link to comment https://forums.phpfreaks.com/topic/263589-graph-objects/#findComment-1350972 Share on other sites More sharing options...
smoseley Posted June 4, 2012 Share Posted June 4, 2012 You could do that. Might pose unnecessary overhead, though. Quote Link to comment https://forums.phpfreaks.com/topic/263589-graph-objects/#findComment-1350974 Share on other sites More sharing options...
hackalive Posted June 4, 2012 Author Share Posted June 4, 2012 So in that case - can you suggest better way please Quote Link to comment https://forums.phpfreaks.com/topic/263589-graph-objects/#findComment-1350998 Share on other sites More sharing options...
smoseley Posted June 4, 2012 Share Posted June 4, 2012 I already did, in your other thread on the topic. To reiterate: use a RESTful API architecture, where the URI identifies the resource: www.domain.com/user/1 = User #1 www.domain.com/image/1 = Image #1 There's no ambiguity in that. URIs were designed to represent resources, why reinvent the wheel when the current solution is so simple? Quote Link to comment https://forums.phpfreaks.com/topic/263589-graph-objects/#findComment-1351001 Share on other sites More sharing options...
hackalive Posted June 4, 2012 Author Share Posted June 4, 2012 As I already pointed out - I am trying to achieve a solution more inline with Facebooks Graph. Quote Link to comment https://forums.phpfreaks.com/topic/263589-graph-objects/#findComment-1351002 Share on other sites More sharing options...
smoseley Posted June 4, 2012 Share Posted June 4, 2012 Why? Their solution sucks. Quote Link to comment https://forums.phpfreaks.com/topic/263589-graph-objects/#findComment-1351004 Share on other sites More sharing options...
hackalive Posted June 4, 2012 Author Share Posted June 4, 2012 Okay so WHY does their solution suck from a developer point of view? I can see it useful in the fact you can go graph.facebook.com/1234567890/(photos,atendees,etc) and can easily get info from that "object". Quote Link to comment https://forums.phpfreaks.com/topic/263589-graph-objects/#findComment-1351005 Share on other sites More sharing options...
smoseley Posted June 4, 2012 Share Posted June 4, 2012 It sucks because: 1. It adds unnecessary overhead both on INSERT and on SELECT, 2. It circumvents a useful, elegant, meaningful HTTP architecture to unnecessarily abstract "objects". 3. It introduces API interface ambiguity, 4. It requires use of a BIGINT unique id for all "objects", and 5. It adds a lot of work to developing your API All the above, and doesn't offer a single quantifiable advantage. Just cause FB does it doesn't mean it's right. They're trying to design an API that idiots can use... not exactly the best premise for good design. Quote Link to comment https://forums.phpfreaks.com/topic/263589-graph-objects/#findComment-1351006 Share on other sites More sharing options...
hackalive Posted June 4, 2012 Author Share Posted June 4, 2012 So how would you achieve the same abilities without doing it like they have? In that being able to get all photos from object "96567" which you have NO idea if it is an album, event, page or person? Quote Link to comment https://forums.phpfreaks.com/topic/263589-graph-objects/#findComment-1351008 Share on other sites More sharing options...
smoseley Posted June 4, 2012 Share Posted June 4, 2012 That's my point in interface ambiguity. Not knowing what you're asking for is a BAD thing in application development. Let's say I ask for all photos for facebook.com/12345 - great... that may work for all their "objects". But what happens when I ask for "first_name" and 12345 turns out to be an event? Events don't HAVE a first_name Point is, if you use an explicit HTTP interface, the uri defines what TYPE of object you're asking for AS WELL AS its identity. So I can say www.yourdomain.com/user/12345 and KNOW what I can do with that resource. I have nothing else to add to this discussion. If I haven't convinced you yet, I wish you the best of luck in your career. Quote Link to comment https://forums.phpfreaks.com/topic/263589-graph-objects/#findComment-1351009 Share on other sites More sharing options...
hackalive Posted June 4, 2012 Author Share Posted June 4, 2012 smoseley: Im always open to opinions - im just trying to evaluate the best way forward as you have given me a fir bit to think of. Facebook does allow you todo metadata=1 which tells you all the attributes you can call for say 1234567 Quote Link to comment https://forums.phpfreaks.com/topic/263589-graph-objects/#findComment-1351011 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.