[Developers] mqlwrite & implicit connect directives

Augusto Callejas acallejas at appliedminds.com
Thu Feb 28 20:09:50 UTC 2008


hi-

from the mqlwrite documentation, there is mention of implicit connect
directives:

====
{
  "type":"/user/docs/note",
  "name":"G",
  "next":{
    "create":"unless_exists",
    "type":"/user/docs/note",
    "name":"D"
  }
}

Notice that there is no connect directive here. Since the create directive
is nested in this query, the connection is implicit.
====

does this not apply to id-queries?  in my example below, there is a type "s"
that has a property "t" of type "t".  i have an instance of "s" and an
instance of "t".  running the write operation below seems to verify that
they are not connected:

====
{
  "query" : {
    "id" : "/guid/9202a8c04000641f80000000077070ba",
    "t" : {
      "id" : "/guid/9202a8c04000641f800000000771049c",
      "type" : "/user/augusto/e/t"
    },
    "type" : "/user/augusto/e/s"
  }
}
====
{
  "code" : "/api/status/error",
  "messages" : [
    {
      "code" : "/api/status/error/mql/result",
      "info" : {},
      "message" : "Can't locate this clause - cannot continue",
      "path" : "",
      "query" : {
        "error_inside" : ".",
        "id" : "/guid/9202a8c04000641f80000000077070bac",
        "t" : {
          "id" : "/guid/9202a8c04000641f800000000771049",
          "type" : "/user/augusto/e/t"
        },
        "type" : "/user/augusto/e/s"
      }
    }
  ]
}
====

however, when i add the "connect" directive, it connects them:

====
{
  "query" : {
    "id" : "/guid/9202a8c04000641f80000000077070ba",
    "t" : {
      "connect" : "insert",
      "id" : "/guid/9202a8c04000641f800000000771049c",
      "type" : "/user/augusto/e/t"
    },
    "type" : "/user/augusto/e/s"
  }
}
====
{
  "code" : "/api/status/ok",
  "result" : {
    "id" : "/guid/9202a8c04000641f80000000077070ba",
    "t" : {
      "connect" : "inserted",
      "id" : "/guid/9202a8c04000641f800000000771049c",
      "type" : "/user/augusto/e/t"
    },
    "type" : "/user/augusto/e/s"
  }
}
====

so my question is why is connect not implicit in my first write query, yet
it is in the example from the documenation?  is it because the the nested
query has a "create" directive?

thanks,
augusto.




More information about the Developers mailing list