From AVH at zing.net Fri Feb 1 03:43:22 2008 From: AVH at zing.net (Arthur van Hoff) Date: Thu, 31 Jan 2008 19:43:22 -0800 Subject: [Developers] language codes In-Reply-To: <20080131191142.GN4957@metaweb.com> References: <20080131164305.GM4957@metaweb.com> <20080131191142.GN4957@metaweb.com> Message-ID: Hi Kurt, > We'll get to that ASAP, but in the meantime, you can download > > http://www.ethnologue.com/14/iso639/all_639-1.tab > > to map 639-1 to 639-3 codes for lookup with MQL. I tried that mapping, but I don't think that file maps 639-1 to 639-3 correctly. The 3 letter codes appear to be SIL codes (not sure what these are), and the mapping is ambiguous (some 2 letter codes map to many 3 letter codes). I'll special case English for now, and move on, but I would appreciated it if someone could take a look at this and fix up the various language codes to be correct. Thanks. From crism at metaweb.com Fri Feb 1 03:55:13 2008 From: crism at metaweb.com (Christopher R. Maden) Date: Thu, 31 Jan 2008 19:55:13 -0800 Subject: [Developers] language codes In-Reply-To: References: <20080131164305.GM4957@metaweb.com> <20080131191142.GN4957@metaweb.com> Message-ID: <47A29821.6090707@metaweb.com> Arthur van Hoff wrote: > I'll special case English for now, and move on, but I would appreciated > it if someone could take a look at this and fix up the various language > codes to be correct. This has been tested on sandbox, and should be deployed on OTG tomorrow. Note that there are two properties on /language/human_language, though; the ISO 639-1 code and ISO 639-2 codes may both need to be checked. > I tried that mapping, but I don't think that file maps 639-1 to 639-3 > correctly. The 3 letter codes appear to be SIL codes (not sure what > these are), and the mapping is ambiguous (some 2 letter codes map to > many 3 letter codes). SIL was, formerly, the Summer Institute for Linguistics, a missionary group whose work included translating the Bible into as many languages as possible; as a result, they have better language knowledge coverage than many other institutions. However, you?re right that that?s a short file; the ambiguity is unavoidable since a single 2-letter code (zh for Chinese) may map to multiple 3-letter codes (yue for Cantonese, cmn for Mandarin). ~Chris -- Christopher R. Maden Data Architect Metaweb Technologies, Inc. From AVH at zing.net Fri Feb 1 04:03:22 2008 From: AVH at zing.net (Arthur van Hoff) Date: Thu, 31 Jan 2008 20:03:22 -0800 Subject: [Developers] datetime format Message-ID: Hi, I'm finding some dates that are of the format: 2008-01-28T07:24:17-00:00 According to the documentation the format should be: 2008-01-28T07:24:17.000Z What is going on here? What formats should I be prepared to handle? [{ "type": "/user/cotton/default_domain/podcast", "name" : "Sleepy Cast", "date_published": null }] Have fun, Arthur van Hoff ___________________________________________ Arthur van Hoff, Dell-ZING, CTO Software and Services. W: 650-267-2413, F: 650-267-2498, M: 650-283-0842 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.freebase.com/pipermail/developers/attachments/20080131/9ef5c43b/attachment.htm From crism at metaweb.com Fri Feb 1 04:52:37 2008 From: crism at metaweb.com (Christopher R. Maden) Date: Thu, 31 Jan 2008 20:52:37 -0800 Subject: [Developers] datetime format In-Reply-To: References: Message-ID: <47A2A595.4030704@metaweb.com> Arthur van Hoff wrote: > I?m finding some dates that are of the format: 2008-01-28T07:24:17-00:00 > > According to the documentation the format should be: > 2008-01-28T07:24:17.000Z > > What is going on here? What formats should I be prepared to handle? Hi, Arthur. Datetime valued properties will not have an explicit timezone assertion; they are all in UTC. The latter form is used for system time assertions, like the dateline on a write or read, but not for actual property values. ~Chris -- Christopher R. Maden Data Architect Metaweb Technologies, Inc. From AVH at zing.net Fri Feb 1 04:56:58 2008 From: AVH at zing.net (Arthur van Hoff) Date: Thu, 31 Jan 2008 20:56:58 -0800 Subject: [Developers] datetime format In-Reply-To: <47A2A595.4030704@metaweb.com> References: <47A2A595.4030704@metaweb.com> Message-ID: Not sure I understand, both styles occur in my property values, and the documentation does not mention the first format. I guess I need to read both? I assume that the -00:00 is a timezone. Why is that included if we always use UTC? > -----Original Message----- > From: developers-bounces at freebase.com [mailto:developers- > bounces at freebase.com] On Behalf Of Christopher R. Maden > Sent: Thursday, January 31, 2008 8:53 PM > To: For discussions about MQL,Freebase API and apps built on Freebase > Subject: Re: [Developers] datetime format > > Arthur van Hoff wrote: > > I?m finding some dates that are of the format: 2008-01-28T07:24:17- > 00:00 > > > > According to the documentation the format should be: > > 2008-01-28T07:24:17.000Z > > > > What is going on here? What formats should I be prepared to handle? > > Hi, Arthur. Datetime valued properties will not have an explicit > timezone assertion; they are all in UTC. > > The latter form is used for system time assertions, like the dateline > on > a write or read, but not for actual property values. > > ~Chris > -- > Christopher R. Maden > Data Architect > Metaweb Technologies, Inc. > > _______________________________________________ > Developers mailing list > Developers at freebase.com > http://lists.freebase.com/mailman/listinfo/developers From crism at metaweb.com Fri Feb 1 05:25:28 2008 From: crism at metaweb.com (Christopher R. Maden) Date: Thu, 31 Jan 2008 21:25:28 -0800 Subject: [Developers] datetime format In-Reply-To: References: <47A2A595.4030704@metaweb.com> Message-ID: <47A2AD48.8000104@metaweb.com> Arthur van Hoff wrote: > Not sure I understand, both styles occur in my property values, and > the documentation does not mention the first format. I guess I need > to read both? I assume that the -00:00 is a timezone. Why is that > included if we always use UTC? Sorry, Arthur; I didn?t have enough coffee to read your first message correctly. Datetimes set via the UI are always stored in 2008-01-28T07:24:17.000Z format. However, most valid ISO 8601 expressions will be accepted (and stored) by the middle tier; it looks like the population of datetimes in podcast publication date values was done by an automated script using the 2008-01-28T07:24:17-00:00 format. If these values are compared or manipulated in an ISO 8601-aware context, including (I believe, though I will check) in MQL, they should compare identically. ~Chris -- Christopher R. Maden Data Architect Metaweb Technologies, Inc. From jg at metaweb.com Fri Feb 1 05:20:40 2008 From: jg at metaweb.com (John Giannandrea) Date: Thu, 31 Jan 2008 21:20:40 -0800 Subject: [Developers] datetime format In-Reply-To: References: <47A2A595.4030704@metaweb.com> Message-ID: Arthur van Hoff wrote: > Not sure I understand, both styles occur in my property values, and > the documentation does not mention the first format. I guess I need > to read both? I assume that the -00:00 is a timezone. Why is that > included if we always use UTC? how was that particular value created? it looks like it was written by you. the problem could be that we follow the ISO 8601 spec and allow all legal forms during mqlwrite and dont normalize them. The 07:24.17.000Z is including unnecessary precision in the seconds, but ISO claims that is not the same thing as 07:24:17Z because that could be anything from 07:24:17.000 to 07:24:17.999. Im gathering that you are getting these dates from an external source. I need to re-read the ISO spec to see what -00:00 means and if that can be normalized into Z -jg From AVH at zing.net Fri Feb 1 08:46:02 2008 From: AVH at zing.net (Arthur van Hoff) Date: Fri, 1 Feb 2008 00:46:02 -0800 Subject: [Developers] Results in [ ] Message-ID: This may be a dumb question. Check out this query: "query" : { "feed_media_format":[], "/user/cotton/default_domain/broadcast/genre":[], "id": "/guid/9202a8c04000641f8000000006b802dc", "type": "/user/cotton/default_domain/podcast" } For feed_media_format it returns an array of ids, but for the genre property it returns an array of names (which is what I excepted in both cases). Why the difference? "result": { "feed_media_format": [ "/media_type/audio/mpeg" ], "type": "/user/cotton/default_domain/podcast", "id": "/guid/9202a8c04000641f8000000006b802dc", "/user/cotton/default_domain/broadcast/genre": [ "Technology" ] } ___________________________________________ Arthur van Hoff, Dell-ZING, CTO Software and Services. W: 650-267-2413, F: 650-267-2498, M: 650-283-0842 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.freebase.com/pipermail/developers/attachments/20080201/9ad1eeeb/attachment.htm From crism at metaweb.com Fri Feb 1 09:08:43 2008 From: crism at metaweb.com (Christopher R. Maden) Date: Fri, 1 Feb 2008 04:08:43 -0500 (EST) Subject: [Developers] Results in [ ] In-Reply-To: Message-ID: <33087889.157741201856923444.JavaMail.root@h00215> Arthur van Hoff wrote: > This may be a dumb question. Check out this query: > > For feed_media_format it returns an array of ids, but for the genre > property it returns an array of names (which is what I excepted in both > cases). Why the difference? Not a dumb question, but a subtlety of MQL. When asked to display a simple string form of a property value, MQL has some rules that it follows. If the property has a simple value, like a text or integer value, it displays the value. Then, for most link properties, it shows the display name of the linked object. (This is why some CVT property values just show up as ?null?; those CVTs don?t have display names.) But for some types of linked objects, MQL will use a different property, rather than the name, to show a value. Take a look at , the type expected by the feed_media_format property. The default property is set to ?id? ? in other words, for any media type value, the ID of the target node will be given, rather than the English display name. Generally, if one wants reliably an ID of a target or a name of a target, the query should be explicit about that: "property":[{"id":null}] or "property":[{"name":null}] Those will always do what is expected, regardless of any changes to the type definition. ~Chris -- Christopher R. Maden Data Architect Metaweb Technologies, Inc. From AVH at zing.net Fri Feb 1 09:29:17 2008 From: AVH at zing.net (Arthur van Hoff) Date: Fri, 1 Feb 2008 01:29:17 -0800 Subject: [Developers] Results in [ ] In-Reply-To: <33087889.157741201856923444.JavaMail.root@h00215> References: <33087889.157741201856923444.JavaMail.root@h00215> Message-ID: Thanks Christopher. I'm curious why the default is set to "id" for media types. The name (i.e. the mime type) would have been a very reasonable choice in this case. > -----Original Message----- > From: developers-bounces at freebase.com [mailto:developers- > bounces at freebase.com] On Behalf Of Christopher R. Maden > Sent: Friday, February 01, 2008 1:09 AM > To: For discussions about MQL,Freebase API and apps built on Freebase > Subject: Re: [Developers] Results in [ ] > > Arthur van Hoff wrote: > > This may be a dumb question. Check out this query: > > > > For feed_media_format it returns an array of ids, but for the genre > > property it returns an array of names (which is what I excepted in > both > > cases). Why the difference? > > Not a dumb question, but a subtlety of MQL. > > When asked to display a simple string form of a property value, MQL > has some rules that it follows. > > If the property has a simple value, like a text or integer value, it > displays the value. > > Then, for most link properties, it shows the display name of the > linked object. (This is why some CVT property values just show up as > ?null?; those CVTs don?t have display names.) > > But for some types of linked objects, MQL will use a different > property, rather than the name, to show a value. Take a look at > , the > type expected by the feed_media_format property. The default > property is set to ?id? ? in other words, for any media type value, > the ID of the target node will be given, rather than the English > display name. > > Generally, if one wants reliably an ID of a target or a name of a > target, the query should be explicit about that: > > "property":[{"id":null}] > > or > > "property":[{"name":null}] > > Those will always do what is expected, regardless of any changes to > the type definition. > > ~Chris > -- > Christopher R. Maden > Data Architect > Metaweb Technologies, Inc. > > _______________________________________________ > Developers mailing list > Developers at freebase.com > http://lists.freebase.com/mailman/listinfo/developers From crism at metaweb.com Fri Feb 1 09:52:51 2008 From: crism at metaweb.com (Christopher R. Maden) Date: Fri, 1 Feb 2008 04:52:51 -0500 (EST) Subject: [Developers] Results in [ ] In-Reply-To: Message-ID: <11998209.157771201859571580.JavaMail.root@h00215> Arthur van Hoff wrote: > Thanks Christopher. I'm curious why the default is set to "id" for media types. The name (i.e. the mime type) would have been a very reasonable choice in this case. This is the case for nearly all of the Metaweb system types, that is, the types in the /type domain. /type/object has ?name? as its default property, but the rest of the non-literal types have ?id? as the default to eliminate ambiguity. { "query" : [ { "default_property" : null, "domain" : "/type", "id" : null, "type" : "/type/type" } ] } ~Chris -- Christopher R. Maden Data Architect Metaweb Technologies, Inc. From jlowe at giswebsite.com Fri Feb 1 16:04:59 2008 From: jlowe at giswebsite.com (Jonathan W. Lowe) Date: Fri, 01 Feb 2008 16:04:59 +0000 Subject: [Developers] Unique timestamps? In-Reply-To: <47A2AD48.8000104@metaweb.com> References: <47A2A595.4030704@metaweb.com> <47A2AD48.8000104@metaweb.com> Message-ID: <1201881899.8660.28.camel@localhost> In coding a replication routine between Freebase and a remote database, I've been relying on the many timestamps associated with topics and links to order the processes, and have assumed that these timestamps are unique across all of Freebase. So far, my routine hasn't encountered any instances of simultaneous events, but I'd like to turn my assumption into certainty. Seems like the answer has to be that all timestamps are forced to be unique in order to avoid transactional collisions. For instance, there must be some mechanism, even a random choice, that deals with the (however unlikely) scenario in which one user tries to adds a link to one topic at exactly the same instant another user unwittingly attempts to delete that same topic. In such a scenario, would Freebase arbitrarily designate one of these two write queries as the first, perform its transaction, then evaluate the second write query based in part on the outcome of the chosen first query? There must be a clever MQL query that would answer this unique timestamp question. If only I were a clever boy. :( Thanks, Jonathan ---------------- Jonathan W. Lowe Giswebsite LLP London, UK http://www.giswebsite.com From tsturge at metaweb.com Fri Feb 1 21:00:55 2008 From: tsturge at metaweb.com (Tim Sturge) Date: Fri, 01 Feb 2008 13:00:55 -0800 Subject: [Developers] understanding an error message In-Reply-To: References: Message-ID: <47A38887.7010304@metaweb.com> It means we haven't been very precise in issuing good error messages. "sort" is a directive (and you see it in the "key" field) but the "dictionary value" part is just trying to cover too much ground in a single message. I'll see if I can make these messages a bit clearer. Tim Augusto Callejas wrote: > hi- > > when i intentionally submit this bad query: > > { > "query" : [ > { > "id" : "/common/topic", > "properties" : [ > {} > ], > "sort" : [ > null > ], > "type" : "/type/type" > } > ] > } > > i get this error message: > > { > "code" : "/api/status/error", > "messages" : [ > { > "code" : "/api/status/error/mql/parse", > "info" : { > "key" : "sort" > }, > "message" : "Can't use a dictionary as a directive value" > } > ] > } > > i don't understand it. what dictionary is the message referring to? > does the error message mean the array? > > thanks, > augusto. > > > _______________________________________________ > Developers mailing list > Developers at freebase.com > http://lists.freebase.com/mailman/listinfo/developers > From AVH at zing.net Fri Feb 1 21:14:00 2008 From: AVH at zing.net (Arthur van Hoff) Date: Fri, 1 Feb 2008 13:14:00 -0800 Subject: [Developers] Editing a URI property Message-ID: Hi, I'm encountering a problem when editing the feed property for this topic: http://www.freebase.com/view/guid/9202a8c04000641f8000000006fb937a I select Edit from the tab to the left of the feed property, and the text box is displayed containing a short version of the URL ending in ... Is that a bug? It should allow me to edit the original value, right? By the way, this works fine for the summary property. ___________________________________________ Arthur van Hoff, Dell-ZING, CTO Software and Services. W: 650-267-2413, F: 650-267-2498, M: 650-283-0842 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.freebase.com/pipermail/developers/attachments/20080201/f705a4f7/attachment.htm From tsturge at metaweb.com Fri Feb 1 21:23:37 2008 From: tsturge at metaweb.com (Tim Sturge) Date: Fri, 01 Feb 2008 13:23:37 -0800 Subject: [Developers] Unique timestamps? In-Reply-To: <1201881899.8660.28.camel@localhost> References: <47A2A595.4030704@metaweb.com> <47A2AD48.8000104@metaweb.com> <1201881899.8660.28.camel@localhost> Message-ID: <47A38DD9.4020700@metaweb.com> Yes; the timestamps of objects (that is the result of the "timestamp" field in) [{ "id": null, "timestamp": null }] are all unique; the subsecond fraction is more like a sequence number than an actual number of milliseconds. If you're syncing with another database you might consider using the "guid" field [{ "id": null, "guid": null }] rather than the timestamp. This is designed to be a unique identifier for the object in freebase which is what a replication routine probably wants rather than relying on an implementation decision for timestamps. Tim Jonathan W. Lowe wrote: > In coding a replication routine between Freebase and a remote database, > I've been relying on the many timestamps associated with topics and > links to order the processes, and have assumed that these timestamps are > unique across all of Freebase. So far, my routine hasn't encountered > any instances of simultaneous events, but I'd like to turn my assumption > into certainty. > > Seems like the answer has to be that all timestamps are forced to be > unique in order to avoid transactional collisions. For instance, there > must be some mechanism, even a random choice, that deals with the > (however unlikely) scenario in which one user tries to adds a link to > one topic at exactly the same instant another user unwittingly attempts > to delete that same topic. In such a scenario, would Freebase > arbitrarily designate one of these two write queries as the first, > perform its transaction, then evaluate the second write query based in > part on the outcome of the chosen first query? > > There must be a clever MQL query that would answer this unique timestamp > question. If only I were a clever boy. :( > > Thanks, > Jonathan > > ---------------- > Jonathan W. Lowe > Giswebsite LLP > London, UK > http://www.giswebsite.com > > _______________________________________________ > Developers mailing list > Developers at freebase.com > http://lists.freebase.com/mailman/listinfo/developers > From AVH at zing.net Fri Feb 1 21:21:41 2008 From: AVH at zing.net (Arthur van Hoff) Date: Fri, 1 Feb 2008 13:21:41 -0800 Subject: [Developers] Searching for ? Message-ID: Hi, I'm trying to find all podcasts that have an '?' in their URL. Here is the query: "query":[{ "id": null, "name":null, "type": "/user/cotton/default_domain/podcast", "feed~=": "?", "feed":null }] It returns way too many results. Can I search for '?' or is that a special character? By the way, I already specify "escape":false in the request, and I tried escaping the ? with \. ___________________________________________ Arthur van Hoff, Dell-ZING, CTO Software and Services. W: 650-267-2413, F: 650-267-2498, M: 650-283-0842 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.freebase.com/pipermail/developers/attachments/20080201/04090216/attachment.htm From tsturge at metaweb.com Fri Feb 1 21:27:26 2008 From: tsturge at metaweb.com (Tim Sturge) Date: Fri, 01 Feb 2008 13:27:26 -0800 Subject: [Developers] Searching for ? In-Reply-To: References: Message-ID: <47A38EBE.4050507@metaweb.com> Hi Arthur, This should be possible, although you need two backslashes before the ?, not just one. That's because JSON itself handles the single backslash escapes, and is very much like how regular expressions work in many programming languages. So "feed~=": "\\?", should give you only those podcasts with a query component in the URL. Tim Arthur van Hoff wrote: > > Hi, > > I?m trying to find all podcasts that have an ??? in their URL. Here is > the query: > > ?query?:[{ > > "id": null, > > "name":null, > > "type": "/user/cotton/default_domain/podcast", > > "feed~=": "?", > > "feed":null > > }] > > It returns way too many results. Can I search for ??? or is that a > special character? > > By the way, I already specify ?escape?:false in the request, and I > tried escaping the ? with \. > > ___________________________________________ > > Arthur van Hoff, Dell-ZING, CTO Software and Services. > > W: 650-267-2413, F: 650-267-2498, M: 650-283-0842 > > ------------------------------------------------------------------------ > > _______________________________________________ > Developers mailing list > Developers at freebase.com > http://lists.freebase.com/mailman/listinfo/developers > From AVH at zing.net Fri Feb 1 21:30:36 2008 From: AVH at zing.net (Arthur van Hoff) Date: Fri, 1 Feb 2008 13:30:36 -0800 Subject: [Developers] Searching for ? In-Reply-To: <47A38EBE.4050507@metaweb.com> References: <47A38EBE.4050507@metaweb.com> Message-ID: I figured it out. I need "*\\?*". Why do I need the *s? > -----Original Message----- > From: developers-bounces at freebase.com [mailto:developers- > bounces at freebase.com] On Behalf Of Tim Sturge > Sent: Friday, February 01, 2008 1:27 PM > To: For discussions about MQL,Freebase API and apps built on Freebase > Subject: Re: [Developers] Searching for ? > > Hi Arthur, > > This should be possible, although you need two backslashes before the > ?, > not just one. That's because JSON itself handles the single backslash > escapes, and is very much like how regular expressions work in many > programming languages. > > So > > "feed~=": "\\?", > > should give you only those podcasts with a query component in the > URL. > > Tim > > Arthur van Hoff wrote: > > > > Hi, > > > > I'm trying to find all podcasts that have an '?' in their URL. Here > is > > the query: > > > > "query":[{ > > > > "id": null, > > > > "name":null, > > > > "type": "/user/cotton/default_domain/podcast", > > > > "feed~=": "?", > > > > "feed":null > > > > }] > > > > It returns way too many results. Can I search for '?' or is that a > > special character? > > > > By the way, I already specify "escape":false in the request, and I > > tried escaping the ? with \. > > > > ___________________________________________ > > > > Arthur van Hoff, Dell-ZING, CTO Software and Services. > > > > W: 650-267-2413, F: 650-267-2498, M: 650-283-0842 > > > > ------------------------------------------------------------------- > ----- > > > > _______________________________________________ > > Developers mailing list > > Developers at freebase.com > > http://lists.freebase.com/mailman/listinfo/developers > > > > _______________________________________________ > Developers mailing list > Developers at freebase.com > http://lists.freebase.com/mailman/listinfo/developers From jlowe at giswebsite.com Fri Feb 1 22:20:38 2008 From: jlowe at giswebsite.com (Jonathan W. Lowe) Date: Fri, 01 Feb 2008 22:20:38 +0000 Subject: [Developers] Unique timestamps? In-Reply-To: <47A38DD9.4020700@metaweb.com> References: <47A2A595.4030704@metaweb.com> <47A2AD48.8000104@metaweb.com> <1201881899.8660.28.camel@localhost> <47A38DD9.4020700@metaweb.com> Message-ID: <1201904438.12584.16.camel@localhost> On Fri, 2008-02-01 at 13:23 -0800, Tim Sturge wrote: > Yes; the timestamps of objects (that is the result of the "timestamp" > field in) > > [{ "id": null, > "timestamp": null > }] > > are all unique; the subsecond fraction is more like a sequence number > than an actual number of milliseconds. Great -- and useful to know about the milliseconds detail. > > If you're syncing with another database you might consider using the > "guid" field > > [{ "id": null, > "guid": null > }] > > rather than the timestamp. This is designed to be a unique identifier > for the object in freebase which is what a replication routine probably > wants rather than relying on an implementation decision for timestamps. Thanks, Tim. I understand what you mean regarding guid, but am not replicating everything, only a pair of related types, and am translating Freebase's append-only rules into a temporal relational database (rather than another graph) such that history (such as cotype additions/deletions, BLOB-to-topic reassignment, etc.) is preserved in the RDBMS. For example, the same guid might appear, disappear, and then reappear in a scenario where a user adds Description text (i.e. a text/html BLOB) to a topic, then later edits it, then later still, decides to revert back to the original description text. (If this sounds painful, that's because it is. There are at least ten different change conditions you have to track to accomplish this.) But, there's a payoff. Because the topics/types I'm replicating are geospatial, users will be able to "roll back" the map to a particular moment in time, or watch map features appear, shift and disappear in a time-lapse sequence corresponding to Freebase activity. Fields such as archeology, geology, emergency response, oil & gas and transportation management need this sort of capability. And recently, legal disputes around what a map looked like at the time it supported some disputed decision have "implicated" digital spatial data providers. At any rate...if you have an idea for trapping this kind of history by guids alone, I'd love to hear about it, as the timestamp approach involves an awful lot of rules and logic. > > Tim > > > > Jonathan W. Lowe wrote: > > In coding a replication routine between Freebase and a remote database, > > I've been relying on the many timestamps associated with topics and > > links to order the processes, and have assumed that these timestamps are > > unique across all of Freebase. So far, my routine hasn't encountered > > any instances of simultaneous events, but I'd like to turn my assumption > > into certainty. > > > > Seems like the answer has to be that all timestamps are forced to be > > unique in order to avoid transactional collisions. For instance, there > > must be some mechanism, even a random choice, that deals with the > > (however unlikely) scenario in which one user tries to adds a link to > > one topic at exactly the same instant another user unwittingly attempts > > to delete that same topic. In such a scenario, would Freebase > > arbitrarily designate one of these two write queries as the first, > > perform its transaction, then evaluate the second write query based in > > part on the outcome of the chosen first query? > > > > There must be a clever MQL query that would answer this unique timestamp > > question. If only I were a clever boy. :( > > > > Thanks, > > Jonathan > > > > ---------------- > > Jonathan W. Lowe > > Giswebsite LLP > > London, UK > > http://www.giswebsite.com > > > > _______________________________________________ > > Developers mailing list > > Developers at freebase.com > > http://lists.freebase.com/mailman/listinfo/developers > > > > From daepark at metaweb.com Sat Feb 2 07:24:11 2008 From: daepark at metaweb.com (Dae Park) Date: Fri, 1 Feb 2008 23:24:11 -0800 Subject: [Developers] Editing a URI property In-Reply-To: References: Message-ID: That's a bug. It's the client javascript that is ellipsifying the long urls on viewing but should not when you edit them. In fact you can see the full URI in the explore view: http://www.freebase.com/view/explore/guid/ 9202a8c04000641f8000000006fb937a You should still be able to edit through the interface. I will create a ticket to track this. -dae On Feb 1, 2008, at 1:14 PM, Arthur van Hoff wrote: > Hi, > > > > I'm encountering a problem when editing the feed property for this > topic: > > > > http://www.freebase.com/view/guid/9202a8c04000641f8000000006fb937a > > > > I select Edit from the tab to the left of the feed property, and the > text box is displayed containing a short version of the URL ending in > ... Is that a bug? It should allow me to edit the original value, > right? > > > > By the way, this works fine for the summary property. > > > > ___________________________________________ > > Arthur van Hoff, Dell-ZING, CTO Software and Services. > > W: 650-267-2413, F: 650-267-2498, M: 650-283-0842 > > > > _______________________________________________ > Developers mailing list > Developers at freebase.com > http://lists.freebase.com/mailman/listinfo/developers From daepark at metaweb.com Sat Feb 2 07:58:47 2008 From: daepark at metaweb.com (Dae Park) Date: Fri, 1 Feb 2008 23:58:47 -0800 Subject: [Developers] Editing a URI property In-Reply-To: References: Message-ID: <58E1027B-1F96-4598-AABF-C78F65272E58@metaweb.com> Bug created: #7176 - When editing a URL, the original value is shown ellipsified -dae On Feb 1, 2008, at 11:24 PM, Dae Park wrote: > That's a bug. It's the client javascript that is ellipsifying the > long urls on viewing but should not when you edit them. In fact you > can see the full URI in the explore view: > > http://www.freebase.com/view/explore/guid/ > 9202a8c04000641f8000000006fb937a > > You should still be able to edit through the interface. > > I will create a ticket to track this. > > -dae > > On Feb 1, 2008, at 1:14 PM, Arthur van Hoff wrote: > >> Hi, >> >> >> >> I'm encountering a problem when editing the feed property for this >> topic: >> >> >> >> http://www.freebase.com/view/guid/9202a8c04000641f8000000006fb937a >> >> >> >> I select Edit from the tab to the left of the feed property, and the >> text box is displayed containing a short version of the URL ending in >> ... Is that a bug? It should allow me to edit the original value, >> right? >> >> >> >> By the way, this works fine for the summary property. >> >> >> >> ___________________________________________ >> >> Arthur van Hoff, Dell-ZING, CTO Software and Services. >> >> W: 650-267-2413, F: 650-267-2498, M: 650-283-0842 >> >> >> >> _______________________________________________ >> Developers mailing list >> Developers at freebase.com >> http://lists.freebase.com/mailman/listinfo/developers > > _______________________________________________ > Developers mailing list > Developers at freebase.com > http://lists.freebase.com/mailman/listinfo/developers From jlowe at giswebsite.com Sat Feb 2 10:53:28 2008 From: jlowe at giswebsite.com (Jonathan W. Lowe) Date: Sat, 02 Feb 2008 10:53:28 +0000 Subject: [Developers] "link" and the "operation" In-Reply-To: <08DC1D51-94E2-400E-BF44-F96AE44894AD@metaweb.com> References: <08DC1D51-94E2-400E-BF44-F96AE44894AD@metaweb.com> Message-ID: <1201949608.2941.42.camel@localhost> Warning: the following may be on the arcane side. Is it a bug that the /type/link/valid property can display both true and false for the same link operation? Here's an example: This MQL read query... { "query" : { "/common/topic/article" : [ { "content" : [ { "creator" : null, "id" : null, "link" : [ { "creator" : null, "operation" : null, "timestamp" : null, "valid" : null } ] } ], "id" : null } ], "name" : "Jamie Taylor" } } ...returns this result (notice the 'link' "operation" and "valid" properties: { "/common/topic/article" : [ { "content" : [ { "creator" : "/user/jamie", "id" : "/guid/9202a8c04000641f8000000004515938", "link" : [ { "creator" : "/user/jamie", "operation" : "insert", "timestamp" : "2007-03-25T01:09:34.0015Z", "valid" : true } ] } ], "id" : "/guid/9202a8c04000641f8000000004515934" } ], "name" : "Jamie Taylor" } So far, this makes sense -- Jamie added a description to his topic on March 25, 2007. Therefore the "operation" value is "insert" and, at the time of query, the "valid" value is true. Next, I edit Jamie's Description, adding "Mr. " to its beginning and saving the change. The same MQL query now returns the following: { "/common/topic/article" : [ { "content" : [ { "creator" : "/user/jamie", "id" : "/guid/9202a8c04000641f8000000004515938", "link" : [ { "creator" : "/user/jamie", "operation" : "insert", "timestamp" : "2007-03-25T01:09:34.0015Z", "valid" : false } ] }, { "creator" : "/user/jonathanwlowe", "id" : "/guid/9202a8c04000641f80000000070a5193", "link" : [ { "creator" : "/user/jonathanwlowe", "operation" : "update", "timestamp" : "2008-02-02T10:22:42.0008Z", "valid" : true } ] } ], "id" : "/guid/9202a8c04000641f8000000004515934" } ], "name" : "Jamie Taylor" } Still as expected -- the original insert operation is now valid=false. My edit appears as operation=update, valid=true. Suddenly realizing I have no business fussing with other people's Descriptions, I re-edit Jamie's Description back to its original text, removing the "Mr. " from its beginning. Now the same MQL query returns the following: { "/common/topic/article" : [ { "content" : [ { "creator" : "/user/jamie", "id" : "/guid/9202a8c04000641f8000000004515938", "link" : [ { "creator" : "/user/jamie", "operation" : "insert", "timestamp" : "2007-03-25T01:09:34.0015Z", "valid" : false } ] }, { "creator" : "/user/jonathanwlowe", "id" : "/guid/9202a8c04000641f80000000070a5193", "link" : [ { "creator" : "/user/jonathanwlowe", "operation" : "update", "timestamp" : "2008-02-02T10:22:42.0008Z", "valid" : false } ] }, { "creator" : "/user/jonathanwlowe", "id" : "/guid/9202a8c04000641f80000000070a519c", "link" : [ { "creator" : "/user/jonathanwlowe", "operation" : "update", "timestamp" : "2008-02-02T10:26:06.0008Z", "valid" : true } ] } ], "id" : "/guid/9202a8c04000641f8000000004515934" } ], "name" : "Jamie Taylor" } The results still make sense. Jamie's original entry and my first edit are both valid=false, and my re-edit (operation=update) is valid=true. Now modify one item in the original MQL query by changing "valid":null to "valid":false. The results are become: { "/common/topic/article" : [ { "content" : [ { "creator" : "/user/jamie", "id" : "/guid/9202a8c04000641f8000000004515938", "link" : [ { "creator" : "/user/jamie", "operation" : "insert", "timestamp" : "2007-03-25T01:09:34.0015Z", "valid" : false } ] }, { "creator" : "/user/jonathanwlowe", "id" : "/guid/9202a8c04000641f80000000070a5193", "link" : [ { "creator" : "/user/jonathanwlowe", "operation" : "update", "timestamp" : "2008-02-02T10:22:42.0008Z", "valid" : false } ] }, { "creator" : "/user/jonathanwlowe", "id" : "/guid/9202a8c04000641f80000000070a519c", "link" : [ { "creator" : "/user/jonathanwlowe", "operation" : "update", "timestamp" : "2008-02-02T10:26:06.0008Z", "valid" : false } ] } ], "id" : "/guid/9202a8c04000641f8000000004515934" } ], "name" : "Jamie Taylor" } The difference is that the same entry (my re-edit) resulting in the same BLOB (gid ending in "...4515934") appears as valid=false. In the previous query, it appeared as valid=true. So...why does my re-edit of Jamie's Description back to its original state, have both a valid=true AND a valid=false setting? Perhaps it's the work of a renegade Buddhist developer eager to spread enlightenment about the futility of dualism... What is true? What is false? All validities are but one, grasshopper. - Jonathan p.s. Thanks, Jamie, for the use of your topic's Description; I tried not to leave any bruises. On Wed, 2008-01-16 at 16:18 -0800, Alec Flett wrote: > > On Jan 16, 2008, at 3:43 PM, Christopher Dummy wrote: > > > I couldn't find any documentation on /type/link which is used for > > properties. I'm trying to understand what some of the values can be > > and what they mean. > > > > > This doesn't necessarily help a huge amount, but you can look at the > schema for "link": > > > http://www.freebase.com/view/schema/type/link > > > > > Here's the short documentation which I'll try to get into a help > topic: > > > type: I believe this will always be "/type/link" > > > timestamp: the time the link was created > > > creator: points to the user (i.e. /user/alecf) who created it > > > master_property: the property that this link represents > (like /film/film/cast) > > > reverse: whether or not the master_property is pointing to or away > from the item > > > operation: "insert" means it is a normal link, that doesn't supercede > any other value. "update" means that it is a normal link that > "overwrote" a previous link. "delete" means the link actually > represents the deletion of a different link. Since freebase's database > is append-only, the way to "delete" a link is to overwrite it with a > "tombstone" link - that's what "delete" is > > > valid: a boolean indicating if this current link is active - i.e. > wasn't deleted by another link.. and so yeah you're right that a > "delete" link isn't really valid or not, since it is really making a > different link "invalid" > > > attribution: a more complex subject - basically this may point to a > user or a node which describes some sort of attribution, such as what > datasource a particular link came from... (i.e. if someone asserted > that "the population of china is 1 billion people" according to the > CIA World Fact Book) this isn't really used right now. > > > I hope this gets you started. The master_property/reverse stuff can be > a little confusing at times.. my advice there is just to play around > with it to understand how it works until we have more extensive > documentation. > > > Alec > > > { > > "guid": "#9202a8c04000641f8000000000014a39", > > "link": { > > "timestamp": "2008-01-16T22:08:24.0000Z", > > "operation": "insert", > > "valid": false > > }, > > "name": "Electronic music" > > }, > > { > > "guid": "#9202a8c04000641f8000000000014a39", > > "link": { > > "timestamp": "2008-01-16T22:11: 12.0000Z", > > "operation": "delete", > > "valid": null > > }, > > "name": "Electronic music" > > } > > > > I assume the "valid" refers to whether the link is valid or not. the > > UI will display just the valid links. For that reason, "delete" > > doesn't have a true or false value since it doesn't represent a > > link. Is that correct? > > > > I've seen the operations "insert", "update", "delete". > > > > Are there any other operations that can happen? Is there a time when > > the "delete" operation might have something other than a null for > > valid? > > > > -- > > Christopher Cotton > > Zing/Dell Engineer > > http://zing.net/ _______________________________________________ > > Developers mailing list > > Developers at freebase.com > > http://lists.freebase.com/mailman/listinfo/developers > > _______________________________________________ > Developers mailing list > Developers at freebase.com > http://lists.freebase.com/mailman/listinfo/developers From chris at eppsteins.net Sun Feb 3 20:55:01 2008 From: chris at eppsteins.net (Chris Eppstein) Date: Sun, 3 Feb 2008 12:55:01 -0800 Subject: [Developers] Announcing: New release of the Ruby Freebase API (0.0.1) Message-ID: <6FEF67E7-F31B-45A9-9189-37C5F2D4553D@eppsteins.net> The Ruby Freebase API currently provides read access to http://www.freebase.com/ . This release includes: Gem support. This means installing is a snap if you already have ruby and gems installed on your system. JSON Parsing fix. The Ruby on Rails JSON parser was not compliant and failed on some freebase mql reads, JSON is now parsed using the JSON parser from http://json.rubyforge.org/ Unit test framework - support for caching responses as files so there's no runtime requirement on the freebase service and changes to data will not break existing tests. This library is still early ALPHA. The API will change, there's going to be some bugs. Your help in any form is appreciated. To Install: ~ $ sudo gem install -y freebase Successfully installed freebase-0.0.1 1 gem installed Installing ri documentation for freebase-0.0.1... Installing RDoc documentation for freebase-0.0.1... You can then launch an interactive ruby shell to try it out: chris:~ chris$ irb irb(main):001:0> require 'rubygems' => true irb(main):002:0> require 'freebase' => true irb(main):003:0> (an_artist = Freebase::Types::Music::Artist.find(:first)).name => "Blonde Redhead" irb(main):004:0> an_artist.albums.size => 17 irb(main):005:0> an_artist.albums[2].name => "Fake Can Be Just as Good" irb(main):006:0> an_artist.albums[2].tracks.size => 8 irb(main):007:0> an_artist.albums[2].tracks.first.name => "Kazuality" Ruby on Rails support is still available, but it now requires the gem to be installed. To install the latest: rails_project $ ./script/plugin install http://freebaseapi.rubyforge.org/svn/trunk/plugins/rails/freebase + ./config/freebase.yml + ./init.rb + ./install.rb + ./tasks/freebase_tasks.rake + ./uninstall.rb Installing: config/freebase.yml If you haven't yet done so, please install the freebase gem: [sudo] gem install freebase Enjoy! - Chris Eppstein -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.freebase.com/pipermail/developers/attachments/20080203/95ee1288/attachment.htm From christopher.dummy at gmail.com Mon Feb 4 16:18:26 2008 From: christopher.dummy at gmail.com (Christopher Dummy) Date: Mon, 4 Feb 2008 10:18:26 -0600 Subject: [Developers] image_thumb bug? Message-ID: I assume this is a bug, can anyone confirm it? for this image, if I request a maxwidth of 100 and maxheight of 300, i get a 300x300 image, instead of a 100x100 as I expect: http://www.freebase.com/api/trans/image_thumb/guid/9202a8c04000641f8000000006b7f347?maxwidth=100&maxheight=300 But, if I change the params to be: http://www.freebase.com/api/trans/image_thumb/guid/9202a8c04000641f8000000006b7f347?maxwidth=100&maxheight=290 then I get a correct 100x100 image. It seems a bug happens since it matches the exact height with the 300. --Christopher From aseem at metaweb.com Mon Feb 4 17:35:12 2008 From: aseem at metaweb.com (Aseem Mohanty) Date: Mon, 04 Feb 2008 09:35:12 -0800 Subject: [Developers] image_thumb bug? In-Reply-To: References: Message-ID: <47A74CD0.4030007@metaweb.com> Hi Christopher, At this time if either the horizontal scale value /or/ the vertical scale value is 1 we simply return the original image without processing. Only if neither them is 1 do we we scale the image. AM Christopher Dummy wrote: > I assume this is a bug, can anyone confirm it? > > for this image, if I request a maxwidth of 100 and maxheight of 300, i > get a 300x300 image, instead of a 100x100 as I expect: > > > http://www.freebase.com/api/trans/image_thumb/guid/9202a8c04000641f8000000006b7f347?maxwidth=100&maxheight=300 > > > But, if I change the params to be: > > > http://www.freebase.com/api/trans/image_thumb/guid/9202a8c04000641f8000000006b7f347?maxwidth=100&maxheight=290 > > > then I get a correct 100x100 image. It seems a bug happens since it > matches the exact height with the 300. > > > > --Christopher > _______________________________________________ > Developers mailing list > Developers at freebase.com > http://lists.freebase.com/mailman/listinfo/developers From kirrily at metaweb.com Mon Feb 4 18:05:56 2008 From: kirrily at metaweb.com (Kirrily Robert) Date: Mon, 4 Feb 2008 13:05:56 -0500 (EST) Subject: [Developers] Announcing: New release of the Ruby Freebase API (0.0.1) In-Reply-To: <6FEF67E7-F31B-45A9-9189-37C5F2D4553D@eppsteins.net> Message-ID: <31815351.165661202148356387.JavaMail.root@h00215> Thanks, Chris! I've reposted your announcement to http://blog.freebase.com/ Perhaps you would also like to add it to http://www.freebase.com/view/freebase/metaweb_framework K. (Note to self: either stop ending sentences with URLs, or figure out how to punctuate them.) -- Kirrily Robert Freebase Community Director kirrily at metaweb.com From christopher.dummy at gmail.com Mon Feb 4 18:34:07 2008 From: christopher.dummy at gmail.com (Christopher Dummy) Date: Mon, 4 Feb 2008 12:34:07 -0600 Subject: [Developers] image_thumb bug? In-Reply-To: <47A74CD0.4030007@metaweb.com> References: <47A74CD0.4030007@metaweb.com> Message-ID: Ok, you are saying that if it matches one of them, then you return the original image? For example, I could be requesting a 100x100 image to fit into a 100x100 square. If someone happens to upload an image that is 900x100, i will get back the original at 900x100? What is the reasoning behind not scaling if one of them matches? On Feb 4, 2008 11:35 AM, Aseem Mohanty wrote: > Hi Christopher, > > At this time if either the horizontal scale value /or/ the vertical > scale value is 1 we simply return the original image without processing. > Only if neither them is 1 do we we scale the image. > > AM > > > Christopher Dummy wrote: > > I assume this is a bug, can anyone confirm it? > > > > for this image, if I request a maxwidth of 100 and maxheight of 300, i > > get a 300x300 image, instead of a 100x100 as I expect: > > > > > > http://www.freebase.com/api/trans/image_thumb/guid/9202a8c04000641f8000000006b7f347?maxwidth=100&maxheight=300 > > > > > > But, if I change the params to be: > > > > > > http://www.freebase.com/api/trans/image_thumb/guid/9202a8c04000641f8000000006b7f347?maxwidth=100&maxheight=290 > > > > > > then I get a correct 100x100 image. It seems a bug happens since it > > matches the exact height with the 300. > > > > > > > > --Christopher > > _______________________________________________ > > Developers mailing list > > Developers at freebase.com > > http://lists.freebase.com/mailman/listinfo/developers > _______________________________________________ > Developers mailing list > Developers at freebase.com > http://lists.freebase.com/mailman/listinfo/developers > -- Christopher Cotton Zing/Dell Engineer http://zing.net/ From tim at metaweb.com Mon Feb 4 19:03:40 2008 From: tim at metaweb.com (Tim Kientzle) Date: Mon, 4 Feb 2008 11:03:40 -0800 Subject: [Developers] image_thumb bug? In-Reply-To: References: <47A74CD0.4030007@metaweb.com> Message-ID: <5BCEC1B9-296C-4208-919A-402493CF45A2@metaweb.com> It's a bug. We'll fix it. Tim Kientzle On Feb 4, 2008, at 10:34 AM, Christopher Dummy wrote: > Ok, you are saying that if it matches one of them, then you return the > original image? For example, I could be requesting a 100x100 image to > fit into a 100x100 square. If someone happens to upload an image that > is 900x100, i will get back the original at 900x100? > > What is the reasoning behind not scaling if one of them matches? > > > On Feb 4, 2008 11:35 AM, Aseem Mohanty wrote: >> Hi Christopher, >> >> At this time if either the horizontal scale value /or/ the vertical >> scale value is 1 we simply return the original image without >> processing. >> Only if neither them is 1 do we we scale the image. >> >> AM >> >> >> Christopher Dummy wrote: >>> I assume this is a bug, can anyone confirm it? >>> >>> for this image, if I request a maxwidth of 100 and maxheight of >>> 300, i >>> get a 300x300 image, instead of a 100x100 as I expect: >>> >>> >>> http://www.freebase.com/api/trans/image_thumb/guid/9202a8c04000641f8000000006b7f347?maxwidth=100&maxheight=300 >>> >>> >>> But, if I change the params to be: >>> >>> >>> http://www.freebase.com/api/trans/image_thumb/guid/9202a8c04000641f8000000006b7f347?maxwidth=100&maxheight=290 >>> >>> >>> then I get a correct 100x100 image. It seems a bug happens since it >>> matches the exact height with the 300. >>> >>> >>> >>> --Christopher >>> _______________________________________________ >>> Developers mailing list >>> Developers at freebase.com >>> http://lists.freebase.com/mailman/listinfo/developers >> _______________________________________________ >> Developers mailing list >> Developers at freebase.com >> http://lists.freebase.com/mailman/listinfo/developers >> > > > > -- > Christopher Cotton > Zing/Dell Engineer > http://zing.net/ > _______________________________________________ > Developers mailing list > Developers at freebase.com > http://lists.freebase.com/mailman/listinfo/developers From christopher.dummy at gmail.com Mon Feb 4 19:07:12 2008 From: christopher.dummy at gmail.com (Christopher Dummy) Date: Mon, 4 Feb 2008 13:07:12 -0600 Subject: [Developers] image_thumb bug? In-Reply-To: <5BCEC1B9-296C-4208-919A-402493CF45A2@metaweb.com> References: <47A74CD0.4030007@metaweb.com> <5BCEC1B9-296C-4208-919A-402493CF45A2@metaweb.com> Message-ID: Great! thanks. On Feb 4, 2008 1:03 PM, Tim Kientzle wrote: > It's a bug. We'll fix it. > > Tim Kientzle > > > On Feb 4, 2008, at 10:34 AM, Christopher Dummy wrote: > > > Ok, you are saying that if it matches one of them, then you return the > > original image? For example, I could be requesting a 100x100 image to > > fit into a 100x100 square. If someone happens to upload an image that > > is 900x100, i will get back the original at 900x100? > > > > What is the reasoning behind not scaling if one of them matches? > > > > > > On Feb 4, 2008 11:35 AM, Aseem Mohanty wrote: > >> Hi Christopher, > >> > >> At this time if either the horizontal scale value /or/ the vertical > >> scale value is 1 we simply return the original image without > >> processing. > >> Only if neither them is 1 do we we scale the image. > >> > >> AM > >> > >> > >> Christopher Dummy wrote: > >>> I assume this is a bug, can anyone confirm it? > >>> > >>> for this image, if I request a maxwidth of 100 and maxheight of > >>> 300, i > >>> get a 300x300 image, instead of a 100x100 as I expect: > >>> > >>> > >>> http://www.freebase.com/api/trans/image_thumb/guid/9202a8c04000641f8000000006b7f347?maxwidth=100&maxheight=300 > >>> > >>> > >>> But, if I change the params to be: > >>> > >>> > >>> http://www.freebase.com/api/trans/image_thumb/guid/9202a8c04000641f8000000006b7f347?maxwidth=100&maxheight=290 > >>> > >>> > >>> then I get a correct 100x100 image. It seems a bug happens since it > >>> matches the exact height with the 300. > >>> > >>> > >>> > >>> --Christopher > >>> _______________________________________________ > >>> Developers mailing list > >>> Developers at freebase.com > >>> http://lists.freebase.com/mailman/listinfo/developers > >> _______________________________________________ > >> Developers mailing list > >> Developers at freebase.com > >> http://lists.freebase.com/mailman/listinfo/developers > >> > > > > > > > > -- > > Christopher Cotton > > Zing/Dell Engineer > > http://zing.net/ > > _______________________________________________ > > Developers mailing list > > Developers at freebase.com > > http://lists.freebase.com/mailman/listinfo/developers > > _______________________________________________ > Developers mailing list > Developers at freebase.com > http://lists.freebase.com/mailman/listinfo/developers > -- Christopher Cotton Zing/Dell Engineer http://zing.net/ From aseem at metaweb.com Mon Feb 4 19:43:01 2008 From: aseem at metaweb.com (Aseem Mohanty) Date: Mon, 04 Feb 2008 11:43:01 -0800 Subject: [Developers] image_thumb bug? In-Reply-To: References: <47A74CD0.4030007@metaweb.com> Message-ID: <47A76AC5.9080201@metaweb.com> Unfortunately yes. It is a known bug and will be fixed. Thanks. AM Christopher Dummy wrote: > Ok, you are saying that if it matches one of them, then you return the > original image? For example, I could be requesting a 100x100 image to > fit into a 100x100 square. If someone happens to upload an image that > is 900x100, i will get back the original at 900x100? > > What is the reasoning behind not scaling if one of them matches? > > > On Feb 4, 2008 11:35 AM, Aseem Mohanty wrote: >> Hi Christopher, >> >> At this time if either the horizontal scale value /or/ the vertical >> scale value is 1 we simply return the original image without processing. >> Only if neither them is 1 do we we scale the image. >> >> AM >> >> >> Christopher Dummy wrote: >>> I assume this is a bug, can anyone confirm it? >>> >>> for this image, if I request a maxwidth of 100 and maxheight of 300, i >>> get a 300x300 image, instead of a 100x100 as I expect: >>> >>> >>> http://www.freebase.com/api/trans/image_thumb/guid/9202a8c04000641f8000000006b7f347?maxwidth=100&maxheight=300 >>> >>> >>> But, if I change the params to be: >>> >>> >>> http://www.freebase.com/api/trans/image_thumb/guid/9202a8c04000641f8000000006b7f347?maxwidth=100&maxheight=290 >>> >>> >>> then I get a correct 100x100 image. It seems a bug happens since it >>> matches the exact height with the 300. >>> >>> >>> >>> --Christopher >>> _______________________________________________ >>> Developers mailing list >>> Developers at freebase.com >>> http://lists.freebase.com/mailman/listinfo/developers >> _______________________________________________ >> Developers mailing list >> Developers at freebase.com >> http://lists.freebase.com/mailman/listinfo/developers >> > > > From tsturge at metaweb.com Mon Feb 4 20:06:37 2008 From: tsturge at metaweb.com (Tim Sturge) Date: Mon, 4 Feb 2008 15:06:37 -0500 (EST) Subject: [Developers] "link" and the "operation" In-Reply-To: <1201949608.2941.42.camel@localhost> Message-ID: <10758679.167171202155597688.JavaMail.root@h00215> As the renegade Buddhist developer in question; when I see a fly on the wall, is just an insect? Or is it actually a bug in insect form? I'll get a fix for this in the next release. It's triggered by combining "operation": null and "valid": false Tim ----- Original Message ----- From: "Jonathan W. Lowe" To: "For discussions about MQL, Freebase API and apps built on Freebase" Sent: Saturday, February 2, 2008 2:53:28 AM (GMT-0800) America/Los_Angeles Subject: Re: [Developers] "link" and the "operation" Warning: the following may be on the arcane side. Is it a bug that the /type/link/valid property can display both true and false for the same link operation? Here's an example: This MQL read query... { "query" : { "/common/topic/article" : [ { "content" : [ { "creator" : null, "id" : null, "link" : [ { "creator" : null, "operation" : null, "timestamp" : null, "valid" : null } ] } ], "id" : null } ], "name" : "Jamie Taylor" } } ...returns this result (notice the 'link' "operation" and "valid" properties: { "/common/topic/article" : [ { "content" : [ { "creator" : "/user/jamie", "id" : "/guid/9202a8c04000641f8000000004515938", "link" : [ { "creator" : "/user/jamie", "operation" : "insert", "timestamp" : "2007-03-25T01:09:34.0015Z", "valid" : true } ] } ], "id" : "/guid/9202a8c04000641f8000000004515934" } ], "name" : "Jamie Taylor" } So far, this makes sense -- Jamie added a description to his topic on March 25, 2007. Therefore the "operation" value is "insert" and, at the time of query, the "valid" value is true. Next, I edit Jamie's Description, adding "Mr. " to its beginning and saving the change. The same MQL query now returns the following: { "/common/topic/article" : [ { "content" : [ { "creator" : "/user/jamie", "id" : "/guid/9202a8c04000641f8000000004515938", "link" : [ { "creator" : "/user/jamie", "operation" : "insert", "timestamp" : "2007-03-25T01:09:34.0015Z", "valid" : false } ] }, { "creator" : "/user/jonathanwlowe", "id" : "/guid/9202a8c04000641f80000000070a5193", "link" : [ { "creator" : "/user/jonathanwlowe", "operation" : "update", "timestamp" : "2008-02-02T10:22:42.0008Z", "valid" : true } ] } ], "id" : "/guid/9202a8c04000641f8000000004515934" } ], "name" : "Jamie Taylor" } Still as expected -- the original insert operation is now valid=false. My edit appears as operation=update, valid=true. Suddenly realizing I have no business fussing with other people's Descriptions, I re-edit Jamie's Description back to its original text, removing the "Mr. " from its beginning. Now the same MQL query returns the following: { "/common/topic/article" : [ { "content" : [ { "creator" : "/user/jamie", "id" : "/guid/9202a8c04000641f8000000004515938", "link" : [ { "creator" : "/user/jamie", "operation" : "insert", "timestamp" : "2007-03-25T01:09:34.0015Z", "valid" : false } ] }, { "creator" : "/user/jonathanwlowe", "id" : "/guid/9202a8c04000641f80000000070a5193", "link" : [ { "creator" : "/user/jonathanwlowe", "operation" : "update", "timestamp" : "2008-02-02T10:22:42.0008Z", "valid" : false } ] }, { "creator" : "/user/jonathanwlowe", "id" : "/guid/9202a8c04000641f80000000070a519c", "link" : [ { "creator" : "/user/jonathanwlowe", "operation" : "update", "timestamp" : "2008-02-02T10:26:06.0008Z", "valid" : true } ] } ], "id" : "/guid/9202a8c04000641f8000000004515934" } ], "name" : "Jamie Taylor" } The results still make sense. Jamie's original entry and my first edit are both valid=false, and my re-edit (operation=update) is valid=true. Now modify one item in the original MQL query by changing "valid":null to "valid":false. The results are become: { "/common/topic/article" : [ { "content" : [ { "creator" : "/user/jamie", "id" : "/guid/9202a8c04000641f8000000004515938", "link" : [ { "creator" : "/user/jamie", "operation" : "insert", "timestamp" : "2007-03-25T01:09:34.0015Z", "valid" : false } ] }, { "creator" : "/user/jonathanwlowe", "id" : "/guid/9202a8c04000641f80000000070a5193", "link" : [ { "creator" : "/user/jonathanwlowe", "operation" : "update", "timestamp" : "2008-02-02T10:22:42.0008Z", "valid" : false } ] }, { "creator" : "/user/jonathanwlowe", "id" : "/guid/9202a8c04000641f80000000070a519c", "link" : [ { "creator" : "/user/jonathanwlowe", "operation" : "update", "timestamp" : "2008-02-02T10:26:06.0008Z", "valid" : false } ] } ], "id" : "/guid/9202a8c04000641f8000000004515934" } ], "name" : "Jamie Taylor" } The difference is that the same entry (my re-edit) resulting in the same BLOB (gid ending in "...4515934") appears as valid=false. In the previous query, it appeared as valid=true. So...why does my re-edit of Jamie's Description back to its original state, have both a valid=true AND a valid=false setting? Perhaps it's the work of a renegade Buddhist developer eager to spread enlightenment about the futility of dualism... What is true? What is false? All validities are but one, grasshopper. - Jonathan p.s. Thanks, Jamie, for the use of your topic's Description; I tried not to leave any bruises. On Wed, 2008-01-16 at 16:18 -0800, Alec Flett wrote: > > On Jan 16, 2008, at 3:43 PM, Christopher Dummy wrote: > > > I couldn't find any documentation on /type/link which is used for > > properties. I'm trying to understand what some of the values can be > > and what they mean. > > > > > This doesn't necessarily help a huge amount, but you can look at the > schema for "link": > > > http://www.freebase.com/view/schema/type/link > > > > > Here's the short documentation which I'll try to get into a help > topic: > > > type: I believe this will always be "/type/link" > > > timestamp: the time the link was created > > > creator: points to the user (i.e. /user/alecf) who created it > > > master_property: the property that this link represents > (like /film/film/cast) > > > reverse: whether or not the master_property is pointing to or away > from the item > > > operation: "insert" means it is a normal link, that doesn't supercede > any other value. "update" means that it is a normal link that > "overwrote" a previous link. "delete" means the link actually > represents the deletion of a different link. Since freebase's database > is append-only, the way to "delete" a link is to overwrite it with a > "tombstone" link - that's what "delete" is > > > valid: a boolean indicating if this current link is active - i.e. > wasn't deleted by another link.. and so yeah you're right that a > "delete" link isn't really valid or not, since it is really making a > different link "invalid" > > > attribution: a more complex subject - basically this may point to a > user or a node which describes some sort of attribution, such as what > datasource a particular link came from... (i.e. if someone asserted > that "the population of china is 1 billion people" according to the > CIA World Fact Book) this isn't really used right now. > > > I hope this gets you started. The master_property/reverse stuff can be > a little confusing at times.. my advice there is just to play around > with it to understand how it works until we have more extensive > documentation. > > > Alec > > > { > > "guid": "#9202a8c04000641f8000000000014a39", > > "link": { > > "timestamp": "2008-01-16T22:08:24.0000Z", > > "operation": "insert", > > "valid": false > > }, > > "name": "Electronic music" > > }, > > { > > "guid": "#9202a8c04000641f8000000000014a39", > > "link": { > > "timestamp": "2008-01-16T22:11: 12.0000Z", > > "operation": "delete", > > "valid": null > > }, > > "name": "Electronic music" > > } > > > > I assume the "valid" refers to whether the link is valid or not. the > > UI will display just the valid links. For that reason, "delete" > > doesn't have a true or false value since it doesn't represent a > > link. Is that correct? > > > > I've seen the operations "insert", "update", "delete". > > > > Are there any other operations that can happen? Is there a time when > > the "delete" operation might have something other than a null for > > valid? > > > > -- > > Christopher Cotton > > Zing/Dell Engineer > > http://zing.net/ _______________________________________________ > > Developers mailing list > > Developers at freebase.com > > http://lists.freebase.com/mailman/listinfo/developers > > _______________________________________________ > Developers mailing list > Developers at freebase.com > http://lists.freebase.com/mailman/listinfo/developers _______________________________________________ Developers mailing list Developers at freebase.com http://lists.freebase.com/mailman/listinfo/developers From tyler at metaweb.com Tue Feb 5 01:34:07 2008 From: tyler at metaweb.com (Tyler Pirtle) Date: Mon, 04 Feb 2008 17:34:07 -0800 Subject: [Developers] Sandbox data refresh Message-ID: <47A7BD0F.10106@metaweb.com> Happening over the next few minutes T From daepark at metaweb.com Tue Feb 5 03:00:52 2008 From: daepark at metaweb.com (Dae Park) Date: Mon, 4 Feb 2008 19:00:52 -0800 Subject: [Developers] freebase-suggest 0.3 (jquery plugin) In-Reply-To: <00DDA4D9-7090-44C3-B76A-F82126916962@metaweb.com> References: <00DDA4D9-7090-44C3-B76A-F82126916962@metaweb.com> Message-ID: <0C9CBD9E-90D0-4E36-AD86-D489108805D0@metaweb.com> We've been holding off on releasing a new version of the freebase- suggest plugin until jquery-1.2.2 was out. Well, jquery-1.2.2 is official, so here it is: http://code.google.com/p/freebase-suggest/ Some changes/enhancements include: - using the "prefix" parameter (instead of the "query" parameter) to the FreebaseAPISearch (http://code.google.com/p/freebase-suggest/wiki/ FreebaseAPISearch) - the selection events are now 'fb-select' and 'fb-select- new' ('suggest' and 'suggest-new' will be deprecated in the near future) - A new freebaseSelect plugin for getting a finite set of instances of a certain type which is equivalent to the html element) that can be used to list the first n instances of a type. For example to list all 50 US States you would do something like: $("#myinput").freebaseSelect({type:"/location/us_state", limit: 50}) .bind('fb-select', function(e, data) { console.log ('select: ', data.id); }) Currently it doesn't show the drop down when you focus, but it does show the drop down list on down arrow. -dae ps. hope you don't mind me posting your question to developers at freebase.com since others might benefit as well... On Feb 7, 2008, at 3:27 PM, William Pietri wrote: > Hi, guys! I'm happily using Freebase Suggest 0.3, and had a > suggestion (or maybe just a usage question). > > Right now, it looks like you have to type at least one character to > get Freebase Suggest to pop up. But for some fields I'd like to > have it pop up as soon as the field gets focus. > > Obviously this would only make sense where I know the type and > further know that the number of items is small. But it would make a > nice option for those cases. Is there a way I can do that now? > > Thanks, > > William > > > > > -- > William Pietri - william at scissor.com - +1-415-643-1024 > Agile consulting, coaching, and development: http://www.scissor.com/ > A team room, in pictures: http://www.scissor.com/resources/teamroom/ > From christopher.dummy at gmail.com Mon Feb 11 23:55:54 2008 From: christopher.dummy at gmail.com (Christopher Dummy) Date: Mon, 11 Feb 2008 17:55:54 -0600 Subject: [Developers] import tool Message-ID: Can I get a feature added for the Import tool? We have lists that already have a set of Freebase Topics that we want to import into the list. I have all the guids, but the important tool doesn't recognize it. It should recognize items of the format: "/guid/9202a8c04000641f8000000006e6ea28" or at least "#9202a8c04000641f8000000006e6ea28" -- Christopher Cotton Zing/Dell Engineer http://zing.net/ From bryan at metaweb.com Tue Feb 12 01:00:30 2008 From: bryan at metaweb.com (Bryan Culbertson) Date: Mon, 11 Feb 2008 17:00:30 -0800 Subject: [Developers] import tool In-Reply-To: References: Message-ID: Great idea Chris. I've been the developer working on the List Import tool so far, and I'll definitely look into adding guid recognition. --Bryan On Feb 11, 2008, at 3:55 PM, Christopher Dummy wrote: > Can I get a feature added for the Import tool? We have lists that > already have a set of Freebase Topics that we want to import into the > list. > > I have all the guids, but the important tool doesn't recognize it. > > It should recognize items of the format: > "/guid/9202a8c04000641f8000000006e6ea28" or at least > "#9202a8c04000641f8000000006e6ea28" > > -- > Christopher Cotton > Zing/Dell Engineer > http://zing.net/ > _______________________________________________ > Developers mailing list > Developers at freebase.com > http://lists.freebase.com/mailman/listinfo/developers From bryan.cheung at metaweb.com Tue Feb 12 03:50:28 2008 From: bryan.cheung at metaweb.com (Bryan Cheung) Date: Mon, 11 Feb 2008 19:50:28 -0800 Subject: [Developers] Upcoming Schema Changes Message-ID: Hello all, Unless there is serious objection, we will be making the following changes to existing types next week. Please let us know if you have any objections to or questions about these changes. The specific changes, and rationale for them, are provided below. We hope to keep such changes to a minimum, but as we have moved through alpha, a variety of issues with some schemas have been discovered, and we are hoping to resolve as many of them as possible before we reach beta. All such changes will be announced on these lists, and we will take any concerns or objections from the community into consideration. Proposed Changes: Business The type company currently has properties which have an expected type of money value. However, these are monetary values associated with a given point in time. As such, we have modeled a type dated money value to represent a money value at a specific date. The expected values of the monetary properties of type company should be updated to use the type dated money value. * /business/company/net_income * /business/company/operating_income * /business/company/revenue Awards The following domains will have their awards normalized to the awards domain. We are making this change because many domains had nearly identical schemata to model awards specific to that domain. Because most domains could potentially have awards associated with them, we decided to use a general type schema, rather than requiring separate but similar types in many domains. The awards types in the following domains will have their data migrated to the /award domain, and the types and properties that rely on them will be deleted. * /architecture * /film * /book * /science * /automotive Location The following types will get /location/statistical_region as an included type, and if the type has a population property, the data will be normalized to the statistical region type. The population data and properties on the types listed below will then be deleted. We are making this change in order to make it easier to access and compare statistical information (such as population) about different locations, without having to write multiple queries. * /location/country * /location/administrative_division * /location/citytown * /location/census_designated_place Music Multi-Part Musical Release and Musical Release Component will be added to the Music domain. * Individual discs (like ?The Beatles (disc 1)?) will be made Release Components * New multi-part releases will be created corresponding to these sets of individual discs * Albums currently titled ?(disc n)? will be merged together If you have any opinion on any of the changes, please feel free to respond to the mailing list or to me directly. Thanks for contributing, Bryan Cheung bryan.cheung at metaweb.com From christopher.dummy at gmail.com Tue Feb 12 20:40:23 2008 From: christopher.dummy at gmail.com (Christopher Dummy) Date: Tue, 12 Feb 2008 14:40:23 -0600 Subject: [Developers] import tool In-Reply-To: References: Message-ID: Excellent! Another suggestion. It seems like some of the searching doesn't work well with punctuation. For example: I was trying to add a Podcast and the text I entered was: People.com This Weeks Buzz the real title of the podcast was: People.com: This Week's Buzz But, it doesn't show up at all in the list. The only thing that shows up is "Tiger Woods", as a Topic, Person, Golfer. It seems like the Podcast should show up in the list. Also, I've had other ones, where I search for "SomenameOfSomething", and the real title was "SomenameOfSomething.com", and it would not show up at all unless I entered the exact text. If you want other examples, I'm sure I can give you more. On Feb 11, 2008 7:00 PM, Bryan Culbertson wrote: > Great idea Chris. I've been the developer working on the List Import > tool so far, and I'll definitely look into adding guid recognition. > --Bryan > > On Feb 11, 2008, at 3:55 PM, Christopher Dummy wrote: > > > > Can I get a feature added for the Import tool? We have lists that > > already have a set of Freebase Topics that we want to import into the > > list. > > > > I have all the guids, but the important tool doesn't recognize it. > > > > It should recognize items of the format: > > "/guid/9202a8c04000641f8000000006e6ea28" or at least > > "#9202a8c04000641f8000000006e6ea28" > > > > -- > > Christopher Cotton > > Zing/Dell Engineer > > http://zing.net/ > > > _______________________________________________ > > Developers mailing list > > Developers at freebase.com > > http://lists.freebase.com/mailman/listinfo/developers > > _______________________________________________ > Developers mailing list > Developers at freebase.com > http://lists.freebase.com/mailman/listinfo/developers > -- Christopher Cotton Zing/Dell Engineer http://zing.net/ From christopher.dummy at gmail.com Tue Feb 12 20:44:11 2008 From: christopher.dummy at gmail.com (Christopher Dummy) Date: Tue, 12 Feb 2008 14:44:11 -0600 Subject: [Developers] merge with topic, needs to filter out its own topic Message-ID: we have had some podcasts get entered in twice. When i go to one of the podcasts and do "merge with existing topic". That search list REALLY needs to filter out the current topic. Since, both topics have almost exactly the same information when they both show up I have to figure out which GUID is which topic and make sure to select the correct one. It should not list its own topic as a suggestion to merge with. -- Christopher Cotton Zing/Dell Engineer http://zing.net/ From ptomblin at xcski.com Fri Feb 15 01:22:48 2008 From: ptomblin at xcski.com (Paul Tomblin) Date: Thu, 14 Feb 2008 20:22:48 -0500 Subject: [Developers] Processing In-Reply-To: <31218615.134421201571825890.JavaMail.root@h00215> References: <31218615.134421201571825890.JavaMail.root@h00215> Message-ID: <47B4E968.7000902@xcski.com> Kirrily Robert wrote: > Is anyone here working with Processing? (http://processing.org/) And since we're all data junkies and suckers for cool representations of that data: http://roslingsblogger.blogspot.com/2007/06/debunking-myths-about-world.html -- Paul Tomblin http://blog.xcski.com/ Can't get out of 'vi'? Common problem. Don't worry, I'm here to help. Just log in as root and type "init 0". It works for pretty much any problem you might have with Linux. No, no, no. Thank /you/. -- Mikey Raeder From christopher.dummy at gmail.com Mon Feb 18 23:58:10 2008 From: christopher.dummy at gmail.com (Christopher Dummy) Date: Mon, 18 Feb 2008 17:58:10 -0600 Subject: [Developers] searching Message-ID: I had thought that searching would return results of related items. For example, the search i'm doing is for "Avril" http://www.freebase.com/api/service/search?prefix=avril&type=/user/cotton/default_domain/broadcast I have a broadcast that links to Avril Lavigne: http://www.freebase.com/view/guid/9202a8c04000641f8000000006e55dbd I would expect that if i searched for Avril, that this station would come up in the search. is this the expect behavior? or is there some way to get that to work? -- Christopher Cotton Zing/Dell Engineer http://zing.net/ From faye at metaweb.com Tue Feb 19 00:04:26 2008 From: faye at metaweb.com (Faye Li) Date: Mon, 18 Feb 2008 16:04:26 -0800 Subject: [Developers] searching In-Reply-To: References: Message-ID: <47BA1D0A.3070904@metaweb.com> Hi Christopher, Search doesn't look up property values of a topic yet. It examines the topic title, alias, article, and various data from Wikipedia if it has any. So if you add Avril Lavigne to the list of artists played in the description for Alice at 97.3, then you'll be able to find the station. Amy Winehouse, for example, is in the description, so the following search works: http://www.freebase.com/api/service/search?prefix=winehouse&type=/user/cotton/default_domain/broadcast -- Faye Christopher Dummy wrote: > I had thought that searching would return results of related items. > For example, the search i'm doing is for "Avril" > > http://www.freebase.com/api/service/search?prefix=avril&type=/user/cotton/default_domain/broadcast > > I have a broadcast that links to Avril Lavigne: > > http://www.freebase.com/view/guid/9202a8c04000641f8000000006e55dbd > > I would expect that if i searched for Avril, that this station would > come up in the search. is this the expect behavior? or is there some > way to get that to work? > > From hirsch.christian at gmail.com Tue Feb 19 03:07:24 2008 From: hirsch.christian at gmail.com (Christian Hirsch) Date: Tue, 19 Feb 2008 16:07:24 +1300 Subject: [Developers] Java and mql write service Message-ID: <443bada30802181907l5f52118dpa559611e5247809d@mail.gmail.com> Hi All, I am trying to access the write API using Java, but somehow I always get an error. Sending read and login requests works just fine, however when I'm sending write requests I'm always getting '400 bad request'. I'm not very familiar with http requests in java... could there be something wrong with the request header? or the credentials? - maybe someone has some working example code? this is the code I'm using: query = "{\"create\":\"unless_exists\",\"id\":null,\"type\":\"/common/topic\", \"name\":\"test_xy\"}"; String envelope = "{\"qname\":{\"query\":" +query+ "}}"; String data = URLEncoder.encode(envelope, "UTF-8"); URL url = new URL("http://sandbox.freebase.com/api/service/mqlwrite"); URLConnection conn = url.openConnection(); conn.setDoInput(true); conn.setDoOutput(true); String credentials = "metaweb-user=..."; // value of the Set-Cookie from the login response conn.setRequestProperty("Cookie", credentials); conn.setRequestProperty("X-Metaweb-Request", "True"); conn.setRequestProperty("Content-type", "application/x-www-form-urlencoded"); OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream()); wr.write(data); wr.flush(); BufferedReader rd = new BufferedReader(new InputStreamReader( conn.getInputStream())); //write the response to a JSON object... wr.close(); rd.close(); Thanks, Christian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.freebase.com/pipermail/developers/attachments/20080219/c01c1916/attachment.htm From bryan.cheung at metaweb.com Tue Feb 19 05:24:17 2008 From: bryan.cheung at metaweb.com (Bryan Cheung) Date: Mon, 18 Feb 2008 21:24:17 -0800 Subject: [Developers] Java and mql write service In-Reply-To: <443bada30802181907l5f52118dpa559611e5247809d@mail.gmail.com> References: <443bada30802181907l5f52118dpa559611e5247809d@mail.gmail.com> Message-ID: <1C48A427-2866-4D49-BA3F-B09F9D6532BE@metaweb.com> Hi Christian, I've had better luck using the Jakarta Commons HTTPClient library(http://hc.apache.org/httpclient-3.x/ ). In pseudo-code, you can login using the PostMethod: private static final String LOGIN_PATH = "/api/account/login"; private static final String WRITE_PATH = "/api/service/mqlwrite"; private String freebaseUrl; // sandbox or www PostMethod method = new PostMethod(freebaseUrl); method.setPath(LOGIN_PATH); method.setRequestBody(requestBody); // the request body int responseCode = client.executeMethod(method); // execute method The client object will store your cookie credentials and you can then reuse the client to execute a write: method.setPath(WRITE_PATH); method.setRequestHeader("X-Metaweb-Request", "true"); method.setRequestHeader("Content-type", "application/x-www-form- urlencoded"); method.setRequestBody(requestBody); // the request body int responseCode = client.executeMethod(method); Once upon a time, I wrote a FreebaseClient using HTTPClient and JSON in Java (http://json.org/java/). If you're interested, I can send you or anyone else some code samples. Bryan On Feb 18, 2008, at 7:07 PM, Christian Hirsch wrote: > Hi All, > > I am trying to access the write API using Java, but somehow I always > get an error. > Sending read and login requests works just fine, however when I'm > sending write requests I'm always getting '400 bad request'. I'm not > very familiar with http requests in java... could there be something > wrong with the request header? or the credentials? - maybe someone > has some working example code? > > this is the code I'm using: > > query = "{\"create\":\"unless_exists\",\"id\":null,\"type\":\"/ > common/topic\", \"name\":\"test_xy\"}"; > String envelope = "{\"qname\":{\"query\":" +query+ "}}"; > String data = URLEncoder.encode(envelope, "UTF-8"); > > URL url = new URL("http://sandbox.freebase.com/api/service/mqlwrite"); > URLConnection conn = url.openConnection(); > conn.setDoInput(true); > conn.setDoOutput(true); > > String credentials = "metaweb-user=..."; // value of the Set-Cookie > from the login response > conn.setRequestProperty("Cookie", credentials); > conn.setRequestProperty("X-Metaweb-Request", "True"); > conn.setRequestProperty("Content-type", "application/x-www-form- > urlencoded"); > > OutputStreamWriter wr = new > OutputStreamWriter(conn.getOutputStream()); > wr.write(data); > wr.flush(); > > BufferedReader rd = new BufferedReader(new > InputStreamReader(conn.getInputStream())); > //write the response to a JSON object... > wr.close(); > rd.close(); > > > Thanks, > Christian > _______________________________________________ > Developers mailing list > Developers at freebase.com > http://lists.freebase.com/mailman/listinfo/developers -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.freebase.com/pipermail/developers/attachments/20080218/d669246f/attachment-0001.htm From daepark at metaweb.com Tue Feb 19 09:24:58 2008 From: daepark at metaweb.com (Dae Park) Date: Tue, 19 Feb 2008 01:24:58 -0800 Subject: [Developers] Java and mql write service In-Reply-To: <443bada30802181907l5f52118dpa559611e5247809d@mail.gmail.com> References: <443bada30802181907l5f52118dpa559611e5247809d@mail.gmail.com> Message-ID: <790294EB-CC13-49F4-B679-A62930F8D336@metaweb.com> Do you have the message detail (JSON response) of the 400 response you are getting? Make sure you are doing a POST and your post parameter looks like: queries={'qname':{'query':{...}}} -dae On Feb 18, 2008, at 7:07 PM, Christian Hirsch wrote: > Hi All, > > I am trying to access the write API using Java, but somehow I > always get an error. > Sending read and login requests works just fine, however when I'm > sending write requests I'm always getting '400 bad request'. I'm > not very familiar with http requests in java... could there be > something wrong with the request header? or the credentials? - > maybe someone has some working example code? > > this is the code I'm using: > > query = "{\"create\":\"unless_exists\",\"id\":null,\"type\":\"/ > common/topic\", \"name\":\"test_xy\"}"; > String envelope = "{\"qname\":{\"query\":" +query+ "}}"; > String data = URLEncoder.encode(envelope, "UTF-8"); > > URL url = new URL("http://sandbox.freebase.com/api/service/mqlwrite"); > URLConnection conn = url.openConnection(); > conn.setDoInput(true); > conn.setDoOutput(true); > > String credentials = "metaweb-user=..."; // value of the Set-Cookie > from the login response > conn.setRequestProperty("Cookie", credentials); > conn.setRequestProperty("X-Metaweb-Request", "True"); > conn.setRequestProperty("Content-type", "application/x-www-form- > urlencoded"); > > OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream > ()); > wr.write(data); > wr.flush(); > > BufferedReader rd = new BufferedReader(new InputStreamReader > (conn.getInputStream())); > //write the response to a JSON object... > wr.close(); > rd.close(); > > > Thanks, > Christian > _______________________________________________ > Developers mailing list > Developers at freebase.com > http://lists.freebase.com/mailman/listinfo/developers From ksrinivs at gmail.com Tue Feb 19 16:22:55 2008 From: ksrinivs at gmail.com (Kavitha Srinivas) Date: Tue, 19 Feb 2008 11:22:55 -0500 Subject: [Developers] Question about references to wikipedia articles Message-ID: <118B710C-A308-4207-802C-2ED4F2974A41@gmail.com> Is there a way to get a canonical reference to the current version of the wikipedia article for a given guid in freebase? We are trying to establish connections between freebase and dbpedia, and it looks like dbpedia has a canonical reference, whereas freebase uses a link to the version from which it was created. Finding equivalences between dbpedia and freebase has not been easy, and is prone to errors. Thanks! Kavitha From ben at metaweb.com Tue Feb 19 18:29:34 2008 From: ben at metaweb.com (Ben Drees) Date: Tue, 19 Feb 2008 10:29:34 -0800 Subject: [Developers] Java and mql write service In-Reply-To: <790294EB-CC13-49F4-B679-A62930F8D336@metaweb.com> References: <443bada30802181907l5f52118dpa559611e5247809d@mail.gmail.com> <790294EB-CC13-49F4-B679-A62930F8D336@metaweb.com> Message-ID: <47BB200E.4010104@metaweb.com> Hi Christian, The HTTP error response bodies usually provide clues as to what's going on. It looks like you're getting back response bodies that include the message "one of query=, or queries= must be provided", which points to a missing "queries=" prefix in your 'envelope' variable. -Ben Dae Park wrote: > Do you have the message detail (JSON response) of the 400 response > you are getting? > > Make sure you are doing a POST and your post parameter looks like: > > queries={'qname':{'query':{...}}} > > -dae > > On Feb 18, 2008, at 7:07 PM, Christian Hirsch wrote: > > >> Hi All, >> >> I am trying to access the write API using Java, but somehow I >> always get an error. >> Sending read and login requests works just fine, however when I'm >> sending write requests I'm always getting '400 bad request'. I'm >> not very familiar with http requests in java... could there be >> something wrong with the request header? or the credentials? - >> maybe someone has some working example code? >> >> this is the code I'm using: >> >> query = "{\"create\":\"unless_exists\",\"id\":null,\"type\":\"/ >> common/topic\", \"name\":\"test_xy\"}"; >> String envelope = "{\"qname\":{\"query\":" +query+ "}}"; >> String data = URLEncoder.encode(envelope, "UTF-8"); >> >> URL url = new URL("http://sandbox.freebase.com/api/service/mqlwrite"); >> URLConnection conn = url.openConnection(); >> conn.setDoInput(true); >> conn.setDoOutput(true); >> >> String credentials = "metaweb-user=..."; // value of the Set-Cookie >> from the login response >> conn.setRequestProperty("Cookie", credentials); >> conn.setRequestProperty("X-Metaweb-Request", "True"); >> conn.setRequestProperty("Content-type", "application/x-www-form- >> urlencoded"); >> >> OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream >> ()); >> wr.write(data); >> wr.flush(); >> >> BufferedReader rd = new BufferedReader(new InputStreamReader >> (conn.getInputStream())); >> //write the response to a JSON object... >> wr.close(); >> rd.close(); >> >> >> Thanks, >> Christian >> _______________________________________________ >> Developers mailing list >> Developers at freebase.com >> http://lists.freebase.com/mailman/listinfo/developers >> > > _______________________________________________ > Developers mailing list > Developers at freebase.com > http://lists.freebase.com/mailman/listinfo/developers > > From colin at metaweb.com Wed Feb 20 01:45:32 2008 From: colin at metaweb.com (Colin Evans) Date: Tue, 19 Feb 2008 17:45:32 -0800 Subject: [Developers] Question about references to wikipedia articles In-Reply-To: <118B710C-A308-4207-802C-2ED4F2974A41@gmail.com> References: <118B710C-A308-4207-802C-2ED4F2974A41@gmail.com> Message-ID: <47BB863C.2050405@metaweb.com> Hi Kavitha, Every Freebase topic that has a corresponding Wikipedia topic has a set of keys with the namespace "/wikipedia/en" and also a "/wikipedia/en_id" key. You can see examples of those keys here: http://freebase.com/view/explore/topic/en/abraham_lincoln The "en" keys are the Wikipedia article titles and redirects that correspond to the Freebase topic. The "en_id" is the Wikipedia page_id from the Mediawiki database. We re-synchronize with Wikipedia roughly twice a month, with a strong emphasis on keeping Freebase topics stable. Thus, if a page is split, merged, moved, or deleted in Wikipedia, the corresponding topic(s) in Freebase will reflect the changes conservatively or maybe not at all, depending on the data and our current sync algorithm. We work hard to keep Freebase.com aligned with Wikipedia, so for most cases the "en" keys should be a good mapping. The dbpedia extraction is run on a regular basis from scratch, and therefore their canonical reference is to a specific article version in a specific Wikipedia dump. Because Freebase.com is continuously synchronizing with Wikipedia, there isn't a more canonical reference than the "en" and "en_id" keys. If you're looking to reconcile a specific dbpedia dump with Freebase.com, I'd recommend aligning on article names and redirects -- the "en" keys in Freebase. There may be some inconsistencies as Wikiepdia redirects move around over time, but this will probably work for the majority of records. Also, I'd like to get in a plug for the new Freebase Wikipedia Extraction, which is the basis for a lot of our sync algorithms and data mining of Wikipdia. The "freebase_names" table has a mapping of Freebase guids to Wikipedia article names, which should make alignment easier: http://download.freebase.com/wex/doc/#freebase_names Hope that helps! -Colin Kavitha Srinivas wrote: > Is there a way to get a canonical reference to the current version of > the wikipedia article for a given guid in freebase? We are trying to > establish connections between freebase and dbpedia, and it looks like > dbpedia has a canonical reference, whereas freebase uses a link to > the version from which it was created. Finding equivalences between > dbpedia and freebase has not been easy, and is prone to errors. Thanks! > Kavitha > _______________________________________________ > Developers mailing list > Developers at freebase.com > http://lists.freebase.com/mailman/listinfo/developers > From ksrinivs at gmail.com Wed Feb 20 04:05:56 2008 From: ksrinivs at gmail.com (Kavitha Srinivas) Date: Tue, 19 Feb 2008 23:05:56 -0500 Subject: [Developers] Question about references to wikipedia articles In-Reply-To: <47BB863C.2050405@metaweb.com> References: <118B710C-A308-4207-802C-2ED4F2974A41@gmail.com> <47BB863C.2050405@metaweb.com> Message-ID: <1DF7F255-F015-4362-91C2-E171F07F6DD4@gmail.com> Yes, that's a good suggestion. The trouble is, as you pointed out, even the redirects don't always match, because of the differences in the update cycles. Thanks for the information about the Freebase Wikipedia Extraction. That looks like it may help us start establishing connections between dbpedia and freebase. Kavitha On Feb 19, 2008, at 8:45 PM, Colin Evans wrote: > Hi Kavitha, > Every Freebase topic that has a corresponding Wikipedia topic has a > set > of keys with the namespace "/wikipedia/en" and also a "/wikipedia/ > en_id" > key. You can see examples of those keys here: > http://freebase.com/view/explore/topic/en/abraham_lincoln > > The "en" keys are the Wikipedia article titles and redirects that > correspond to the Freebase topic. The "en_id" is the Wikipedia > page_id > from the Mediawiki database. > > We re-synchronize with Wikipedia roughly twice a month, with a strong > emphasis on keeping Freebase topics stable. Thus, if a page is split, > merged, moved, or deleted in Wikipedia, the corresponding topic(s) in > Freebase will reflect the changes conservatively or maybe not at all, > depending on the data and our current sync algorithm. We work hard to > keep Freebase.com aligned with Wikipedia, so for most cases the "en" > keys should be a good mapping. > > The dbpedia extraction is run on a regular basis from scratch, and > therefore their canonical reference is to a specific article > version in > a specific Wikipedia dump. Because Freebase.com is continuously > synchronizing with Wikipedia, there isn't a more canonical reference > than the "en" and "en_id" keys. > > If you're looking to reconcile a specific dbpedia dump with > Freebase.com, I'd recommend aligning on article names and redirects -- > the "en" keys in Freebase. There may be some inconsistencies as > Wikiepdia redirects move around over time, but this will probably work > for the majority of records. > > Also, I'd like to get in a plug for the new Freebase Wikipedia > Extraction, which is the basis for a lot of our sync algorithms and > data > mining of Wikipdia. The "freebase_names" table has a mapping of > Freebase guids to Wikipedia article names, which should make alignment > easier: http://download.freebase.com/wex/doc/#freebase_names > > Hope that helps! > -Colin > > Kavitha Srinivas wrote: >> Is there a way to get a canonical reference to the current version of >> the wikipedia article for a given guid in freebase? We are trying to >> establish connections between freebase and dbpedia, and it looks like >> dbpedia has a canonical reference, whereas freebase uses a link to >> the version from which it was created. Finding equivalences between >> dbpedia and freebase has not been easy, and is prone to errors. >> Thanks! >> Kavitha >> _______________________________________________ >> Developers mailing list >> Developers at freebase.com >> http://lists.freebase.com/mailman/listinfo/developers >> > > _______________________________________________ > Developers mailing list > Developers at freebase.com > http://lists.freebase.com/mailman/listinfo/developers From hirsch.christian at gmail.com Wed Feb 20 20:28:28 2008 From: hirsch.christian at gmail.com (Christian Hirsch) Date: Thu, 21 Feb 2008 09:28:28 +1300 Subject: [Developers] Java and mql write service In-Reply-To: <47BB200E.4010104@metaweb.com> References: <443bada30802181907l5f52118dpa559611e5247809d@mail.gmail.com> <790294EB-CC13-49F4-B679-A62930F8D336@metaweb.com> <47BB200E.4010104@metaweb.com> Message-ID: <443bada30802201228h39d36b80tb840580b6b40b45@mail.gmail.com> Hi, thanks for the suggestions. The problem was in fact the missing "queries=". As well as the urlencode of the envelope variable (which is not neccessary). I am now using the Commons HTTPClient library like Bryan suggested and it seems to work. here is the code: //login myclient = new HttpClient(); PostMethod method = new PostMethod(BASE_URL); method.setPath("/api/account/login"); method.setParameter("username", username); method.setParameter("password", password); int responseCode = myclient.executeMethod(method); //write query = "{\"create\":\"unless_exists\",\"id\":null,\"type\":\"/common/topic\", \"name\":\"testxy\"}"; String envelope = "queries={\"qname\":{\"query\":" +query+ "}}"; PostMethod method = new PostMethod(BASE_URL); method.setPath("/api/service/mqlwrite"); method.setRequestHeader("X-Metaweb-Request", "true"); method.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); method.setRequestBody(envelope); int responseCode = myclient.executeMethod(method); Cheers, Christian On Feb 20, 2008 7:29 AM, Ben Drees wrote: > Hi Christian, > > The HTTP error response bodies usually provide clues as to what's going > on. > > It looks like you're getting back response bodies that include the message > "one of query=, or queries= must be provided", which points to a missing > "queries=" > prefix in your 'envelope' variable. > > -Ben > > Dae Park wrote: > > Do you have the message detail (JSON response) of the 400 response > > you are getting? > > > > Make sure you are doing a POST and your post parameter looks like: > > > > queries={'qname':{'query':{...}}} > > > > -dae > > > > On Feb 18, 2008, at 7:07 PM, Christian Hirsch wrote: > > > > > >> Hi All, > >> > >> I am trying to access the write API using Java, but somehow I > >> always get an error. > >> Sending read and login requests works just fine, however when I'm > >> sending write requests I'm always getting '400 bad request'. I'm > >> not very familiar with http requests in java... could there be > >> something wrong with the request header? or the credentials? - > >> maybe someone has some working example code? > >> > >> this is the code I'm using: > >> > >> query = "{\"create\":\"unless_exists\",\"id\":null,\"type\":\"/ > >> common/topic\", \"name\":\"test_xy\"}"; > >> String envelope = "{\"qname\":{\"query\":" +query+ "}}"; > >> String data = URLEncoder.encode(envelope, "UTF-8"); > >> > >> URL url = new URL("http://sandbox.freebase.com/api/service/mqlwrite"); > >> URLConnection conn = url.openConnection(); > >> conn.setDoInput(true); > >> conn.setDoOutput(true); > >> > >> String credentials = "metaweb-user=..."; // value of the Set-Cookie > >> from the login response > >> conn.setRequestProperty("Cookie", credentials); > >> conn.setRequestProperty("X-Metaweb-Request", "True"); > >> conn.setRequestProperty("Content-type", "application/x-www-form- > >> urlencoded"); > >> > >> OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream > >> ()); > >> wr.write(data); > >> wr.flush(); > >> > >> BufferedReader rd = new BufferedReader(new InputStreamReader > >> (conn.getInputStream())); > >> //write the response to a JSON object... > >> wr.close(); > >> rd.close(); > >> > >> > >> Thanks, > >> Christian > >> _______________________________________________ > >> Developers mailing list > >> Developers at freebase.com > >> http://lists.freebase.com/mailman/listinfo/developers > >> > > > > _______________________________________________ > > Developers mailing list > > Developers at freebase.com > > http://lists.freebase.com/mailman/listinfo/developers > > > > > > _______________________________________________ > Developers mailing list > Developers at freebase.com > http://lists.freebase.com/mailman/listinfo/developers > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.freebase.com/pipermail/developers/attachments/20080221/214b9db7/attachment-0001.htm From jlowe at giswebsite.com Wed Feb 20 22:16:33 2008 From: jlowe at giswebsite.com (Jonathan W. Lowe) Date: Wed, 20 Feb 2008 22:16:33 +0000 Subject: [Developers] MQL equivalent of SQL's SELECT DISTINCT? In-Reply-To: <443bada30802201228h39d36b80tb840580b6b40b45@mail.gmail.com> References: <443bada30802181907l5f52118dpa559611e5247809d@mail.gmail.com> <790294EB-CC13-49F4-B679-A62930F8D336@metaweb.com> <47BB200E.4010104@metaweb.com> <443bada30802201228h39d36b80tb840580b6b40b45@mail.gmail.com> Message-ID: <1203545793.4316.12.camel@localhost.localdomain> I'm trying to form an MQL read query that specifies a type (e.g. /business/company), finds all topics of that type, lists all other types linked to those topics and returns a distinct list of those other types (as per a SQL SELECT DISTINCT... query). Is there an MQL "shortcut" equivalent to SQL's SELECT DISTINCT? Thanks, Jonathan From crism at metaweb.com Wed Feb 20 22:30:03 2008 From: crism at metaweb.com (Christopher R. Maden) Date: Wed, 20 Feb 2008 14:30:03 -0800 Subject: [Developers] MQL equivalent of SQL's SELECT DISTINCT? In-Reply-To: <1203545793.4316.12.camel@localhost.localdomain> References: <443bada30802181907l5f52118dpa559611e5247809d@mail.gmail.com> <790294EB-CC13-49F4-B679-A62930F8D336@metaweb.com> <47BB200E.4010104@metaweb.com> <443bada30802201228h39d36b80tb840580b6b40b45@mail.gmail.com> <1203545793.4316.12.camel@localhost.localdomain> Message-ID: <47BCA9EB.70808@metaweb.com> Jonathan W. Lowe wrote: > I'm trying to form an MQL read query that specifies a type > (e.g. /business/company), finds all topics of that type, lists all other > types linked to those topics and returns a distinct list of those other > types (as per a SQL SELECT DISTINCT... query). > > Is there an MQL "shortcut" equivalent to SQL's SELECT DISTINCT? The trick to this, in MQL, is to turn the query inside out. You want to find all types who have instances shared with a target type (/business/company). { "query":[ { "type":"/type/type", "name":null, "id":null, "instance":[ { "type":"/business/company", "limit":1 } ] } ] } (The limit clause is in there to keep it more readable and to decrease the likelihood of timeout.) ~Chris -- Christopher R. Maden Data Architect Metaweb Technologies, Inc. From hirsch.christian at gmail.com Wed Feb 20 22:53:02 2008 From: hirsch.christian at gmail.com (Christian Hirsch) Date: Thu, 21 Feb 2008 11:53:02 +1300 Subject: [Developers] Creating new Relationships Message-ID: <443bada30802201453gbedea7eh2bf650e4f2fed52d@mail.gmail.com> Hi, I am developing an application which should be able to create new relationships between existing topics. For example connect a movie to a person with the relationship "story_by". I am trying to establish this with 3 known variables: - the "source" id, e.g. the movie ID - the "sink" id, e.g. the person ID - the name of the relationship, e.g. "story_by" As I found out, these 3 variables are not enough to create the relationshp (if I'm wrong please correct me ;)... I have two questions: 1) creating the relationship with the 3 mentioned variables alone doesn't work. The following write request is missing the correct type { "id" : "movieID", "story_by" : { "connect" : "insert", "id" : "personID" }, } this works: { "id" : "movieID", "story_by" : { "connect" : "insert", "id" : "personID" }, "type" : "/film/film" } So my question is: given only the 3 variables, What is the best way to find out, that I need to use the type "/film/film"? 2) the second write request above is still not enough to create the new relationship. I need to assign a new type to the person. In this example I need to do the following: { "id" : "personID", "type" : { "connect" : "insert", "id" : "/film/film_story_contributor" } } The question is again: how do I find out that the new type which needs to be assigned to the person is "/film/film_story_contributor"? Thanks, Christian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.freebase.com/pipermail/developers/attachments/20080221/12547423/attachment.htm From crism at metaweb.com Wed Feb 20 23:16:31 2008 From: crism at metaweb.com (Christopher R. Maden) Date: Wed, 20 Feb 2008 15:16:31 -0800 Subject: [Developers] Creating new Relationships In-Reply-To: <443bada30802201453gbedea7eh2bf650e4f2fed52d@mail.gmail.com> References: <443bada30802201453gbedea7eh2bf650e4f2fed52d@mail.gmail.com> Message-ID: <47BCB4CF.2000404@metaweb.com> Christian Hirsch wrote: > So my question is: given only the 3 variables, What is the best way to > find out, that I need to use the type "/film/film"? The relationship (or property) is not ?story_by,? it is ?/film/film/story_by.? A shorthand is allowed when the type is known, but the full form is always OK. How did you find that the property is ?story_by?? Anywhere you found that, you should also have been able to find the full form. > The question is again: how do I find out that the new type which needs > to be assigned to the person is "/film/film_story_contributor"? A property is an object in Freebase, just like everything else. The Property type has properties, and instances of Property (like story_by) have property values themselves. In this case, what you are looking for is the Expected Type property, which tells you what kind of thing should be found at the other end. ~Chris -- Christopher R. Maden Data Architect Metaweb Technologies, Inc. From bryan.cheung at metaweb.com Wed Feb 20 23:30:50 2008 From: bryan.cheung at metaweb.com (Bryan Cheung) Date: Wed, 20 Feb 2008 15:30:50 -0800 Subject: [Developers] Creating new Relationships In-Reply-To: <443bada30802201453gbedea7eh2bf650e4f2fed52d@mail.gmail.com> References: <443bada30802201453gbedea7eh2bf650e4f2fed52d@mail.gmail.com> Message-ID: <2ED940A7-BFC3-4C90-9DB0-493114983978@metaweb.com> 1) Since concepts can have multiple types, you will always need to specify the type that you are populating values for. Alternatively, you can use the instance ID and the fully qualified property ID for your query: { "query" : { "id" : movieID, "story_by" : { "connect" : "insert", "id" : personID, "type" : { "connect" : "insert", "id" : "/film/film_contributor" } }, "type" : "/film/film" } } and { "query" : { "/film/film/story_by" : { "connect" : "insert", "id" : personID, "type" : { "connect" : "insert", "id" : "/film/film_contributor" } }, "id" : movieID } } are equivalent queries. The latter is handy when you are populating values for multiple types for a given instance. 2) When you're connecting the film contributor, MQL, unlike the web client, does not infer that if the personID you are adding is of type / film/film_contributor and you should specify it explicitly. If the person is already typed as a /film/film_contributor, MQL will return connect:present. If you wish to programatically find out what the ECT of a property is, you can query for it like this: { "query" : { "expected_type" : { "id" : null, "name" : null }, "id" : "/film/film/story_by", "type" : "/type/property" } } Bryan On Feb 20, 2008, at 2:53 PM, Christian Hirsch wrote: > Hi, > I am developing an application which should be able to create new > relationships between existing topics. For example connect a movie > to a person with the relationship "story_by". I am trying to > establish this with 3 known variables: > - the "source" id, e.g. the movie ID > - the "sink" id, e.g. the person ID > - the name of the relationship, e.g. "story_by" > > As I found out, these 3 variables are not enough to create the > relationshp (if I'm wrong please correct me ;)... I have two > questions: > > 1) > creating the relationship with the 3 mentioned variables alone > doesn't work. The following write request is missing the correct type > > { > "id" : "movieID", > "story_by" : { > "connect" : "insert", > "id" : "personID" > }, > } > > this works: > > { > "id" : "movieID", > "story_by" : { > "connect" : "insert", > "id" : "personID" > }, > "type" : "/film/film" > } > > So my question is: given only the 3 variables, What is the best way > to find out, that I need to use the type "/film/film"? > > > 2) > the second write request above is still not enough to create the new > relationship. I need to assign a new type to the person. In this > example I need to do the following: > > { > "id" : "personID", > "type" : { > "connect" : "insert", > "id" : "/film/film_story_contributor" > } > } > > The question is again: how do I find out that the new type which > needs to be assigned to the person is "/film/film_story_contributor"? > > > Thanks, > Christian > _______________________________________________ > Developers mailing list > Developers at freebase.com > http://lists.freebase.com/mailman/listinfo/developers From alex at foxybanana.com Thu Feb 21 00:31:36 2008 From: alex at foxybanana.com (Alexander Botero-Lowry) Date: Wed, 20 Feb 2008 16:31:36 -0800 Subject: [Developers] 503 error when trying to do a large write to Sandbox Message-ID: <20080221003136.GB54994@puddlejumper.foxybanana.com> Hi, Monday night I tried to import 2561 records as a single query on Sandbox. After fixing some bugs in how I was formatting my date, I finally got the query to execute but I received a 503. I tried the query a few more times and then checked sandbox to make sure nothing had happened and low and behold some of the entries showed up! At that point I realized that I wasn't sure all of them were there so I rewrote my importer script to do it in 100 block increments, and I got an error that there were 2 unique entries, which I looked up and determined was the result of create=unless_exists not being able to disambiguate! So it seems like somehow, even though i was using create=unless_exists the entry got added twice. I'm not exactly sure how transactions work internally so I can't really speculate further on how that happened. Follows is my importer: #!/usr/bin/env python import metaweb USERNAME='' PASSWORD='' MONTH_MAP = {'Jan':1, 'Feb':2, 'Mar':3, 'Apr':4, 'May':5, 'Jun':6, 'Jul':7, 'Aug':8, 'Sep':9, 'Oct':10, 'Nov':11, 'Dec':12} TYPEID = '/user/alexbl/default_domain/exchange_rate' SOURCE_CURR = {'name':'US $', 'type':'/finance/currency'} TARGET_CURR = {'name':'Australian dollar', 'type':'/finance/currency'} def generate_query(a): data = a.split() # FIXME: find a better way to do this rate_date = data[0].split('-') rate_date[2] = '19'+rate_date[2] rate_date[1] = "%02d" % (MONTH_MAP[rate_date[1]]) rate_date[0] = "%02d" % int(rate_date[0]) data[0] = '-'.join(reversed(rate_date)) q = {'create':'unless_exists', 'id':None, 'type':[TYPEID], 'source_of_exchange':SOURCE_CURR, 'target_of_exchange':TARGET_CURR, 'amount':float(data[1]), 'date_of_rate':data[0] } return q if __name__ == '__main__': query = [ generate_query(a) for a in file('USD-AUD-90-99.txt') ] credentials = metaweb.login(USERNAME, PASSWORD) for a in range(100, len(query), 100): result = metaweb.write(query[a:a+100], credentials) for r in result: print r['create'], r['id'] Before I added the stepper, it was simply directly doing what's in side the for loop with the query list. The data format is like: 2-Jan-90 0.7855 3-Jan-90 0.7818 ... I will most likely write a script to query the ids and then detype them and then do an import again with the 100 block steps version to see if that's the only problem. Luckily this was all on sandbox :) Thanks, Alex From sm at metaweb.com Thu Feb 21 02:38:10 2008 From: sm at metaweb.com (Scott Meyer) Date: Wed, 20 Feb 2008 18:38:10 -0800 Subject: [Developers] Cursor format change on sandbox, coming soon to freebase.com Message-ID: <47BCE412.2010209@metaweb.com> Our just-completed software update of sandbox.freebase.com has a cursor-format change. Basically, cursors created with against the previous sandbox software will not work against the new software. If you created a cursor before 4pm PST today, attempts to use it will now generate an error. The recovery is to restart the cursored query from the beginning. The cause of the incompatibility are some new optimizations to graphd which deliver a 2x performance increase for certain queries. Our intention is that cursors have an indefinite but relatively short lifespan. We're making the format more resistant to incompatibilities, but the information stored in a cursor is intimately related to the capabilities of our query optimizer. Faster queries may come at the expense of cursor format compatibility, and recovery (for example, by silently rerunning the queries producing the first N pages) may not always be feasible. If you're using long-running cursored queries, or contemplating such, we'd love to hear from you. -Scott From jim.weaver at lat-inc.com Thu Feb 21 13:53:26 2008 From: jim.weaver at lat-inc.com (James L. Weaver) Date: Thu, 21 Feb 2008 08:53:26 -0500 (EST) Subject: [Developers] A couple of freebase-related posts,