At the heart of the True Knowledge semantic technology is our ontology. Our ontology describes a tree-like structure of classes, and every entity fits into this tree.
In this post I'm going to explain a bit more about how we structure the world's information and how you can tap into this structure using our API.
But first, some theory. Don't skip it because it directly affects how you query the True Knowledge API!
What is a Class?
The easiest way to explain a class is take a real world example. Below is an image showing the class [book].
In our ontology, the class called [book] describes all books. It is the collection of all books that we know about, and it will be the home of all books we don't know about when they are added. All books have similar properties and attributes, and all of them can be described in similar terms: If I ask you to imagine what a book is, your mind will picture something similar to what other people imagine a book to be. In short, if you can say "This is a <something>", that something is a class.
We know there are different types of books, like novels, cookbooks, art books, textbooks, science books, science fiction books, etc. These are all subclasses of the class [book]. A subclass is a more specific class, and so is lower down in the ontology tree.
Of course it works the other way too: a more general class is a parent class. So the parent class of [science book] and [cookbook] is [book]. The class [book] itself has two parent classes, [written publication] and [source of knowledge]. The class [written publication] has other subclasses such as [comic], [issue of a periodical], etc.
You can easily browse our ontology by looking at the profiles of a class and clicking through to parents and children. Here are profiles for some of the classes mentioned above:
Instances of Classes
So far we've been talking about classes which are collections ordered in the ontology tree. So what about members of these classes? How does True Knowledge handle specific books like The Da Vinci Code?
Each member of a class, for example each book, is an instance of that class. So [the da vinci code] is an instance of [book]. Likewise, [dune] is also an instance of [book].
API Queries
To test these queries, you will need to use our API library. Details of our new API library are in this previous blog post.
You can get all subclasses of books that we know about with this query:
query bookclass
bookclass [is a subclass of] [book]
The following TK Query gets a list of novels from True Knowledge:
query novel
novel [is an instance of] [novel]
The query asks for a variable called "novel" which satisfies the relation "[is an instance of]" for the True Knowledge ID of the class [novel].
Finally, you can tap into the power of having a structured ontology tree by getting a list of books, novels and everything else, with this query:
query book
book [is an instance of] [book]
If you look through the list of results returned by the books query and compare it to the novels query results, you'll see overlap. This is because all instances of the class [novel] are also instances of the class [book] because [novel] is a subclass of [book]. You can go up the tree more and ask for all instances of the class [written publication], which will get you all books (including novels) and other publications.
It appears quite similar to concepts of OWL. It would be really interesting to know how TrueKnowledge harnesses those features and if it builds on top it or if it does things differently..
Posted by: Ruju Gandhi | 10 September 2009 at 06:32 PM