// Copied from org.eclipse.ocl.examples.test.xtext.PivotDocumentationExamples.java // accumulate the document constraints in constraintMap and print all constraints Map constraintMap = new HashMap(); for (TreeIterator tit = asResource.getAllContents(); tit.hasNext(); ) { EObject next = tit.next(); if (next instanceof Constraint) { Constraint constraint = (Constraint)next; ExpressionInOCL expressionInOCL = ocl.getSpecification(constraint); if (expressionInOCL != null) { String name = constraint.getName(); if (name != null) { constraintMap.put(name, expressionInOCL); debugPrintf("%s: %s%n\n", name, expressionInOCL.getOwnedBody()); } } } }