问题
Is it possible to use the "text" MQL extension with the java api, so you can get the full description text. I mean sth like this:link but for the java api.
回答1:
You can use the extended parameter in the query envelope to enable MQL extensions in your query. With the example query that Philip gave in the linked question, that would look like this:
JSON query = o(
"id", "/en/jimi_hendrix",
"/common/topic/article", a(o(
"text", o(
"maxlength", 16384,
"chars", null
)
))
);
JSON envelope = o("extended", 1);
JSON params = o();
Freebase freebase = Freebase.getFreebase();
JSON response = freebase.mqlread(query, envelope, params);
String text = response.get("result")
.get("/common/topic/article")
.get(0).get("text")
.get("chars")
.toString();
I should point out that MQL extensions are an experimental feature of the Freebase API and they are not supported in the new version of the API. The new API will provide text either through the Topic API or directly from the Text API.
来源:https://stackoverflow.com/questions/7820106/freebase-java-api-full-text-retrieval