krotik / eliasdb

EliasDB a graph-based database.
Mozilla Public License 2.0
998 stars 49 forks source link

EQL: count func with a conditional? #15

Closed jimyx17 closed 5 years ago

jimyx17 commented 5 years ago

Hi Krotik

Don't really know if this is supported right now, but I'd rally need to add a condition to the @count function in a conditional statement. For instance, with the dataset provided in the tutorial, let's try to get the stations that are in 2 or more lines whose names begin with D.

I was thinking in something like:

get Station where @count(:Connection::Line where Name beginswith D) > 1

Is there any possibility for this to be added to the EQL language?

Tahnks!

krotik commented 5 years ago

That's an interesting idea - let me think about it ...

krotik commented 5 years ago

Hey there,

I've implemented now the extension to the @count function. Since it is a function I have to put the condition as a string which is parsed during runtime. You can now write the following query on the tutorial data:

get Station where @count(:StationOnLine::Line, 'name beginswith C') > 1 show name

This should give the following result:

Name 1:n:name

Liverpool Street Notting Hill Gate

(The two stations where Central Line and Circle Line cross)

Let me know if this solves your problem...

jimyx17 commented 5 years ago

That actually works for me!!

Thanks!!!

krotik commented 5 years ago

Cool - I'll close this issue. Please reopen or create a new one if you have more suggestions.