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

Chain of related fixes #182

Merged
merged 1 commit into from
Sep 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,21 @@ public static boolean isPath(Object value) {

List list = (List) value;

if (list.isEmpty() || !isNode(list.get(0))) {
if (list.isEmpty()) {
return false;
}

boolean nodeCheck = true;
for (Object e : list) {
if (!isNode(e) && !isRelationship(e)) {
if (nodeCheck && !isNode(e)) {
return false;
}

if (!nodeCheck && !isRelationship(e)) {
return false;
}

nodeCheck = !nodeCheck;
}

return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package org.opencypher.gremlin.translation.walker

import org.opencypher.gremlin.translation.GremlinSteps
import org.opencypher.gremlin.translation.Tokens.MATCH_START
import org.opencypher.gremlin.translation.context.WalkerContext
import org.opencypher.gremlin.translation.exception.SyntaxException
import org.opencypher.gremlin.translation.walker.NodeUtils.setProperty
Expand Down Expand Up @@ -48,10 +47,9 @@ private class CreateWalker[T, P](context: WalkerContext[T, P], g: GremlinSteps[T
patternParts.foreach {
case EveryPath(n: PatternElement) =>
walkPattern(n)
case NamedPatternPart(Variable(name), EveryPath(n: PatternElement)) =>
case p @ NamedPatternPart(_, EveryPath(n: PatternElement)) =>
walkPattern(n)
PatternWalker.walk(context, g, n, Some(name))
g.path().from(MATCH_START + name).as(name)
MatchWalker.walkPatternParts(context, g, Seq(p), None)
case n =>
context.unsupported("create pattern", n)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ private class ExpressionWalker[T, P](context: WalkerContext[T, P], g: GremlinSte
}
traversal

case ListComprehension(ExtractScope(_, _, Some(function)), target) =>
case ListComprehension(ExtractScope(_, None, Some(function)), target) =>
val targetT = walkLocal(target, maybeAlias)
val functionT = walkLocal(function, maybeAlias)

Expand Down Expand Up @@ -283,7 +283,7 @@ private class ExpressionWalker[T, P](context: WalkerContext[T, P], g: GremlinSte
traversal.flatMap(functionT).fold()
} else if (projection.dependencies.size == 1) {
val Variable(dependencyName) = projection.dependencies.head
traversal.as(dependencyName).flatMap(functionT).fold()
traversal.select(dependencyName).flatMap(functionT).fold()
} else {
context.unsupported("pattern comprehension with multiple arguments", expression)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private class MatchWalker[T, P](context: WalkerContext[T, P], g: GremlinSteps[T,
PatternWalker.walk(context, g, patternElement)
case NamedPatternPart(Variable(pathName), EveryPath(patternElement)) =>
PatternWalker.walk(context, g, patternElement, Some(pathName))
g.as(MATCH_END + pathName).path().as(pathName)
g.as(MATCH_END + pathName).path().from(Tokens.MATCH_START + pathName).as(pathName)
case n =>
context.unsupported("match pattern", n)
}
Expand Down