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

Support new text predicates via JanusGraph Server #4279

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 @@ -52,12 +52,21 @@
case "geoWithin":
case "geoContains":
case "textContains":
case "textNotContains":
case "textContainsFuzzy":
case "textNotContainsFuzzy":
case "textContainsPrefix":
case "textNotContainsPrefix":
case "textContainsRegex":
case "textNotContainsRegex":
case "textContainsPhrase":
case "textNotContainsPhrase":
case "textFuzzy":
case "textNotFuzzy":
case "textPrefix":
case "textNotPrefix":
case "textRegex":
case "textNotRegex":
return true;
default:
return false;
Expand All @@ -76,18 +85,36 @@
return Geo.geoContains(value);
case "textContains":
return Text.textContains(value);
case "textNotContains":
return Text.textNotContains(value);

Check warning on line 89 in janusgraph-driver/src/main/java/org/janusgraph/graphdb/tinkerpop/JanusGraphPSerializer.java

View check run for this annotation

Codecov / codecov/patch

janusgraph-driver/src/main/java/org/janusgraph/graphdb/tinkerpop/JanusGraphPSerializer.java#L89

Added line #L89 was not covered by tests
case "textContainsFuzzy":
return Text.textContainsFuzzy(value);
case "textNotContainsFuzzy":
return Text.textNotContainsFuzzy(value);

Check warning on line 93 in janusgraph-driver/src/main/java/org/janusgraph/graphdb/tinkerpop/JanusGraphPSerializer.java

View check run for this annotation

Codecov / codecov/patch

janusgraph-driver/src/main/java/org/janusgraph/graphdb/tinkerpop/JanusGraphPSerializer.java#L93

Added line #L93 was not covered by tests
case "textContainsPrefix":
return Text.textContainsPrefix(value);
case "textNotContainsPrefix":
return Text.textNotContainsPrefix(value);

Check warning on line 97 in janusgraph-driver/src/main/java/org/janusgraph/graphdb/tinkerpop/JanusGraphPSerializer.java

View check run for this annotation

Codecov / codecov/patch

janusgraph-driver/src/main/java/org/janusgraph/graphdb/tinkerpop/JanusGraphPSerializer.java#L97

Added line #L97 was not covered by tests
case "textContainsRegex":
return Text.textContainsRegex(value);
case "textNotContainsRegex":
return Text.textNotContainsRegex(value);

Check warning on line 101 in janusgraph-driver/src/main/java/org/janusgraph/graphdb/tinkerpop/JanusGraphPSerializer.java

View check run for this annotation

Codecov / codecov/patch

janusgraph-driver/src/main/java/org/janusgraph/graphdb/tinkerpop/JanusGraphPSerializer.java#L101

Added line #L101 was not covered by tests
case "textContainsPhrase":
return Text.textContainsPhrase(value);

Check warning on line 103 in janusgraph-driver/src/main/java/org/janusgraph/graphdb/tinkerpop/JanusGraphPSerializer.java

View check run for this annotation

Codecov / codecov/patch

janusgraph-driver/src/main/java/org/janusgraph/graphdb/tinkerpop/JanusGraphPSerializer.java#L103

Added line #L103 was not covered by tests
case "textNotContainsPhrase":
return Text.textNotContainsPhrase(value);

Check warning on line 105 in janusgraph-driver/src/main/java/org/janusgraph/graphdb/tinkerpop/JanusGraphPSerializer.java

View check run for this annotation

Codecov / codecov/patch

janusgraph-driver/src/main/java/org/janusgraph/graphdb/tinkerpop/JanusGraphPSerializer.java#L105

Added line #L105 was not covered by tests
case "textFuzzy":
return Text.textFuzzy(value);
case "textNotFuzzy":
return Text.textNotFuzzy(value);

Check warning on line 109 in janusgraph-driver/src/main/java/org/janusgraph/graphdb/tinkerpop/JanusGraphPSerializer.java

View check run for this annotation

Codecov / codecov/patch

janusgraph-driver/src/main/java/org/janusgraph/graphdb/tinkerpop/JanusGraphPSerializer.java#L109

Added line #L109 was not covered by tests
case "textPrefix":
return Text.textPrefix(value);
case "textNotPrefix":
return Text.textNotPrefix(value);

Check warning on line 113 in janusgraph-driver/src/main/java/org/janusgraph/graphdb/tinkerpop/JanusGraphPSerializer.java

View check run for this annotation

Codecov / codecov/patch

janusgraph-driver/src/main/java/org/janusgraph/graphdb/tinkerpop/JanusGraphPSerializer.java#L113

Added line #L113 was not covered by tests
case "textRegex":
return Text.textRegex(value);
case "textNotRegex":
return Text.textNotRegex(value);

Check warning on line 117 in janusgraph-driver/src/main/java/org/janusgraph/graphdb/tinkerpop/JanusGraphPSerializer.java

View check run for this annotation

Codecov / codecov/patch

janusgraph-driver/src/main/java/org/janusgraph/graphdb/tinkerpop/JanusGraphPSerializer.java#L117

Added line #L117 was not covered by tests
default:
throw new UnsupportedOperationException("Matched predicate {" + predicateName + "} is not support by JanusGraphPSerializer");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,21 @@ private static Stream<JanusGraphP> janusGraphPProvider() {
Geo.geoDisjoint(Geoshape.circle(37.97, 23.72, 50)),
Geo.geoContains(Geoshape.point(37.97, 23.72)),
Text.textContains("neptune"),
Text.textNotContains("neptune"),
Text.textContainsPrefix("nep"),
Text.textNotContainsPrefix("nep"),
Text.textContainsRegex("nep.*"),
Text.textNotContainsRegex("nep.*"),
Text.textContainsPhrase("neptune,pluto"),
Text.textNotContainsPhrase("neptune,pluto"),
Text.textPrefix("n"),
Text.textNotPrefix("n"),
Text.textRegex(".*n.*"),
Text.textNotRegex(".*n.*"),
Text.textContainsFuzzy("neptun"),
Text.textFuzzy("nepitne")
Text.textNotContainsFuzzy("neptun"),
Text.textFuzzy("nepitne"),
Text.textNotFuzzy("nepitne")
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public void testJanusGraphPredicatesAsGraphSON(GraphSONVersion graphSONVersion)
g.E().has("place", Geo.geoDisjoint(Geoshape.circle(37.97, 23.72, 50))),
g.V().has("place", Geo.geoContains(Geoshape.point(37.97, 23.72))),
g.V().has("name", Text.textContains("neptune")), g.V().has("name", Text.textContainsPrefix("nep")),
g.V().has("name", Text.textNotContains("neptune")), g.V().has("name", Text.textNotContainsPrefix("nep")),
g.V().has("name", Text.textContainsRegex("nep.*")), g.V().has("name", Text.textPrefix("n")),
g.V().has("name", Text.textRegex(".*n.*")), g.V().has("name", Text.textContainsFuzzy("neptun")),
g.V().has("name", Text.textFuzzy("nepitne")) };
Expand Down
Loading