Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gremlin Query does not run in a Function #7096

Closed
4 tasks
ashkumar opened this issue Jan 19, 2017 · 2 comments
Closed
4 tasks

Gremlin Query does not run in a Function #7096

ashkumar opened this issue Jan 19, 2017 · 2 comments
Assignees
Labels
Milestone

Comments

@ashkumar
Copy link

OrientDB Version, operating system, or hardware.

  • v2.2.13

Operating System

  • Linux
  • [X ] MacOSX
  • Windows
  • Other Unix
  • Other, name?

Expected behavior and actual behavior

I have a Gremlin pipeline as such


g.v('41:0').outE('AE_Cat_SubCat').inV().transform{[id:it.id, text:it.text]}.gather

This produces the following output in Gremlin console
[{id=#46:0, text=Physics}, {id=#45:0, text=General Science}, {id=#47:0, text=Sports}]

However, I created a function in the OrientDB web console and used the following code


def mydb = orient.getGraph();
def queryOutput, results;
try{
  def query = "g.v(\'${CategoryId}\').outE(\'AE_Cat_SubCat\').inV().transform{[\'id\':it.id, \'text\':it.text]}.gather";
  println query
  queryOutput = mydb.command('gremlin', query);
  println queryOutput

  
}catch(err){
  return err;  
}
return queryOutput;

And I get the following result

[
{
"@type": "d",
"@Version": 0,
"value": [
null,
null,
null
]
}
]

Output in the console is
g.v('41:0').outE('AE_Cat_SubCat').inV().transform{['id':it.id, 'text':it.text]}.gather
[null, null, null]

Please note the the Gremlin query and transform is identical. I have tried with and without the quotes in the transform also.

However, if we remove the transform step, now I get the expected result but a bit too verbose for practical use.


def mydb = orient.getGraph();
def queryOutput, results;
try{
  def query = "g.v(\'${CategoryId}\').outE(\'AE_Cat_SubCat\').inV().gather";
  println query
  queryOutput = mydb.command('gremlin', query);
  println queryOutput

  
}catch(err){
  return err;  
}
return queryOutput;

Gives me back
[
{
"@type": "d",
"@Rid": "#46:0",
"@Version": 2,
"@Class": "A_SubCategory",
"text": "Physics",
"in_AE_Cat_SubCat": [
"#53:0"
],
"@fieldTypes": "in_AE_Cat_SubCat=g"
},
{
"@type": "d",
"@Rid": "#45:0",
"@Version": 2,
"@Class": "A_SubCategory",
"text": "General Science",
"in_AE_Cat_SubCat": [
"#54:0"
],
"@fieldTypes": "in_AE_Cat_SubCat=g"
},
{
"@type": "d",
"@Rid": "#47:0",
"@Version": 5,
"@Class": "A_SubCategory",
"out_AE_SubCat_Question": [
"#73:0",
"#74:0",
"#75:0"
],
"text": "Sports",
"in_AE_Cat_SubCat": [
"#55:0"
],
"@fieldTypes": "out_AE_SubCat_Question=g,in_AE_Cat_SubCat=g"
}
]

Steps to reproduce the problem

I suspect the transform stage of the pipeline does not work in Functions. You can try to apply any type of transform and it will likely fail.

Is there a better way to accomplish what I need? I am merely trying to clean up the output such that we get only the data that the front end would need and be interested in.

Thanks

@lvca lvca added the bug label Jan 27, 2017
@wolf4ood
Copy link
Member

hi @ashkumar
let me check

@wolf4ood wolf4ood added this to the 2.2.x (next hotfix) milestone Feb 14, 2017
wolf4ood added a commit that referenced this issue Feb 14, 2017
wolf4ood added a commit that referenced this issue Feb 14, 2017
@wolf4ood
Copy link
Member

hi @ashkumar
Fixed. It will be available in the next release 2.2.17
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

4 participants