unomi-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe K <risto.kowaczew...@gmail.com>
Subject Re: Unomi Query Language help?
Date Thu, 18 Mar 2021 13:50:27 GMT
Hi Serge,

Thank you for your prompt response.

I have another question? You mentioned GraphQL as a filtering system. Does
it mean that the current API will become obsolete with the next release of
Unomi.

Regards,
Risto


On Mon, 15 Mar 2021 at 15:54, Serge Huber <shuber@apache.org> wrote:

> Hello Joe,
>
> Thanks for sharing that with us! It looks really interesting. The Unomi UI
> for building conditions is a bit convoluted but it's because it was mostly
> designed to be consumed by machines to build UIs rather than for humans to
> directly write them. The new GraphQL filter system is however a bit closer
> to what you have built but I still really like your approach as it is close
> to SQL and therefore natural for people experienced with it.
>
> Concerning your questions
> 1. Actually this is something being worked on by some developers, but you
> are right it is not yet available.
> 2. The addValue has been added recently I believe in the
> setPropertyAction. You need to use property set "strategies" with a
> "setPropertyStrategy" parameter on the action with the value "addValue"
> 3. The remove value from a list property has not yet been implemented and
> I believe it should be.
> 4. Set property to true/false is possible but it requires using a
> "setPropertyValueBoolean" instead of a "setPropertyValue" parameter.
> 5. Removing a property can be achieved using the "remove" strategy instead
> of the "addValue" in answer 2.
>
> You can find the logic behind the setPropertyAction here:
> https://github.com/apache/unomi/blob/master/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/actions/SetPropertyAction.java
>
> For sending to webhooks or Kafka we don't have that (yet) in the project
> but it really should be something easy to do in a custom action (in a
> custom plugin). But this would require some knowledge of Java.
> It would also make a very nice contribution to the project because I think
> a lot of people would be interested in such actions.
>
> Regards,
>   Serge...
>
> On Fri, Mar 12, 2021 at 3:31 PM Joe K <risto.kowaczewski@gmail.com> wrote:
>
>> Hello everyone.
>>
>> I am trying to use unomi as part of my project and during my work with
>> Unomi I found that it has a shallow learning curve (at least for me) due to
>> quite complex API.
>>
>> Therefore I committed some time to write open-sourced Unomi Query
>> Language(UQL) that would ease the management of Unomi (
>> https://github.com/atompie/unomi-query-language). The language itself is
>> very similar to SQL. An example CREATE RULE statement looks like this:
>>
>> CREATE RULE
>>
>>    "if identify event then copy event properties to profile"
>>
>>    DESCRIBE "Copies user data from events target properties to profile"
>>
>>    IN SCOPE "my-site"
>>
>>    WHEN event:type="identify" AND event:scope = "my-site"
>>
>>    THEN CopyEventsToProfileProperties()
>>
>> It connects to Unomi API (cxs/rules/) and performs:
>>
>> {'actions': [{'parameterValues': {},
>>
>>                'type': 'allEventToProfilePropertiesAction'}],
>>
>>   'condition': {'parameterValues': {'operator': 'and',
>>
>>                                     'subConditions':
>> [{'parameterValues': {'comparisonOperator': 'equals',
>>
>>
>> 'propertyName': 'eventType',
>>
>>
>> 'propertyValue': 'identify'},
>>
>>                                                        'type':
>> 'eventPropertyCondition'},
>>
>>                                                       {'parameterValues':
>> {'comparisonOperator': 'equals',
>>
>>
>> 'propertyName': 'scope',
>>
>>
>> 'propertyValue': 'my-site'},
>>
>>                                                        'type':
>> 'eventPropertyCondition'}]},
>>
>>                 'type': 'booleanCondition'},
>>
>>   'itemId': 'if-identify-event-then-copy-event-properties-to-profile',
>>
>>   'itemType': 'rule',
>>
>>   'metadata': {'description': 'Copies user data from events target
>> properties '
>>
>>                               'to profile',
>>
>>                'enabled': True,
>>
>>                'hidden': False,
>>
>>                'id':
>> 'if-identify-event-then-copy-event-properties-to-profile',
>>
>>                'missingPlugins': False,
>>
>>                'name': 'if identify event then copy event properties to '
>>
>>                        'profile',
>>
>>                'readOnly': False,
>>
>>                'scope': 'my-site',
>>
>>                'tags': []},
>>
>>   'priority': -1,
>>
>>   'raiseEventOnlyOnceForProfile': False,
>>
>>   'raiseEventOnlyOnceForSession': False}
>>
>> UQL just maps simplified queries to API call.
>>
>> I would like to further develop this language but I came to some issues
>> with the documentation that stopped me from doing this.
>>
>> I could not find a full list of available booleanCondition operators:
>>
>> This is what I gathered reading different unomi articles:
>>
>> * exists
>>
>> * between
>>
>> * equals
>>
>> * notEquals
>>
>> * greaterThanOrEqualTo
>>
>> * lessThanOrEqualTo
>>
>> * greaterThan
>>
>> * lessThan
>>
>> * missing
>>
>> * contains
>>
>> I could not find any this on IS NULL, NOT CONTAINS, IS TRUE/FALSE
>>
>> Furthermore I am having difficulties to find base property actions.I
>> found some examples on how to set profile properties but that's it. I could
>> not find examples of actions that would perform some core operations, such
>> as:
>>
>>
>>    -
>>
>>    increment a profile property.
>>    -
>>
>>    append value to property (given the property is of type list)
>>    -
>>
>>    remove value to property (given the property is of type list)
>>    -
>>
>>    set property to true/false
>>    -
>>
>>    remove property
>>
>>
>> Could you point me to the place where I could find such information or
>> give me an example of API calls that would do the above actions?
>>
>> Furthermore are there any actions that perform requests to webhooks or
>> pass profiles to kafka?
>>
>> Thanks in advance for your reply
>>
>>
>> ---
>>
>> Risto
>>
>

Mime
View raw message