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

Duplicate Vertices created by readme sample code #2

Closed
PeterLappo opened this issue Nov 5, 2015 · 3 comments
Closed

Duplicate Vertices created by readme sample code #2

PeterLappo opened this issue Nov 5, 2015 · 3 comments
Labels

Comments

@PeterLappo
Copy link

Hi Dave,
When I'm running against tinkergraph I get duplicate vertices with the last example when starting with a clean database. See below for code, console output and reply from server using http://localhost:8182/?gremlin=g.V()

Also Id seems to be created as a property, which doesn't look right.
Will try sample on titan too and let you know.

Other than than that pretty cool library and better than gremlin console if we can solve the duplicates.
Cheers
Peter

Code

client = gremlinrestclient.GremlinRestClient()
graph = gremlinrestclient.TinkerGraph()
d = {"name": "dave", "label": "person"}
coll = graph.create(d)
dave, = coll.vertices  # Unpack tuple of length 1
print(dave)
print(coll)
coll = graph.create(
   {"name": "python", "label": "lang"},
   (dave, "LIKES", 0, {'weight': 1}))
print(coll)
resp = client.execute("g.V()")
print(resp)

Console output

Response(status_code=200,
data=[
  {
    u'properties': {
      u'name': [
        {
          u'id': 1,
          u'value': u'dave'
        }
      ]
    },
    u'type': u'vertex',
    u'id': 0,
    u'label': u'person'
  },
  {
    u'properties': {
      u'name': [
        {
          u'id': 3,
          u'value': [
            {
              u'id': 1,
              u'value': u'dave'
            }
          ]
        }
      ]
    },
    u'type': u'vertex',
    u'id': 2,
    u'label': u'person'
  },
  {
    u'properties': {
      u'name': [
        {
          u'id': 5,
          u'value': u'python'
        }
      ]
    },
    u'type': u'vertex',
    u'id': 4,
    u'label': u'lang'
  }
],
message={

},
metadata=u'')

Reply from server

{
  "requestId": "2d571957-c321-408c-b2b1-765c67abf2b1",
  "status": {
    "message": "",
    "code": 200,
    "attributes": {

    }
  },
  "result": {
    "data": [
      {
        "id": 0,
        "label": "person",
        "type": "vertex",
        "properties": {
          "name": [
            {
              "id": 1,
              "value": "dave"
            }
          ]
        }
      },
      {
        "id": 2,
        "label": "person",
        "type": "vertex",
        "properties": {
          "name": [
            {
              "id": 3,
              "value": [
                {
                  "id": 1,
                  "value": "dave"
                }
              ]
            }
          ]
        }
      },
      {
        "id": 4,
        "label": "lang",
        "type": "vertex",
        "properties": {
          "name": [
            {
              "id": 5,
              "value": "python"
            }
          ]
        }
      }
    ],
    "meta": {

    }
  }
}
@PeterLappo
Copy link
Author

Works fine with Titan. Perhaps its my tinkergraph setup or just a feature of tinkergraph

@davebshow davebshow added the bug label Nov 5, 2015
@davebshow
Copy link
Owner

Peter,

Thanks for reporting this. It was definitely a bug that has to do with the fact that Tinkergraph assigns a node id of 0, which caused a truth check to fail.

@PeterLappo
Copy link
Author

thanks

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

No branches or pull requests

2 participants