eclipse-ocl / org.eclipse.ocl

Eclipse Public License 2.0
0 stars 0 forks source link

"No OCL Standard Library content available points to a missing ocl specific setup" error during parse an ocl file #982

Closed eclipse-ocl-bot closed 1 month ago

eclipse-ocl-bot commented 1 month ago

| --- | --- | | Bugzilla Link | 390768 | | Status | CLOSED INVALID | | Importance | P3 normal | | Reported | Sep 30, 2012 09:12 EDT | | Modified | May 27, 2014 09:53 EDT | | Reporter | Faiez Za |

Description

I define my file test.ocl using \ completeocl sources (org.eclipse.ocl.examples.xtext.completeocl -> Run As Eclipse Application)

[code]\ import 'MyEcore.ecore'\ package test

context TestClass ... ....\ [/code]

I try after to parse this file using Xtext.\ [code]\ package fr.enseeiht.completeocl.parser;

import java.io.IOException;\ import java.util.Map;

import org.eclipse.emf.common.util.URI;\ import org.eclipse.emf.ecore.resource.Resource;\ import org.eclipse.emf.ecore.resource.ResourceSet;\ import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;\ import org.eclipse.emf.ecore.util.EcoreUtil;\ import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;\ import org.eclipse.ocl.examples.xtext.completeocl.CompleteOCLStandaloneSetup;

[code]

public class Parser {

public static void main(String[] args) throws IOException {

    CompleteOCLStandaloneSetup.doSetup();\
    ResourceSet resourceSet = new ResourceSetImpl();\
    Resource resource = resourceSet.getResource(URI.createURI(args[0]), true);\
    resource.load(null);\
    \
    Resource resource1 = resourceSet.getResource(URI.createURI("src/MyDSL.ecore"), true);\
    resource1.load(null);\
    \
    Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;\
    Map<String, Object> m = reg.getExtensionToFactoryMap();\
    m.put("completeocl", new XMIResourceFactoryImpl());\
    \
    EcoreUtil.resolveAll(resource); \
    \
    Resource resourceAsXmi = resourceSet.createResource(URI.createURI(args[0].substring(0, args[0].length()-4)+".completeOCLCST"));\
    \
    resourceAsXmi.getContents().addAll(resource.getContents());\
    resourceAsXmi.save(null);\
    System.out.println(args[0].substring(0, args[0].length()-5));

}\

}\ [/code]

[/code]

I get this error

[code]\ Exception in thread "main" org.eclipse.ocl.examples.pivot.utilities.IllegalLibraryException: No OCL Standard Library content available\ at org.eclipse.ocl.examples.pivot.manager.PivotStandardLibrary.getRequiredLibraryType(PivotStandardLibrary.java:277)\ at org.eclipse.ocl.examples.pivot.manager.PivotStandardLibrary.resolveRequiredSimpleType(PivotStandardLibrary.java:376)\ at org.eclipse.ocl.examples.pivot.manager.PivotStandardLibrary.getOclInvalidType(PivotStandardLibrary.java:206)\ at org.eclipse.ocl.examples.xtext.base.baseCST.impl.PathElementCSImpl.getElement(PathElementCSImpl.java:354)\ at org.eclipse.ocl.examples.xtext.base.baseCST.impl.PathNameCSImpl.getElement(PathNameCSImpl.java:390)\ at org.eclipse.ocl.examples.xtext.completeocl.completeOCLCST.impl.ClassifierContextDeclCSImpl.getClassifier(ClassifierContextDeclCSImpl.java:201)\ at org.eclipse.ocl.examples.xtext.completeocl.completeOCLCST.impl.ClassifierContextDeclCSImpl.eIsSet(ClassifierContextDeclCSImpl.java:168)\ at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObjectImpl.java:1237)\ at org.eclipse.emf.ecore.util.EContentsEList$FeatureIteratorImpl.hasNext(EContentsEList.java:401)\ at org.eclipse.emf.ecore.util.EContentsEList$FeatureIteratorImpl.next(EContentsEList.java:559)\ at org.eclipse.emf.ecore.util.EcoreUtil.resolveCrossReferences(EcoreUtil.java:302)\ at org.eclipse.emf.ecore.util.EcoreUtil.resolveAll(EcoreUtil.java:296)\ at org.eclipse.emf.ecore.util.EcoreUtil.resolveAll(EcoreUtil.java:281)\ at fr.enseeiht.completeocl.parser.Parser.main(Parser.java:33)

[/code]

and if I comment this line\ [code]\ //EcoreUtil.resolveAll(resource); \ [/code]

My OCL file is parsed but without resolve cross references:\ For example,\ the \ [code]\ import 'SimplePDL.ecore'\ [/code]\ is parsed as\ [code]\ \ [/code]

Can you please help me to resolve this problem

Best regards,\ Thanks

eclipse-ocl-bot commented 1 month ago

By Ed Willink on Sep 30, 2012 12:27

Read the OCL Standard Library section in http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.ocl.doc%2Fhelp%2FPivotStandalone.html.

eclipse-ocl-bot commented 1 month ago

By Ed Willink on May 27, 2014 09:45

CLOSED after more than a year in RESOLVED state.

eclipse-ocl-bot commented 1 month ago

By Ed Willink on May 27, 2014 09:53

and CLOSE