[Developers] "link" and the "operation"
Tim Sturge
tsturge at metaweb.com
Mon Feb 4 20:06:37 UTC 2008
As the renegade Buddhist developer in question; when I see a fly on the wall, is just an insect? Or is it actually a bug in insect form?
I'll get a fix for this in the next release. It's triggered by combining
"operation": null
and
"valid": false
Tim
----- Original Message -----
From: "Jonathan W. Lowe" <jlowe at giswebsite.com>
To: "For discussions about MQL, Freebase API and apps built on Freebase" <developers at freebase.com>
Sent: Saturday, February 2, 2008 2:53:28 AM (GMT-0800) America/Los_Angeles
Subject: Re: [Developers] "link" and the "operation"
Warning: the following may be on the arcane side.
Is it a bug that the /type/link/valid property can display both true and
false for the same link operation? Here's an example:
This MQL read query...
{
"query" : {
"/common/topic/article" : [
{
"content" : [
{
"creator" : null,
"id" : null,
"link" : [
{
"creator" : null,
"operation" : null,
"timestamp" : null,
"valid" : null
}
]
}
],
"id" : null
}
],
"name" : "Jamie Taylor"
}
}
...returns this result (notice the 'link' "operation" and "valid"
properties:
{
"/common/topic/article" : [
{
"content" : [
{
"creator" : "/user/jamie",
"id" : "/guid/9202a8c04000641f8000000004515938",
"link" : [
{
"creator" : "/user/jamie",
"operation" : "insert",
"timestamp" : "2007-03-25T01:09:34.0015Z",
"valid" : true
}
]
}
],
"id" : "/guid/9202a8c04000641f8000000004515934"
}
],
"name" : "Jamie Taylor"
}
So far, this makes sense -- Jamie added a description to his topic on
March 25, 2007. Therefore the "operation" value is "insert" and, at the
time of query, the "valid" value is true.
Next, I edit Jamie's Description, adding "Mr. " to its beginning and
saving the change. The same MQL query now returns the following:
{
"/common/topic/article" : [
{
"content" : [
{
"creator" : "/user/jamie",
"id" : "/guid/9202a8c04000641f8000000004515938",
"link" : [
{
"creator" : "/user/jamie",
"operation" : "insert",
"timestamp" : "2007-03-25T01:09:34.0015Z",
"valid" : false
}
]
},
{
"creator" : "/user/jonathanwlowe",
"id" : "/guid/9202a8c04000641f80000000070a5193",
"link" : [
{
"creator" : "/user/jonathanwlowe",
"operation" : "update",
"timestamp" : "2008-02-02T10:22:42.0008Z",
"valid" : true
}
]
}
],
"id" : "/guid/9202a8c04000641f8000000004515934"
}
],
"name" : "Jamie Taylor"
}
Still as expected -- the original insert operation is now valid=false.
My edit appears as operation=update, valid=true.
Suddenly realizing I have no business fussing with other people's
Descriptions, I re-edit Jamie's Description back to its original text,
removing the "Mr. " from its beginning.
Now the same MQL query returns the following:
{
"/common/topic/article" : [
{
"content" : [
{
"creator" : "/user/jamie",
"id" : "/guid/9202a8c04000641f8000000004515938",
"link" : [
{
"creator" : "/user/jamie",
"operation" : "insert",
"timestamp" : "2007-03-25T01:09:34.0015Z",
"valid" : false
}
]
},
{
"creator" : "/user/jonathanwlowe",
"id" : "/guid/9202a8c04000641f80000000070a5193",
"link" : [
{
"creator" : "/user/jonathanwlowe",
"operation" : "update",
"timestamp" : "2008-02-02T10:22:42.0008Z",
"valid" : false
}
]
},
{
"creator" : "/user/jonathanwlowe",
"id" : "/guid/9202a8c04000641f80000000070a519c",
"link" : [
{
"creator" : "/user/jonathanwlowe",
"operation" : "update",
"timestamp" : "2008-02-02T10:26:06.0008Z",
"valid" : true
}
]
}
],
"id" : "/guid/9202a8c04000641f8000000004515934"
}
],
"name" : "Jamie Taylor"
}
The results still make sense. Jamie's original entry and my first edit
are both valid=false, and my re-edit (operation=update) is valid=true.
Now modify one item in the original MQL query by changing "valid":null
to "valid":false. The results are become:
{
"/common/topic/article" : [
{
"content" : [
{
"creator" : "/user/jamie",
"id" : "/guid/9202a8c04000641f8000000004515938",
"link" : [
{
"creator" : "/user/jamie",
"operation" : "insert",
"timestamp" : "2007-03-25T01:09:34.0015Z",
"valid" : false
}
]
},
{
"creator" : "/user/jonathanwlowe",
"id" : "/guid/9202a8c04000641f80000000070a5193",
"link" : [
{
"creator" : "/user/jonathanwlowe",
"operation" : "update",
"timestamp" : "2008-02-02T10:22:42.0008Z",
"valid" : false
}
]
},
{
"creator" : "/user/jonathanwlowe",
"id" : "/guid/9202a8c04000641f80000000070a519c",
"link" : [
{
"creator" : "/user/jonathanwlowe",
"operation" : "update",
"timestamp" : "2008-02-02T10:26:06.0008Z",
"valid" : false
}
]
}
],
"id" : "/guid/9202a8c04000641f8000000004515934"
}
],
"name" : "Jamie Taylor"
}
The difference is that the same entry (my re-edit) resulting in the same
BLOB (gid ending in "...4515934") appears as valid=false. In the
previous query, it appeared as valid=true.
So...why does my re-edit of Jamie's Description back to its original
state, have both a valid=true AND a valid=false setting?
Perhaps it's the work of a renegade Buddhist developer eager to spread
enlightenment about the futility of dualism... What is true? What is
false? All validities are but one, grasshopper.
- Jonathan
p.s. Thanks, Jamie, for the use of your topic's Description; I tried not
to leave any bruises.
On Wed, 2008-01-16 at 16:18 -0800, Alec Flett wrote:
>
> On Jan 16, 2008, at 3:43 PM, Christopher Dummy wrote:
>
> > I couldn't find any documentation on /type/link which is used for
> > properties. I'm trying to understand what some of the values can be
> > and what they mean.
> >
>
>
> This doesn't necessarily help a huge amount, but you can look at the
> schema for "link":
>
>
> http://www.freebase.com/view/schema/type/link
>
>
>
>
> Here's the short documentation which I'll try to get into a help
> topic:
>
>
> type: I believe this will always be "/type/link"
>
>
> timestamp: the time the link was created
>
>
> creator: points to the user (i.e. /user/alecf) who created it
>
>
> master_property: the property that this link represents
> (like /film/film/cast)
>
>
> reverse: whether or not the master_property is pointing to or away
> from the item
>
>
> operation: "insert" means it is a normal link, that doesn't supercede
> any other value. "update" means that it is a normal link that
> "overwrote" a previous link. "delete" means the link actually
> represents the deletion of a different link. Since freebase's database
> is append-only, the way to "delete" a link is to overwrite it with a
> "tombstone" link - that's what "delete" is
>
>
> valid: a boolean indicating if this current link is active - i.e.
> wasn't deleted by another link.. and so yeah you're right that a
> "delete" link isn't really valid or not, since it is really making a
> different link "invalid"
>
>
> attribution: a more complex subject - basically this may point to a
> user or a node which describes some sort of attribution, such as what
> datasource a particular link came from... (i.e. if someone asserted
> that "the population of china is 1 billion people" according to the
> CIA World Fact Book) this isn't really used right now.
>
>
> I hope this gets you started. The master_property/reverse stuff can be
> a little confusing at times.. my advice there is just to play around
> with it to understand how it works until we have more extensive
> documentation.
>
>
> Alec
>
> > {
> > "guid": "#9202a8c04000641f8000000000014a39",
> > "link": {
> > "timestamp": "2008-01-16T22:08:24.0000Z",
> > "operation": "insert",
> > "valid": false
> > },
> > "name": "Electronic music"
> > },
> > {
> > "guid": "#9202a8c04000641f8000000000014a39",
> > "link": {
> > "timestamp": "2008-01-16T22:11: 12.0000Z",
> > "operation": "delete",
> > "valid": null
> > },
> > "name": "Electronic music"
> > }
> >
> > I assume the "valid" refers to whether the link is valid or not. the
> > UI will display just the valid links. For that reason, "delete"
> > doesn't have a true or false value since it doesn't represent a
> > link. Is that correct?
> >
> > I've seen the operations "insert", "update", "delete".
> >
> > Are there any other operations that can happen? Is there a time when
> > the "delete" operation might have something other than a null for
> > valid?
> >
> > --
> > Christopher Cotton
> > Zing/Dell Engineer
> > http://zing.net/ _______________________________________________
> > Developers mailing list
> > Developers at freebase.com
> > http://lists.freebase.com/mailman/listinfo/developers
>
> _______________________________________________
> Developers mailing list
> Developers at freebase.com
> http://lists.freebase.com/mailman/listinfo/developers
_______________________________________________
Developers mailing list
Developers at freebase.com
http://lists.freebase.com/mailman/listinfo/developers
More information about the Developers
mailing list