Re: Question about $ref statement processing

3 views
Skip to first unread message

Markus Sabadello

unread,
Sep 9, 2015, 1:49:40 PM9/9/15
to Ning Zhang, Dev, xd...@googlegroups.com
Ning, this looks like a bug in the server, I documented it and will fix in the next release:
https://github.com/projectdanube/xdi2/issues/42

For now yes it seems a workaround is to send separate message envelopes.

You should be able to send the $del in one envelope, and then the two $set messages together in a separate message envelope.
This way at least you can send all the $set operations in a single message envelope.

Markus


On Wed, Sep 9, 2015 at 9:05 PM, Ning Zhang <ni...@respectnetwork.net> wrote:
Here is the message sent:

2015-09-09 12:11:04,301 - DEBUG [xdi2.client.http.XDIHttpClient] - MessageEnvelope: {"(=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c[$msg]@2$do/$set)":{"<#avatar>":{"&":null},"=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c#profile$card":{"<#email>":{"&":"ma...@example.com"},"<#phone>":{"&":"+1.7035551234"},"[<#alias>]<*!:uuid:40b8227b-4bf0-4751-b869-081e39587df3>":{"&":"J"},"[<#alias>]<*!:uuid:e54afaf1-b63a-4329-8edd-d2d667e57bf5>":{"&":"Jack"},"[<#alias>]<*!:uuid:afeb1523-246f-48e7-8448-815bdc0a6ae7>":{"&":"Johnny"},"<#birth><$date>":{"&":"2015-09-09"},"<#last><#name>":{"&":"Doe"},"<#first><#name>":{"&":"John"},"<#card><#name>":{"&":"Main"}},"=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c#profile$card#address":{"<#postal>":{"&":"01234"},"<#country>":{"&":"USA"},"[<#street>]<@1>":{"&":"Suite 400"},"[<#street>]<@0>":{"&":"123 Main Street"},"<#locality>":{"&":"Somewhere"},"<#region>":{"&":"MA"}},"<#middle><#name>":{"&":null},"<#nickname>":{"&":null}},"=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c[$msg]@0":{"<$secret><$token>":{"&":"Test@123"},"/$is()":["(=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c)"],"/$do":["(=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c/=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c)$do"]},"=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c[$msg]@0$do":{"/$del":["=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c#profile$card[<#alias>]","=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c#profile$card#address[<#street>]","=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c#profile$card<#avatar>","=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c#profile$card<#middle><#name>","=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c#profile$card<#nickname>","=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c#profile$card[#property]"]},"=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c[$msg]@1":{"<$secret><$token>":{"&":"Test@123"},"/$is()":["(=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c)"],"/$do":["(=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c/=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c)$do"]},"=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c[$msg]@2":{"<$secret><$token>":{"&":"Test@123"},"/$is()":["(=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c)"],"/$do":["(=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c/=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c)$do"]},"(=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c[$msg]@1$do/$set)":{"=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c#profile$card":{"<#email>":{"/$ref":["=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c<#verified><#email>"]},"<#avatar>":{"/$ref":["=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c<#avatar>"]},"<#phone>":{"/$rep":["=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c<#verified><#phone>"]},"<#middle><#name>":{"/$ref":["=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c<#middle><#name>"]},"<#birth><$date>":{"/$ref":["=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c<#birth><$date>"]},"<#nickname>":{"/$ref":["=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c<#nickname>"]},"<#last><#name>":{"/$ref":["=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c<#last><#name>"]},"<#first><#name>":{"/$ref":["=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c<#first><#name>"]},"<#card><#name>":{"/$ref":["=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c<#card><#name>"]}},"=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c#profile$card#address":{"/$ref":["=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c#address"]}}}
2015-09-09 12:11:04,425 - DEBUG [xdi2.client.http.XDIHttpClient] - Received result. Content-Type: application/xdi+json;charset=UTF-8, Content-Length: 756
2015-09-09 12:11:04,430 - DEBUG [xdi2.client.http.XDIHttpClient] - MessageResult: {"=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c[$msg]@2$do":{"/$set":["(=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c[$msg]@2$do/$set)"]},"<$false>":{"&":"Cannot add <#country> context node to context node =!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c#profile$card#address containing a $ref relation."},"($false/<$error>)":{"=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c[$msg]@2":{"<$secret><$token>":{"&":"Test@123"},"<$secret><$token><$valid>":{"&":true},"/$is()":["(=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c)"],"/$do":["(=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c/=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c)$do"]},"=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c[$msg]@2$do":{"/$set":["(=!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c[$msg]@2$do/$set)"]}}}
2015-09-09 12:11:04,437 - ERROR [net.respectnetwork.xdi.XdiTemplate] - Cloud operation failed - =!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c #profile$card
xdi2.client.exceptions.Xdi2ClientException: Error message result (check server logs!): Cannot add <#country> context node to context node =!:uuid:e1df0bb2-dfdf-4a78-bfae-239ec1352f3c#profile$card#address containing a $ref relation.
 

On Wed, Sep 9, 2015 at 12:46 PM, Markus Sabadello <mar...@respectnetwork.net> wrote:
Hmm this should work, can you show the exact message envelope you're sending?

Markus


On Wed, Sep 9, 2015 at 8:27 PM, Ning Zhang <ni...@respectnetwork.net> wrote:
Markus,

I have the following statements sent to the graph server in a single MessageEvelope:

=!:uuid:9999#profile$card#address/$ref/=!:uuid:9999#address

=!:uund:9999#profile$card#address<#country>/&/"USA"

Each statement has its own ordered Message within the 

But the graph server an exception such as:

Cannot add <#country> context node to context node =!:uuid:9999#profile$card#address containing a $ref relation.

The workaround seems to be sending two separate messages.

I am wondering if there are better way to do this.

Thanks,
-Ning



Reply all
Reply to author
Forward
0 new messages