You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by Gabriel Cardoso <ga...@corp.globo.com> on 2018/05/30 19:42:58 UTC

Help creating conditions and segments

Hello everyone,
I'm from Globo.com (same team as @diogo.munaro) and we're in the process of
knowing more about Unomi and its API. Currently we're running in our local
machines but we're already with some machines ready to deploy Unomi in our
QA environment.
I have some questions about the API and I would be really grateful if
someone could lend me a hand.
I'm trying to understand the flux to create a segment. Reading the api docs
(http://unomi.incubator.apache.org/rest-api-doc/index.html) I understood
that to create a Segment first I need to create a Condition. I see that
there is a "conditionEvaluator" and a "queryBuilder" as part of the
payload, but I don't really understand how to use it. Lurking in the github
repository I found these conditions (
https://github.com/apache/incubator-unomi/tree/unomi-root-1.2.0-incubating/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions)
made as plugins, and also I didn't understand how to use them.

tl;dr:
How do I create Conditions and how do I create a Segment based on those
previously created Conditions?
How do I use those conditions created as plugins as my ConditionType?

Is there any documentation regarding those topics? I would gladly read them
before asking for help again about those topics.

Thanks in advance,
-- 
Gabriel Cardoso
Profiling@BigData
Globo.com

Re: Help creating conditions and segments

Posted by Serge Huber <sh...@jahia.com>.
Hello Gabriel,

I'm glad that helped.

Don't hesitate to continue on this thread or you could start another one in
this mailing list, that's fine too.

Sharing here will also help others that are interested in the project. The
main objective is to help and develop the community around Apache Unomi.
This will help the product with its next step : graduation to a top-level
Apache project and getting out of the incubator.

Regards,
  Serge

Serge Huber
CTO & Co-Founder
T +41 22 361 3424
9 route des Jeunes | 1227 Acacias | Switzerland
jahia.com <http://www.jahia.com/>
SKYPE | LINKEDIN <https://www.linkedin.com/in/sergehuber> | TWITTER
<https://twitter.com/sergehuber> | VCARD
<http://www.jahia.com/vcard/HuberSerge.vcf>


> JOIN OUR COMMUNITY <http://www.jahia.com/> to evaluate, get trained and
to discover why Jahia is a leading User Experience Platform (UXP) for
Digital Transformation.

On Fri, Jun 1, 2018 at 10:33 PM, Gabriel Cardoso <
gabriel.cardoso@corp.globo.com> wrote:

> Hi Serge!
> Thank you so much for answering, with your help we were able to create some
> segments and test it out. Everything is running smoothly.
> I'll be creating more complex segments next week, if I have any questions
> that the documentation can't help me, should I send my questions in this
> thread?
>
> Thank you again,
>
>
> 2018-06-01 5:35 GMT-03:00 Serge Huber <sh...@jahia.com>:
>
> > Hello Gabriel,
> >
> > Thanks for reaching out on the mailing list and for working with Unomi.
> >
> > To create a segment you are right you need to setup some conditions on
> it.
> > Here is an example of a segment definition:
> >
> > {
> >   "metadata": {
> >     "id": "contacts",
> >     "name": "Contacts",
> >     "scope": "systemscope",
> >     "description": "You can customize the list below by editing the
> > contacts segment.",
> >     "readOnly":true
> >   },
> >   "condition": {
> >     "parameterValues": {
> >       "subConditions": [
> >         {
> >           "parameterValues": {
> >             "propertyName": "properties.email",
> >             "comparisonOperator": "exists"
> >           },
> >           "type": "profilePropertyCondition"
> >         },
> >         {
> >           "parameterValues": {
> >             "propertyName": "properties.phoneNumber",
> >             "comparisonOperator": "exists"
> >           },
> >           "type": "profilePropertyCondition"
> >         },
> >         {
> >           "parameterValues": {
> >             "propertyName": "properties.facebookId",
> >             "comparisonOperator": "exists"
> >           },
> >           "type": "profilePropertyCondition"
> >         },
> >         {
> >           "parameterValues": {
> >             "propertyName": "properties.twitterId",
> >             "comparisonOperator": "exists"
> >           },
> >           "type": "profilePropertyCondition"
> >         },
> >         {
> >           "parameterValues": {
> >             "propertyName": "properties.linkedInId",
> >             "comparisonOperator": "exists"
> >           },
> >           "type": "profilePropertyCondition"
> >         }
> >       ],
> >       "operator" : "or"
> >     },
> >     "type": "booleanCondition"
> >   }
> > }
> >
> >
> > In this example we define a contacts segment that checks if any of the
> > listed properties exist. We are using two condition types :
> > profilePropertyCondition and booleanCondition. These condition types are
> > defined here :
> >
> > https://github.com/apache/incubator-unomi/blob/master/
> > plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/
> > profilePropertyCondition.json
> >
> > and here :
> >
> > https://github.com/apache/incubator-unomi/blob/master/
> > plugins/baseplugin/src/main/resources/META-INF/cxs/
> > conditions/booleanCondition.json
> >
> > The evaluator if you are curious are actually OSGi service properties
> > registered using OSGi Blueprint. This makes it possible to develop new
> > custom condition evaluators if need be (although you can already do a lot
> > with the built-in ones). Here is the reference to the blueprint file that
> > registers those evaluators :
> >
> > https://github.com/apache/incubator-unomi/blob/master/
> > plugins/baseplugin/src/main/resources/OSGI-INF/blueprint/blueprint.xml
> >
> > I hope this answers your questions.
> >
> > Best regards,
> >   Serge...
> >
> > Serge Huber
> > CTO & Co-Founder
> > T +41 22 361 3424
> > 9 route des Jeunes | 1227 Acacias | Switzerland
> > jahia.com <http://www.jahia.com/>
> > SKYPE | LINKEDIN <https://www.linkedin.com/in/sergehuber> | TWITTER
> > <https://twitter.com/sergehuber> | VCARD
> > <http://www.jahia.com/vcard/HuberSerge.vcf>
> >
> >
> > > JOIN OUR COMMUNITY <http://www.jahia.com/> to evaluate, get trained
> and
> > to discover why Jahia is a leading User Experience Platform (UXP) for
> > Digital Transformation.
> >
> > On Wed, May 30, 2018 at 9:42 PM, Gabriel Cardoso <
> > gabriel.cardoso@corp.globo.com> wrote:
> >
> > > Hello everyone,
> > > I'm from Globo.com (same team as @diogo.munaro) and we're in the
> process
> > of
> > > knowing more about Unomi and its API. Currently we're running in our
> > local
> > > machines but we're already with some machines ready to deploy Unomi in
> > our
> > > QA environment.
> > > I have some questions about the API and I would be really grateful if
> > > someone could lend me a hand.
> > > I'm trying to understand the flux to create a segment. Reading the api
> > docs
> > > (http://unomi.incubator.apache.org/rest-api-doc/index.html) I
> understood
> > > that to create a Segment first I need to create a Condition. I see that
> > > there is a "conditionEvaluator" and a "queryBuilder" as part of the
> > > payload, but I don't really understand how to use it. Lurking in the
> > github
> > > repository I found these conditions (
> > > https://github.com/apache/incubator-unomi/tree/unomi-
> > > root-1.2.0-incubating/plugins/baseplugin/src/main/java/org/
> > > apache/unomi/plugins/baseplugin/conditions)
> > > made as plugins, and also I didn't understand how to use them.
> > >
> > > tl;dr:
> > > How do I create Conditions and how do I create a Segment based on those
> > > previously created Conditions?
> > > How do I use those conditions created as plugins as my ConditionType?
> > >
> > > Is there any documentation regarding those topics? I would gladly read
> > them
> > > before asking for help again about those topics.
> > >
> > > Thanks in advance,
> > > --
> > > Gabriel Cardoso
> > > Profiling@BigData
> > > Globo.com
> > >
> >
>
>
>
> --
> Gabriel Cardoso
> Ramal 6584 - (21) 96601-4664
> Profiling@BigData
>

Re: Help creating conditions and segments

Posted by Diogo Munaro Vieira <di...@corp.globo.com>.
Do I need to create properties first?

What the need for profile properties creation?


Em sex, 1 de jun de 2018 às 17:34, Gabriel Cardoso <
gabriel.cardoso@corp.globo.com> escreveu:

> Hi Serge!
> Thank you so much for answering, with your help we were able to create some
> segments and test it out. Everything is running smoothly.
> I'll be creating more complex segments next week, if I have any questions
> that the documentation can't help me, should I send my questions in this
> thread?
>
> Thank you again,
>
>
> 2018-06-01 5:35 GMT-03:00 Serge Huber <sh...@jahia.com>:
>
> > Hello Gabriel,
> >
> > Thanks for reaching out on the mailing list and for working with Unomi.
> >
> > To create a segment you are right you need to setup some conditions on
> it.
> > Here is an example of a segment definition:
> >
> > {
> >   "metadata": {
> >     "id": "contacts",
> >     "name": "Contacts",
> >     "scope": "systemscope",
> >     "description": "You can customize the list below by editing the
> > contacts segment.",
> >     "readOnly":true
> >   },
> >   "condition": {
> >     "parameterValues": {
> >       "subConditions": [
> >         {
> >           "parameterValues": {
> >             "propertyName": "properties.email",
> >             "comparisonOperator": "exists"
> >           },
> >           "type": "profilePropertyCondition"
> >         },
> >         {
> >           "parameterValues": {
> >             "propertyName": "properties.phoneNumber",
> >             "comparisonOperator": "exists"
> >           },
> >           "type": "profilePropertyCondition"
> >         },
> >         {
> >           "parameterValues": {
> >             "propertyName": "properties.facebookId",
> >             "comparisonOperator": "exists"
> >           },
> >           "type": "profilePropertyCondition"
> >         },
> >         {
> >           "parameterValues": {
> >             "propertyName": "properties.twitterId",
> >             "comparisonOperator": "exists"
> >           },
> >           "type": "profilePropertyCondition"
> >         },
> >         {
> >           "parameterValues": {
> >             "propertyName": "properties.linkedInId",
> >             "comparisonOperator": "exists"
> >           },
> >           "type": "profilePropertyCondition"
> >         }
> >       ],
> >       "operator" : "or"
> >     },
> >     "type": "booleanCondition"
> >   }
> > }
> >
> >
> > In this example we define a contacts segment that checks if any of the
> > listed properties exist. We are using two condition types :
> > profilePropertyCondition and booleanCondition. These condition types are
> > defined here :
> >
> > https://github.com/apache/incubator-unomi/blob/master/
> > plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/
> > profilePropertyCondition.json
> >
> > and here :
> >
> > https://github.com/apache/incubator-unomi/blob/master/
> > plugins/baseplugin/src/main/resources/META-INF/cxs/
> > conditions/booleanCondition.json
> >
> > The evaluator if you are curious are actually OSGi service properties
> > registered using OSGi Blueprint. This makes it possible to develop new
> > custom condition evaluators if need be (although you can already do a lot
> > with the built-in ones). Here is the reference to the blueprint file that
> > registers those evaluators :
> >
> > https://github.com/apache/incubator-unomi/blob/master/
> > plugins/baseplugin/src/main/resources/OSGI-INF/blueprint/blueprint.xml
> >
> > I hope this answers your questions.
> >
> > Best regards,
> >   Serge...
> >
> > Serge Huber
> > CTO & Co-Founder
> > T +41 22 361 3424
> > 9 route des Jeunes | 1227 Acacias | Switzerland
> > jahia.com <http://www.jahia.com/>
> > SKYPE | LINKEDIN <https://www.linkedin.com/in/sergehuber> | TWITTER
> > <https://twitter.com/sergehuber> | VCARD
> > <http://www.jahia.com/vcard/HuberSerge.vcf>
> >
> >
> > > JOIN OUR COMMUNITY <http://www.jahia.com/> to evaluate, get trained
> and
> > to discover why Jahia is a leading User Experience Platform (UXP) for
> > Digital Transformation.
> >
> > On Wed, May 30, 2018 at 9:42 PM, Gabriel Cardoso <
> > gabriel.cardoso@corp.globo.com> wrote:
> >
> > > Hello everyone,
> > > I'm from Globo.com (same team as @diogo.munaro) and we're in the
> process
> > of
> > > knowing more about Unomi and its API. Currently we're running in our
> > local
> > > machines but we're already with some machines ready to deploy Unomi in
> > our
> > > QA environment.
> > > I have some questions about the API and I would be really grateful if
> > > someone could lend me a hand.
> > > I'm trying to understand the flux to create a segment. Reading the api
> > docs
> > > (http://unomi.incubator.apache.org/rest-api-doc/index.html) I
> understood
> > > that to create a Segment first I need to create a Condition. I see that
> > > there is a "conditionEvaluator" and a "queryBuilder" as part of the
> > > payload, but I don't really understand how to use it. Lurking in the
> > github
> > > repository I found these conditions (
> > > https://github.com/apache/incubator-unomi/tree/unomi-
> > > root-1.2.0-incubating/plugins/baseplugin/src/main/java/org/
> > > apache/unomi/plugins/baseplugin/conditions)
> > > made as plugins, and also I didn't understand how to use them.
> > >
> > > tl;dr:
> > > How do I create Conditions and how do I create a Segment based on those
> > > previously created Conditions?
> > > How do I use those conditions created as plugins as my ConditionType?
> > >
> > > Is there any documentation regarding those topics? I would gladly read
> > them
> > > before asking for help again about those topics.
> > >
> > > Thanks in advance,
> > > --
> > > Gabriel Cardoso
> > > Profiling@BigData
> > > Globo.com
> > >
> >
>
>
>
> --
> Gabriel Cardoso
> Ramal 6584 - (21) 96601-4664
> Profiling@BigData
>


-- 
Diogo Munaro Vieira

-------
Big Data
Ramal: 6866

http://diogomunaro.com
(21) 98656-0745

Re: Help creating conditions and segments

Posted by Gabriel Cardoso <ga...@corp.globo.com>.
Hi Serge!
Thank you so much for answering, with your help we were able to create some
segments and test it out. Everything is running smoothly.
I'll be creating more complex segments next week, if I have any questions
that the documentation can't help me, should I send my questions in this
thread?

Thank you again,


2018-06-01 5:35 GMT-03:00 Serge Huber <sh...@jahia.com>:

> Hello Gabriel,
>
> Thanks for reaching out on the mailing list and for working with Unomi.
>
> To create a segment you are right you need to setup some conditions on it.
> Here is an example of a segment definition:
>
> {
>   "metadata": {
>     "id": "contacts",
>     "name": "Contacts",
>     "scope": "systemscope",
>     "description": "You can customize the list below by editing the
> contacts segment.",
>     "readOnly":true
>   },
>   "condition": {
>     "parameterValues": {
>       "subConditions": [
>         {
>           "parameterValues": {
>             "propertyName": "properties.email",
>             "comparisonOperator": "exists"
>           },
>           "type": "profilePropertyCondition"
>         },
>         {
>           "parameterValues": {
>             "propertyName": "properties.phoneNumber",
>             "comparisonOperator": "exists"
>           },
>           "type": "profilePropertyCondition"
>         },
>         {
>           "parameterValues": {
>             "propertyName": "properties.facebookId",
>             "comparisonOperator": "exists"
>           },
>           "type": "profilePropertyCondition"
>         },
>         {
>           "parameterValues": {
>             "propertyName": "properties.twitterId",
>             "comparisonOperator": "exists"
>           },
>           "type": "profilePropertyCondition"
>         },
>         {
>           "parameterValues": {
>             "propertyName": "properties.linkedInId",
>             "comparisonOperator": "exists"
>           },
>           "type": "profilePropertyCondition"
>         }
>       ],
>       "operator" : "or"
>     },
>     "type": "booleanCondition"
>   }
> }
>
>
> In this example we define a contacts segment that checks if any of the
> listed properties exist. We are using two condition types :
> profilePropertyCondition and booleanCondition. These condition types are
> defined here :
>
> https://github.com/apache/incubator-unomi/blob/master/
> plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/
> profilePropertyCondition.json
>
> and here :
>
> https://github.com/apache/incubator-unomi/blob/master/
> plugins/baseplugin/src/main/resources/META-INF/cxs/
> conditions/booleanCondition.json
>
> The evaluator if you are curious are actually OSGi service properties
> registered using OSGi Blueprint. This makes it possible to develop new
> custom condition evaluators if need be (although you can already do a lot
> with the built-in ones). Here is the reference to the blueprint file that
> registers those evaluators :
>
> https://github.com/apache/incubator-unomi/blob/master/
> plugins/baseplugin/src/main/resources/OSGI-INF/blueprint/blueprint.xml
>
> I hope this answers your questions.
>
> Best regards,
>   Serge...
>
> Serge Huber
> CTO & Co-Founder
> T +41 22 361 3424
> 9 route des Jeunes | 1227 Acacias | Switzerland
> jahia.com <http://www.jahia.com/>
> SKYPE | LINKEDIN <https://www.linkedin.com/in/sergehuber> | TWITTER
> <https://twitter.com/sergehuber> | VCARD
> <http://www.jahia.com/vcard/HuberSerge.vcf>
>
>
> > JOIN OUR COMMUNITY <http://www.jahia.com/> to evaluate, get trained and
> to discover why Jahia is a leading User Experience Platform (UXP) for
> Digital Transformation.
>
> On Wed, May 30, 2018 at 9:42 PM, Gabriel Cardoso <
> gabriel.cardoso@corp.globo.com> wrote:
>
> > Hello everyone,
> > I'm from Globo.com (same team as @diogo.munaro) and we're in the process
> of
> > knowing more about Unomi and its API. Currently we're running in our
> local
> > machines but we're already with some machines ready to deploy Unomi in
> our
> > QA environment.
> > I have some questions about the API and I would be really grateful if
> > someone could lend me a hand.
> > I'm trying to understand the flux to create a segment. Reading the api
> docs
> > (http://unomi.incubator.apache.org/rest-api-doc/index.html) I understood
> > that to create a Segment first I need to create a Condition. I see that
> > there is a "conditionEvaluator" and a "queryBuilder" as part of the
> > payload, but I don't really understand how to use it. Lurking in the
> github
> > repository I found these conditions (
> > https://github.com/apache/incubator-unomi/tree/unomi-
> > root-1.2.0-incubating/plugins/baseplugin/src/main/java/org/
> > apache/unomi/plugins/baseplugin/conditions)
> > made as plugins, and also I didn't understand how to use them.
> >
> > tl;dr:
> > How do I create Conditions and how do I create a Segment based on those
> > previously created Conditions?
> > How do I use those conditions created as plugins as my ConditionType?
> >
> > Is there any documentation regarding those topics? I would gladly read
> them
> > before asking for help again about those topics.
> >
> > Thanks in advance,
> > --
> > Gabriel Cardoso
> > Profiling@BigData
> > Globo.com
> >
>



-- 
Gabriel Cardoso
Ramal 6584 - (21) 96601-4664
Profiling@BigData

Re: Help creating conditions and segments

Posted by Serge Huber <sh...@jahia.com>.
Hello Gabriel,

Thanks for reaching out on the mailing list and for working with Unomi.

To create a segment you are right you need to setup some conditions on it.
Here is an example of a segment definition:

{
  "metadata": {
    "id": "contacts",
    "name": "Contacts",
    "scope": "systemscope",
    "description": "You can customize the list below by editing the
contacts segment.",
    "readOnly":true
  },
  "condition": {
    "parameterValues": {
      "subConditions": [
        {
          "parameterValues": {
            "propertyName": "properties.email",
            "comparisonOperator": "exists"
          },
          "type": "profilePropertyCondition"
        },
        {
          "parameterValues": {
            "propertyName": "properties.phoneNumber",
            "comparisonOperator": "exists"
          },
          "type": "profilePropertyCondition"
        },
        {
          "parameterValues": {
            "propertyName": "properties.facebookId",
            "comparisonOperator": "exists"
          },
          "type": "profilePropertyCondition"
        },
        {
          "parameterValues": {
            "propertyName": "properties.twitterId",
            "comparisonOperator": "exists"
          },
          "type": "profilePropertyCondition"
        },
        {
          "parameterValues": {
            "propertyName": "properties.linkedInId",
            "comparisonOperator": "exists"
          },
          "type": "profilePropertyCondition"
        }
      ],
      "operator" : "or"
    },
    "type": "booleanCondition"
  }
}


In this example we define a contacts segment that checks if any of the
listed properties exist. We are using two condition types :
profilePropertyCondition and booleanCondition. These condition types are
defined here :

https://github.com/apache/incubator-unomi/blob/master/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/profilePropertyCondition.json

and here :

https://github.com/apache/incubator-unomi/blob/master/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/booleanCondition.json

The evaluator if you are curious are actually OSGi service properties
registered using OSGi Blueprint. This makes it possible to develop new
custom condition evaluators if need be (although you can already do a lot
with the built-in ones). Here is the reference to the blueprint file that
registers those evaluators :

https://github.com/apache/incubator-unomi/blob/master/plugins/baseplugin/src/main/resources/OSGI-INF/blueprint/blueprint.xml

I hope this answers your questions.

Best regards,
  Serge...

Serge Huber
CTO & Co-Founder
T +41 22 361 3424
9 route des Jeunes | 1227 Acacias | Switzerland
jahia.com <http://www.jahia.com/>
SKYPE | LINKEDIN <https://www.linkedin.com/in/sergehuber> | TWITTER
<https://twitter.com/sergehuber> | VCARD
<http://www.jahia.com/vcard/HuberSerge.vcf>


> JOIN OUR COMMUNITY <http://www.jahia.com/> to evaluate, get trained and
to discover why Jahia is a leading User Experience Platform (UXP) for
Digital Transformation.

On Wed, May 30, 2018 at 9:42 PM, Gabriel Cardoso <
gabriel.cardoso@corp.globo.com> wrote:

> Hello everyone,
> I'm from Globo.com (same team as @diogo.munaro) and we're in the process of
> knowing more about Unomi and its API. Currently we're running in our local
> machines but we're already with some machines ready to deploy Unomi in our
> QA environment.
> I have some questions about the API and I would be really grateful if
> someone could lend me a hand.
> I'm trying to understand the flux to create a segment. Reading the api docs
> (http://unomi.incubator.apache.org/rest-api-doc/index.html) I understood
> that to create a Segment first I need to create a Condition. I see that
> there is a "conditionEvaluator" and a "queryBuilder" as part of the
> payload, but I don't really understand how to use it. Lurking in the github
> repository I found these conditions (
> https://github.com/apache/incubator-unomi/tree/unomi-
> root-1.2.0-incubating/plugins/baseplugin/src/main/java/org/
> apache/unomi/plugins/baseplugin/conditions)
> made as plugins, and also I didn't understand how to use them.
>
> tl;dr:
> How do I create Conditions and how do I create a Segment based on those
> previously created Conditions?
> How do I use those conditions created as plugins as my ConditionType?
>
> Is there any documentation regarding those topics? I would gladly read them
> before asking for help again about those topics.
>
> Thanks in advance,
> --
> Gabriel Cardoso
> Profiling@BigData
> Globo.com
>