Hi Guys --
I have been looking at Dbpedia spotlight for a week or so now and I am
impressed with the work that has gone into it. One thing that I am trying
to do is to use the rest api to only annotate company names. I can't filter
using "types" because "Organization" gets too many matches (false positives
in my case). I see two options to perform filtering of the results and
wanted to know if there was a recommended approach.
i) Write custom filtering code after getOccurrences(). The code here is
slightly inefficient and error prone, but provides a start in doing this.
private List<DBpediaResourceOccurrence>
applyFilter(List<DBpediaResourceOccurrence> occList){
List<DBpediaResourceOccurrence> finalOccList = new
ArrayList<DBpediaResourceOccurrence>();
for(DBpediaResourceOccurrence occ : occList) {
DBpediaResource dBpediaResource = occ.resource();
List<OntologyType> types = dBpediaResource.getTypes();
for(OntologyType ontologyType: types){
if (ontologyType.typeID().contains("/business") ||
ontologyType.typeID().contains("Company") ){
finalOccList.add(occ);
break;
}
}
}
return finalOccList;
}
ii) The other option would be to use a sparql query like this:
Sparql = "SELECT DISTINCT ?x where {?x rdf:type <
http://dbpedia.org/ontology/Company> .}";
But this means making a remote query or installing the data locally.
Are there any other ways to achieve filtering?
Thanks,
Sang
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Dbp-spotlight-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dbp-spotlight-users