<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Freebase Blog &#187; MQL</title>
	<atom:link href="http://blog.freebase.com/category/developers/mql/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.freebase.com</link>
	<description>A blog for data geeks, application developers and interested civilians</description>
	<lastBuildDate>Wed, 25 Nov 2009 01:29:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Check out Stefano&#8217;s Schema Explorer</title>
		<link>http://blog.freebase.com/2009/06/26/check-out-stefanos-schema-explorer/</link>
		<comments>http://blog.freebase.com/2009/06/26/check-out-stefanos-schema-explorer/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 20:32:05 +0000</pubDate>
		<dc:creator>skud</dc:creator>
				<category><![CDATA[Acre]]></category>
		<category><![CDATA[Applications]]></category>
		<category><![CDATA[MQL]]></category>
		<category><![CDATA[Schema]]></category>
		<category><![CDATA[freebase]]></category>
		<category><![CDATA[stefano mazzocchi]]></category>

		<guid isPermaLink="false">http://blog.freebase.com/?p=1022</guid>
		<description><![CDATA[Stefano writes on our developer mailing list:
If you&#8217;re like me, MQL often feels like a combination of power and dark  magic:  some people can whip up a MQL query in no time, like they knew  all about every type, every property and how they link all the various pieces of the graph [...]]]></description>
			<content:encoded><![CDATA[<p><i><a href="http://www.freebase.com/view/en/stefano_mazzocchi">Stefano</a> writes on our <a href="http://lists.freebase.com/mailman/listinfo/developers">developer mailing list</a>:</i></p>
<p>If you&#8217;re like me, MQL often feels like a combination of power and dark  magic:  some people can whip up a MQL query in no time, like they knew  all about every type, every property and how they link all the various pieces of the graph together.</p>
<p>Asking around how people did it, yielded several strategies&#8230; but many basically revolved around using the &#8216;explore pages&#8217; (those magically  revealed by hitting the F8 key on freebase.com).</p>
<p>Then David wrote the new query editor, with the amazing context completion and I thought I was set&#8230; but while my MQL mojo improved a  lot with it, it always felt like something was missing: if I knew the type I wanted, I could get started&#8230; but what if I didn&#8217;t know where to  start? what if I didn&#8217;t know how to construct the query and I needed  some guidance in navigating how the types were all connected together?  (especially with CVTs and whatnot)</p>
<p>I felt like I was in a fog and with no map: finding my way out felt tentative at best, frustrating at worst.</p>
<p>The Jason showed me an acre app he had written a long time ago and that he uses all the time that offered a browsable interface to all the  freebase domains, types and properties, their IDs&#8230; and how they all connect together.</p>
<p>I had found my map.</p>
<p>Unfortunately, while extremely useful already, the schema explorer app needed some love&#8230; so I decided to give it some and the result has been so successful internally that I&#8217;m happy to announce it to the public so that everybody can benefit from it. Find it at: <a href="http://schemas.freebaseapps.com/">http://schemas.freebaseapps.com/</a></p>
<p>I hope you&#8217;ll find it as useful as I do.</p>
<p>NOTES:</p>
<p>1) suggestions/criticism/feature-requests appreciated and welcome</p>
<p>2) this is an acre app and if you&#8217;re curious (or interested in forking it) you can find it at: <a href="http://acre.freebase.com/#app=/user/jdouglas/schemas">http://acre.freebase.com/#app=/user/jdouglas/schemas</a></p>
<p>3) this couldn&#8217;t have been possible without Jason&#8217;s work upon which I built this so kudos go to him while all the mistakes remain mine</p>
<p>4) I&#8217;ve been working on integrating the schema explorer with the upcoming freebase developer&#8217;s documentation hub, so that newcomers won&#8217;t have to hunt down this URL in the mail archives to find a little guidance in the type maze.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.freebase.com/2009/06/26/check-out-stefanos-schema-explorer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MQL Monday: sorting by a count</title>
		<link>http://blog.freebase.com/2009/03/09/mql-monday-sorting-by-a-count/</link>
		<comments>http://blog.freebase.com/2009/03/09/mql-monday-sorting-by-a-count/#comments</comments>
		<pubDate>Mon, 09 Mar 2009 19:46:45 +0000</pubDate>
		<dc:creator>skud</dc:creator>
				<category><![CDATA[MQL]]></category>

		<guid isPermaLink="false">http://blog.freebase.com/?p=465</guid>
		<description><![CDATA[Today we have a new MQL feature to announce: sort: count
We already had the ability to return a count of results:
[{
  "type" : "/astronomy/planet",
  "return" : "count"
}]
(The above will tell you how many planets we have in Freebase&#8217;s Astronomy Commons.)
And you can even find counts within a sub-part of the query, like, how [...]]]></description>
			<content:encoded><![CDATA[<p>Today we have a new MQL feature to announce: <b>sort: count</b></p>
<p>We already had the ability to return a count of results:</p>
<pre>[{
  "type" : "/astronomy/planet",
  "return" : "count"
}]</pre>
<p>(The above will tell you how many planets we have in Freebase&#8217;s <a href="http://freebase.com/view/astronomy">Astronomy Commons</a>.)</p>
<p>And you can even find counts within a sub-part of the query, like, how many moons each planet has:</p>
<pre>[{
  "type" : "/astronomy/planet",
  "/astronomy/orbital_relationship/orbited_by" : {
    "optional" : true,
    "return" : "count"
  }
}]</pre>
<p>But what if you just wanted to know the planets with the most satellites?  There&#8217;s no way to sort by that count that&#8217;s returned&#8230; until now!</p>
<pre>[{
  "type" : "/astronomy/planet",
  "/astronomy/orbital_relationship/orbited_by" : {
    "return" : "count"
  },
  "sort" : "-/astronomy/orbital_relationship/orbited_by.count",
  "limit" : 3
}]</pre>
<p>You can also use <code>estimate-count</code> for counts which are large and might otherwise time out.</p>
<p><a href="http://www.freebase.com/tools/queryeditor?q=[{%22/astronomy/orbital_relationship/orbited_by%22:{%22return%22:%22count%22},%22limit%22:3,%22sort%22:%22-/astronomy/orbital_relationship/orbited_by.count%22,%22type%22:%22/astronomy/planet%22}]&#038;read=1">Try it in the query editor!</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.freebase.com/2009/03/09/mql-monday-sorting-by-a-count/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MQL Monday: Nested containment</title>
		<link>http://blog.freebase.com/2009/03/02/mql-monday-nested-containment/</link>
		<comments>http://blog.freebase.com/2009/03/02/mql-monday-nested-containment/#comments</comments>
		<pubDate>Mon, 02 Mar 2009 22:27:34 +0000</pubDate>
		<dc:creator>skud</dc:creator>
				<category><![CDATA[MQL]]></category>

		<guid isPermaLink="false">http://blog.freebase.com/?p=445</guid>
		<description><![CDATA[Let&#8217;s say you want to find all the Freebase users who live in the USA, but they have their locations set to things like &#8220;San Francisco&#8221; or &#8220;New Orleans&#8221;.  How do you ask for &#8220;USA, and anything within the USA&#8221;?
While MQL doesn&#8217;t currently support transitive closure, the /location/ location/containedby property model was designed to [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s say you want to find all the Freebase users who live in the USA, but they have their locations set to things like &#8220;San Francisco&#8221; or &#8220;New Orleans&#8221;.  How do you ask for &#8220;USA, and anything within the USA&#8221;?</p>
<p>While MQL doesn&#8217;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.</p>
<p>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:</p>
<p>Note: the ID for the US is /guid/9202a8c04000641f8000000000959f60</p>
<pre>  {
     "query":[{
       "/location/location/containedby":[{
         "/location/location/containedby":[{
           "/location/location/containedby":[{
             "id":"/guid/9202a8c04000641f8000000000959f60"
           }],
           "name":null
         }],
         "name":null
       }],
       "name":null,
       "type":"/education/university"
     }]
  }</pre>
<p>Someday, MQL will probably handle transitivity operations &#8211; but until then it is possible to construct queries which utilize the containment models based on some minimal assumptions about the data.</p>
<p>This tip came from the <a href="http://www.freebase.com/view/en/the_mql_cookbook">MQL Cookbook</a>: <a href="http://www.freebase.com/view/en/perform_transitive_queries">Perform transitive queries</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.freebase.com/2009/03/02/mql-monday-nested-containment/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MQL Monday: Finding Included Types of a Type with a Client Property</title>
		<link>http://blog.freebase.com/2009/02/23/mql-monday-finding-included-types-of-a-type-with-a-client-property/</link>
		<comments>http://blog.freebase.com/2009/02/23/mql-monday-finding-included-types-of-a-type-with-a-client-property/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 01:21:39 +0000</pubDate>
		<dc:creator>philg</dc:creator>
				<category><![CDATA[MQL]]></category>

		<guid isPermaLink="false">http://blog.freebase.com/?p=432</guid>
		<description><![CDATA[A question has come up a couple times now of how you would find the included types of a type; for example, many types contain either (or both) the Topic or Person types. It can get more complicated though, as in the case of user-created types, and it&#8217;s possible that when constructing a MQL query, [...]]]></description>
			<content:encoded><![CDATA[<p>A question has come up a couple times now of how you would find the included types of a type; for example, many types contain either (or both) the Topic or Person types. It can get more complicated though, as in the case of user-created types, and it&#8217;s possible that when constructing a MQL query, you might want to use values for properties in the included types as well as the main type.</p>
<p>What makes it tricky to find included types is that there is no property within the type itself that contains the information you need. Instead, you have to take advantage of a a property that is used by the Freebase client to display type information. These client properties are all properties of /type/property and can be queried in the same way as other properties of a property. These are bare properties; the type is not asserted on the property. Client properties include:</p>
<ul>
<li>/freebase/documented_object/tip: Adding documentation to a property (ect: /type/text)</li>
<li>/freebase/property_hints/display_none: True if the property is hidden</li>
<li>/freebase/property_hints/disambiguator: True if the property will operate as a disambiguator</li>
<li>/freebase/property_hints/display_orientation: vertical if the property should be displayed as such, horizontal otherwise</li>
<li>/freebase/type_hints/included_types: lists types included with another type</li>
</ul>
<p>For this particular query, use the /freebase/type_hints/included_types property, as shown in the following query:</p>
<pre>{
  "/freebase/type_hints/included_types" : [
   {}
  ],
  "id" : "/music/artist"
}</pre>
<p>This example is from the <a href="http://www.freebase.com/view/guid/9202a8c04000641f800000000a16e743">Schema Introspection Cookbook</a>, where you can find more MQL recipes for finding out information about types, properties, and schema.More information about /type/property and its properties can be found in <a href="http://mql.freebaseapps.com/ch02.html">Chapter 2 of the Complete MQL Reference Guide</a>, &#8220;Metaweb Architecture.&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.freebase.com/2009/02/23/mql-monday-finding-included-types-of-a-type-with-a-client-property/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MQL Monday: Querying for Wikipedia Article Information</title>
		<link>http://blog.freebase.com/2009/02/09/mql-monday-querying-for-wikipedia-article-information/</link>
		<comments>http://blog.freebase.com/2009/02/09/mql-monday-querying-for-wikipedia-article-information/#comments</comments>
		<pubDate>Mon, 09 Feb 2009 20:07:24 +0000</pubDate>
		<dc:creator>philg</dc:creator>
				<category><![CDATA[MQL]]></category>

		<guid isPermaLink="false">http://blog.freebase.com/?p=425</guid>
		<description><![CDATA[MQL Monday is a new feature of the Freebase blog; every Monday we&#8217;ll post a MQL query drawn from documentation like the Schema Introspection Cookbook or the MQL Cookbook, or based on a question or submission from you all. In fact, we heartily encourage you to submit questions or solutions for MQL queries that have [...]]]></description>
			<content:encoded><![CDATA[<p>MQL Monday is a new feature of the Freebase blog; every Monday we&#8217;ll post a MQL query drawn from documentation like the <a href="http://www.freebase.com/view/guid/9202a8c04000641f800000000a16e743">Schema Introspection Cookbook</a> or the <a href="http://www.freebase.com/view/guid/9202a8c04000641f8000000008c0cbfb">MQL Cookbook</a>, or based on a question or submission from you all. In fact, we heartily encourage you to submit questions or solutions for MQL queries that have come from your own experience.</p>
<p>This week the query focuses on getting the Wikipedia article ID for a given topic, and is drawn from the help topic <a href="http://www.freebase.com/view/guid/9202a8c04000641f800000000a97e249">Attributing Topic Descriptions to Wikipedia</a>. According to the Freebase terms of service, if you reproduce a Freebase topic description that originally came from Wikipedia in your own application, you are obligated to provide a link back to the original Wikipedia article. Fortunately, there&#8217;s an easy way to identify the source of a Freebase topic description by examining its <strong>/common/document/source_uri</strong> property for the topic description. If this property contains a <strong>wp</strong>, as in  <a class="external free" title="http://wp/en/1194195" rel="nofollow" href="http://wp/en/1194195">http://wp/en/1194195</a>, then that description originated from Wikipedia. However, you should note that this value is a &#8220;pseudo-URI;&#8221; it won&#8217;t link you back to the original Wikipedia article, it&#8217;s simply a way of assigning a resource indicator to the article description.</p>
<p>With this in mind, the trick is to create a basic MQL query that will return the value for this property. Here&#8217;s a query that can be used to examine this property for a single topic:</p>
<pre>  {
     "id" : "/en/hortense_ellis",
     "/common/topic/article" : [{
     "id":null,
     "/common/document/source_uri" : []
     }]
   }</pre>
<p>Note that this query is configured to return multiple results in case there&#8217;s both a Wikipedia and user-contributed topic description.</p>
<p>In most cases, however, you&#8217;ll want to run this query against a batch of results, and then, programmatically create links back to the Wikipedia articles where appropriate. Here&#8217;s how you could incorporate the same query into a larger one that looks for 25 albums with tracks containing the word &#8220;love,&#8221; and returns the artist name, track name, album name, and the GUID of the topic description, along with the /common/document/source_uri property value:</p>
<pre>   [
     {
       "album" : [{
         "artist" : [ ],
         "name" : null,
         "/common/topic/article" : [{
     "id":null,
     "/common/document/source_uri" : [ ]
     }]

       }],
       "limit" : 25,
       "name" : null,
       "name~=" : "Love*",
       "type" : "/music/track"
     }
   ]</pre>
<p>Having retrieved the information you need, all you need to do is re-insert the number at the end of the /common/document/source_uri property, which identifies the article in Wikipedia,<strong> </strong>into a working Wikipedia URL<strong>, </strong>like this:<strong> </strong><a class="external free" title="http://en.wikipedia.org/w/index.php?curid=1194195" rel="nofollow" href="http://en.wikipedia.org/w/index.php?curid=1194195">http://en.wikipedia.org/w/index.php?curid=1194195</a>. Again, this is something you can do programmically once you&#8217;ve gotten the information you need.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.freebase.com/2009/02/09/mql-monday-querying-for-wikipedia-article-information/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MQL Monday: Looking Back Into the Past with as_of_time</title>
		<link>http://blog.freebase.com/2009/02/02/mql-monday-looking-back-into-the-past-with-as_of_time/</link>
		<comments>http://blog.freebase.com/2009/02/02/mql-monday-looking-back-into-the-past-with-as_of_time/#comments</comments>
		<pubDate>Mon, 02 Feb 2009 22:44:03 +0000</pubDate>
		<dc:creator>philg</dc:creator>
				<category><![CDATA[MQL]]></category>

		<guid isPermaLink="false">http://blog.freebase.com/?p=431</guid>
		<description><![CDATA[[A new weekly feature on MQL tips, by our Doctor of Docs, Phil.]
One of the interesting features of the graph database structure underlying Freebase is that, because nothing is ever completely removed from the graph, you can create queries that let you examine the state of domains, types, and other objects at some point in [...]]]></description>
			<content:encoded><![CDATA[<p><i>[A new weekly feature on MQL tips, by our Doctor of Docs, Phil.]</i></p>
<p>One of the interesting features of the graph database structure underlying Freebase is that, because nothing is ever completely removed from the graph, you can create queries that let you examine the state of domains, types, and other objects at some point in the past. This can be useful, for example, for charting the growth of a domain, or establishing a trusted view of a topics by establishing a view based on a timestamp. This is accomplished by using the &#8220;as_of_time&#8221; envelope parameter. This is covered in detail in <a href="http://mql.freebaseapps.com/ch04.html#envelopeparameters">section 4.2.4 of the MQL Reference Guide</a>, but below is an example of how you would use this parameter to answer the question &#8220;how many types existed in the Architecture domain on January 9, 2007, at a little after 10 PM?&#8221;</p>
<pre>
{
  "q1" : {
    "as_of_time" : "2007-01-09T22:00:56.0000Z",
    "query" : [
      {
        "domain" : "/architecture",
        "id" : null,
        "return" : "count",
        "timestamp" : null,
        "type" : "/type/type"
      }
    ]
  }
}
</pre>
<p>The answer is &#8220;12.&#8221; This example was drawn from a user-contributed query in the <a href="http://www.freebase.com/view/guid/9202a8c04000641f8000000008c0cbfb">MQL Cookbook</a>. Please feel free to contribute your own queries as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.freebase.com/2009/02/02/mql-monday-looking-back-into-the-past-with-as_of_time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Query Editor</title>
		<link>http://blog.freebase.com/2008/03/26/new-query-editor/</link>
		<comments>http://blog.freebase.com/2008/03/26/new-query-editor/#comments</comments>
		<pubDate>Wed, 26 Mar 2008 16:59:01 +0000</pubDate>
		<dc:creator>danm</dc:creator>
				<category><![CDATA[MQL]]></category>

		<guid isPermaLink="false">http://blog.freebase.com/2008/03/26/new-query-editor/</guid>
		<description><![CDATA[With the latest release, we&#8217;re pleased to announce the availability of a new Query Editor. We&#8217;re currently making both the old editor and the new one (which is still in experimental mode) available so that we can solicit feedback on the new interface before we make the switch.
Some cool features of the new editor

permalinks allow [...]]]></description>
			<content:encoded><![CDATA[<p>With the latest release, we&#8217;re pleased to announce the availability of a <a href="http://www.freebase.com/tools/queryeditor/">new Query Editor</a>. We&#8217;re currently making both <a href="http://www.freebase.com/view/queryeditor/">the old editor</a> and the new one (which is still in experimental mode) available so that we can solicit feedback on the new interface before we make the switch.</p>
<p><strong>Some cool features of the new editor</strong></p>
<ul>
<li>permalinks allow you to forward a URL with an embedded query (note: the links created in this version aren&#8217;t going to be supported going forward, we have a planned enhancement to &#8216;beautify&#8217; them when we move out of experimental mode)</li>
<li>more reliable UI (less buggy in various browsers)</li>
<li>full screen editing</li>
<li>toggle syntax highlighting on/off</li>
<li>undo/redo</li>
</ul>
<p><strong>Missing features from the old editor:</strong>
<ul>
<li>no tree view</li>
<li>no full json results</li>
<li>no filter option on sample queries</li>
</li>
</ul>
<p>Let us know what you think. There are a bunch of other enhancements in the queue, including the ability to save queries. We&#8217;re particularly interested in feedback on which (if any) of the unimplemented old features above you feel are important to resurrect in the new one. We hope to replace the old editor with the new one formally within the next release or two.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.freebase.com/2008/03/26/new-query-editor/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
