Thursday, 15 October 2015

Example of using SWRL built-ins with Solar System ontology.

Introduction to SWRL

Semantic Web Rule Language (SWRL for short) is a combination of OWL DL and OWL Lite sub-languages of OWL Web Ontology. It is possible to write ontology with SWRL built-ins in Ontorion Fluent Editor. One of such example of ontology written by using Semantic Web Rule Language is Cognitum's Solar System Ontology.

To follow along open Fluent Editor, go to File -> New and type Solar System. Double click on the template to open.

Introduction to Solar System ontology

Here is the core of our solar system ontology.
In the picture above it is seen that every instance in our ontology that orbits something is either a planet or a moon. Planets orbit some stars and moons orbit some planets. Later it can be possible to ask very complex queries with Fluent Editor with these two simple rules. Then later in the ontology data modelling is utilized. 

We define relations such as:
  • has-index
  • orbits
  • has-semimajor-axis-1000-km
  • has-period
  • was-discovered-by
  • was-discovered-in-year
And with these relations assigned to each instance we can later ask very complex queries.

How does rule written in SWRL look like?

You describe concepts/instances as a thing and attributes as a value. If you want to reference previous stated instance/concept use the thing and while referencing previous stated attribute use the value
Fluent Editor supports core SWRL built-ins such as: comparisons, maths, strings, date, time and duration. In the example above it can be seen that comparison operator is used.
Rule above states which radius of orbiting of a star is higher. For instance let's ask the materialized graph (reasoner HermiT does not support SWRL yet) following query.

Who-or-What is covered by Earth?

It got us this response and indeed, it is true. Venus and Mercury are closer to the Sun than the Earth.
Now let's ask about orbiting radius of Mars.

Who-or-What is covered by Mars?

And once again it can be seen that our ontology, thus SWRL is working correctly. Not only the Venus and Mercury is included but also the Earth.

Other types of query

It is possible to directly make SPARQL queries.

SELECT ?y WHERE {:Mars :covers ?y}

Or use SWRL Debugger in Tools tab.

Complex queries

Try following query:

Who-or-What was-discovered-in-year greater-than 1900 and is a planet and covers Neptune?

While debate about Pluto being a planet is still up to date Fluent Editor, will provide an answer regardless of others people opinion. 

Not only we had built SWRL feature into Fluent Editor but also we expanded it. We implemented SOUNDEX algorithm into semantics of Fluent Editor. Check example below.

SOUNDEX algorithm allows us to approximate and compare words which have similar pronunciation. For instance, ask following query:

It responded with all moons which were discovered by a person with approximately the same name.
In this case - identical.


Fluent Editor provides necessary tools to write simple and quite complex rules using SWRL built-ins. You can easily query the materialized graph, or use SPARQL queries directly to achieve response you expect.

More Resources:


  1. How does one say in Fluent CNL, "if a thing has-end-date equal-to value(1) and the thing has-start-date equal-to value(2) then the value(2) must be greater-than-or-equal-to the value(1)" ?

  2. SWRL as a proposed language for the semantic web as I am using for programming for logic etc... is a huge help for the simulations I'm currently on. Thanks for the tips btw, if you happen to know some writing services, would you mind recommending one too. This Edusson reviews has too many promises but failed to even deliver one.

  3. I came to 123helpme service searching for information on and From the first sight, they seem to be very similar service except for one crucial thing. They don't have any contacts. Some people like them for their grading tool which is similar to Grammarly online checker, the others for the huge essay sample database. They claim to have more than 400,000 samples for all kind of essays, term papers, course works, etc. If I were a student, I would definitely use them at least once. However, the major part of the essay examples are not free, and you have to but a prescription for them. Moreover, those papers are for paraphrasing only, and it is not easy to cancel the prescription if you signed up for it. See the full review to decide if
    is a scam or a decent service.

  4. New school year starts and students have to deal with their homeworks, essays and summaries as basis. Some students get through this on their own meanwhile others face difficulties. While some students still need to work homeworks take a lot of time and energy. Hence the question arises “Who can help me to write my essays?”. It's obvious that they'll want to apply to source like this

  5. Before graduating from the University, students are expected to write many assignments that take the essay format. I know the company that takes the opportunity to extend its services to a team of writers to ensure the students access help with their overwhelmingly demanding essays. The essay help that offered for academic purpose comes at a very cheap fee. Cases of students paying for services which were never dispensed are common in this writing field. Students can track the progress of their assignments from time to time.

  6. Wonderful day! Thank you for posting such a great article! It contains wonderful and helpful posts. Keep up the good work!