In Python (or Java), define a simple ontology/taxonomy (up to 5 classes, up to 10 individuals) about companies. Provide REST endpoints
- to add a new individual;
- to remove an existing individual from the ontology;
- to download modified ontology.
The proposed ontology contains three classes:
- Company, Industry and Person
The following properties are allowed:
- has_industry(Company, Industry)
- has_founder(Company, Person)
- is_founder_of(Person, Company)
python3 create_ontology.py
Defines the ontology, creates a few entities and saves it in onto.owl
python3 app.py
We can inspect an entity by sending a GET request with the following format:
curl --request GET --url http://127.0.0.1:5000/<class>/<name>
For example, we can see details about Apple Inc. company:
curl --request GET --url http://127.0.0.1:5000/company/Apple_Inc
Simple search works, too:
curl --request GET --url http://127.0.0.1:5000/company/Apple
We can add a new entity by sending a POST request.
curl --request POST --url http://127.0.0.1:5000/person/Albert_Einstein
We can also pass parameters in the following way:
curl --request POST --url http://127.0.0.1:5000/person/Henry?founder_of=Henry_s_Fresh_Apples
curl --request POST --url http://127.0.0.1:5000/company/IBM?industry=Computer_Hardware
curl --request DELETE --url http://127.0.0.1:5000/person/Albert_Einstein
curl --request GET --url http://127.0.0.1:5000/onto > modified_onto.owl