This was the coursework for the Semantic Web-tech and Knowledge Graphs Coursework. I was not enrolled in this module. But decided to do this later.
The specification is here and the data is here
The final class hierarchy:
The original ontology/Knowledge Graph is stored in the ontologyModelling folder.
This converts the CSV data to a Knowledge Graph. To run use:
python3 -m tabularDataToKG
To run reasoning use:
python3 sparqlAndReasoning/inference.py
python3 sparqlAndReasoning/pizza_bianca_restaurants.py
Average price of a Margherita pizza: $12.05
python3 sparqlAndReasoning/average_price_margherita.py
python3 sparqlAndReasoning/number_restaurants.py
Restaurants missing postcode csv
python3 sparqlAndReasoning/restaurants_missing_postcode.py
To run use:
python3 ontologyAlignment/alignment.py
Recreate the data using:
python3 -m ontologyAlignment.recreate_data
Then load the data into GraphDB, setting up the repository using the settings given in the file. Add all the namespaces from the turtle file. Then run the query in the SPARQL file.
Class Relationships:
Here I used OWL2Vec to create various models from my pizza Knowledge Graph.
Words | Pizza Data Model | New Seed Model | Ontology Model |
---|---|---|---|
pizza vs tef:margherita | 0.19777332 | 0.18296033 | 0.29705462 |
margherita vs tef:marherita | 0.3494562 | 0.26561624 | 0.48218608 |
pizza vs tef:pizza | 0.22770958 | 0.2965466 | 0.23359077 |
american vs tef:american | 0.31192777 | 0.25724742 | 0.42699656 |
pizzaiola vs tef:pizzaiola | 0.2567482 | 0.2311137 | 0.46955892 |
There did not seem to be much difference in changing the number of clusters:
Pizza Ontology Model:
Pizza Data Model:
Pizza Data New Seed Model
- data.ttl: the data in the original ontology
- dataPostAlignment.ttl: the data in the aligned ontology
- mainAlignedOntology.tll: the merged (and modified) Pizza.owl ontology and my ontology
- ontology.owl: my pizza ontology
- Pipfile: the various Python dependencies
To run use:
pipenv run dynamic_docs
To save use:
pipenv run save_docs