Linking individuals

Now its time to link each of the instances with the object and data properties to define them further. These will then be the terms we can query in our ontology to extract information from it.

We'll start by linking Object properties to our instances so that for example, the ontology can know which genre each anime belongs to. In order to do so we must select each individual after which Protegé will display a window on the lower right corner of our application with data about that given object as shown in the figure.

We click the Add Object property assertions to add them.

This will open a dialog where we must type in the Object property we want to link. We can use CTRL+SPACE to autocomplete our sentences and speed up the process. We must type the Individual name in the other window as shown in the Figure.

We also want to add the Data properties full name and release year to our anime. In this case we select the Data property assertions element of our Property assertions​ window as shown.

This will open a window where we must type the desired values. In RDF syntax these values are known as Literals.

We repeat this process for each of our instances so we'll end up with something similar to the data shown in the figure.

Now its time to check for errors and save our ontology so that we can extract some data from it using SPARQL. In order to do that we must activate the Reasoner to check for any errors and link implicit relationships together. To do that we must select the Reasoner from the main menu as shown.

We'll use the Hermit reasoner which is an OWL based implementation that can detect inconsistencies in ontologies, hidden relationships, among other things. We select HermiT in the menu and then from the same menu select the Start reasoner option.

If we get no error message then the reasoner found no inconsistencies. We can now Save our ontology by selecting the Save option in the File option.

Protegé offers several formats to save our ontology but the most common and widely used is the RDF/XML format. We shall save our file using it. In recent years more and more applications are using Turtle and OWL/XML or OWL Functional formats but RDFLib seems to have some problems reading them so we'll stick with RDF/XML.

​If you manage to operate RDFLib or other Python library with the other formats let me know!

We give it a name and add the .rdf file extension as shown. In this case I made a directory to store my files called TakiAnime based on my otaku knowledge.