SWRL rules cause of slow response?

Hi there,

I am experiencing unbearably slow response when I make an assertion, then issue a sparql query with reasoning turned on. I have uploaded about 60-70 SWRL rules into my ontology and am wondering if

  • using rules; or
  • the number of rules; or
  • the way I have partitioned the rules into named graphs (should I house all the rules together for better performance?)

are the main cause of the slowdown. Any advice/suggestion would be much appreciated. Thanks in advance!

Hi,

According to my experience, rules (not only SWRL) are a pain for any reasoner, even outside Stardog.
Unfortunately, they are also a fundamental way to formalize knowledge in an ontology.
In some cases, I also experienced a crash of the Pellet reasoner in Stardog.
Using stardog rules syntax would bring no apparent benefit.

So far, the only viable workaround I found is to translate the SWRL rule into a SPARQL construct query. For instance, if your SWRL RULE is like:
{condition1} ^ {condition2} ^ {condition3} -> {statement1} ^ {statement2}

the equivalent SPARQL construct would be

CONSTRUCT
{
{statement1}
{statement2}

}
WHERE
{
{condition1}
{condition2}
{condition3}

}

Then I elaborate the construct queries on Jena running on a java app in an iterative fashion, until no new statements are produced.

This brings the drawbacks of having an external, custom made app and a support graph where to store the inferred statements in the form of additionally asserted statements.
Processing times are still high but in any case slower than any other attempt with (SWRL) rules on stardog built-in reasoner.
And, as mentioned, the only viable solution I found as number and complexity of rules and model increases.

Hope this may have helped you in some way.
Regards,
Lorenzo.