Hi all,

Using 1.7.9 (freshly installed 20 mins ago to confirm :) ), I am seeing a 
wierd result from a gremlin query. I have minimized it to a small set of 
commands, which reproduce the issue.

The problem in a nutshell is that when returning the results of ".map" in a 
gremlin query, over the HTTP API, I get invalid json as a result.

I make a plocal graph database, then create a schema with the following sql 
commands:

create class EmbType1 
create property EmbType1.someint INTEGER
create property EmbType1.name STRING
create class FooType extends V
create property FooType.name STRING
alter property FooType.name MANDATORY=true
create property FooType.embinfo EMBEDDED EmbType1

Then doing a gremlin query of:

g.V("@class", "FooType").map

returns invalid JSON.

The problem is reproducable on my Mac with this set of commands, running 
the default configuration xml (except the root password is changed to 
"root"):

$ curl -X POST http://root:root@localhost:2480/database/mytest/plocal/graph

$ curl -X POST -H "Content-type: application/json" 
http://admin:admin@localhost:2480/batch/mytest -d '{"operations": 
[{"command": "create class EmbType1 ", "type": "cmd", "language": "sql"}, 
{"command": "create property EmbType1.someint INTEGER", "type": "cmd", 
"language": "sql"}, {"command": "create property EmbType1.name STRING", 
"type": "cmd", "language": "sql"}, {"command": "create class FooType 
extends V", "type": "cmd", "language": "sql"}, {"command": "create property 
FooType.name STRING", "type": "cmd", "language": "sql"}, {"command": "alter 
property FooType.name MANDATORY=true", "type": "cmd", "language": "sql"}, 
{"command": "create property FooType.embinfo EMBEDDED EmbType1", "type": 
"cmd", "language": "sql"}], "transaction": false}'

$ curl -X POST  -H "Content-type: application/json" 
http://admin:admin@localhost:2480/document/mytest -d '{"name": "fname1", 
"@class": "FooType", "embinfo": {"someint": 42, "name": "ename1", "@class": 
"EmbType1", "@type": "d"}}'

$ curl -X POST  -H "Content-type: application/json" 
http://admin:admin@localhost:2480/document/mytest -d '{"name": "fname2", 
"@class": "FooType", "embinfo": {"someint": 42, "name": "ename2", "@class": 
"EmbType1", "@type": "d"}}'

$ curl -X POST http://admin:admin@localhost:2480/command/mytest/gremlin -d 
'g.V("@class","FooType").map'

The resulting json from the gremlin query is:

{"result":[{"@type":"d","@version":0,"value":[{{"@type":"d","@version":0,"@class":"EmbType1","someint":42,"name":"ename1"},"name":"fname1"},{{"@type":"d","@version":0,"@class":"EmbType1","someint":42,"name":"ename2"},"name":"fname2"}]}]}

Which is invalid, because value is a list of objects. The first member of 
each object is the embedded document type without a key - specifically the 
key in this case shoule be "embinfo" (as per my sql).

I'm pretty sure this is a bug, but I'm open to the idea I'm using things 
improperly too, if that's the case.

-- 

--- 
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.

Reply via email to