Characters (í, á, ã...) : Parser | Complete OCL | UML Models [message #992425] |
Fri, 21 December 2012 15:56 |
John Guerson Messages: 51 Registered: August 2011 |
Member |
|
|
Hi,
How the OCL libraries for UML and Ecore (i.e. org.eclipse.ocl and org.eclipse.ocl.uml) deal with package and classes names that have withespaces, and most importantly, have characters like "í", "á", "ã" , etc... ?
Related to the package hierarchy, it works ? For instance, writing something like
RootPackage::Package1::Package2::PAckage3::Class1 as a context, or package declaration... i have a parser error... I'm using the Complete OCL Editor with UML models. I know that the name are placed like this: _'ClassName'. But, i still got the parser errors that i mentioned.
I have seen that the 3.2 version (.ocl and .ocl.uml) does not work very well in this cases, also with the hierarchy packages.
Is there correct? And what about the new version of OCL like 4.0 and so on...
I need of this funcionality, i.e. dealing with this kind of caracters and names...
Thank you very much !
John
|
|
|
Re: Characters ( [message #992445 is a reply to message #992425] |
Fri, 21 December 2012 16:36 |
Ed Willink Messages: 7655 Registered: July 2009 |
Senior Member |
|
|
Hi
In principle non-ASCII characters are only an issue on input (parsing)
and output (code generation).
Up until OCL 2.3, OCL gave no clue as to how Unicode characters were
supported; they just were.
OCL 2.3 added an underscore-prefix string literal in which standard Java
backslash sequences (other than Octal) may be used; see the OCL spec on
StringLiteral in Clause 9.
This syntax has been supported by Eclipse OCL probably since Indigo;
certainly in Juno.
If you use non-ASCII characters you need to ensure that their encoding
is not corrupted; I recommend setting your project to UTF-8.
As to the parser errors, since you provide no detail or repro, I cannot
comment further.
Regards
Ed Willink
On 21/12/2012 15:56, John G. wrote:
> Hi,
>
> How the OCL libraries for UML and Ecore (i.e. org.eclipse.ocl and
> org.eclipse.ocl.uml) deal with package and classes names that have
> withespaces, and most importantly, have characters like "í", "á", "ã"
> , etc... ?
> Related to the package hierarchy, it works ? For instance, writing
> something like
> RootPackage::Package1::Package2::PAckage3::Class1 as a context, or
> package declaration... i have a parser error... I'm using the Complete
> OCL Editor with UML models. I know that the name are placed like this:
> _'ClassName'. But, i still got the parser errors that i mentioned.
>
> I have seen that the 3.2 version (.ocl and .ocl.uml) does not work
> very well in this cases, also with the hierarchy packages.
>
> Is there correct? And what about the new version of OCL like 4.0 and
> so on...
>
> I need of this funcionality, i.e. dealing with this kind of caracters
> and names...
>
> Thank you very much !
>
> John
>
|
|
|
Re: Characters ( [message #992463 is a reply to message #992445] |
Fri, 21 December 2012 17:49 |
John Guerson Messages: 51 Registered: August 2011 |
Member |
|
|
My constraint:
import 'platform:/resource/Myproject/model/teste.uml'
package EA_Model
context _'PessoaFísica'
inv teste: self.RG > 0
endpackage
I think that this error is due to the context _'PessoaFísica'
java.lang.IllegalArgumentException: The 'no null' constraint is violated
at org.eclipse.emf.common.util.AbstractEList.validate(AbstractEList.java:95)
at org.eclipse.emf.ecore.util.EcoreEList.validate(EcoreEList.java:63)
at org.eclipse.emf.common.util.BasicEList.addUnique(BasicEList.java:418)
at org.eclipse.emf.common.notify.impl.NotifyingListImpl.doAddUnique(NotifyingListImpl.java:325)
at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:282)
at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:301)
at org.eclipse.ocl.uml.internal.UMLReflectionImpl.addConstrainedElement(UMLReflectionImpl.java:523)
at org.eclipse.ocl.uml.internal.UMLReflectionImpl.addConstrainedElement(UMLReflectionImpl.java:1)
at org.eclipse.ocl.parser.AbstractOCLAnalyzer.invCS(AbstractOCLAnalyzer.java:1451)
at org.eclipse.ocl.parser.AbstractOCLAnalyzer.invOrDefCS(AbstractOCLAnalyzer.java:1419)
at org.eclipse.ocl.parser.AbstractOCLAnalyzer.classifierContextDeclCS(AbstractOCLAnalyzer.java:1371)
at org.eclipse.ocl.parser.AbstractOCLAnalyzer.contextDeclCS(AbstractOCLAnalyzer.java:777)
at org.eclipse.ocl.parser.AbstractOCLAnalyzer.packageDeclarationCS(AbstractOCLAnalyzer.java:736)
at org.eclipse.ocl.parser.AbstractOCLAnalyzer.packageDeclarationCS(AbstractOCLAnalyzer.java:752)
at org.eclipse.ocl.parser.AbstractOCLAnalyzer.documentCS(AbstractOCLAnalyzer.java:674)
at org.eclipse.ocl.parser.OCLAnalyzer.parseOCLDocument(OCLAnalyzer.java:215)
at org.eclipse.ocl.OCL.parse(OCL.java:305)
at br.ufes.inf.nemo.ocl2alloy.parser.OCLParser.<init>(OCLParser.java:151)
at br.ufes.inf.nemo.ocl2alloy.parser.OCLParser.main(OCLParser.java:196)
// this line was added due to a bug of Eclipse :
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=372258
Environment.Registry.INSTANCE.registerEnvironment(new UMLEnvironmentFactory().createEnvironment());
org.eclipse.uml2.uml.Package umlmodel = (org.eclipse.uml2.uml.Package) umlResource.getContents().get(0);
umlResource.getResourceSet().getPackageRegistry().put(null,umlmodel);
org.eclipse.ocl.uml.OCL.initialize(umlResource.getResourceSet());
org.eclipse.ocl.uml.UMLEnvironmentFactory envFactory = new org.eclipse.ocl.uml.UMLEnvironmentFactory(umlResource.getResourceSet());
umlenv = envFactory.createEnvironment();
org.eclipse.ocl.uml.OCL myOCL = org.eclipse.ocl.uml.OCL.newInstance(umlenv);
myOCL.setParseTracingEnabled(true);
analyzer = myOCL.createAnalyzer(oclConstraints);
cstree = analyzer.parseConcreteSyntax();
if (cstree!=null && cstree.getStartToken().toString().equals("context"))
{
String msg ="You need to specify your constraints inside a package declaration. \n\npackage PackageName\n...\nYour constraints\n...\nendpackage";
throw new Exception(msg);
}
OCLInput document = new OCLInput(oclConstraints);
umlconstraintsList = myOCL.parse(document);
umlreflection = umlenv.getUMLReflection();
[Updated on: Fri, 21 December 2012 18:56] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03302 seconds