(Based on the book Programming the Semantic Web. from O'Reilly)
What is the Semantic Web?
Semantic refers basically to the meaning of anything tha is under evaluation. In few words something has semantic content if it has a meaning within the context it is been evaluated.
For example: “34” Doesn’t have any real meaning at all. Just a number
On the other hand “34 celcius degrees”. Has a meaning tha anybody can understand (it’s hot)
Semantic Web tries to integrate semantic expressions to the Web. Giving meaning to the data on it, and not just showing meaningless raw data. In this way, knowledge instead of data can be exposed and shared between machines with humans or other machines.
Knowledge representation.
To represent knowledge instead of data, this data must be delevered with it’s meaning. The meaning of the data is actually data about the data, which is known as metadata.
So to represent the knowledge on the Web we must provide the descriptive metadata along with the actual data. This is important to understand: Unlike a database (for example) where the meaning of the data comes somehow in the table and column names, in our representations the metadata goes hand in hand with the actual data.
The basic constructor for the representation of semantic data is the Triple. A Triple is nothing more than a languaje construction of the form (subject, predicate, object). Where “subject” is normally an entity, “predicate” is an attribute or characteristic applied to the subject over the object, which can be an entity with further relations, or literal final value, like a String.
For example: Aragorn son_of Arathorn
With this simple representation we can describe infinite relations and meaningful semantic attributes on infinite entitites originating a complex directed graph of semantic relationships between nodes.
The idea is to represent everything we can as Triples, and save them to a Triple Store. There are many of this triplestores on line, but we’ll see this in the next article.
Example of a mini triple store for our Lord of The Rings Triples:
Subject | Predicate | Object |
Aragorn | son_of | Arathorn |
Frodo | bearer_of | Anillo |
Sam | friend_of | Frodo |
Frodo | is_a | Hobbit |
Aragorn | takes_care_of | Frodo |
Pippin | friend_of | Frodo |
As you can see, the idea is to define a standard language for a particular domain and make it easy to extend and share. The structure itself of the Triple Store makes it easy to extend (By adding new Triples) and the sharing comes from standarizing the language used for the particular domain (which we’ll see in the next article). This sharing and extending is the fundamental to the Semantic Web ideas.
As we mentioned before, to represent semantic data and relationships we use directed graphs. For the Triple Store from before, the graph would be something like:
This kind of structure allows us to give answers to questions like the following, in natural language and in Triple mode.
Natural Language | Triple | Meaning |
¿who takes care of Frodo? | ? takes_care_of Frodo | Returns all Triples that make the sentence true. In our case Aragorn takes_care_of Frodo |
Who is a hobbit and a ring bearer? | ?a is_a Hobbit ?a bearer_of Anillo | Like the previous case, but this time with a binding variable which must make both sentences true. In our case this is true just for Frodo. Frodo es_un Hobbit Frodo portador_de Anillo |
Who is Sam friend of and also a hobbit? | Sam friend_of ?a a? is_a hobbit | Like in the previous case but with the binding variable in different positions. Sam friend_of Frodo Frodo is_a hobbit |
Who is friend of Frodo? | ? friend_of Frodo | Triple with multiple results. Sam friend_of Frodo Pippin friend_of Frodo |
Infering new Triples
From the data and asserts existent in our triplestore, as from our knowledge of the specific domain, we can build rules that help us create new knowledge in our store.
For example. We can define a Rule saying “If X is friend of Frodo the X is friend of Sam”. By implementing this inference rule, we will generate new Triples of knowledge in our store.
Graph merging and linked data
Other option all this alloes, is graph merging. For example, let’s suppose we find somewhere a Triplestore refering to “The Hobbit” novel. It could be merged with our datastore and create more knowledge in our store:
For example. Our Triplestore
Frodo nephew_of Bilbo
The Hobbit
Bilbo saves dwarfes
By relating both Bilbos, we can add this new knowledge to our Triplestore.
This introduction was focused on the description of how the Semantic Web essentials works. In the next article we’ll see the standards languages and tools that make use of this concepts to deliver content and share it on the Web.
Sharing will be machine-human and most importantly machine-machine.
We’ll see public Triplestores and how to merge them, query them, make inferences out of them and more.
Carlo