From niallo at metaweb.com Tue May 1 00:43:48 2007 From: niallo at metaweb.com (Niall O'Higgins) Date: Mon, 30 Apr 2007 17:43:48 -0700 Subject: [Developers] Sandbox.freebase.com update Message-ID: <46368D44.5000104@metaweb.com> Weekly update of software and data for sandbox.freebase.com is underway. -- Niall O'Higgins Software Engineer Metaweb Technologies, Inc. From alecf at metaweb.com Tue May 1 20:54:58 2007 From: alecf at metaweb.com (Alec Flett) Date: Tue, 01 May 2007 13:54:58 -0700 Subject: [Developers] Flash Data Mob #3: Film Subjects Message-ID: <4637A922.50905@metaweb.com> We continue this week in the film/tv arena.... Last week I discovered my new favorite property: "Film Subject" What I really like about this property is that it allows the film domain to creep into places where it doesn't belong.. but often there is a wikipedia article on whatever subject you can imagine. It's the film domain's own form of viral marketing! If you visit the page on the RMS Titanic: http://www.freebase.com/view?id=%239202a8c04000641f80000000000348e2 You'll see that the movie "Titanic" covers that topic: http://www.freebase.com/view?id=%239202a8c04000641f8000000000065fe4 But even though we have some 23,000+ films, we have a mere 31 film subjects.. almost third of which I have entered myself :) What's great about Film Subjects is that they can be vague and sometimes comical - and it often assigns a type to an abstract concept that would be hard to "Type" in freebase. I mean just look at this list... http://www.freebase.com/view/filter?id=/film/film_subject Everything from Boxing to Existentialism to Lucid Dreaming! Ever want to know movies about the suburbs, Jake LaMotta or extramarital affairs? Let freebase be your source. The task this week is to see if we can flush "film subject" out to a few hundred subjects. Here's what you can do: I've provided a few links below to movies that specific actors have been in - I'm hoping this provides a good diversity of subjects across well known films but feel free to search for your own favorite/obscure movies. Pick a few and assign some film subjects. For bonus points, add some new movies that aren't already assigned to these actors. (I've found the easiest thing to do is hold down the Control/command button while clicking on 10 films at a time to load them in 10 separate tabs... then go tab-by-tab to add film subjects) Tom Hanks: http://www.freebase.com/view/reorder?id=%239202a8c04000641f800000000005732e&propertyId=%2Ffilm%2Factor%2Ffilm Parker Posey: http://www.freebase.com/view/reorder?id=%239202a8c04000641f80000000002b70c9&propertyId=%2Ffilm%2Factor%2Ffilm Audrey Hepburn: http://www.freebase.com/view/reorder?id=%239202a8c04000641f8000000000065973&propertyId=%2Ffilm%2Factor%2Ffilm Jack Nicholson: http://www.freebase.com/view/reorder?id=%239202a8c04000641f800000000004b545&propertyId=%2Ffilm%2Factor%2Ffilm Halle Berry: http://www.freebase.com/view/reorder?id=%239202a8c04000641f800000000001c692&propertyId=%2Ffilm%2Factor%2Ffilm Luke Wilson: http://www.freebase.com/view/reorder?id=%239202a8c04000641f8000000000306a90&propertyId=%2Ffilm%2Factor%2Ffilm Owen Wilson: http://www.freebase.com/view/reorder?id=%239202a8c04000641f80000000001b7eaf&propertyId=%2Ffilm%2Factor%2Ffilm I'll report back in a few days so we can see how many film subjects we've come up with... And again, if someone wants to do a MJT page tracking this challenge, please post here with a url... Alec From niallo at metaweb.com Wed May 2 00:23:23 2007 From: niallo at metaweb.com (Niall O'Higgins) Date: Tue, 01 May 2007 17:23:23 -0700 Subject: [Developers] www.freebase.com software updated Message-ID: <4637D9FB.8030405@metaweb.com> Currently deploying software update to www.freebase.com. May be some minimal downtime. -- Niall O'Higgins Software Engineer Metaweb Technologies, Inc. From niallo at metaweb.com Wed May 2 00:54:52 2007 From: niallo at metaweb.com (Niall O'Higgins) Date: Tue, 01 May 2007 17:54:52 -0700 Subject: [Developers] www.freebase.com software updated In-Reply-To: <4637D9FB.8030405@metaweb.com> References: <4637D9FB.8030405@metaweb.com> Message-ID: <4637E15C.1080500@metaweb.com> Update completed successfully. Niall O'Higgins wrote: > Currently deploying software update to www.freebase.com. May be some > minimal downtime. > > -- Niall O'Higgins Software Engineer Metaweb Technologies, Inc. From jack at metaweb.com Wed May 2 02:01:24 2007 From: jack at metaweb.com (Jack Alves) Date: Tue, 1 May 2007 19:01:24 -0700 Subject: [Developers] query to determine if a property has at least one link Message-ID: I wrote a mjt script that queries topics of a specified type and counts the number of properties that have at least one link (value or instance). http://taco/~jack/mjt/TypeCoverage.html?domain=aviation&type=aircraft_model& prop_key=manufacturer Can you recommend a low cost query for this script? The following works but returns too much data, [{ "id":null, "maiden_flight":[{}], "type":"/aviation/aircraft_model" }] The following seems to works for properties that expect value types or instances with a single type, [{ "id":null, "maiden_flight":[{ "limit":1, "type":null }], "name":null, "type":"/aviation/aircraft_model" }] The query fails if the property instance has multiple types, [{ "id":null, "manufacturer":[{ "limit":1, "type":null }], "name":null, "type":"/aviation/aircraft_model" }] I can fix the query to work for property instances that have multiple types, [{ "id":null, "manufacturer":[{ "limit":1, "type":[] }], "name":null, "type":"/aviation/aircraft_model" }] but then the query fails for value types with, "message": "value field 'type' must be null or a value", [{ "id":null, "maiden_flight":[{ "limit":1, "type":[] }], "name":null, "type":"/aviation/aircraft_model" }] Another option I thought of is to query for the expected type of the property then generate the compatible query. From jg at metaweb.com Wed May 2 06:27:24 2007 From: jg at metaweb.com (John Giannandrea) Date: Tue, 1 May 2007 23:27:24 -0700 Subject: [Developers] query to determine if a property has at least one link In-Reply-To: References: Message-ID: Jack Alves wrote: > but then the query fails for value types with, "message": "value field > 'type' must be null or a value", that seems unfortunate, Ill let Tim determine if its a bug not to accept [] there. I noticed you cant say type : {"limit":1} in a value clause either. here is a workaround for what I think you are trying to do. [{ "id":null, "manufacturer":{ "limit":1, "link":null }, "name":null, "type":"/aviation/aircraft_model" }] -jg From jack at metaweb.com Wed May 2 16:48:32 2007 From: jack at metaweb.com (Jack Alves) Date: Wed, 2 May 2007 09:48:32 -0700 Subject: [Developers] mjt timeout Message-ID: Is there a way to set the timeout duration for a mjt script? I have a script that extracts a lot of data (22,000 films). The query succeeds. I think the timeout is due to data transfer time. http://mqlx.com/~jack/mjt/typeCoverage.html?domain=film&type=film&prop_key=s tarring /XXX/mjt/message/script_timeout : browser could not contact the server The script executes the following query: [{ "id":null, "limit":0, "starring":{ "limit":1, "link":null }, "type":"/film/film" }] In queryeditor this query succeeds within a minute or hangs Firefox. From larry at maccherone.com Thu May 3 13:17:35 2007 From: larry at maccherone.com (Larry Maccherone) Date: Thu, 3 May 2007 06:17:35 -0700 Subject: [Developers] API for queries Message-ID: <420052FE54B9344D9B2CA758B7BF396801E32058@EXVS01.ex.dslextreme.net> I found this mailing list from the mjt site. Having used Kid and Genshi, I'm very impressed with mjt. It's now at the top of the short list for a project I'm ramping up. Keep up the good work. However, that's not the reason for my email. Another aspect of this project is also related to the work you are doing at freebase. I need a RESTful interface to my data. I'm going to build the controller myself and I'm now in the process of designing the URL conventions. I was hoping to mimic the conventions of some popular service or tool but that's not working out great. I looked at Amazon's S3. The biggest problem there is that as far as I can tell, the only query capability is a match at the start of the key. Also, I'm also a bit worried about the flat key/data model. That probably helps performance but it means that the object lives in that place forever. So access to http://mydata/invoices/1234/invoicelines is impossible. I'd have to imbed the invoice key as the start of the key for the invoicelines bucket or I'd have to store pointers to the keys for the invoicelines inside the invoices/1234 object. Neither is a good fit for my mental model which is a RESTful interface to (probably normalized) table data. I looked at MS Code Named Astoria (http://astoria.mslivelabs.com/gettingStarted.aspx). It's closer to my tables of data mental model and it includes a lot of the concepts that I was planning on including: skip/top, expand, callback, orderby, etc. It specifies the python/javascript square bracket key notation right in the URL so the address for invoice 1234 is http://mydata/invoices[1234]/ and its lines are at http://mydata/invoices[1234]/invoicelines . It deviates from Python/JavaScript notation in that you can embed very simple queries in the brackets. You could write http://mydata/invoices[OrderDate gt '1998-1-1'], where "gt" means ">". At first blush I can't think of a concrete objection to this but my instinct is that this sort of thing should be done in the URL parameters. So I would prefer http://mydata/invoices/1234 and http://mydata/invoices?OrderDate='>1998-1-1 References: <420052FE54B9344D9B2CA758B7BF396801E32058@EXVS01.ex.dslextreme.net> Message-ID: <463A28D7.9000605@metaweb.com> Larry Maccherone wrote: > I can sort of reverse engineer the freebase URL and query scheme by > looking at the output of the query builder (URL encoded JSON query > string). It looks like your scheme may be a better fit. Can I get > access to the freebase docs that fully describes the URL mechanisms? > Also, I'd like to hear your opinion on the Astoria URL scheme. Do you > think square bracket notation will be a problem down the road? > > As an aside, I'm also curios about why implemented your own database. > I'm planning on using SQL. Thanks for your positive feedback on MJT. I'll let someone more knowledgeable take the detailed URL questions, but in general, we're focused on making the URLs Freebase as clean and meaningful as possible, and it's something we continue to think about. Why did we implement our own database language and not use SQL? We use MQL to generate the views you see on the Freebase website, and we want you to have full access to the underlying structures in Freebase. MQL is designed from the start to match these structures, while SQL assumes a tables and rows view of data. --Pat From sm at metaweb.com Thu May 3 18:57:12 2007 From: sm at metaweb.com (Scott Meyer) Date: Thu, 03 May 2007 11:57:12 -0700 Subject: [Developers] API for queries In-Reply-To: <420052FE54B9344D9B2CA758B7BF396801E32058@EXVS01.ex.dslextreme.net> References: <420052FE54B9344D9B2CA758B7BF396801E32058@EXVS01.ex.dslextreme.net> Message-ID: <463A3088.4030001@metaweb.com> Larry Maccherone wrote: > As an aside, I?m also curios about why implemented your own database. > I?m planning on using SQL. While it is possible to represent a graph as SQL tables, the resulting general purpose data model will perform abysmally as it will require multiple joins or selects (sometimes both) for even the simplest queries. If you can expose a specific schema to SQL and your queries are more tree-like than graphical, you may be able to get reasonable performance, but neither of those restrictions work for us: we need a general-purpose schema-last data model and we need to support graphical queries. As for the URL documentation, http://www.freebase.com/view/documentation/ is a good start, chapter 4 specifically. Regards, -Scott From niallo at metaweb.com Tue May 8 00:16:44 2007 From: niallo at metaweb.com (Niall O'Higgins) Date: Mon, 07 May 2007 17:16:44 -0700 Subject: [Developers] sandbox.freebase.com data refresh Message-ID: <463FC16C.70201@metaweb.com> Hi, Weekly sandbox.freebase.com data refresh will occur shortly. -- Niall O'Higgins Software Engineer Metaweb Technologies, Inc. From niallo at metaweb.com Tue May 8 00:38:15 2007 From: niallo at metaweb.com (Niall O'Higgins) Date: Mon, 07 May 2007 17:38:15 -0700 Subject: [Developers] sandbox.freebase.com data refresh In-Reply-To: <463FC16C.70201@metaweb.com> References: <463FC16C.70201@metaweb.com> Message-ID: <463FC677.2050801@metaweb.com> Refresh complete. Niall O'Higgins wrote: > Hi, > > Weekly sandbox.freebase.com data refresh will occur shortly. > > -- Niall O'Higgins Software Engineer Metaweb Technologies, Inc. From robert at metaweb.com Tue May 8 19:53:27 2007 From: robert at metaweb.com (Robert Cook) Date: Tue, 8 May 2007 12:53:27 -0700 Subject: [Developers] Refactoring into "Data World" domain Message-ID: I just created a new domain for tracking and organizing data import projects. I moved some types from the /common and /freebase domains into it and added several others. http://www.freebase.com/view/domain?id=/dataworld The types moved are: /common/data_project_type /common/data_project /common/information_source /common/mass_data_operation /freebase/type_project /freebase/type_status /freebase/type_project_mediator If you have written code that depends on these types, you will have to update it. It's not generally a good policy to move types like this, but as these are support types and we are still in Alpha, we went ahead. In the future, we will put together a more formal communication system for such changes. Robert From will at hamstersoup.com Wed May 9 14:09:06 2007 From: will at hamstersoup.com (Will Moffat) Date: Wed, 9 May 2007 16:09:06 +0200 Subject: [Developers] Freebase users on Google Maps: Better MQL? Message-ID: <2f665fe20705090709m6fcb24fck657cc66b1fa4072b@mail.gmail.com> Hi, I'm trying to improve the MQL queries (see below) that I use for my mashup "Freebase users on Google Maps" http://hamstersoup.wordpress.com/ Since many people haven't filled in "my_full_name" in their user profile I also search on their username. I have to make 2 almost identical queries (and get 2 almost identical sets of results) because of a lack of an OR construct in MQL. This seems pretty inefficient. Am I missing something? Is there a better way? thanks, --Will Query1: Search for users with "fi" in their username: [{ "id":null, "limit":10, "location":[{ "geolocation":{ "latitude":null, "longitude":null }, "id":null, "limit":1, "name":null }], "my_full_name":null, "name":null, "name~=":"*fi*", "personal_quote":null, "type":"/freebase/user_profile" }] Query2: Search for users with "fi" in their full name [{ "id":null, "limit":10, "location":[{ "geolocation":{ "latitude":null, "longitude":null }, "id":null, "limit":1, "name":null }], "my_full_name":null, "my_full_name~=":"*fi*", "name":null, "personal_quote":null, "type":"/freebase/user_profile" }] From kurt at metaweb.com Wed May 9 16:32:52 2007 From: kurt at metaweb.com (Kurt Bollacker) Date: Wed, 9 May 2007 09:32:52 -0700 Subject: [Developers] Freebase users on Google Maps: Better MQL? In-Reply-To: <2f665fe20705090709m6fcb24fck657cc66b1fa4072b@mail.gmail.com> References: <2f665fe20705090709m6fcb24fck657cc66b1fa4072b@mail.gmail.com> Message-ID: <20070509163252.GM27529@metaweb.com> On Wed, May 09, 2007 at 04:09:06PM +0200, Will Moffat wrote: > Hi, > > I'm trying to improve the MQL queries (see below) that I use for my > mashup "Freebase users on Google Maps" > http://hamstersoup.wordpress.com/ > > Since many people haven't filled in "my_full_name" in their user > profile I also search on their username. I have to make 2 almost > identical queries (and get 2 almost identical sets of results) > because of a lack of an OR construct in MQL. This seems pretty > inefficient. > > Am I missing something? Is there a better way? You're not missing anything obvious. There *is* a way to combine these into a single using the "/type/reflect" reflection properties. The query is not pretty, but does allow a limited OR construct. Your query could be rewritten to look like: { "query":[{ "/type/reflect/any_value":[{ "link":{ "master_property":{ "id":null, "id|=":["/type/object/name","/freebase/user_profile/my_full_name"] } }, "type":"/type/text", "value":null, "value~=":"*fi*" }], "id":null, "limit":10, "location":[{ "geolocation":{ "latitude":null, "longitude":null }, "id":null, "limit":1, "name":null }], "my_full_name":null, "name":null, "personal_quote":null, "type":"/freebase/user_profile" }] } I hope this helps... Kurt :-) > thanks, > --Will > > > Query1: Search for users with "fi" in their username: > [{ > "id":null, > "limit":10, > "location":[{ > "geolocation":{ > "latitude":null, > "longitude":null > }, > "id":null, > "limit":1, > "name":null > }], > "my_full_name":null, > "name":null, > "name~=":"*fi*", > "personal_quote":null, > "type":"/freebase/user_profile" > }] > > Query2: Search for users with "fi" in their full name > [{ > "id":null, > "limit":10, > "location":[{ > "geolocation":{ > "latitude":null, > "longitude":null > }, > "id":null, > "limit":1, > "name":null > }], > "my_full_name":null, > "my_full_name~=":"*fi*", > "name":null, > "personal_quote":null, > "type":"/freebase/user_profile" > }] > _______________________________________________ > Developers mailing list > Developers at freebase.com > http://lists.freebase.com/mailman/listinfo/developers From will at hamstersoup.com Fri May 11 14:33:33 2007 From: will at hamstersoup.com (Will Moffat) Date: Fri, 11 May 2007 16:33:33 +0200 Subject: [Developers] Freebase users on Google Maps: Better MQL? In-Reply-To: <20070509163252.GM27529@metaweb.com> References: <2f665fe20705090709m6fcb24fck657cc66b1fa4072b@mail.gmail.com> <20070509163252.GM27529@metaweb.com> Message-ID: <2f665fe20705110733u38ee18bfr1fe9e5563e163052@mail.gmail.com> > You're not missing anything obvious. There *is* a way to combine > these into a single using the "/type/reflect" reflection properties. Thanks Kurt, I don't think I would have figured that out myself from the current documentation. I updated my 'Freebase users on Google Maps' applet with your suggested MQL. http://hamstersoup.wordpress.com Next question: Is there a way to match an empty field? I can match user profiles with a geolocation with the query below. But how could I match users _without_ a geolocation? I could query all users and post-process but it seems like it would be more efficient if there was a MQL construct like "geolocation":undefined thanks for your help, --Will Query to show users '*fi*' and their geolocation: [{ "id":null, "limit":10, "location":[{ "geolocation":{ "latitude":null, "longitude":null }, "name":null }], "name":null, "name~=":"*fi*", "type":"/freebase/user_profile" }] From kurt at metaweb.com Fri May 11 18:53:52 2007 From: kurt at metaweb.com (Kurt Bollacker) Date: Fri, 11 May 2007 11:53:52 -0700 Subject: [Developers] Freebase users on Google Maps: Better MQL? In-Reply-To: <2f665fe20705110733u38ee18bfr1fe9e5563e163052@mail.gmail.com> References: <2f665fe20705090709m6fcb24fck657cc66b1fa4072b@mail.gmail.com> <20070509163252.GM27529@metaweb.com> <2f665fe20705110733u38ee18bfr1fe9e5563e163052@mail.gmail.com> Message-ID: <20070511185352.GB27529@metaweb.com> On Fri, May 11, 2007 at 04:33:33PM +0200, Will Moffat wrote: > Next question: Is there a way to match an empty field? > > I can match user profiles with a geolocation with the query below. But > how could I match users _without_ a geolocation? I could query all > users and post-process but it seems like it would be more efficient if > there was a MQL construct like "geolocation":undefined You are asking for a general NOT operator, which MQL currently does not have. This is not to say we won't add such a feature at some point in the future. However, for now your best bet is to filter as you suggest. Kurt :-) > thanks for your help, > --Will > > Query to show users '*fi*' and their geolocation: > [{ > "id":null, > "limit":10, > "location":[{ > "geolocation":{ > "latitude":null, > "longitude":null > }, > "name":null > }], > "name":null, > "name~=":"*fi*", > "type":"/freebase/user_profile" > }] From nix at metaweb.com Fri May 11 20:39:11 2007 From: nix at metaweb.com (Nick Thompson) Date: Fri, 11 May 2007 13:39:11 -0700 Subject: [Developers] mjt 0.4 is released Message-ID: <4644D46F.1060602@metaweb.com> Mjt 0.4 has been released to http://mjtemplate.org/ . The most noticeable change in this release is the inclusion of many more examples: http://mjtemplate.org/examples/ . Try "view source..." on any of the examples - for the single-page examples this will show you the entire application's source code. There is an experimental mjt.rnc schema that describes the Mjt extensions to XHTML in RelaxNG compact syntax - most Mjt code can now be validated against this schema. Other changes include many cleanups, bugfixes, and speedups, as well as infrastructure to support more complex Mjt applications. Bugs and questions can be sent to this list or to me directly... nick From daepark at metaweb.com Fri May 11 21:26:17 2007 From: daepark at metaweb.com (Dae Park) Date: Fri, 11 May 2007 14:26:17 -0700 Subject: [Developers] Recently edited types Message-ID: <6CE7CDDD-8508-49C1-A8A8-110B696BC7E4@metaweb.com> I would like to get the most recently edited types for our new domains page. Edited meaning either: 1. the type name 2. the type key 3. adding a new property 4. deleting a new property 5. editing a property name 6. editing a property key 7. modifying the expected type of a property It seems like this is doable using the /type/reflect reflection properties but I'm not too familiar with this syntax. 1 million bonus points will be awarded to the first one with the right answer! -dae From niallo at metaweb.com Mon May 14 23:44:33 2007 From: niallo at metaweb.com (Niall O'Higgins) Date: Mon, 14 May 2007 16:44:33 -0700 Subject: [Developers] Sandbox data refresh Message-ID: <4648F461.2030805@metaweb.com> Hi, Weekly http://sandbox.freebase.com data refresh will be happening over the next few minutes. -- Niall O'Higgins Software Engineer Metaweb Technologies, Inc. From niallo at metaweb.com Tue May 15 00:06:57 2007 From: niallo at metaweb.com (Niall O'Higgins) Date: Mon, 14 May 2007 17:06:57 -0700 Subject: [Developers] Sandbox data refresh In-Reply-To: <4648F461.2030805@metaweb.com> References: <4648F461.2030805@metaweb.com> Message-ID: <4648F9A1.4070605@metaweb.com> Refresh complete. Niall O'Higgins wrote: > Hi, > > Weekly http://sandbox.freebase.com data refresh will be happening over > the next few minutes. > > -- Niall O'Higgins Software Engineer Metaweb Technologies, Inc. From niallo at metaweb.com Tue May 15 00:43:50 2007 From: niallo at metaweb.com (Niall O'Higgins) Date: Mon, 14 May 2007 17:43:50 -0700 Subject: [Developers] Sandbox software update Message-ID: <46490246.4030601@metaweb.com> Hi, Updating http://sandbox.freebase.com software now. -- Niall O'Higgins Software Engineer Metaweb Technologies, Inc. From niallo at metaweb.com Tue May 15 01:19:18 2007 From: niallo at metaweb.com (Niall O'Higgins) Date: Mon, 14 May 2007 18:19:18 -0700 Subject: [Developers] Sandbox software update In-Reply-To: <46490246.4030601@metaweb.com> References: <46490246.4030601@metaweb.com> Message-ID: <46490A96.7000508@metaweb.com> Update complete. Niall O'Higgins wrote: > Hi, > > Updating http://sandbox.freebase.com software now. > > -- Niall O'Higgins Software Engineer Metaweb Technologies, Inc. From peter.boot at gmail.com Tue May 15 09:29:09 2007 From: peter.boot at gmail.com (Peter Boot) Date: Tue, 15 May 2007 19:29:09 +1000 Subject: [Developers] wildcard search in PHP Message-ID: <611cae850705150229g5470cde7nc4a4d422a8872b3f@mail.gmail.com> I am trying to extend the example code albumlist.php to perform a wildcard search. The query array, shown below, that works in the Query Editor does not work in PHP. The $response["qname"]["status"] variable in metaweb.php is ./mql/status/error' . $query = array("type" => "/music/artist", "name" => null , "name~=" => "^" . $band . "*" ); Can some one please tell me what I am doing wrong ? thanks Peter From jg at metaweb.com Tue May 15 16:32:28 2007 From: jg at metaweb.com (John Giannandrea) Date: Tue, 15 May 2007 09:32:28 -0700 Subject: [Developers] wildcard search in PHP In-Reply-To: <611cae850705150229g5470cde7nc4a4d422a8872b3f@mail.gmail.com> References: <611cae850705150229g5470cde7nc4a4d422a8872b3f@mail.gmail.com> Message-ID: Hi Can you send us the php fragment? The way php handles null in arrays is a little different from JS. Take a look at the example here: http://www.freebase.com/view/documentation/ch04.html#metaweb.php -jg Peter Boot wrote: > I am trying to extend the example code albumlist.php to perform a > wildcard search. The query array, shown below, that works in the > Query Editor does not work in PHP. The $response["qname"]["status"] > variable in metaweb.php is ./mql/status/error' . From will at metaweb.com Tue May 15 17:05:40 2007 From: will at metaweb.com (will) Date: Tue, 15 May 2007 10:05:40 -0700 Subject: [Developers] wildcard search in PHP In-Reply-To: <611cae850705150229g5470cde7nc4a4d422a8872b3f@mail.gmail.com> References: <611cae850705150229g5470cde7nc4a4d422a8872b3f@mail.gmail.com> Message-ID: <4649E864.4010604@metaweb.com> hi peter, i don't think the problem is with null value in php. when you're making a wildcard query you'll get back a list of bands. this means you'll need to add an array on the outside to hold the list. you'll also have to traverse the array differently than in the example by first iterating over each band found, and then iterate over each album by the band. try something like: // Build a MQL request for the list of albums by a list of band $query = array(array("type" => "/music/artist", "name" => null, "name~=" => "^$band*", "album" => array())); // Insert your own freebase.com cookie data into the string below $credentials = 'metaweb-user=YOUR_METAWEB-USER_COOKIE_HERE'; // Submit the query using the utility function defined earlier $result = $metaweb->read($query, $credentials); // iterate over each band found foreach ($result as $item) { echo "band: " . $item["name"] . "
"; $albums = $item["album"]; // iterate over each album of a band foreach ($albums as $album) echo "
  • " . $album . "

  • "; } will Peter Boot wrote: > I am trying to extend the example code albumlist.php to perform a > wildcard search. The query array, shown below, that works in the > Query Editor does not work in PHP. The $response["qname"]["status"] > variable in metaweb.php is ./mql/status/error' . > > $query = array("type" => "/music/artist", > "name" => null , > "name~=" => "^" . $band . "*" ); > > Can some one please tell me what I am doing wrong ? > > thanks > > Peter From peter.boot at gmail.com Tue May 15 23:46:56 2007 From: peter.boot at gmail.com (Peter Boot) Date: Wed, 16 May 2007 09:46:56 +1000 Subject: [Developers] wildcard search in PHP In-Reply-To: <4649E864.4010604@metaweb.com> References: <611cae850705150229g5470cde7nc4a4d422a8872b3f@mail.gmail.com> <4649E864.4010604@metaweb.com> Message-ID: <611cae850705151646u5dc68b20x5e2baa5b3d08671a@mail.gmail.com> That worked thanks for your help, still getting my mind around MQL I ended up using this $query = array(array("type" => "/music/artist", "name" => null, "name~=" => "^$band*", "id" => array())); On 5/16/07, will wrote: > hi peter, > > i don't think the problem is with null value in php. when you're making > a wildcard query you'll get back a list of bands. this means you'll need > to add an array on the outside to hold the list. you'll also have to > traverse the array differently than in the example by first iterating > over each band found, and then iterate over each album by the band. > > try something like: > > // Build a MQL request for the list of albums by a list of band > $query = array(array("type" => "/music/artist", > "name" => null, > "name~=" => "^$band*", > "album" => array())); > > // Insert your own freebase.com cookie data into the string below > $credentials = 'metaweb-user=YOUR_METAWEB-USER_COOKIE_HERE'; > > // Submit the query using the utility function defined earlier > $result = $metaweb->read($query, $credentials); > > // iterate over each band found > foreach ($result as $item) { > echo "band: " . $item["name"] . "
    "; > $albums = $item["album"]; > // iterate over each album of a band > foreach ($albums as $album) echo "
  • " . $album . "

  • "; > } > > will > > Peter Boot wrote: > > I am trying to extend the example code albumlist.php to perform a > > wildcard search. The query array, shown below, that works in the > > Query Editor does not work in PHP. The $response["qname"]["status"] > > variable in metaweb.php is ./mql/status/error' . > > > > $query = array("type" => "/music/artist", > > "name" => null , > > "name~=" => "^" . $band . "*" ); > > > > Can some one please tell me what I am doing wrong ? > > > > thanks > > > > Peter > From niallo at metaweb.com Wed May 16 00:22:29 2007 From: niallo at metaweb.com (Niall O'Higgins) Date: Tue, 15 May 2007 17:22:29 -0700 Subject: [Developers] www.freebase.com software updated Message-ID: <464A4EC5.7080904@metaweb.com> Hi, Software on www.freebase.com has been updated. -- Niall O'Higgins Software Engineer Metaweb Technologies, Inc. From brendan at metaweb.com Thu May 17 18:58:26 2007 From: brendan at metaweb.com (brendan neutra) Date: Thu, 17 May 2007 11:58:26 -0700 Subject: [Developers] mjt timeout In-Reply-To: References: Message-ID: <464CA5D2.2050805@metaweb.com> you should use a cursor in a loop. I think the documentation covers this. http://www.freebase.com/view/documentation/ch04.html#readall.py I haven't tried the sample code but I think it's about right. Basically, you request a cursor ("cursor":true) and a limit (e.g. "limit":100) then you use the cursor that's returned to grab the next page of results. That way you can grab a chunk at a time. Asking for thousands of results in one query hogs resources from the database (especially, if you accidentally ask for millions of things). The timeout is a "feature" in that it forces users to use cursors and throttles their request a little. example first query: { "cursor":true, "query":[{ "artist":"Sting", "limit":2, "name":null, "release_date":null, "sort":"release_date", "type":"/music/album" }] } response: { "cursor":"eNorzi8qsSo2sTK0tDBLtzQyMEq0SDYwMTAwMDMxTLMwgAKjtCTjFGMTABz3C5E=", "result":[{ "artist":"Sting", "name":"The Dream of the Blue Turtles", "release_date":"1985", "type":"/music/album" },{ "artist":"Sting", "name":"Bring on the Night (disc 1)", "release_date":"1986", "type":"/music/album" }], "status":"/mql/status/ok" } next query: { "cursor":"eNorzi8qsSo2sTK0tDBLtzQyMEq0SDYwMTAwMDMxTLMwgAKjtCTjFGMTABz3C5E=", "query":[{ "artist":"Sting", "limit":2, "name":null, "release_date":null, "sort":"release_date", "type":"/music/album" }] } response: { "cursor":"eNorzi8qsSo2sTK0tDBPtzQyMEq0SDYwMTAwMDMxTLMwgAEzY8vURHMAG3oLaQ==", "result":[{ "artist":"Sting", "name":"Bring on the Night (disc 2)", "release_date":"1986", "type":"/music/album" },{ "artist":"Sting", "name":"...Nothing Like the Sun", "release_date":"1987", "type":"/music/album" }], "status":"/mql/status/ok" } Brendan Jack Alves wrote: > Is there a way to set the timeout duration for a mjt script? I have a script > that extracts a lot of data (22,000 films). The query succeeds. I think the > timeout is due to data transfer time. > > http://mqlx.com/~jack/mjt/typeCoverage.html?domain=film&type=film&prop_key=s > tarring > > /XXX/mjt/message/script_timeout : browser could not contact the server > > The script executes the following query: > > [{ > "id":null, > "limit":0, > "starring":{ > "limit":1, > "link":null > }, > "type":"/film/film" > }] > > In queryeditor this query succeeds within a minute or hangs Firefox. > > _______________________________________________ > Developers mailing list > Developers at freebase.com > http://lists.freebase.com/mailman/listinfo/developers From darin at metaweb.com Fri May 18 23:30:39 2007 From: darin at metaweb.com (Darin Wilson) Date: Fri, 18 May 2007 16:30:39 -0700 Subject: [Developers] changes to /business/mailing_address and /business/retail_location Message-ID: <70CBA32C-48A5-4BEB-81E1-BB25ADFEF3BB@metaweb.com> Hi- We've made a couple of minor changes to property keys of these two types: 1) /business/mailing_address/city_town is now /business/ mailing_address/citytown 2) /business/retail_location/location is now /business/ retail_location/address This was to make the keys more consistent with other keys that were already in use. We apologize for any problems this change may have caused. Darin From peter.boot at gmail.com Sat May 19 10:41:11 2007 From: peter.boot at gmail.com (Peter Boot) Date: Sat, 19 May 2007 20:41:11 +1000 Subject: [Developers] trans service Message-ID: <611cae850705190341t3e36de54k38c07296c2cd4e63@mail.gmail.com> I am trying understand how to display Wikipedia type content for a /film/film object similar to how it is done on http://www.freebase.com/view?id=%239202a8c04000641f80000000004b2047 Is it correct the trans service needs to be used to do this ? The WhatsNew.html demo application from the manual returns an error saying that there are no new images. Do any examples exist showing how to use the trans service in PHP ? thanks Peter -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.freebase.com/pipermail/developers/attachments/20070519/021aea6f/attachment.htm From nix at metaweb.com Sun May 20 00:02:05 2007 From: nix at metaweb.com (Nick Thompson) Date: Sat, 19 May 2007 17:02:05 -0700 Subject: [Developers] trans service In-Reply-To: <611cae850705190341t3e36de54k38c07296c2cd4e63@mail.gmail.com> References: <611cae850705190341t3e36de54k38c07296c2cd4e63@mail.gmail.com> Message-ID: <464F8FFD.5000603@metaweb.com> Peter Boot wrote: > > I am trying understand how to display Wikipedia type content for a > /film/film object similar to how it is done on > http://www.freebase.com/view?id=%239202a8c04000641f80000000004b2047 > > Is it correct the trans service needs to be used to do this ? that's right. for example, the url for the image in that page uses the id found in the topic .image property: http://www.freebase.com/api/trans/image_thumb/%239202a8c04000641f800000000119cb42?maxwidth=120&maxheight=120 and the short blurb from the article is: http://www.freebase.com/api/trans/blurb/%239202a8c04000641f80000000004b2051?maxlength=1000 (the id here came from the topic's .article property) you can get the whole article as html using /trans/raw instead of /trans/blurb: http://www.freebase.com/api/trans/raw/%239202a8c04000641f80000000004b2051 to include images through PHP, you can just generate an tag: you can include an article in a similar way using an