code: private static GrammaticalRelation determinePrepRelation(Map<TreeGraphNode, ? extends Set<TypedDependency>> map, List<TreeGraphNode> partmod, TypedDependency pc, TypedDependency topPrep, boolean pobj) {
      // handling the case of an "agent":
      // the governor of a "by" preposition must have an "auxpass" dependency
      // or be the dependent of a "partmod" relation
      // if it is the case, the "agent" variable becomes true
      boolean agent = false;
      String preposition = pc.dep().value().toLowerCase();
      if (preposition.equals("by")) {
        // look if we have an auxpass
        Set<TypedDependency> aux_pass_poss = map.get(topPrep.gov());
        if (aux_pass_poss != null) {
          for (TypedDependency td_pass : aux_pass_poss) {
            if (td_pass.reln() == AUX_PASSIVE_MODIFIER) {
              agent = true;
            }
          }
        }
        // look if we have a partmod
        if (!partmod.isEmpty() && partmod.contains(topPrep.gov())) {
          agent = true;
        }
      }
  
      GrammaticalRelation reln;
      if (agent) {
        reln = AGENT;
      } else if (pc.reln() == RELATIVE) {
        reln = RELATIVE;
      } else {
        // for prepositions, use the preposition
        // for pobj: we collapse into "prep"; for pcomp: we collapse into "prepc"
        if (pobj) {
          reln = EnglishGrammaticalRelations.getPrep(preposition);
        } else {
          reln = EnglishGrammaticalRelations.getPrepC(preposition);
        }
      }
      return reln;
    }
docs: Work out prep relation name. pc is the dependency whose dep() is the
  preposition to do a name for. topPrep may be the same or different.
  Among the daughters of its gov is where to look for an auxpass.