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

RelationshipProxy instruments wrong API calls #138

Open
realoptimal opened this issue Jun 26, 2014 · 5 comments
Open

RelationshipProxy instruments wrong API calls #138

realoptimal opened this issue Jun 26, 2014 · 5 comments

Comments

@realoptimal
Copy link

e.g.

class Person(Node):
... element_type = "person"
... name = String(nullable=False)
...
class Knows(Relationship):
... lable = "knows"
...
class Knows(Relationship):
... label = "knows"
... created = DateTime(default=current_timestamp, nullable=False)
...
g.add_proxy("person", Person)
g.add_proxy("knows", Knows)

james = g.person.create(name="James")
POST url: http://10.0.3.139:8182/graphs/emptygraph/vertices
POST body: {"element_type": "person", "name": "James"}
julie = g.person.create(name="Julie")
POST url: http://10.0.3.139:8182/graphs/emptygraph/vertices
POST body: {"element_type": "person", "name": "Julie"}
g.knows.create(james, julie)
POST url: http://10.0.3.139:8182/graphs/emptygraph/edges
POST body: {"_label": "knows", "created": 1403798951, "_outV": 15, "_inV": 16}
<Knows: http://10.0.3.139:8182/graphs/emptygraph/edges/17>

All good, but now:

g.knows.get_all()
GET url: http://10.0.3.139:8182/graphs/emptygraph/vertices?value=knows&key=label
GET body: None

Hmm, shouldn't the URI should be a request on edges not vertices?

What about?

g.knows.index.lookup(created=1403798951)
GET url: http://10.0.3.139:8182/graphs/emptygraph/vertices?value=1403798951&key=created
GET body: None

Again, same thing.

@espeed
Copy link
Owner

espeed commented Jun 27, 2014

Why do you have two Relationship classes?

Also note in the first Relationship class there is a typo: lable

Here's the code that should get called on g.knows.get_all():

https://github.com/espeed/bulbs/blob/master/bulbs/model.py#L915

For some reason, the index object on the knows Relationship model is being set to a Vertex index instead of an Edge index.

@espeed
Copy link
Owner

espeed commented Jul 11, 2014

Is this resolved?

@realoptimal
Copy link
Author

I don't think so -- as you said index object on the knows Relationship model is being set to a Vertex index instead of an Edge index. Since I am not explicitly creating any indexes on model properties, I assume, all properties are indexed. Why shouldn't this return all knows Relationship objects?

@espeed
Copy link
Owner

espeed commented Jul 11, 2014

The knows object should be hitting the http://10.0.3.139:8182/graphs/emptygraph/edges endpoint for get_all() and index lookup() -- in the code snippet you have two Knows classes, and the first one has a typo for label -- would you mind posting the complete example to a Gist (imports and all) so I can try to reproduce the issue?

@realoptimal
Copy link
Author

Yes, sorry, should have done that from the start:
https://gist.github.com/realoptimal/d5fe0b566b6eb50165e8

and emptygraph is for me an hbase backed titan-db with configuration in rexster.xml as:

        <graph>
            <graph-enabled>true</graph-enabled>
            <graph-name>emptygraph</graph-name>
            <graph-type>com.thinkaurelius.titan.tinkerpop.rexster.TitanGraphConfiguration</graph-type>
            <graph-read-only>false</graph-read-only>
            <properties>
                <storage.backend>hbase</storage.backend>
                <storage.tablename>titandb_test</storage.tablename>
            </properties>
            <extensions>
                <allows>
                    <allow>tp:gremlin</allow>
                </allows>
            </extensions>
        </graph>

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

No branches or pull requests

2 participants