Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsParse an OCL String without any Kind Information
https://www.eclipse.org/forums/index.php/mv/msg/166490/527776/#msg_527776
Originally posted by: philipp.berger.student.hpi.uni-potsdam.de
Hey guys,
I currently working with ecore.OCL and I want to traverse and use an AST
of an OCLExpression. My problem is, that any helper I found require a
ConstraintKind.
Is there any possibility to convert a given String to an OCLExpression
without any Kind information?
Where can I locate such a parsing method?
Currently I just assume that myExpression is an Invariant (it can be
everything, post/body/init/def)
Can I assume that no matter which Kind I give the returned expression
spans the same AST?
Regards,
Phil]]>2010-04-16T12:50:44-00:00Re: Parse an OCL String without any Kind Information
https://www.eclipse.org/forums/index.php/mv/msg/166490/527778/#msg_527778
An invariant is supposed to be Boolean valued, so if you do too much
something may complain that your AST is not Boolean.
Is there any reason why you don't just use createQuery(String) ?
Regards
Ed Willink
On 16/04/2010 13:50, Philipp Berger wrote:
> Hey guys,
> I currently working with ecore.OCL and I want to traverse and use an AST
> of an OCLExpression. My problem is, that any helper I found require a
> ConstraintKind.
> Is there any possibility to convert a given String to an OCLExpression
> without any Kind information?
> Where can I locate such a parsing method?
>
> Currently I just assume that myExpression is an Invariant (it can be
> everything, post/body/init/def)
>
> OCL ocl = org.eclipse.ocl.ecore.OCL.newInstance();
> Helper helper = ocl.createOCLHelper();
> OCLExpression<EClassifier>
> myExpression=helper.createConstraint(ConstraintKind.INVARIAN T,
> myExpressionAsString).getSpecification().getBodyExpression() ;
>
> Can I assume that no matter which Kind I give the returned expression
> spans the same AST?
>
> Regards,
> Phil]]>Ed Willink2010-04-16T12:56:43-00:00Re: Parse an OCL String without any Kind Information
https://www.eclipse.org/forums/index.php/mv/msg/166490/527792/#msg_527792
Originally posted by: philipp.berger.student.hpi.uni-potsdam.de
Hey Ed,
actually, there is no reason...
I beg your pardon, but I overlooked this method.
Thanks
Am 16.04.2010 14:56, schrieb Ed Willink:
> Hi Philipp
>
> An invariant is supposed to be Boolean valued, so if you do too much
> something may complain that your AST is not Boolean.
>
> Is there any reason why you don't just use createQuery(String) ?
>
> Regards
>
> Ed Willink
>
> On 16/04/2010 13:50, Philipp Berger wrote:
>> Hey guys,
>> I currently working with ecore.OCL and I want to traverse and use an AST
>> of an OCLExpression. My problem is, that any helper I found require a
>> ConstraintKind.
>> Is there any possibility to convert a given String to an OCLExpression
>> without any Kind information?
>> Where can I locate such a parsing method?
>>
>> Currently I just assume that myExpression is an Invariant (it can be
>> everything, post/body/init/def)
>>
>> OCL ocl = org.eclipse.ocl.ecore.OCL.newInstance();
>> Helper helper = ocl.createOCLHelper();
>> OCLExpression<EClassifier>
>> myExpression=helper.createConstraint(ConstraintKind.INVARIAN T,
>> myExpressionAsString).getSpecification().getBodyExpression() ;
>>
>> Can I assume that no matter which Kind I give the returned expression
>> spans the same AST?
>>
>> Regards,
>> Phil
>]]>2010-04-16T13:08:08-00:00