select custom function in graph.command

77 views
Skip to first unread message

bryan

unread,
Jun 10, 2015, 4:35:58 AM6/10/15
to orient-...@googlegroups.com
Hi, All.

I'm using orientdb-community2.0.8.

i make custom function on studio.

funtion name is getBestReply.

var graph = orient.getGraphNoTx();

try{
    var results = graph.command('sql',"select bdy, ruid, rdt, out('SRLE').size() as cnt from story_reply where in('SE') in " + pRID + " order by cnt desc, rdt asc limit 1 ");
}catch(err){
    return "[]";  
}

return results.getRecord();

so, i called select command in graphdb.

My source :
OrientGraph graph = new OrientGraph("remote:host/dbname, "id", "password)");

for (Vertex v : (Iterable<Vertex>)graph.command(new OCommandSQL("select @rid, ruid, bdy, rdt, out('SIE').ext as ext, out('SIE').idx as idx, out('SIE').color as color, out('SLE').size() as lcnt, out('SE').size() as rcnt, out('SLE').lk_userid as lk_user, ifnull(if(out('SE').out('SRLE').size() > 0, getBestReply(@rid)), '[]') as btrep from story where use = '0' and uid = 'bodying1951' limit 50 order by rdt desc")).execute())
{
JsonParser parser = new JsonParser();
String s = v.getProperty("btrep").toString();
System.out.println(s);
                }




output is com.tinkerpop.blueprints.impls.orient.OrientElementIterable@44a7bfbc.

i want to get result set with another data.

how can i to do get function data and select filed?


thank you.

alessand...@gmail.com

unread,
Jun 10, 2015, 5:01:18 AM6/10/15
to orient-...@googlegroups.com
Hi Bryan,
can you post your schema ?

Regards,
Alessandro

bryan

unread,
Jun 10, 2015, 5:25:44 AM6/10/15
to orient-...@googlegroups.com
Hi. alessand.

i send to you by email.

thank you.

regrads,
bryan.

2015년 6월 10일 수요일 오후 6시 1분 18초 UTC+9, alessand...@gmail.com 님의 말:

탁선호

unread,
Jun 11, 2015, 4:10:05 AM6/11/15
to orient-...@googlegroups.com
Hi alessandro.
Did you get my attached file?

if you did not get my db file, here it is.

thank you.

regards,
bryan.


--

---
You received this message because you are subscribed to a topic in the Google Groups "OrientDB" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/orient-database/HAlhsjBf-tI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to orient-databa...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

pan_plus_story(1).gz

alessand...@gmail.com

unread,
Jun 11, 2015, 4:57:20 AM6/11/15
to orient-...@googlegroups.com
Hi Bryan,
I had received your file and I'm working on , when I'm done I'll let you know

Alessandro


bryan

unread,
Jun 29, 2015, 12:43:28 AM6/29/15
to orient-...@googlegroups.com
Hi alessandro.

first, thank you for your working.

i'm waiting your reply.

have you any problem?

best regards,
bryan.

2015년 6월 11일 목요일 오후 5시 57분 20초 UTC+9, alessand...@gmail.com 님의 말:

alessand...@gmail.com

unread,
Jun 29, 2015, 3:20:20 AM6/29/15
to orient-...@googlegroups.com
Hi Bryan,
I'm sorry if I have not responded more.
I have tried several times and the function getBestReply works correctly from Studio but when the function is called from java api don't work.

Alessandro

탁선호

unread,
Jun 30, 2015, 1:29:22 AM6/30/15
to orient-...@googlegroups.com
Hi. Alessandro.
Thank you for your quckly reply.
yes, it's correct. the function is called from java api don't work.
if it is bug, have you plan fot fix? or have you to do work another way?

thank you.
best regards,
bryan.


--

alessand...@gmail.com

unread,
Jun 30, 2015, 5:11:13 AM6/30/15
to orient-...@googlegroups.com
Hi Bryan,
I think that is a bug and I don't know how to solve the problem.

Alessandro

탁선호

unread,
Jun 30, 2015, 5:22:00 AM6/30/15
to orient-...@googlegroups.com
Hi Alessandro.
I think the bug is very important on my solution.
because functions runs important role.
so, i hope that the bug fix asap.
thank you very much.

best regards
bryan.



--
Reply all
Reply to author
Forward
0 new messages