You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "Marko A. Rodriguez (JIRA)" <ji...@apache.org> on 2015/06/03 01:27:50 UTC

[jira] [Commented] (TINKERPOP3-551) Neo4j multiple labels can not be queried individually

    [ https://issues.apache.org/jira/browse/TINKERPOP3-551?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14569974#comment-14569974 ] 

Marko A. Rodriguez commented on TINKERPOP3-551:
-----------------------------------------------

I think we can do:

{code}
g.V.has(label,of('person'))
{code}

{{of}} would be a Neo4j-specific bi-predicate that would be:

{code}
public boolean test(final String fullLabel, final String checkLabel) {
  return fullLabel.contains(checkLabel);
}
{code}

This would make it so we don't need a {{Neo4jHasStep}} nor a specific strategy. Moreover, {{WhereStep}}, {{IsStep}}, etc. would benefit from it.

{code}
g.V().label().is(of('person'))
{code}

Finally, what is cool is then this also works with other P-predicates.

{code}
g.V().has(label,not(of('person')))
{code}

The only thing we would need to be smart about is making sure {{Neo4jGraphStep}} hits indices correctly given the {{HasContainer}} with {{N.of()}}-predicate. I will implement this tomorrow.

> Neo4j multiple labels can not be queried individually
> -----------------------------------------------------
>
>                 Key: TINKERPOP3-551
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP3-551
>             Project: TinkerPop 3
>          Issue Type: Bug
>          Components: neo4j
>            Reporter: Stanislav Malyshev
>            Priority: Critical
>
> With TP3 M7, I can add multiple labels to Neo4j vertex:
> {code}
> gremlin> v = g.addVertex(label, 'test', 'wikibaseId', 'test')
> ==>v[3]
> gremlin> v.addLabel('test2')
> ==>null
> gremlin> v.labels()
> ==>test
> ==>test2
> {code}
> However, if I try a lookup by this label, it does not work:
> {code}
> gremlin> g.V().has(label, 'test2')
> gremlin> g.V().has(label, 'test')
> gremlin> g.V().has(label, 'test').hasNext()
> ==>false
> {code}
> This lookup works for nodes with single label, but not for nodes with multiple labels. This, however, works:
> {code}
> gremlin> g.cypher('MATCH (x:test2) RETURN x')
> ==>[x:v[3]]
> {code}
> So Neo4j query works fine, while TP3 one does not.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)