Thanks Luca. I have no other option, but to catch you on Twitter, as you are sometimes missing from this group :-)
Your pointer worked. As you suggested, I am able to resolve it by parsing JSON and replacing RIDs with related objects. Whenever time permits, you can add this small feature in OrientDB, that will be great. Thanks again ! For reference of others, below is the code from OrientDB JS driver (https://github.com/orientechnologies/orientdb/blob/master/server/src/site/js/orientdb-api.js) which replaces RIDs with related objects to make the whole JSON complete: ODatabase.prototype.parseConnections = function(obj) { if (typeof obj == 'object') { var linkMap = { "foo" : 0 }; linkMap = this.createObjectsLinksMap(obj, linkMap); if (linkMap["foo"] == 1) { linkMap = this.putObjectInLinksMap(obj, linkMap); if (linkMap["foo"] == 2) { obj = this.getObjectFromLinksMap(obj, linkMap); } } } return obj; } ODatabase.prototype.createObjectsLinksMap = function(obj, linkMap) { for ( var field in obj) { if (!obj.hasOwnProperty(field)) { continue; } var value = obj[field]; if (typeof value == 'object') { this.createObjectsLinksMap(value, linkMap); } else { if (typeof value == 'string') { if (value.length > 0 && value.charAt(0) == '#') { if (!linkMap.hasOwnProperty(value)) { linkMap["foo"] = 1; linkMap[value] = null; } } } } } return linkMap; } ODatabase.prototype.putObjectInLinksMap = function(obj, linkMap) { for ( var field in obj) { if (!obj.hasOwnProperty(field)) { continue; } var value = obj[field]; if (typeof value == 'object') { this.putObjectInLinksMap(value, linkMap); } else { if (field == '@rid' && value.length > 0 && linkMap.hasOwnProperty(value) && linkMap[value] === null) { linkMap["foo"] = 2; linkMap[value] = obj; } } } return linkMap; } ODatabase.prototype.getObjectFromLinksMap = function(obj, linkMap) { for ( var field in obj) { if (!obj.hasOwnProperty(field)) { continue; } var value = obj[field]; if (typeof value == 'object') { this.getObjectFromLinksMap(value, linkMap); } else { if (field != '@rid' && value.length > 0 && value.charAt(0) == '#' && linkMap[value] != null) { obj[field] = linkMap[value]; } } } return obj; } Regards, Gaurav On Wednesday, April 23, 2014 7:36:03 PM UTC+5:30, Lvc@ wrote: > > Hi Guarav, > I'm sorry, but we've a roadmap and paying clients so we can't work on > issues like this because are not critical. Even if you tweet for help every > day :-) > > You can do a workaround by parsing the returning JSON and put real objects > by RID. We do this on OrientDB JS library. > Lvc@ > > > On 21 April 2014 14:39, Gaurav Dhiman <[email protected] > <javascript:>>wrote: > >> Hi Luca, >> >> I have filed a request on bug system, but till it comes in next release, >> is there any workaround for this. >> I am using 1.7-rc1 >> >> I will appreciate, if you can let me know the work around to get things >> going. >> >> Regards, >> Gaurav >> >> >> On Sunday, April 20, 2014 2:18:36 PM UTC+5:30, Lvc@ wrote: >> >>> Hi Gaurav, >>> this is to avoid cyclic references. Think to the case you've the same >>> RID in your graph: it would be recursively infinite. But in your case could >>> have sense to just always expand records even if already expanded. >>> >>> AFAIK we don't have such setting on fetch-plan. May you create a new >>> issue? It's very easy to implement it. >>> >>> Lvc@ >>> >>> >>> >>> On 19 April 2014 11:36, Gaurav Dhiman <[email protected]> wrote: >>> >>>> How to fetch all related records (LINK / LINKSET) in a case if two or >>>> more links point to same record ? >>>> >>>> *Example:* >>>> Lets say the class (A) have links createByUser, modifiedByUser and >>>> allUsers pointing to same record (#10:3) of OUser class. >>>> >>>> If we specify FETCHPLAN ("*:-1") to fetch deep level records, only one >>>> link is expanded (allUsers), rest other two (createByUser, >>>> modifiedByUser) are not expanded. The reason for this is that all >>>> three link points to same OUser record. >>>> >>>> SELECT FROM A FETCHPLAN *:-1 >>>> >>>> *Query:* >>>> In above case, how to expand all three links even if they are pointing >>>> to same record ? >>>> >>>> Regards, >>>> Gaurav >>>> >>>> -- >>>> >>>> --- >>>> You received this message because you are subscribed to the Google >>>> Groups "OrientDB" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> -- >> >> --- >> You received this message because you are subscribed to the Google Groups >> "OrientDB" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- --- You received this message because you are subscribed to the Google Groups "OrientDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
