Previous topic  Top  Next topic  Print this Topic
 

ConceptNamesGround

 

This switch can be set in OntoConfig.prp via:

ConceptNamesGround = <on|off>

This switch can improve performance significantly in most cases, but in some cases it can also deteriorate the performance.

Normally OntoBroker has one table for all concept-instance pairs called <$assertedisa>. This means if you have the following instances:

Tom:Cat.

Garfield:Cat.

Jerry:Mouse.

SpeedyGonzales:Mouse.

then they are stored in a single table "$assertedisa":

$assertedisa

-----------------------

Tom             Cat

Garfield        Cat

Jerry           Mouse

SpeedyGonzales  Mouse

The ConceptNamesGround switch will change this to

$assertedisa_Cat

--------

Tom      

Garfield

 

$assertedisa_Mouse

--------------

Jerry        

SpeedyGonzales

When using ConceptNamesGround=with the consequence that no rules are no longer allowed which have nonground arguments at concept positions in rule heads.

The reason is that OntoBroker would have to create a new table for each value of Y which is not yet in the database. To keep it simple: If you have such rules in your ontology you cannot use the ConceptNamesGround switch (OntoBroker will detect this and will refuse to start). Why would you want to use the ConceptNamesGround switch? Well, there are two reasons. The first one is the improved performance. It is simply cheaper to query the tables if you have fewer restrictions. E.g. if you want to retrieve all cats from OntoBroker then you pose the query:

?- ?X:"Cat".

When ConceptNamesGround is off, then OntoBroker must scan the table "$assertedisa" and check for each element if the second parameter is "Cat". (Of course OntoBroker uses indices for accessing tables but the general idea is that the queries are cheaper if the tables are smaller.) If ConceptNamesGround is used OntoBroker only needs to query a single table to get the results. So this is a typical example of a query which can be evaluated faster if ConceptNamesGround is used. The more concepts you have the cheaper a query for instances becomes. However, there are some types of queries which are slower when ConceptNamesGround is used. If you do not use a concept restriction for your queries then the performance degrades. Consider the following query:

?- ?X:?Y.

This kind of query is slower when ConceptNamesGround is used because in this case OntoBroker must query all "$assertedisa" tables ($assertedisa_Cat, $assertedisa_Mouse, ...). When ConceptNamesGround is turned off then OntoBroker must only query a single table.

So basically you have to decide between good performance for queries with restrictions or good performance for queries without restrictions.

The second reason for choosing ConceptNamesGround=on is that it is much easier to deal with negations in rules. If you ever encounter a "StratificationException" then switching to ConceptNamesGround=on might help.