// Copied from org.eclipse.ocl.examples.test.xtext.PivotDocumentationExamples.java Library library = getLibrary(resourceSet); // get library from a hypothetical source // use the constraints defined in the OCL document // use getBooks() from the document in another query to find a book ExpressionInOCL expression = ocl.createQuery(EXTLibraryPackage.Literals.LIBRARY, "getBooks('Bleak House')->asSequence()->first()"); Book book = (Book) ocl.evaluate(library, expression); debugPrintf("Got book: %s%n\n", book); // use the unique_title constraint to validate the book boolean isValid = ocl.check(book, constraintMap.get("unique_title")); debugPrintf("Validate book: %b%n\n", isValid);