@Override
  protected void processForSerialization(
      ReteRecipe recipe, ReteNodeRecipe nodeRecipe, Model vocabulary, int recipeIndex) { // XXX
    if (nodeRecipe instanceof ProductionRecipe) {
      ProductionRecipe productionRecipe = (ProductionRecipe) nodeRecipe;
      nodeRecipe.setTraceInfo(((PQuery) productionRecipe.getPattern()).getFullyQualifiedName());
      productionRecipe.setPattern(null);
    } else if (nodeRecipe instanceof ExpressionEnforcerRecipe) {
      ExpressionEnforcerRecipe expressionEnforcerRecipe = (ExpressionEnforcerRecipe) nodeRecipe;
      IExpressionEvaluator evaluator =
          (IExpressionEvaluator) expressionEnforcerRecipe.getExpression().getEvaluator();
      // XXX use an evaluator shared from runtime
      Object[] evaluationInfo = {
        evaluator.getShortDescription(), evaluator.getInputParameterNames()
      };
      expressionEnforcerRecipe.getExpression().setEvaluator(evaluationInfo);
    } else if (nodeRecipe instanceof UnaryInputRecipe) {
      UnaryInputRecipe unaryInputRecipe = (UnaryInputRecipe) nodeRecipe;

      String typeNameSuffix = RecipeProcessor.extractType(unaryInputRecipe).getTypeNameSuffix();
      unaryInputRecipe.setTraceInfo(VERTEX_DISCRIMINATOR + ": " + typeNameSuffix);
    } else if (nodeRecipe instanceof BinaryInputRecipe) {
      BinaryInputRecipe binaryInputRecipe = (BinaryInputRecipe) nodeRecipe;
      org.openrdf.model.Resource propertyUri =
          RdfPatternLanguageUtils.toRdfResource(binaryInputRecipe.getTypeName());

      String typeNameSuffix = RecipeProcessor.extractType(binaryInputRecipe).getTypeNameSuffix();
      if (RdfUtils.isDatatypeProperty(propertyUri, vocabulary)) {
        binaryInputRecipe.setTraceInfo(ATTRIBUTE_DISCRIMINATOR + ": " + typeNameSuffix);
      } else if (RdfUtils.isObjectProperty(propertyUri, vocabulary)) {
        binaryInputRecipe.setTraceInfo(EDGE_DISCRIMINATOR + ": " + typeNameSuffix);
      }
    }
    nodeRecipe.setTraceInfo(nodeRecipe.getTraceInfo() + " [recipe " + recipeIndex + "]");
  }
 @Override
 protected Model getMetamodel(RdfPatternModel patternModel) {
   return RdfPatternLanguageUtils.getVocabulary(patternModel);
 }