I have a N-Triples file with entity types like this (sample):
<http://es.dbpedia.org/resource/Volcán_Ichinski> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://dbpedia.org/ontology/Location> .
<http://es.dbpedia.org/resource/Volcán_Ichinski> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://dbpedia.org/ontology/NaturalPlace> .
<http://es.dbpedia.org/resource/Volcán_Ichinski> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://dbpedia.org/ontology/Place> .
<http://es.dbpedia.org/resource/Wayne_Watson> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://dbpedia.org/ontology/Agent> .
<http://es.dbpedia.org/resource/Wayne_Watson> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://dbpedia.org/ontology/Person> .
<http://es.dbpedia.org/resource/Weston_(Texas)> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://dbpedia.org/ontology/Location> .
<http://es.dbpedia.org/resource/Weston_(Texas)> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://dbpedia.org/ontology/Place> .
<http://es.dbpedia.org/resource/Weston_(Texas)> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://dbpedia.org/ontology/PopulatedPlace> .
<http://es.dbpedia.org/resource/Weston_(Texas)> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://dbpedia.org/ontology/Region> .
I want to obtain the most concrete type according to DBpedia class hierarchy for each entity. Thus, each entity in the file will only have 1 DBpedia type.
In this case, result will be something like this (sample):
<http://es.dbpedia.org/resource/Volcán_Ichinski> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://dbpedia.org/ontology/NaturalPlace> .
<http://es.dbpedia.org/resource/Wayne_Watson> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://dbpedia.org/ontology/Person> .
<http://es.dbpedia.org/resource/Weston_(Texas)> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://dbpedia.org/ontology/Region> .
I don't know if this is possible, if not I will like to do something similar. Hope you can help me. Thanks in advance.