Inference machines (English Reasoner) are another class of software designed to work with ontological models. They allow you to check the correctness of the model and calculate the results of logical expressions. If in the SPARQL language for this you need to build quite complex queries that take into account all the “mechanics” of reflecting logical connections in the model, then inference machines allow you to operate with the names of classes, properties and entities, and “ask questions to the model,” abstracting the user from the details of the internal structure of the model. In a form accessible to the user, the easiest way to get acquainted with Reasoner is Pellet, which can be installed as a plug-in for the Protégé editor, or used as a standalone product.
Let's see how an inference engine checks the correctness of an ontology. Let's create a simple ontology consisting of four classes:
Organization Company Institution Person
In this ontology, we described organizations that are divided into companies and institutions, as well as individuals - individuals. Let's set a disjoint condition for the Company and Institution classes, since no company can be an institution at the same time. Let's try to create an instance of the Company class, and then add the Institution class to its list of types. Reasoner will throw an error message:

Rice. 21. Logical error in ontology
Additionally, an error sign will appear in the upper right corner of the Protégé editor window:

Rice. 22. Logical error sign in ontology in the Protégé editor.
When we click on it we will also be able to see a description of the error. Finally, in our entity's type list, both classes will be highlighted in red:

Figure 23. Incorrectly specified classes in the Protégé editor.
Now let's try the functionality of obtaining logical conclusions. Let's create a link property worksIn (works in), which connects persons and organizations, and declare it a functional inverse property. In the same way, we will create the hasEmployee property, which connects organizations with persons. Let us point out that these properties are inverse of each other:

Rice. 24. Creating an inverse property
Now let's create a custom Person object called Smith and indicate that he works for Alpha. Going to the properties of the Alpha company, we see the conclusion drawn, which is that this company has an employee Smith:

Rice. 25. Property value obtained as a result of logical inference
Let's move on to consider the rules of logical inference. It is necessary to understand that each of the standards for ontological representation of information contains a set of “root” axioms, for example:
rdf:type rdfs:range rdfs:Class .
This axiom states that the scope of the rdf:type predicate is rdfs:Class. Standards thus define themselves in their own terms.
The rules by which inference machines operate are also given in the standards. RDFS defines a basic set of inference rules, OWL significantly expands them. Among the inference rules defined in RDFS are the following:
| IF | THAT |
| aaa rdfs:domain xxx . yyy aaa zzz . | yyy rdf:type xxx . |
| xxx rdfs:subClassOf yyy . yyy rdfs:subClassOf zzz . | xxx rdfs:subClassOf zzz . |
| aaa rdfs:range xxx . yyy aaa zzz . | zzz rdf:type xxx . |
A complete list of RDFS inference rules can be found Here - there are not many of them, only 13. We gave examples of only a few of them to illustrate the principle of operation of inference machines and the limits of their capabilities. For example, according to the rule written in the second row of the table, if class xxx has a subclass yyy, and that has a subclass zzz, then xxx is considered to have a subclass zzz. This is very important in the practical use of ontologies, when class hierarchies can have a complex structure.
You can also use logical inference when working through a SPARQL access point - to do this, you need to enable its engagement mode that corresponds to the desired standard. Then, in response to all requests, the access point will begin to return not only triplets directly contained in the storage, but also triplets obtained as a result of logical inference. Working with engagement modes will be discussed in more detail in Chapter 6.
Next section: Inference rules SWRL, SPIN, SHACL