Wildcard or search for "LIKE" in azure db space with Gremlin Graph API

I am trying to find vertices as a wildcard search. In SQL, it will be: “where the type name is“% abc%. ”Neither the Gremlin graph traversal nor SQL queries support it.

A use case is filtering a 1: n dependency, for example. “Show me all my clients whose name contains“ Sam. ”It's pretty simple and easy with SQL. It's not a full-text search, it's just a filter in this particular release from 1: n.

The following SQL works:

SELECT * FROM g 
  where (g.label = "person" and g.name[0]._value = 'Sam')

which is equivalent to:

g.V().hasLabel("person").has("name", "Sam")

The following SQL does not work ("Syntax error, incorrect syntax next to" like "):

SELECT * FROM g 
  where (g.label = "person" and g.name[0]._value like 'Sam')

Attempting to use lambda in the Gremlin filter step also results in an error.

UDF ? ? ?

+4
1

Azure gremlin

, , , , ...

, , - /

, , , - ( )

.

=

:

= ,

FirstNameInitial = S,

= ,

LastnameInitial = S

g.addV('Person').property('Firstname', 'Sam').property('FirstnameInitial', 'S').property('Lastname', 'Smith').property('LastnameInitial', 'S')

g.V().has('label', 'Person').has('Firstname', 'Sa').has('Lastname', 'Smit').fold().coalesce(
    unfold(),
    g.V().has('label', 'Person').has('FirstnameInitial', 'S').has('Lastname', 'Smit'),
    g.V().has('label', 'Person').has('Firstname', 'Sam').has('LastnameInitial', 'S'),
    g.V().has('label', 'Person').has('FirstnameInitial', 'S').has('LastnameInitial', 'S')
)

Coalesce , , , . , ( .fold(). Coalesce()) , ( unold() coalesce), , .

, . , , , "Lastname2Initials", "Lastname3Initials" ..

, , , !

0

Source: https://habr.com/ru/post/1690529/


All Articles