"Yeah it's new this week -- it was mentioned in the blog, if you follow the release notes there. "
Let's say you want to find all the Freebase users who live in the USA, but they have their locations set to things like "San Francisco" or "New Orleans". How do you ask for "USA, and anything within the USA"?
While MQL doesn't currently support transitive closure, the /location/ location/containedby property model was designed to make the type of query you are attempting to write possible. When creating /location/ location topics the idea is to provide (at least) two levels of hierarchical containment in the containedby property. For example, in the US, cities should specify what county they are in as well as what state they are contained in.
As your query indicates universities should be co-typed as locations and should specify the city they are contained in. Using the two- level of hierarchy containment model, cities should be contained in states, and similarly states should be contained in the US. Therefore, you should be able to get what you are looking for with the query:
Note: the ID for the US is /guid/9202a8c04000641f8000000000959f60{
"query":[{
"/location/location/containedby":[{
"/location/location/containedby":[{
"/location/location/containedby":[{
"id":"/guid/9202a8c04000641f8000000000959f60"
}],
"name":null
}],
"name":null
}],
"name":null,
"type":"/education/university"
}]
}Someday, MQL will probably handle transitivity operations - but until then it is possible to construct queries which utilize the containment models based on some minimal assumptions about the data. I am happy to work with you (and others) to make sure the data conforms to these minimal assumptions to meet your needs.
Search Help Center
- Building Bases
- Creating Schemas
-
Developing Applications
- An Introduction to Freebase Application Development
- Playing in the Sandbox
- Freebase Programming Libraries and Tools
- Data Dump FAQ
- Using the Query Editor
- The Complete Metaweb Query Language (MQL) Reference Guide
- MQL Cheatsheet
-
The MQL Cookbook
- Get data as of a specific time
- Read properties of a type
- values vs name/id
- Incoming links
- Any topics with a specific date
- Wikipedia article text
- Retrieve the Wikipedia URL for an object with a GUID
- Find distinct co-types
- Creating relationships with the connect directive
- Mark for deletion
- Sort by index and timestamp
- Traversing Through Non-Reversed Properties
- Combine queries
- Perform transitive queries
- Freebase API Reference
- Application Developer Tips
- The Acre Hosted Development Environment
- Introduction to the Metaweb Javascript Template Language (MJT)
- Freebase Community