You might be wondering why CrossEcore has an Ecore and OCL Java API, while EMF itself already provides such APIs. By default, EMF's code generator delegates the evaluation of OCL expressions to the OCL interpreter, which evaluates OCL expressions from strings at runtime. Alternatively, you can change behavior of EMF's code generator for the realisation of OCL embedded in Ecore models setting it to Generate Java code in Impl classes. In this case, the OCL expressions are translated into Java code that is compiled ahead-of-time. CrossEcore's approach is similar to the latter method, except that CrossEcore's code is more human-readable. You can choose any method you like. The different methods are used for a performance comparison.
S. Schwichtenberg, I. Jovanovikj, C. Gerth, and G. Engels, "Poster: CrossEcore: An Extendible Framework to Use Ecore and OCL across Platforms," in Proceedings of the 40th International Conference on Software Engineering, ICSE 2018 - Companion Volume, Gothenburg, Sweden.