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 <[email protected]>
  • Loading branch information
FlorianHockmann committed Mar 4, 2024
1 parent ce17428 commit 5b906fe
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 5b906fe

@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: 5b906fe Previous: 1530f0a Ratio
org.janusgraph.JanusGraphSpeedBenchmark.basicAddAndDelete 12304.072174059005 ms/op 12385.880105942719 ms/op 0.99
org.janusgraph.GraphCentricQueryBenchmark.getVertices 903.5856410260895 ms/op 897.5208673932261 ms/op 1.01
org.janusgraph.MgmtOlapJobBenchmark.runClearIndex 215.85787052173913 ms/op 216.14179947499997 ms/op 1.00
org.janusgraph.MgmtOlapJobBenchmark.runReindex 336.0742889436905 ms/op 332.1309897483333 ms/op 1.01
org.janusgraph.JanusGraphSpeedBenchmark.basicCount 211.29036709551562 ms/op 215.02071580531708 ms/op 0.98
org.janusgraph.CQLMultiQueryMultiSlicesBenchmark.getValuesAllPropertiesWithAllMultiQuerySlicesUnderMaxRequestsPerConnection 4751.875581605898 ms/op 4664.188207695399 ms/op 1.02
org.janusgraph.CQLMultiQueryBenchmark.getElementsWithUsingEmitRepeatSteps 16890.639601047504 ms/op 16352.527830474333 ms/op 1.03
org.janusgraph.CQLMultiQueryMultiSlicesBenchmark.getValuesMultiplePropertiesWithSmallBatch 19587.261254351717 ms/op 19824.599960445456 ms/op 0.99
org.janusgraph.CQLMultiQueryMultiSlicesBenchmark.vertexCentricPropertiesFetching 57230.010720733335 ms/op 56201.26617166666 ms/op 1.02
org.janusgraph.CQLMultiQueryBenchmark.getAllElementsTraversedFromOuterVertex 8289.994961654502 ms/op 7906.645219600678 ms/op 1.05
org.janusgraph.CQLMultiQueryBenchmark.getVerticesWithDoubleUnion 372.3700823340844 ms/op 379.8377001964137 ms/op 0.98
org.janusgraph.CQLMultiQueryMultiSlicesBenchmark.getValuesAllPropertiesWithUnlimitedBatch 3970.905275590193 ms/op 3886.8713759808343 ms/op 1.02
org.janusgraph.CQLMultiQueryBenchmark.getNames 8344.506902151945 ms/op 8135.59305787296 ms/op 1.03
org.janusgraph.CQLMultiQueryMultiSlicesBenchmark.getValuesThreePropertiesWithAllMultiQuerySlicesUnderMaxRequestsPerConnection 5724.332095024029 ms/op 5503.356218245031 ms/op 1.04
org.janusgraph.CQLMultiQueryBenchmark.getLabels 7130.540831799355 ms/op 7024.7527374147185 ms/op 1.02
org.janusgraph.CQLMultiQueryBenchmark.getVerticesFilteredByAndStep 433.4031738196221 ms/op 427.17314494545025 ms/op 1.01
org.janusgraph.CQLMultiQueryBenchmark.getVerticesFromMultiNestedRepeatStepStartingFromSingleVertex 12846.356622131114 ms/op 11926.323378581046 ms/op 1.08
org.janusgraph.CQLMultiQueryBenchmark.getVerticesWithCoalesceUsage 358.3362308060665 ms/op 361.90201198876565 ms/op 0.99
org.janusgraph.CQLMultiQueryMultiSlicesBenchmark.getValuesMultiplePropertiesWithAllMultiQuerySlicesUnderMaxRequestsPerConnection 13610.086686501429 ms/op 13280.235397442804 ms/op 1.02
org.janusgraph.CQLMultiQueryBenchmark.getIdToOutVerticesProjection 250.06860329428505 ms/op 245.53304211034066 ms/op 1.02
org.janusgraph.CQLMultiQueryMultiSlicesBenchmark.getValuesMultiplePropertiesWithUnlimitedBatch 13524.960360463876 ms/op 13693.67385197527 ms/op 0.99
org.janusgraph.CQLMultiQueryBenchmark.getNeighborNames 8426.83598049078 ms/op 8163.851328829417 ms/op 1.03
org.janusgraph.CQLMultiQueryBenchmark.getElementsWithUsingRepeatUntilSteps 9108.695284337855 ms/op 8777.982757626436 ms/op 1.04
org.janusgraph.CQLMultiQueryBenchmark.getAdjacentVerticesLocalCounts 8612.09779841221 ms/op 8487.195678565702 ms/op 1.01

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

Please sign in to comment.