Skip to main content

PyLOD is a Python wrapper for exposing Linked Open Data from public SPARQL-served endpoints.

Project description


PyLOD is a Python wrapper for exposing Linked Open Data from public SPARQL-served endpoints. It acts as an abstraction layer for the retrieval of structured data, such as classes, properties and individuals, without requiring any knowledge of SPARQL.

Getting Started

PyLOD is a minimal module for Python (2.x. and 3.x).


SPARQLWrapper - SPARQLWrapper is a simple Python wrapper around a SPARQL service to remotelly execute queries.


  • Manually

  1. Install SPARQLWrapper.
  2. Save to your project's directory.
  • From PyPi

pip install PyLOD


1. Import the PyLOD class and create a PyLOD class object.

from PyLOD import PyLOD
pylod = PyLOD()

2. Provide a dictionary of desired namespaces

    "dbo": "",
    "dbp": ""


This step is optional, since PyLOD already incorporates a set of known namespaces. To get the list of defined namespaces, use this:


3. Define a dictionary of SPARQL endpoints to be queried:

    "DBpedia": "",
    "GeoLinkedData": ""


If no endpoints are defined, PyLOD will use a pre-defined set of known endpoints. To get the list of these endpoints, do this:


4. Use PyLOD's expose functions to retrieve structured data from the endpoints. Set the optional argument limit_per_endpoint to limit the results per endpoint. For example:

# Get entities of type owl:Class
classes = pylod.expose.classes(limit_per_endpoint=100)

# Get the sub-classes of a specific class 
sub_classes = pylod.expose.sub_classes(super_class="dbo:Artist")

# Get instances of a specific class 
instances = pylod.expose.instances_of_class(cls="dbo:Artist", include_subclasses=True, limit_per_endpoint=50)

# Execute custom SPARQL select query to all endpoints
results = pylod.sparql.execute_select_to_all_endpoints(query="SELECT * WHERE {?s ?p ?o}")

Expose functions:

  • classes() - Returns class entities
  • sub_classes() - Returns the sub-classes of a given class
  • super_classes() - Returns the super-classes of a given class
  • equivalent_classes() - Returns the equivalent classes of a given class
  • disjoint_classes() - Returns the disjoint classes of a given class
  • sub_properties() - Returns the sub-properties of a given property
  • super_properties() - Returns the super-properties of a given property
  • triples() - Allows the retrieval of triples within the pattern (subject-predicate-object)
  • subjects() - Returns the subjects of a given predicate-object pair
  • predicates() - Returns the predicates of a given subject-object pair
  • objects() - Returns the objects of a given subject-predicate pair
  • instances_of_class() - Returns instances of a given class type
  • labels() - Returns labels of a given entity, with an optional language argument

SPARQL functions:

  • execute_select() - Allows the execution of a custom SPARQL select query to a given endpoint URL
  • execute_select_to_all_endpoints() - Allows the execution of a custom SPARQL select query to all endpoints defined in pylod.endpoints.get_endpoints()
  • is_active_endpoint() - Checks if a given endpoint URL is alive and responds to SPARQL queries


The official webpage - The Docs


Powered by


PyLOD has been deployed in the following projects:

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for PyLOD, version 0.1.12
Filename, size File type Python version Upload date Hashes
Filename, size PyLOD-0.1.12-py2-none-any.whl (8.0 kB) File type Wheel Python version py2 Upload date Hashes View hashes
Filename, size PyLOD-0.1.12.tar.gz (9.3 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page