[Developers] Freebase newbie: simple question
Gordon Mackenzie
gordon at metaweb.com
Thu Feb 26 02:16:57 UTC 2009
You want Textual Comparisons? To match all states that contain the
term "mass":
{
"country" : {
"id" : "/en/united_states"
},
"filter1:name~=" : "*mass*",
"iso_3166_2_code" : null,
"name" : null,
"type" : "/location/administrative_division"
}
]
This is a great little primer for MQLing:
http://download.freebase.com/
MQL Cheatsheet
A cheatsheet for the Metaweb Query Language (MQL).
Download MQL Cheatsheet
~ Gordon
<<< gordon at metaweb.com >>>
On Feb 25, 2009, at 6:11 PM, Shawn Simister wrote:
> Pito,
>
> I haven't used Httparty before but its looks like a very useful gem
> given that it can download a URI and parse the JSON all in one call.
>
> There are two ways to find states that match "mass". The first way
> would be to constrain the query that I gave earlier using an MQL
> filter like this:
>
> [
> {
> "country" : {
> "id" : "/en/united_states"
> },
>
> "iso_3166_2_code" : null,
> "name" : null,
> "filter1:name~=" : "Mass*",
> "type" : "/location/administrative_division"
> }
> ]
>
> The other way is to query the /common/topic/alias property like this:
>
> [
> {
> "/common/topic/alias" : "Mass.",
> "country" : {
> "id" : "/en/united_states"
> },
> "iso_3166_2_code" : null,
> "name" : null,
> "type" : "/location/administrative_division"
> }
> ]
>
> The benefit of using the alias property is that it will also match
> non-trivial aliases like "Sunshine State". The down-side is that a
> lot of the common aliases haven't been entered into Freebase yet so
> you might have to add them in by yourself to get it to a usable
> level of accuracy (I had to manually add "Mass." as an alias to
> Massachusetts to make the 2nd query work).
>
> Shawn
>
> Pito Salas wrote:
>>
>> Hi Shawn
>>
>> Do you know the httparty gem. It makes it really easy to do what we
>> need here.
>>
>> So... What if I wanted any US states that have the letters "mass" in
>> their name? Is there magic syntax for thatz?
>>
>> Thanks again!
>>
>> Pito
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freebase.com/pipermail/developers/attachments/20090225/c021698c/attachment-0001.htm
More information about the Developers
mailing list