Tuesday 13 May 2014

Simple form design (and more…) using Fluent Editor.

At Cognitum we are developing innovative business applications making use of semantic technologies that can dramatically improve company productivity. Today we would like to present a method using our technologies with which it is possible to build a complex C#-Silverlight business application using a combination of Fluent Editor and Ontorion. We will start by a simple example to better explain the potential of our approach. Then we will present a more realistic example presenting how this approach can be applied to solve common business problems.

Simple form design (and more...) using Fluent Editor.



Let’s imagine we want to make a Customer form containing a customer section with compulsory fields First-Name and Surname.  First of all we code the characteristics of the form using our Controlled Natural Language editor: Fluent Editor, obtaining the code:

Every form is a thing.
Every customer-form is a form.

Every customer-form must concern a customer.

Every customer must have-first-name (some-string-value).
Every customer must have-surname (some-string-value).

our C# application will then render the form as:


As we can see the name of the form is taken from (name)-form, the name of the section is the element concerning the form and the name of the field is taken from have-(name). Moreover as the fields have been declared in the CNL file with the must keyword, submitting the form without specifying these fields will result in an error.
Using this schema it is possible to construct all type of form fields. For example the code

Every customer must have-customer-type a customer-type.
Something is a customer-type if-and-only-if-it is either Already-Client or New-Client.


Will result in a field of type select


It is also possible to have optional checkbox fields using can or additional requirements if a certain choice is made. For example by adding the CNL code

Something is a already-client-customer if-and-only-if-it has-customer-type Already-Client.
Every already-client-customer must have-phone-number (some-integer-value).

Then after choosing the Already-Client option in the form, we will be asked for the phone-number of the customer.
Clearly using such method if we will in the future decide that a field, a field type or a field name have to be changed we can do this immediately by changing the content of the CNL file.
Another interesting consequence of using a CNL file to render the form is that after submitting the form we can easily obtain a CNL-compliant result. For example by filling out the form presented before and submitting it we will obtain a CNL code of the type

Customer-Form-0 is a customer-form.
Customer-1 is a customer.
Customer-1 is a already-client-customer.
Customer-1 has-first-name equal-to 'John'.
Customer-1 has-surname equal-to 'Dow'.
Customer-1 has-customer-type Already-Client.
Customer-1 has-phone-number equal-to '394829388'.
Customer-Form-0 concerns Customer-1.


Going yet one step further we can add to the model some simple rules that we would like the elements of the form to satisfy

Every package is-for a customer-type.
 
If a customer have-customer-type a thing and a package is-for the thing then the package is-package-for the customer.

And a simple instance of the package type:

Already-Client-Package is a package.
Already-Client-Package is-for Already-Client.

Then using Ontorion reasoner inside Fluent Editor, it is possible to ask questions like :  ‘’Who or What is-package-for Customer-1?” and the answer will be: Already-Client-Package. This can also be done automatically by the C# application using the MicroOntorion API. At this point the full potential of this method is unveiled. We will show in the next part how using this kind of approach it is possible to make a complex business application powered by Cognitum’s semantic technologies with a simple user interface intuitive to use.


If you 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.

1 comment:

  1. At Cognitum we are developing innovative business applications making use of semantic technologies that can dramatically improve company productivity. Today we would like to present a method using our technologies with which it is possible to build a complex C#-Silverlight business application using a combination of Fluent Editor and Ontorion. We will start by a simple example to better explain the potential of our approach.
    semi truck accident lawyer

    ReplyDelete