[Developers] Looking for Beyonce
Tim Sturge
tsturge at metaweb.com
Wed Nov 7 05:18:38 UTC 2007
I second Chris's suggestion that the search API is probably a better choice. It understands many ways of naming objects, not all of which MQL captures in either the name or alias fields; and it is also capable of returning results sorted by rank (importance hopefully) which MQL does not currently do.
For reference, there is a somewhat ugly way of asking for "Beyonce" as a name or an alias:
[{ "id":null,
"name": null,
"/type/reflect/any_value": [{
"value~=": "Beyonce",
"value": null,
"type": "/type/text",
"lang": "/lang/en",
"link|=": [ "/type/object/name", "/common/topic/alias" ],
"link": null
}]
}]
asks for the objects that have Beyonce attached to them as an English string in either the name or alias fields.
This isn't well documented, but is stable.
Tim
----- Original Message -----
From: "Christopher R. Maden" <crism at metaweb.com>
To: developers at freebase.com
Sent: Tuesday, November 6, 2007 10:04:09 PM (GMT-0800) America/Los_Angeles
Subject: Re: [Developers] Looking for Beyonce
Arthur van Hoff wrote:
> How do I query for an artist either by name or by alias? Section
> 3.2.20 of the documentation mentions that there is no way to express
> an OR relationship. I need to match against either an alias or a
> name because some bands don't have their name listed as an alias.
You may want to try using the search API instead of MQL for these kinds
of queries.
If you want or need to use direct MQL, you will need to execute two
queries. You can send them in one envelope or two, depending on your
requirements; i.e., you could look for the name first, and if it fails,
then send back a query for the alias, or you could send two queries, one
for the name and one for the alias, and then see what you found.
This is kind of what the search API is optimized for. The best examples
of how to use it are in the freebase-suggest wiki: <URL:
http://code.google.com/p/freebase-suggest/wiki/FreebaseAPISearch >.
~Chris
--
Christopher R. Maden
Data Architect
Metaweb Technologies, Inc.
<URL: http://www.metaweb.com/ >
_______________________________________________
Developers mailing list
Developers at freebase.com
http://lists.freebase.com/mailman/listinfo/developers
More information about the Developers
mailing list