Friday 3 May 2013

Querying against your ontology – an IT infrastructure scenario


Fluent Editor 2 allows you to edit ontologies that are compatible with OWL2 and SWRL and are expressed with Controlled Natural Language (e.g. English CNL).


Simple model for IT infrastructure

Let’s consider a scenario where the knowledge engineer wants to model simple IT infrastructure:
  • there are servers that hosts applications (in other words applications are hosted on the servers) 
  • applications serves different customers 
  • our customers have different severity (critical, medium, low) 
  • moreover, we want to make sure that every application will be assigned to some server in our ontology

His CNL ontology may look like below:

Ontology:
Comment: 'Sample IT ontology'.

Server-1 is a server and hosts Application-1.
Server-2 is a server and hosts Application-2.

Application-1 is an application that serves Customer-1 and serves Customer-2.
Application-3 is an application that serves Customer-3.

Customer-1 is a customer and has-severity critical.
Customer-2 is a customer and has-severity medium.
Customer-3 is a customer and has-severity low.

X is-hosted-on Y if-and-only-if Y hosts X.
Every application must be-hosted-on server.

In Fluent Editor grammar each instance name begins with capital letter (“Server-1”), concept name begins with lowercase (“server”) as well as relation name (“hosts”).

There is no need to explicitly “define” a relation beforehand – you simply use it for instance definition. It will automatically appear on the Taxonomy Tree while editing.

Last two lines introduces a symmetric relation (“is-hosted-on”) and a requirement with modal expression (“must”) to enforce every application must be-hosted-on a server. Symmetric relation makes this expression more convenient (not every server must host an application).

Asking questions

OK. Now we can start asking queries against our ontology. E.g. what hosts applications that serves customers that has-severity critical?

CNL question shall be entered to the reasoner question-box:
Query:
Who-Or-What hosts application that serves customer that has-severity critical?

The answer is (as expected):
Answer:
<?>: Server-1

What’s interesting, the above example can be expressed in much shorten way – by abandon concept designation (assuming we only want ask similar questions as above):
Ontology:
Comment: 'Sample IT ontology'.

Server-1 hosts Application-1.
Server-2 hosts Application-2.

Application-1 serves Customer-1 and serves Customer-2.
Application-3 serves Customer-3.

Customer-1 has-severity critical.
Customer-2 has-severity medium.
Customer-3 has-severity low.

With this shorten ontology we can still ask the same question, but regarding “something” rather than particular concepts (servers and applications):
Query:
Who-Or-What hosts something that serves something that has-severity critical?

And the answer again:
Answer:
<?>: Server-1


Enforcing requirements with modal expressions

Modal expressions are nice way to express requirements for the knowledge. In the above example we express a requirement that every application must be-hosted-on a server:
CNL:
X is-hosted-on Y if-and-only-if Y hosts X.
Every application must be-hosted-on server.

How does work? When the ontology (or its part) is validated, e.g. before committing changes to the knowledge server. Fluent Editor has built-in validator for the ontology being edited (will be available with May release). 
Validating the first example will show these results:
Ontology (validated):
Comment: 'Sample IT ontology'.

Server-1 is a server and hosts Application-1.
Server-2 is a server and hosts Application-2.

Application-1 is an application that serves Customer-1 and serves Customer-2.
Application-3 is an application that serves Customer-3.

Customer-1 is a customer and has-severity critical.
Customer-2 is a customer and has-severity medium.
Customer-3 is a customer and has-severity low.

X is-hosted-on Y if-and-only-if Y hosts X.
Every application must be-hosted-on server.



All instances that were subject to validation (there is some expression with “must”, “can” or “shall” – they differ by the interpretation by the end-user application. Fluent Editor differentiate them by color of the warning) are highlighted. Green means all requirements are fulfilled. Red means there is some requirement not met. Requirements expressed with “shall” will be warned with yellow, when not met. End-user application may forbid committing changes to the database, when some requirements are not met.

In the above example:
·         Application-1 is-hosted-on the Server-1 (validated),
·         Application-2 is-hosted-on the Server-2 (but nowhere denoted as an application concept, thus not being subject to validation) and
·         Application-3 is not assigned to any server – thus marked as red.

To fulfill our requirement we shall designed somehow that Application-3 is hosted on some server, e.g.:
CNL:
Application-3 is-hosted-on Server-2.

or:
CNL:
Server-2 hosts Application-3.

or even indirectly (with SWRL rules in this particular example):
CNL:
If X hosts something that contains Y then X hosts Y.

Group-A contains Application-3.
Server-2 hosts Group-A.


The above example is as simple, as possible, but gives a quick insight how this kind of semantic technology can be used for a very practical problem.

If want to learn more about Fluent Editor CNL-EN grammar, visit this link.


*) FluentEditor 2, ontology editor, is a comprehensive tool for editing and manipulating complex ontologies that uses Controlled Natural Language. Fluent editor provides one with a more suitable for human users alternative to XML-based OWL editors. It's main feature is the usage of Controlled English as a knowledge modeling language. Supported via Predictive Editor, it prohibits one from entering any sentence that is grammatically or morphologically incorrect and actively helps the user during sentence writing. The Controlled English is a subset of Standard English with restricted grammar and vocabulary in order to reduce the ambiguity and complexity inherent in full English.