Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » OCLInECore standalone, Mars(MalformedURLException : unknown protocol: platform)
OCLInECore standalone, Mars [message #1707787] Wed, 09 September 2015 11:26 Go to next message
Jon Rustand is currently offline Jon RustandFriend
Messages: 13
Registered: September 2009
Location: Oslo, Norway
Junior Member
Hi,

My EMF project contains two ecore models :

Common.ecore:
-------------
package common : common = 'http://www.example.org/common'
{
	class Person
	{
		attribute name : String[?];
	}
}

and
MyModel.ecore:
--------------

import common : 'Common.ecore#/' ;

package mymodel : mymodel = 'http://www.example.org/mymodel'
{
	class MyPerson
	{
		property commonPerson : common::Person[?];
		attribute name : String[?] { derived transient volatile }
		{
			initial: commonPerson?.name;
		}
	}
}


How the OclInECoreImportTest project (attached) is generated:
- using Eclipse Modeling Tools, Version: Mars Release (4.5.0), Build id: 20150621-1200
- PluginVersions, see PluginVersions.txt under "doc" folder in attached project.
- created Empty EMF project
- created the two ecore models using the OCLInecore editor.
- new "OCLinEcore Ecore File", modifying the default content.
- created a genmodel for each ecore.
- MyModel.genmodel reference Common.genmodel (usedGenPackages).
- all genmodel properties are default.
- generate java.

When I run this code (ImportTest.java) :

import org.eclipse.ocl.xtext.oclinecore.OCLinEcoreStandaloneSetup;

import mymodel.MyPerson;
import mymodel.MymodelFactory;

public class ImportTest {

	public static void main(String[] args) {

		OCLinEcoreStandaloneSetup.doSetup();

		MyPerson myPerson = MymodelFactory.eINSTANCE.createMyPerson();
		System.out.println(myPerson.getName());
	}

}

I get :
Exception in thread "main" org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: java.net.MalformedURLException: unknown protocol: platform
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:319)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:278)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:406)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getEObject(ResourceSetImpl.java:220)
at org.eclipse.ocl.pivot.internal.ecore.es2as.Ecore2AS.loadImports(Ecore2AS.java:620)
at org.eclipse.ocl.pivot.internal.ecore.es2as.Ecore2AS.loadImports(Ecore2AS.java:583)
at org.eclipse.ocl.pivot.internal.ecore.es2as.Ecore2AS.getASModel(Ecore2AS.java:316)
at org.eclipse.ocl.pivot.internal.ecore.es2as.Ecore2AS.getASOfEcore(Ecore2AS.java:338)
at org.eclipse.ocl.pivot.internal.ecore.es2as.Ecore2AS.getCreated(Ecore2AS.java:411)
at org.eclipse.ocl.pivot.internal.manager.PivotMetamodelManager.getASOfEcore(PivotMetamodelManager.java:827)
at org.eclipse.ocl.pivot.internal.ecore.EcoreASResourceFactory.getASElement(EcoreASResourceFactory.java:63)
at org.eclipse.ocl.pivot.internal.manager.PivotMetamodelManager.getASOf(PivotMetamodelManager.java:805)
at org.eclipse.ocl.pivot.internal.delegate.OCLDelegateDomain.getPivot(OCLDelegateDomain.java:299)
at org.eclipse.ocl.pivot.internal.delegate.OCLSettingDelegate.getProperty(OCLSettingDelegate.java:123)
at org.eclipse.ocl.pivot.internal.delegate.OCLSettingDelegate.get(OCLSettingDelegate.java:108)
at org.eclipse.emf.ecore.util.BasicSettingDelegate$Stateless.dynamicGet(BasicSettingDelegate.java:185)
at mymodel.impl.MyPersonImpl.getName(MyPersonImpl.java:117)
at importtest.ImportTest.main(ImportTest.java:20)

Any hint appreciated.

Regards
Jon Rustand

Re: OCLInECore standalone, Mars [message #1707809 is a reply to message #1707787] Wed, 09 September 2015 13:31 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5434
Registered: July 2009
Senior Member
<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hi<br>
<br>
Your example has no Resource or ResourceSet which can sometimes
prevent EMF-related functionality working. <br>
<br>
You use two genmodels in one project, again not good practice. A
shared genmodel could be better.<br>
<br>
But the actual problem seems to be a URI resolution failure:<br>
<br>
<a class="moz-txt-link-freetext" href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=476968">https://bugs.eclipse.org/bugs/show_bug.cgi?id=476968</a> raised<br>
<br>
For now, just comment out/delete the Import annotation in
MyModel.ecore:<br>
<br>
  &lt;<big><big><big><big><big><b>!--</b></big></big></big></big></big>eAnnotations
source=<a class="moz-txt-link-rfc2396E" href="http://www.eclipse.org/OCL/Import">"http://www.eclipse.org/OCL/Import"</a>&gt;<br>
    &lt;details key="common" value="Common.ecore#/"/&gt;<br>
  &lt;/eAnnotations<big><big><big><big><big><b>--</b></big></big></big></big></big>&gt;<br>
<br>
See the Bugzilla for further progress.<br>
<br>
    Regards<br>
<br>
        Ed Willink<br>
<br>
<br>
<br>
<br>
On 09/09/2015 12:26, Jon Rustand wrote:<br>
</div>
<blockquote cite="mid:msp50m$ip8$1@xxxxxxxxe.org" type="cite">
<pre wrap="">Hi,

My EMF project contains two ecore models :

Common.ecore:
-------------
package common : common = '<a class="moz-txt-link-freetext" href="http://www.example.org/common">http://www.example.org/common</a>'
{
class Person
{
attribute name : String[?];
}
}

and
MyModel.ecore:
--------------

import common : 'Common.ecore#/' ;

package mymodel : mymodel = '<a class="moz-txt-link-freetext" href="http://www.example.org/mymodel">http://www.example.org/mymodel</a>'
{
class MyPerson
{
property commonPerson : common::Person[?];
attribute name : String[?] { derived transient volatile }
{
initial: commonPerson?.name;
}
}
}


How the OclInECoreImportTest project (attached) is generated:
- using Eclipse Modeling Tools, Version: Mars Release (4.5.0), Build id: 20150621-1200
- PluginVersions, see PluginVersions.txt under "doc" folder in attached project.
- created Empty EMF project
- created the two ecore models using the OCLInecore editor.
- new "OCLinEcore Ecore File", modifying the default content.
- created a genmodel for each ecore.
- MyModel.genmodel reference Common.genmodel (usedGenPackages).
- all genmodel properties are default.
- generate java.

When I run this code (ImportTest.java) :

import org.eclipse.ocl.xtext.oclinecore.OCLinEcoreStandaloneSetup;

import mymodel.MyPerson;
import mymodel.MymodelFactory;

public class ImportTest {

public static void main(String[] args) {

OCLinEcoreStandaloneSetup.doSetup();

MyPerson myPerson = MymodelFactory.eINSTANCE.createMyPerson();
System.out.println(myPerson.getName());
}

}

I get :
Exception in thread "main" org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: java.net.MalformedURLException: unknown protocol: platform
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:319)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:278)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:406)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getEObject(ResourceSetImpl.java:220)
at org.eclipse.ocl.pivot.internal.ecore.es2as.Ecore2AS.loadImports(Ecore2AS.java:620)
at org.eclipse.ocl.pivot.internal.ecore.es2as.Ecore2AS.loadImports(Ecore2AS.java:583)
at org.eclipse.ocl.pivot.internal.ecore.es2as.Ecore2AS.getASModel(Ecore2AS.java:316)
at org.eclipse.ocl.pivot.internal.ecore.es2as.Ecore2AS.getASOfEcore(Ecore2AS.java:338)
at org.eclipse.ocl.pivot.internal.ecore.es2as.Ecore2AS.getCreated(Ecore2AS.java:411)
at org.eclipse.ocl.pivot.internal.manager.PivotMetamodelManager.getASOfEcore(PivotMetamodelManager.java:827)
at org.eclipse.ocl.pivot.internal.ecore.EcoreASResourceFactory.getASElement(EcoreASResourceFactory.java:63)
at org.eclipse.ocl.pivot.internal.manager.PivotMetamodelManager.getASOf(PivotMetamodelManager.java:805)
at org.eclipse.ocl.pivot.internal.delegate.OCLDelegateDomain.getPivot(OCLDelegateDomain.java:299)
at org.eclipse.ocl.pivot.internal.delegate.OCLSettingDelegate.getProperty(OCLSettingDelegate.java:123)
at org.eclipse.ocl.pivot.internal.delegate.OCLSettingDelegate.get(OCLSettingDelegate.java:108)
at org.eclipse.emf.ecore.util.BasicSettingDelegate$Stateless.dynamicGet(BasicSettingDelegate.java:185)
at mymodel.impl.MyPersonImpl.getName(MyPersonImpl.java:117)
at importtest.ImportTest.main(ImportTest.java:20)

Any hint appreciated.

Regards
Jon Rustand


</pre>
</blockquote>
<br>
</body>
</html>
Previous Topic:Exception on custom error message with complete OCL
Next Topic:Using getValue(Stereotype, String) with Collections. Possible bug?
Goto Forum:
  


Current Time: Sat Oct 21 17:58:29 GMT 2017

Powered by FUDForum. Page generated in 0.02942 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software