Using IncQuery in standalone EMF configurations

IncQuery can now also be used in standalone EMF configurations, i.e. outside of the Eclipse/OSGi environment (e.g. in command line apps or Java Enterprise applications).  You only need to add a single line of hand-written code per pattern, to initialize the generated pattern builder as follows:

BuilderRegistry.getContributedStatelessPatternBuilders().put(
	EClassMatcher.FACTORY.getPatternName(),
	new PatternBuilderForeClass()); // name of generated pattern builder class, resides inside the patternbuilders.XXX package

This technique is illustrated in the code of the ECore Queries example above, available from the SVN repository at

In case you wish to use derived features as well (see derived features, ecore queries also depends on this since many features of the Ecore metamodel are derived/volatile), you also need the following code line:

WellbehavingDerivedFeatureRegistry.registerWellbehavingDerivedPackage(
	EPackage.Registry.INSTANCE.getEPackage("http://www.eclipse.org/emf/2002/Ecore"));
You can register EPackage, EClass or EStructuralFeature with the convenient methods of WellbehavingDerivedFeatureRegistry.