[Developers] Can't query for values of /type/key in a write?
David Flanagan
david at davidflanagan.com
Tue Sep 2 19:45:39 UTC 2008
Shawn Simister wrote:
> I got the following unexpected error in a write query. Its seems that
> Freebase doesn't like it when I add a prefix to a key value but the
> documentation for the MQL write grammar doesn't say anything about that
> restriction.
Prefixes do appear to be legal in writes, at least in my simple test
cases. I'm working on an update to the MQL write documentation and I'll
make a note of this.
I can duplicate what you're seeing with this query:
{
"name" : "C",
"type" : "/user/docs/music/note",
"key": [{
"connect":"insert",
"namespace":"/user/docs/music/note",
"value":"C"
}]
}
I can put a prefix before name, type or key. But I get an error if I
put one before namespace or value. If I prefix namespace I at least get
an intelligible error message. But prefixing value gives a very
confusing message.
Note, however, that prefixes before the namespace and value properties
don't work right in read queries, either. (Though they don't give
strange errors!) Perhaps there is just a general rule about not using
prefixes on the properties of primitives. Or is it something special
about key?
Anyone know what the rule is?
I'd like to be able to use the prefixes as named parameters
> in my code so hopefully this syntax is possible.
I'm not sure why you want to use prefixes in this query, since they're
not actually necessary here. Note that you can move the nndb_key prefix
from the value property out to the key property and your query should
work, if that helps at all.
David Flanagan
> {
> "status": "200 OK",
> "create_nndb_person_key": {
> "code": "/api/status/error",
> "messages": [
> {
> "info": {
> "value": null,
> "expected_type": "/type/key",
> "mode": "write",
> "key": "value"
> },
> "query": {
> "person:id": "/guid/9202a8c04000641f800000000569f867",
> "type": {
> "id": "/user/narphorium/people/nndb_person",
> "connect": "insert"
> },
> "key": [
> {
> "error_inside": ".",
> "namespace": "/guid/9202a8c04000641f8000000008e5719d",
> "connect": "insert",
> "nndb_key:value": "243$002F000099943"
> }
> ]
> },
> "message": "Can't query for values of /type/key in a write, only
> those of /type/id",
> "code": "/api/status/error/mql/parse",
> "path": "key"
> }
> ]
> },
> "code": "/api/status/ok"
> }
>
> Thanks,
>
> Shawn
> _______________________________________________
> Developers mailing list
> Developers at freebase.com
> http://lists.freebase.com/mailman/listinfo/developers
>
More information about the Developers
mailing list