code: func (r *Rego) PrepareForPartial(ctx context.Context, opts ...PrepareOption) (PreparedPartialQuery, error) {
  	if !r.hasQuery() {
  		return PreparedPartialQuery{}, fmt.Errorf("cannot evaluate empty query")
  	}
  
  	pCfg := &PrepareConfig{}
  	for _, o := range opts {
  		o(pCfg)
  	}
  
  	txn := r.txn
  
  	var err error
  	if txn == nil {
  		txn, err = r.store.NewTransaction(ctx)
  		if err != nil {
  			return PreparedPartialQuery{}, err
  		}
  		defer r.store.Abort(ctx, txn)
  	}
  
  	err = r.prepare(ctx, txn, partialQueryType, []extraStage{
  		{
  			after: "CheckSafety",
  			stage: r.rewriteEqualsForPartialQueryCompile,
  		},
  	})
  
  	if err != nil {
  		return PreparedPartialQuery{}, err
  	}
  
  	return PreparedPartialQuery{preparedQuery{r, pCfg}}, err
  }
docs: // PrepareForPartial will parse inputs, modules, and query arguments in preparation
  // of partially evaluating them.