Uploaded image for project: 'TinkerPop'
  1. TinkerPop
  2. TINKERPOP-2652

Add TextP.regex to the text predicate set

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Done
    • 3.6.0
    • 3.6.0
    • process
    • None

    Description

      We have over the years, going back to a discussion thread from January 2018 https://lists.apache.org/thread/r76r47jjxmomz9hvsx96www6r8qnh60t had discussions of various text predicates that Gremlin lacks but are commonly found in other query languages such as SPARQL and Cypher. We currently have some TextP predicates, but not a specific regex one. I propose we add TextP.regex and for the reference implementation leverage the Java Pattern and Matcher classes. It may be that other implementations will choose to use a different REGEX engine but at least this will get the support into the Gremlin language. As a first pass, I envision this can be something quite simple along these lines (from a small prototype I put together).

       

               \,,,/
               (o o)
      -----oOOo-(3)-oOOo-----
      plugin activated: tinkerpop.server
      plugin activated: tinkerpop.utilities
      plugin activated: tinkerpop.tinkergraph
      gremlin> g=traversal().withGraph(TinkerGraph.open())
      ==>graphtraversalsource[tinkergraph[vertices:0 edges:0], standard]
      gremlin> g.addV('test').property('k1','I like llamas')
      ==>v[0]
      gremlin> g.V().has('k1',TextP.regex("l[i|x]ke"))
      ==>v[0]
      
      gremlin> g.V().has('city',TextP.regex("^Dallas"))                                           
      ==>v[8]                                                                                     
      ==>v[186] 

      Attachments

        Activity

          People

            gfxman Kelvin R. Lawrence
            krlawrence Kelvin Lawrence
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: