[Developers] List Of Properties

Warren Harris warren at metaweb.com
Tue Jul 8 20:01:48 UTC 2008


On Jul 7, 2008, at 10:48 AM, Kendra Kuhl wrote:

> Thanks Christian. That works great.
>
> Now I’m having a bit of a different problem. Now, because there are  
> so many properties, when I query for their values, Freebase either  
> gives me a timeout / bad request(while using the API) or doesn’t do  
> anything (while using the query editor). I’m thinking it’s because  
> there’s too much going on, but maybe somebody can point me in the  
> direction to a better way?

Hi Kendra,

I think you should be able to adapt the mega- /type/reflect query that  
was sent out earlier to return all the detail that you're trying to  
get from the query below. But in general, if you ask for too much in  
one shot, you run the risk of timing out. Maybe you should break this  
up into a series of smaller queries.

You might also want to use cursors:

http://www.freebase.com/view/guid/9202a8c04000641f800000000544e139#cursors
http://www.freebase.com/view/guid/9202a8c04000641f8000000005b7ad20?domain=%2Fuser%2Fnix%2Ftypes
http://mqlx.com/~willmoffat/learn_feature/cursor/cursor.js

Warren


>
> Thanks,
>
> Kendra
>
> Here’s my query:
>
> {
>   "/business/employer/employees" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/common/topic/alias" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/common/topic/article" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/common/topic/image" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/common/topic/webpage" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/government/governmental_jurisdiction/governing_officials" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/government/governmental_jurisdiction/government_bodies" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/government/governmental_jurisdiction/government_positions" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/government/political_district/representatives" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/location/administrative_division/country" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/location/administrative_division/fips_10_4_region_code" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/location/administrative_division/iso_3166_2_code" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/location/administrative_division/official_symbols" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/location/dated_location/date_dissolved" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/location/dated_location/date_founded" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/location/location/adjoin_s" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/location/location/area" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/location/location/containedby" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/location/location/contains" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/location/location/geolocation" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/location/location/geometry" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/location/location/gnis_feature_id" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/location/location/gns_ufi" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/location/location/people_born_here" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/location/location/time_zones" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/location/location/usbg_name" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/location/statistical_region/automobiles_per_capita" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/location/statistical_region/co2_emissions_commercial" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/location/statistical_region/co2_emissions_industrial" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/location/statistical_region/co2_emissions_mobile" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/location/statistical_region/co2_emissions_residential" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/location/statistical_region/co2_emissions_total" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/location/statistical_region/gdp_nominal" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/location/statistical_region/gdp_nominal_per_capita" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/location/statistical_region/major_exports" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/location/statistical_region/major_imports" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/location/statistical_region/places_exported_to" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/location/statistical_region/places_imported_from" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/location/statistical_region/population" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/location/statistical_region/religions" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/location/us_state/capital" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "/wine/wine_region/wines" : [
>     {
>       "*" : null,
>       "optional" : true
>     }
>   ],
>   "guid" : "#9202a8c04000641f800000000054dd5d",
>   "name" : null,
>   "type" : [
>     {
>       "guid" : null,
>       "id" : null,
>       "name" : null
>     }
>   ]
> }
>
> From: developers-bounces at freebase.com [mailto:developers-bounces at freebase.com 
> ] On Behalf Of Christian Hirsch
> Sent: Sunday, July 06, 2008 10:21 PM
> To: For discussions about MQL, Freebase API and apps built on Freebase
> Subject: Re: [Developers] List Of Properties
>
> This thread might be helpful:
> http://markmail.org/message/uwfaeinosbmlorvw#query:+page:1+mid:lxet5u5eh64eljua+state:results
> Warren suggested a query to retrieve all properties for a given  
> topic...
> Cheers,
> Christian
>
> On Mon, Jul 7, 2008 at 10:14 AM, Kendra Kuhl  
> <kendra.kuhl at juggle.com> wrote:
> I need some advice on the best way to do something. What I have  
> isn't working for me anymore.
>
>
>
> A while ago I had asked for a way to get all the properties  
> associated to a topic and Alexander was nice enough to give me this  
> query:
>
>
>
> {
>
>   "query" : [
>
>     {
>
>       "master_property" : null,
>
>       "source" : {
>
>         "id" : "topicId"
>
>       },
>
>       "target" : {
>
>         "id" : null
>
>       },
>
>       "target_value" : null,
>
>       "type" : "/type/link"
>
>     }
>
>   ]
>
> }
>
>
>
> So, I modified it a bit to look like this:
>
>
>
> {
>
>   "query" : [
>
>     {
>
>       "master_property" : null,
>
>       "source" : {
>
>         "id" : null,
>
>         "guid" : null,
>
>         "name" : "Something"
>
>       },
>
>       "target_value" : null,
>
>       "type" : "/type/link"
>
>     }
>
>   ]
>
> }
>
>
>
> That worked out quite nicely until I started messing around with  
> locations (and I'm sure locations aren't unique in this regard).  
> But, if you send that query to freebase with Kansas as the name, you  
> wind up getting back 2700 properties. Most of them "/location/ 
> location/contains" but still, 2700. It takes forever if it doesn't  
> time out on me.  (Even if I send in the exact guid, I still wind up  
> with 2400 properties – 2300 of which are the /location/location/ 
> contains.).
>
>
>
> What I do with those properties is loop through them, filter out  
> anything that starts with /guid, /type, /user as well as any  
> duplicates and create another query to get the values for those  
> properties.
>
>
>
> So, my question is this: given what I'm trying to accomplish, is  
> there an easier way to go about it? Is there a way to get the  
> properties for the topic, without duplicates, without /type, /guid, / 
> user so I can then query to get the information I really want about  
> the topic? I don't really want to hard code all the properties I  
> want to go after for each and every type. I know I could use cursors  
> to "page" through the data, but that would still take forever and  
> I'm trying to make it as fast as possible.
>
>
>
> Thanks,
>
>
>
> Kendra
>
>
> _______________________________________________
> 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/20080708/31e9317b/attachment-0001.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3739 bytes
Desc: not available
Url : http://lists.freebase.com/pipermail/developers/attachments/20080708/31e9317b/attachment-0001.bin 


More information about the Developers mailing list