That did it. You'd think I'd have seen that, but I suppose I stared too long and hard. Many thanks, crism!
Discussions on Adding a Type to a Topic
-
-
-
Oh, the final query looked like:
{
"query":{
"id":"#9202a8c04000641f800000000031e51b",
"type":{
"connect":"insert",
"id":"/user/szaijan/fantasy_football/player",
"type":"/type/type"
}
}
}
And had this result:
{
"code":"/api/status/ok",
"result":{
"id":"#9202a8c04000641f800000000031e51b",
"type":{
"connect":"inserted",
"id":"/user/szaijan/fantasy_football/player",
"type":"/type/type"
}
}
}
Now, is there a way to order the inserts in my query such that I can do the above first, and then fill in any player fields I care to once the type is added, but in a single query I'm guessing not, but it would be handy. I'll experiment. -
As long as you fully qualify the property names ("/user/szaijan/fantasy_football/player/position" for example), you can add the properties in the same query, and the order doesn't matter.
-
-
-
I am able to add types to a Topic through Freebase, but as I need to add a type and data to ~250 instances of a type, I'd like to do it through a script, and thus through MQL. For some reason, despite showing all OK in the status and error messages, I am unable to get the new type to show up in later queries. Using the query editor, if I run the following query:
Note: the ID used is for an instance of type /american_football/football_player, which already has multiple types and to which I'm able to add types manually through Freebase. The new type is a user type which I've created and has not been published publicly.
{
"query":{
"id":"#9202a8c04000641f800000000031e51b",
"type":{
"connect":"insert",
"type":"/user/szaijan/fantasy_football/player"
}
}
}
I get the seemingly successful result:
{
"q1": {
"code": "/api/status/ok",
"result": {
"type": {
"type": "/user/szaijan/fantasy_football/player",
"connect": "present"
},
"id": "#9202a8c04000641f800000000031e51b"
}
},
"status": "200 OK",
"code": "/api/status/ok"
}
This claims the type I tried to insert is already present. When I go and query the instance's types subsequently, I get the following result, which shows that the inserted type is not present:
{
"q1": {
"code": "/api/status/ok",
"result": {
"type": [
"/common/topic",
"/people/person",
"/american_football/football_player",
"/wikipedia/en_id/1249829"
],
"id": "#9202a8c04000641f800000000031e51b"
}
},
"status": "200 OK",
"code": "/api/status/ok"
}
Any ideas as to why this is not working? Thank you.-
Michael, this write query:
{"id": "#123", "type": {"type": "foo","connect": "insert"}}
will find something whose type is foo and make it the type of instance 123. In other words, the type of the type of 123 is foo!
What you want is this:
{"id": "#123", "type": {"id": "foo", "connect": "insert"}}
This explains why, in your result above one of the types is /wikipedia/en_id/1249829, a/k/a LaDainian Tomlinson, a curious type to be sure.
We may want to think about restricting what kind of thing can be the target of a type insertion request, but in the meantime, changing your write queries will help get what you want.
-
-
-
Something I still don't get is how I can add these things. I would like to add postal codes to towns and cities. Should I create a new type (a city is not a postal code, it *has* a postal code)? Can't I just add a property like 'founded' or 'coordinates' and if so, where do I do this?!
-
Hi, cimm. You have to be able to edit a type in order to change it; most users can’t edit core types like City/Town or Postal Code. However, a postal code instance can also be a location, and be contained in a city. Many cities have more than one postal code, so assigning the code as a property is much less interesting than stating which codes, as Locations, are contained within the city.
As for editing types, try creating a new type or two within your own personal domain, here or on sandbox.freebase.com. Play around with it, and get a feel for what you can do there. If there’s a type you think we’re missing, please prototype it in your own domain, add data to it, and then ask for it to be promoted for public use.
-
-
-
When I add a type to an existing topic, the properties of the new type don't show up in the topic page.
Example: I added the type Theorem to the entry for Fermat's Last Theorem:
http://www.freebase.com/view?id=/wikipedia/en_id/51445
but the properties of Theorem (First Proved By, etc) did not appear on the page.
-

