# Checking empty descriptions¶

In this example, we use fastobo to create a small validation script which will report empty definitions in an OBO file. We also use requests in order to connect to the OBO library.

[1]:

import fastobo
import requests


fastobo.load takes a file-handle, which can be accessed using the raw property of the Response object returned by requests.get:

[2]:

res = requests.get("http://purl.obolibrary.org/obo/ms.obo", stream=True)


## Entities¶

Checking for definitions in entity frames is straightforward: all definition clauses have a definition property that returns the textual definition of the entity. We can use duck-typing here to check for empty definitions:

[5]:

for frame in doc:
for clause in frame:
try:
if not clause.definition:
print("Empty definition of", frame.id)
except AttributeError:
pass