[Developers] More information on '/type/reflect'
Scott Meyer
sm at metaweb.com
Fri May 23 19:04:42 UTC 2008
Sumit wrote:
> Hi John,
> Thanks for getting back. Here's what I am trying to do. We have a
> database of people names along with some facts like which company they
> work or worked for, whats their profession, etc. I am working on a
> prototype to see if we can resolve these names to freebase ids (or how
> many of them with the info we have).
Be forewarned that resolution is a hard task, however, if you have
several pieces of data in addition to a name it is tractable.
> I tried the query below to find out if I can find a link between Peter
> Jackson and his employment_tenure, to see if I can get an guid for the
> relation. Thinking, I can query this guid again and see if it has
> Peter's name mentioned in it for the resolution issue.
> [
> {
> "master_property" : null,
> "reverse" : null,
> "source" : {
> "id" : null,
> "name" : "peter jackson",
> "type" : "/people/person"
> },
> "target" : {
> "id" : null,
> "type" : "/business/employment_tenure"
> },
> "type" : "/type/link"
> }
> ]
>
> But it doesn't return anything.
Because you have source and target backwards.
This one works:
{
"master_property" : null,
"reverse" : null,
"source" : {
"id" : null,
"type" : "/business/employment_tenure"
},
"target" : {
"id" : "/en/peter_jackson",
"type" : "/people/person"
},
"type" : "/type/link"
}
]
However I wouldn't use this to resolve names to
people.
If I try the simple query below
> [
> {
> "employment_history" : {},
> "id" : "/en/peter_jackson",
> "name" : "peter jackson",
> "type" : "/people/person"
> }
> ]
This is on the right track. But the "id" constraint is
actualy what you're trying to find, the foreign key used
to locate a Freebase identity.
So if your data leads you to suspect that someone named
"peter jackson" worked for a company named "weta" the
following query could be used to check that:
[
{
"employment_history" : [
{
"company" : {
"name~=" : "weta",
"type" : "/business/employer"
},
"type" : "/business/employment_tenure"
}
],
"name~=" : "peter jackson",
"type" : "/people/person",
"id" : null
}
]
A slightly deeper query could be used to check for
someon named "peter jackson" being married to someone
who worked for a company named "weta"
If you haven't found it yet, the explore view:
http://sandbox.freebase.com/tools/explore/business/employment_tenure
is an excellent way to figure out the data structure.
Hope this helps.
-Scott
More information about the Developers
mailing list