Discussions on Properties

containedby property isn't transitive?

This query looks for all universities in Boston.
{
"qname":{
"query":[{
"*":null,
"/location/location/containedby":{
"name":"Boston, Massachusetts"
},
"type":"/education/university"
}]
}
}

It works fine.
I would expect that replacing "Boston, Massachusetts" by "United States" would find all universities in US.
But it doesn't work.

Two questions:
1- containedby is not a transitive propety? will it be?
2- which query can look for all universities in US?

Many thanks,
DAvid

This question gets asked quite a bit, and my understanding is that the Metaweb folks are putting some thought into the idea of having transitive properties, but haven't implemented anything yet. This post to the dev mailing list and its reply may give you some more information, including an MQL query to walk up the tree a little.

Repost from our email list:

(http://lists.freebase.com/pipermail/data-modeling/2007-November/000218.html)

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 /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.