Home » Eclipse Projects » Sirius » Validate element name
|
Re: Validate element name [message #1699291 is a reply to message #1699287] |
Tue, 23 June 2015 09:14 |
|
Hello,
You can find a section about Sirius Validation rules [1] on the online
documentation.
Regards,
Steve
[1]
https://www.eclipse.org/sirius/doc/specifier/diagrams/Diagrams.html#validation
Le 23/06/2015 11:06, Tuan Hoang Anh a écrit :
> Hi all,
>
> I'd like to add a new Validation Rule to validate the Element name that
> created by user.
> At the moment, Sirius accepts all name from user, but I want to set some
> Validation Rule for it, such as: no space, no special characters as
> brackets, dollar, etc.
>
> Could anyone send me the guide or example for the Sirius Validation rules?
>
> Thanks and BRs,
> Tuan Hoang
--
Steve Monnier - Obeo
Need professional services for Sirius?
http://www.obeodesigner.com/sirius
Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
Re: Validate element name [message #1699716 is a reply to message #1699291] |
Fri, 26 June 2015 06:57 |
Tuan Hoang Anh Messages: 42 Registered: May 2015 |
Member |
|
|
Steve Monnier wrote on Tue, 23 June 2015 09:14Hello,
You can find a section about Sirius Validation rules [1] on the online
documentation.
Regards,
Steve
[1]
https://www.eclipse.org/sirius/doc/specifier/diagrams/Diagrams.html#validation
Le 23/06/2015 11:06, Tuan Hoang Anh a écrit :
> Hi all,
>
> I'd like to add a new Validation Rule to validate the Element name that
> created by user.
> At the moment, Sirius accepts all name from user, but I want to set some
> Validation Rule for it, such as: no space, no special characters as
> brackets, dollar, etc.
>
> Could anyone send me the guide or example for the Sirius Validation rules?
>
> Thanks and BRs,
> Tuan Hoang
--
Steve Monnier - Obeo
Need professional services for Sirius?
http://www.obeodesigner.com/sirius
Hi Steve,
Thank you for your instruction.
I read the Sirius Validation rule, but I'm wondering about the Audit Expression.
For example, I created a new Semantic Validation Rule, Level Error, and the Target Class is "uml.NamedElement".
Could you please tell me which Audit Expression I have to write to have the Validation Rule: check name with no space, no special characters as brackets, dollar, etc?
Thanks and BRs,
Tuan Hoang
|
|
|
Re: Validate element name [message #1699728 is a reply to message #1699716] |
Fri, 26 June 2015 08:28 |
|
Hello,
You should use the acceleo operation "matches" [1] that validates if a
string matches a regular expression pattern (here name with no space, no
special characters as brackets, dollar, etc).
Regards,
Steve Monnier
[1]
https://wiki.eclipse.org/Acceleo/Acceleo_Operations_Reference#matches_.28String_regex.29_:_Boolean
Le 26/06/2015 08:57, Tuan Hoang Anh a écrit :
> Steve Monnier wrote on Tue, 23 June 2015 09:14
>> Hello,
>>
>> You can find a section about Sirius Validation rules [1] on the online
>> documentation.
>>
>> Regards,
>> Steve
>>
>> [1]
>> https://www.eclipse.org/sirius/doc/specifier/diagrams/Diagrams.html#validation
>>
>>
>> Le 23/06/2015 11:06, Tuan Hoang Anh a écrit :
>> > Hi all,
>> >
>> > I'd like to add a new Validation Rule to validate the Element name that
>> > created by user.
>> > At the moment, Sirius accepts all name from user, but I want to set
>> some
>> > Validation Rule for it, such as: no space, no special characters as
>> > brackets, dollar, etc.
>> >
>> > Could anyone send me the guide or example for the Sirius Validation
>> rules?
>> >
>> > Thanks and BRs,
>> > Tuan Hoang
>>
>>
>> --
>> Steve Monnier - Obeo
>>
>> Need professional services for Sirius?
>> http://www.obeodesigner.com/sirius
>
>
> Hi Steve,
>
> Thank you for your instruction.
> I read the Sirius Validation rule, but I'm wondering about the Audit
> Expression.
> For example, I created a new Semantic Validation Rule, Level Error, and
> the Target Class is "uml.NamedElement".
>
> Could you please tell me which Audit Expression I have to write to have
> the Validation Rule: check name with no space, no special characters as
> brackets, dollar, etc?
>
> Thanks and BRs,
> Tuan Hoang
--
Steve Monnier - Obeo
Need professional services for Sirius?
http://www.obeodesigner.com/sirius
Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
Re: Validate element name [message #1699741 is a reply to message #1699728] |
Fri, 26 June 2015 10:30 |
Tuan Hoang Anh Messages: 42 Registered: May 2015 |
Member |
|
|
Steve Monnier wrote on Fri, 26 June 2015 08:28Hello,
You should use the acceleo operation "matches" [1] that validates if a
string matches a regular expression pattern (here name with no space, no
special characters as brackets, dollar, etc).
Regards,
Steve Monnier
[1]
https://wiki.eclipse.org/Acceleo/Acceleo_Operations_Reference#matches_.28String_regex.29_:_Boolean
Le 26/06/2015 08:57, Tuan Hoang Anh a écrit :
> Steve Monnier wrote on Tue, 23 June 2015 09:14
>> Hello,
>>
>> You can find a section about Sirius Validation rules [1] on the online
>> documentation.
>>
>> Regards,
>> Steve
>>
>> [1]
>> https://www.eclipse.org/sirius/doc/specifier/diagrams/Diagrams.html#validation
>>
>>
>> Le 23/06/2015 11:06, Tuan Hoang Anh a écrit :
>> > Hi all,
>> >
>> > I'd like to add a new Validation Rule to validate the Element name that
>> > created by user.
>> > At the moment, Sirius accepts all name from user, but I want to set
>> some
>> > Validation Rule for it, such as: no space, no special characters as
>> > brackets, dollar, etc.
>> >
>> > Could anyone send me the guide or example for the Sirius Validation
>> rules?
>> >
>> > Thanks and BRs,
>> > Tuan Hoang
>>
>>
>> --
>> Steve Monnier - Obeo
>>
>> Need professional services for Sirius?
>> http://www.obeodesigner.com/sirius
>
>
> Hi Steve,
>
> Thank you for your instruction.
> I read the Sirius Validation rule, but I'm wondering about the Audit
> Expression.
> For example, I created a new Semantic Validation Rule, Level Error, and
> the Target Class is "uml.NamedElement".
>
> Could you please tell me which Audit Expression I have to write to have
> the Validation Rule: check name with no space, no special characters as
> brackets, dollar, etc?
>
> Thanks and BRs,
> Tuan Hoang
--
Steve Monnier - Obeo
Need professional services for Sirius?
http://www.obeodesigner.com/sirius
Hi Steve,
Thank you so much for your support.
I could validate the name as my need follow your instruction.
But now, I want to validate the unique of element name. Each element must have an unique name. There are no two-elements which have the same name.
Do you have any suggestions for me?
Thanks and BRs,
Tuan Hoang
|
|
|
Re: Validate element name [message #1699908 is a reply to message #1699741] |
Mon, 29 June 2015 08:34 |
|
Hello,
Well I do not know how is made your metamodel, but if you do not have a
map/cache of the element to have a unique name, you will have to browse
your semantic model to find these elements and validate that there are
no duplicate name. Depending on your metamodel, this can be easier to be
done as a java service.
Regards,
Steve
Le 26/06/2015 12:30, Tuan Hoang Anh a écrit :
> Steve Monnier wrote on Fri, 26 June 2015 08:28
>> Hello,
>>
>> You should use the acceleo operation "matches" [1] that validates if a
>> string matches a regular expression pattern (here name with no space,
>> no special characters as brackets, dollar, etc).
>>
>> Regards,
>> Steve Monnier
>>
>> [1]
>> https://wiki.eclipse.org/Acceleo/Acceleo_Operations_Reference#matches_.28String_regex.29_:_Boolean
>>
>>
>> Le 26/06/2015 08:57, Tuan Hoang Anh a écrit :
>> > Steve Monnier wrote on Tue, 23 June 2015 09:14
>> >> Hello,
>> >>
>> >> You can find a section about Sirius Validation rules [1] on the online
>> >> documentation.
>> >>
>> >> Regards,
>> >> Steve
>> >>
>> >> [1]
>> >>
>> https://www.eclipse.org/sirius/doc/specifier/diagrams/Diagrams.html#validation
>>
>> >>
>> >>
>> >> Le 23/06/2015 11:06, Tuan Hoang Anh a écrit :
>> >> > Hi all,
>> >> >
>> >> > I'd like to add a new Validation Rule to validate the Element
>> name that
>> >> > created by user.
>> >> > At the moment, Sirius accepts all name from user, but I want to set
>> >> some
>> >> > Validation Rule for it, such as: no space, no special characters as
>> >> > brackets, dollar, etc.
>> >> >
>> >> > Could anyone send me the guide or example for the Sirius Validation
>> >> rules?
>> >> >
>> >> > Thanks and BRs,
>> >> > Tuan Hoang
>> >>
>> >>
>> >> --
>> >> Steve Monnier - Obeo
>> >>
>> >> Need professional services for Sirius?
>> >> http://www.obeodesigner.com/sirius
>> >
>> >
>> > Hi Steve,
>> >
>> > Thank you for your instruction.
>> > I read the Sirius Validation rule, but I'm wondering about the Audit
>> > Expression.
>> > For example, I created a new Semantic Validation Rule, Level Error, and
>> > the Target Class is "uml.NamedElement".
>> >
>> > Could you please tell me which Audit Expression I have to write to have
>> > the Validation Rule: check name with no space, no special characters as
>> > brackets, dollar, etc?
>> >
>> > Thanks and BRs,
>> > Tuan Hoang
>>
>>
>> --
>> Steve Monnier - Obeo
>>
>> Need professional services for Sirius?
>> http://www.obeodesigner.com/sirius
>
> Hi Steve,
>
> Thank you so much for your support.
> I could validate the name as my need follow your instruction.
> But now, I want to validate the unique of element name. Each element
> must have an unique name. There are no two-elements which have the same
> name.
>
> Do you have any suggestions for me?
>
> Thanks and BRs,
> Tuan Hoang
--
Steve Monnier - Obeo
Need professional services for Sirius?
http://www.obeodesigner.com/sirius
Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
Re: Validate element name [message #1699914 is a reply to message #1699908] |
Mon, 29 June 2015 09:08 |
Tuan Hoang Anh Messages: 42 Registered: May 2015 |
Member |
|
|
Hi Steve,
I am trying to validate the unique name of element in "basicfamily" example.
https://wiki.eclipse.org/Sirius/Tutorials/4MinTutorial
I could validate the name with the Audit "name.matches('[a-zA-Z0-9]+')". But I want to validate the unique of element name.
Could you please tell me how to use the java service to do it?
Thanks and BRs,
Tuan Hoang
Steve Monnier wrote on Mon, 29 June 2015 08:34Hello,
Well I do not know how is made your metamodel, but if you do not have a
map/cache of the element to have a unique name, you will have to browse
your semantic model to find these elements and validate that there are
no duplicate name. Depending on your metamodel, this can be easier to be
done as a java service.
Regards,
Steve
[Updated on: Mon, 29 June 2015 09:14] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Fri Apr 26 14:13:43 GMT 2024
Powered by FUDForum. Page generated in 0.03301 seconds
|