Skip to content

zorzalerrante/dbpedia_utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

DBpedia Utils

This small Python module contains a set of utility functions to work with DBpedia data. It works with Python 2.7 and 3.4.

You require the following modules: regex, bz2file.

Basically, the important function is iter_entities_from. It works like this:

for entity in iter_entities_from('instance_types_en.nt.bz2'):
    if 'http://dbpedia.org/ontology/Person' in entity['22-rdf-syntax-ns#type']:
        print(entity['resource'])

This snippet would print the DBpedia URI of all entities that are of class Person in the file instance_types_en.nt.bz2. Each entity is a dictionary where the resource key is the DBpedia URI and the other keys correspond to the attributes present in the file being read.

That's all folks! :)

About

A small set of DBpedia utils to parse DBpedia data

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages