class FreebaseHelper {

	public Entity getNameForID(String id) throws IOException {
		String trimmedID = id.replaceAll("\\.", "/");
		if (!trimmedID.startsWith("/")) {
			trimmedID = "/" + trimmedID;
		}
		String metaURL = FREEBASE_SEARCH_API.replace("{id}", trimmedID);

		JsonNode jsonNode = getURL(metaURL);

		LOG.trace(metaURL);

		if (jsonNode.get("result").size() < 1) {
			LOG.error("No results for mid {}", id);
			return null;
		}

		JsonNode result = jsonNode.get("result").get(0);

		String name = result.has("name") ? result.get("name").asText() : "";

		Entity person = new Entity(id, name);

		final JsonNode output = result.get("output");

		if (output.has("type")) {
			final JsonNode types = output.get("type").get("/type/object/type");
			person.types = Lists.newArrayList(Iterables.transform(types, new Function<JsonNode, String>() {
				@Nullable
				@Override
				public String apply(@Nullable JsonNode type) {
					return type.get("id").asText();
				}
			}));
		}

		if (output.has("/common/topic/alias")) {
			final JsonNode alias = output.get("/common/topic/alias").get("/common/topic/alias");
			if (alias != null) {
				person.alias = Lists.newArrayList(Iterables.transform(alias, new Function<JsonNode, String>() {
					@Nullable
					@Override
					public String apply(@Nullable JsonNode alias) {
						return alias.asText();
					}
				}));
			}
		}


		return person;
	}

}