Search code examples
javajenadbpediaapache-jena

How to get object in different language in Jena?


I am pulling abstract information for http://dbpedia.org/page/The_Bronx and it gives me in German, but I would like to get in English. I cannot work with SPARQL. Here is my code:

    Resource bronx=model3.getResource("http://dbpedia.org/resource/The_Bronx");
System.out.println("Description:"+bronx.getProperty(model3.getProperty("http://dbpedia.org/ontology/abstract")).getObject().toString());

And it prints this: Description:Die Bronx [b????ks] ist seit dem 10. Januar 1874 der nördlichste Stadtbezirk (borough) von New York City. Er deckt sich mit Bronx County, dem am drittstärksten besiedelten County des Bundesstaates New York.@de

The question is how can I get this text in English (@en)?


Solution

  • The property abstract is multi-valued but you asked for one object so Jena picked one, which happened to be the German ("..." @de) one. See listProperties and look for the objects which are @en. Or use SPARQL.