*Hi!*
*I'm using Spotlight with this URL (to query for Portuguese Results) : *
private final static String API_URL = "http://spotlight.sztaki.hu:2228/";
*And the extraction method is like this:*
private static final double CONFIDENCE = 0.0;
private static final int SUPPORT = 0;
@Override
public List<DBpediaResource> extract(Text text) throws
AnnotationException {
LOG.info("Querying API.");
String spotlightResponse;
try {
GetMethod getMethod = new GetMethod(API_URL + "rest/annotate/?"
+
"confidence=" + CONFIDENCE
+ "&support=" + SUPPORT
+ "&text=" + URLEncoder.encode(text.text(), "utf-8"));
getMethod.addRequestHeader(new Header("Accept",
"application/json"));
spotlightResponse = request(getMethod);
} catch (UnsupportedEncodingException e) {
throw new AnnotationException("Could not encode text.", e);
}
assert spotlightResponse != null;
JSONObject resultJSON = null;
JSONArray entities = null;
try {
resultJSON = new JSONObject(spotlightResponse);
entities = resultJSON.getJSONArray("Resources");
} catch (JSONException e) {
throw new AnnotationException("Received invalid response from
DBpedia Spotlight API.");
}
LinkedList<DBpediaResource> resources = new
LinkedList<DBpediaResource>();
for(int i = 0; i < entities.length(); i++) {
try {
JSONObject entity = entities.getJSONObject(i);
resources.add(
new DBpediaResource(entity.getString("@URI"),
Integer.parseInt(entity.getString("@support"))));
} catch (JSONException e) {
LOG.error("JSON exception "+e);
}
}
return resources;
}
*The URIs returned are like this:*
http://dbpedia.org/resource/Http://pt.dbpedia.org/resource/Ator
http://dbpedia.org/resource/Http://pt.dbpedia.org/resource/Cruzeiro_Esporte_Clube
http://dbpedia.org/resource/Http://pt.dbpedia.org/resource/Teatro
http://dbpedia.org/resource/Http://pt.dbpedia.org/resource/Wolf_Maya
*When I test the complete URI on the browser, like this:*
http://dbpedia.org/resource/Http://pt.dbpedia.org/resource/Ator
*I get the message: "The requested entity is unknown"*
*And when I test the second part, like this:*
Http://pt.dbpedia.org/resource/Ator
*I get the message: "Service Temporarily Unavailable"*
*What's the problem?*
*Thank you!*
------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing
conversations that shape the rapidly evolving mobile landscape. Sign up now.
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
Dbp-spotlight-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dbp-spotlight-users