Skip to content

Commit

Permalink
Support new text predicates via JanusGraph Server
Browse files Browse the repository at this point in the history
The predicates added in #2559 were not supported by
`JanusGraphPSerializer` and could thus not be used when connecting via
remote to JanusGraph Server.

Fixes #4275

Signed-off-by: Florian Hockmann <fh@florian-hockmann.de>
(cherry picked from commit 5b906fe)
  • Loading branch information
FlorianHockmann committed Mar 5, 2024
1 parent 3089ab5 commit b04cdc2
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,21 @@ public static boolean checkForJanusGraphPredicate(String predicateName) {
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 @@ public static JanusGraphP createPredicateWithValue(String predicateName, Object
return Geo.geoContains(value);
case "textContains":
return Text.textContains(value);
case "textNotContains":
return Text.textNotContains(value);
case "textContainsFuzzy":
return Text.textContainsFuzzy(value);
case "textNotContainsFuzzy":
return Text.textNotContainsFuzzy(value);
case "textContainsPrefix":
return Text.textContainsPrefix(value);
case "textNotContainsPrefix":
return Text.textNotContainsPrefix(value);
case "textContainsRegex":
return Text.textContainsRegex(value);
case "textNotContainsRegex":
return Text.textNotContainsRegex(value);
case "textContainsPhrase":
return Text.textContainsPhrase(value);
case "textNotContainsPhrase":
return Text.textNotContainsPhrase(value);
case "textFuzzy":
return Text.textFuzzy(value);
case "textNotFuzzy":
return Text.textNotFuzzy(value);
case "textPrefix":
return Text.textPrefix(value);
case "textNotPrefix":
return Text.textNotPrefix(value);
case "textRegex":
return Text.textRegex(value);
case "textNotRegex":
return Text.textNotRegex(value);
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

1 comment on commit b04cdc2

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: b04cdc2 Previous: 1530f0a Ratio
org.janusgraph.JanusGraphSpeedBenchmark.basicAddAndDelete 12470.149622734505 ms/op 12385.880105942719 ms/op 1.01
org.janusgraph.GraphCentricQueryBenchmark.getVertices 906.3066613954894 ms/op 897.5208673932261 ms/op 1.01
org.janusgraph.MgmtOlapJobBenchmark.runClearIndex 216.62958473043477 ms/op 216.14179947499997 ms/op 1.00
org.janusgraph.MgmtOlapJobBenchmark.runReindex 335.3981788166667 ms/op 332.1309897483333 ms/op 1.01
org.janusgraph.JanusGraphSpeedBenchmark.basicCount 250.41644871187813 ms/op 215.02071580531708 ms/op 1.16
org.janusgraph.CQLMultiQueryMultiSlicesBenchmark.getValuesAllPropertiesWithAllMultiQuerySlicesUnderMaxRequestsPerConnection 4641.3877744808615 ms/op 4664.188207695399 ms/op 1.00
org.janusgraph.CQLMultiQueryBenchmark.getElementsWithUsingEmitRepeatSteps 17443.049723660322 ms/op 16352.527830474333 ms/op 1.07
org.janusgraph.CQLMultiQueryMultiSlicesBenchmark.getValuesMultiplePropertiesWithSmallBatch 19240.988202253335 ms/op 19824.599960445456 ms/op 0.97
org.janusgraph.CQLMultiQueryMultiSlicesBenchmark.vertexCentricPropertiesFetching 58415.9763029 ms/op 56201.26617166666 ms/op 1.04
org.janusgraph.CQLMultiQueryBenchmark.getAllElementsTraversedFromOuterVertex 8888.477353208576 ms/op 7906.645219600678 ms/op 1.12
org.janusgraph.CQLMultiQueryBenchmark.getVerticesWithDoubleUnion 373.1932028637874 ms/op 379.8377001964137 ms/op 0.98
org.janusgraph.CQLMultiQueryMultiSlicesBenchmark.getValuesAllPropertiesWithUnlimitedBatch 3954.192942424962 ms/op 3886.8713759808343 ms/op 1.02
org.janusgraph.CQLMultiQueryBenchmark.getNames 8570.287660257898 ms/op 8135.59305787296 ms/op 1.05
org.janusgraph.CQLMultiQueryMultiSlicesBenchmark.getValuesThreePropertiesWithAllMultiQuerySlicesUnderMaxRequestsPerConnection 5828.044816767362 ms/op 5503.356218245031 ms/op 1.06
org.janusgraph.CQLMultiQueryBenchmark.getLabels 7378.93888368769 ms/op 7024.7527374147185 ms/op 1.05
org.janusgraph.CQLMultiQueryBenchmark.getVerticesFilteredByAndStep 422.1702623033608 ms/op 427.17314494545025 ms/op 0.99
org.janusgraph.CQLMultiQueryBenchmark.getVerticesFromMultiNestedRepeatStepStartingFromSingleVertex 13365.677521009167 ms/op 11926.323378581046 ms/op 1.12
org.janusgraph.CQLMultiQueryBenchmark.getVerticesWithCoalesceUsage 350.48488087164924 ms/op 361.90201198876565 ms/op 0.97
org.janusgraph.CQLMultiQueryMultiSlicesBenchmark.getValuesMultiplePropertiesWithAllMultiQuerySlicesUnderMaxRequestsPerConnection 13694.538592263383 ms/op 13280.235397442804 ms/op 1.03
org.janusgraph.CQLMultiQueryBenchmark.getIdToOutVerticesProjection 250.5321923998918 ms/op 245.53304211034066 ms/op 1.02
org.janusgraph.CQLMultiQueryMultiSlicesBenchmark.getValuesMultiplePropertiesWithUnlimitedBatch 14562.716548051983 ms/op 13693.67385197527 ms/op 1.06
org.janusgraph.CQLMultiQueryBenchmark.getNeighborNames 8297.868583955496 ms/op 8163.851328829417 ms/op 1.02
org.janusgraph.CQLMultiQueryBenchmark.getElementsWithUsingRepeatUntilSteps 9280.505642852628 ms/op 8777.982757626436 ms/op 1.06
org.janusgraph.CQLMultiQueryBenchmark.getAdjacentVerticesLocalCounts 8972.293168218011 ms/op 8487.195678565702 ms/op 1.06

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.