Ontological modeling technologies. RDF and OWL
This page is a chapter from our teaching guide
"Introduction to Ontology Modeling" (click to go to the full version in PDF format).
Semantic technologies (Semantic Web) is a set of ways to present and use information in electronic form. Their essence can best be understood in comparison with other ways of presenting information.
The most natural and familiar thing for us is streaming view (text, images, videos, sounds). Information presented in streaming form is a signal for which special hardware and software are used to decrypt and reproduce it. As a rule, the software does not analyze the content (meaning) of such a signal, leaving the task of interpreting it entirely to the user. The text representation stands somewhat apart: the text can be analyzed using statistical and other methods that facilitate the search and structuring of information in it. The common feature that unites all options for streaming information is that only a person can perceive it in its entirety.
To process structured information, a relational representation (tables, databases) is used. The essence of this approach is to separate information into metadata, which describes the type and format of information elements, and the data itself, which carries information about specific objects, phenomena, and their properties. As a rule, information is presented in tabular form. Each table stores information about some type of objects or phenomena. The table consists of columns, each of which stores information about a property or relationship of an object. Descriptions of tables and columns are metadata, and their contents are data. The presence of metadata makes it possible to build software algorithms for data processing, that is, to shift some of the information processing tasks to a computer.
Semantic technologies represent the next step in the development of machine-readable representations of information. They make it possible to embody in electronic form semantic models built according to the principles described in the previous section; they make it possible to transmit the information contained in these models and automatically process it, including obtaining logical conclusions based on the axioms available in the model.
The technological embodiment of semantic technologies bears the imprint of the history of their origin. Their development began with the idea of the Semantic Web, a semantic web proposed by Tim Berners-Lee, one of the founders of the Internet. The essence of the idea was to add the publication of information presented in the form of semantic models in addition to streaming data (text, images, video), which mainly forms the content of the World Wide Web. This will make machine processing of such information possible, and will revolutionize Internet search engines, which, of course, will have very serious economic consequences. This is why, in our opinion, the practical implementation of the Semantic Web idea has been stalled for more than ten years. Successes in this field have boiled down to the development of several microformats - extremely limited ontologies that make it possible to publish on websites some information in machine-readable form (addresses, information about products), and again, extremely limited support for these microformats by search engines. This can be compared to the invention and development of microprocessors only to create devices on them that control, for example, the movement of elevators. It is obvious that the actual creation of the semantic web is deeply contrary to the interests of well-known search engines, one of the main sources of income of which is contextual advertising; full-fledged semantic search would make such advertising unnecessary and kill the entire market.
However, thanks to the efforts of Semantic Web enthusiasts, we have a set of technologies adopted in the form of W3C recommendations or standards, and a set of open source software that can be used to solve problems far from the rather narrow goals of the Semantic Web. The potential of these technologies, in our opinion, is seriously underestimated. It is all the more interesting to develop methods for their practical application.
So, let's look at the composition of the Semantic Web "technology stack".
First of all, a basic way of expressing the information represented in semantic models is needed. In this way it became triplet – a syntactic structure consisting of three elements:
Subject Predicate Object
Of course, we gave the names to the three elements of the triplet arbitrarily, but they reflect their essence. Subject is always a model object. Predicate – the property whose value we want to set for this object. Finally, addition can be either a literal (numeric, string value) or another object. Of course, objects and properties are identified by their unique identifiers. The names of the parts of the triplet we have chosen are also convenient because they correspond to the grammatical structure of the simplest phrase-statement in natural language, for example: “A dog is an animal.”
Using such triplets, you can express all the information contained in any semantic model. Of course, it is necessary to define a formalism, or set of rules, by which triplets are formed. We will look at these rules a little later, but for now we will continue our review of semantic technologies.
One of the cornerstones of the semantic model is unique identifiers objects. In the Semantic Web, it is customary for these identifiers to be in the form of URIs - universal resource identifiers standardized for the Internet. Thus, all identifiers in semantic models take the form:
http://hostname/ontology#identifier
You need to understand that this way of writing identifiers is purely a convention. The identifier has nothing to do with the http protocol, the “host name” may be fictitious and not correspond to any real-life site, the names of the ontology and the last (unique) part of the identifier are formed arbitrarily, and there may not be a # symbol before the identifier. In general, a URI can be thought of simply as a string that is formed according to a specific pattern solely for human readability.
There are generally accepted ontologies, for example, FOAF, designed to express information about persons. Such ontologies have their own namespace (the first part of the identifier is roughly “http://hostname/ontology”; for example, for FOAF the namespace is http://xmlns.com/foaf/0.1/).
The next set of technologies we'll look at are used to serialize ontology models (that is, to save models to files). Here we can distinguish the logical and syntactic levels: the logical level determines the principles and rules for transmitting the semantic content of ontologies, and the syntactic level determines the ways of transforming this meaning into sequences of symbols.
There are several “languages” for writing semantic models, the main ones being RDF/RDFS and OWL. RDF/RDFS allow you to record simple facts about objects, classes and properties. OWL describes complex relationships between classes and properties. The relationship between RDF/RDFS and OWL is quite complex: on the one hand, OWL uses some expressions from previous standards, such as the type membership predicate (rdf:type); on the other hand, it redefines such expressions as the entity type “class” (owl:Class instead of rdfs:Class - there is a nuance here in the definition of a class for different OWL dialects); on the third hand, some of these overridden expressions are used less frequently than their predecessor standard counterparts: rdfs:subClassOf is used more often than its counterpart owl:subClassOf. In general, in practice, an ontology is usually a mixture of expressions from all three standards.
OWL has several “dialects”: the outdated and very simplified OWL Lite, the most commonly used OWL DL (Description Logic), and the feature-rich OWL Full. One of the differences between OWL DL and OWL Full is that OWL DL guarantees computability of any logical expression, while OWL Full does not. On the other hand, OWL Full allows, for example, to make an entity a class and an individual object at the same time, which is sometimes necessary in complex models. Throughout our story we will always refer to the use of OWL DL. Finally, there is a new version of the standard - OWL 2. It defines the so-called OWL profiles, which impose various restrictions on the capabilities of the language: OWL RL, OWL QL, etc.
The standards provide different syntaxes that allow you to save OWL or RDF/RDFS to a file. The most common is the well known XML. The Turtle syntax is also used, which is more concise and makes it easier to “see” triplets in the code.
Software for working with RDF/RDFS/OWL includes editors, visualizers, and inference engines (the English term is reasoner). The latter are designed to check ontologies for contradictions, as well as automatically draw conclusions (i.e., produce new triplets) based on the rules and facts available in the model. The most popular free ontology editor is Protégé.
It is clear, however, that working with models in file mode is extremely inconvenient, and in multi-user mode it is almost impossible. Therefore, there are software products of the Triple store class - triplet stores that function similarly to databases. The most well-known solutions of this class are Apache Jena, Virtuoso, Sesame, GraphDB and many others. Including, you can create a triple store based on Oracle 11g. Triplet stores have software interfaces that allow you to access them from various programming tools and use logical inference machines. There is also the SPARQL standard, which describes the programming interface and query syntax for ontology models; Already from its name the analogy with the SQL language is obvious. A software product that provides a SPARQL interface to the contents of a triplet store is called a SPARQL endpoint.
Triplet stores import ontologies from RDF/RDFS/OWL files, but usually do not support export to them. It should also be noted that not all products implement the same rules for converting from OWL to “pure” triplets (see the document “OWL 2 Web Ontology Language Mapping to RDF Graphs"), so the results of importing OWL into a triplet store depend on the software implementation.
Another interesting class of semantic software is systems that support controlled natural language. They allow you to write expressions that are uniquely translated into OWL in a subset of natural language (English, Russian, etc.). You can also ask queries to an inference machine in natural language. True, the syntactic rules of a controlled language in modern implementations are quite limited. An example of such a product is FluentEditor from Cognitum. There is also software that allows you to restore ontological models from text - for example, ABBYY Compreno.
Next chapter: Simple ontological models: creating classes. Protégé Editor