Tolog inference rule overhead

1 view
Skip to first unread message

F. Andy Seidl

unread,
Dec 5, 2009, 10:48:58 AM12/5/09
to ontopia
Is there any significant execution overhead to defining inference
rules in a tolog query which are never actually referenced by the
query?

I am generating tolog queries that rely on a small library of
inference rules and I'm wonder if I should bother to do the dependency
analysis necessary to generate only the referenced rules or if it's
reasonable to simply generate the inference rules unconditionally.

Lars Marius Garshol

unread,
Dec 5, 2009, 12:03:40 PM12/5/09
to ont...@googlegroups.com

* F. Andy Seidl
>
> Is there any significant execution overhead to defining inference
> rules in a tolog query which are never actually referenced by the
> query?

Nope. The only overhead is that of parsing them. After that they sit in a map waiting to be looked up.

> I am generating tolog queries that rely on a small library of
> inference rules and I'm wonder if I should bother to do the dependency
> analysis necessary to generate only the referenced rules or if it's
> reasonable to simply generate the inference rules unconditionally.

I don't think I'd bother.

Not sure how you do this, but if you're parsing the rules with the query every time you may want to parse the rules into a DeclarationContextIF with the parseDeclarations method and then reuse that object instead.

--Lars M.
http://www.garshol.priv.no/tmphoto/
http://www.garshol.priv.no/blog/

F. Andy Seidl

unread,
Dec 5, 2009, 1:40:44 PM12/5/09
to ontopia
Ah, yes, DeclarationContextIF is a great idea. Thanks for the
suggestion.
-- fas

On Dec 5, 12:03 pm, Lars Marius Garshol <lar...@garshol.priv.no>
wrote:

F. Andy Seidl

unread,
Dec 28, 2009, 12:15:58 PM12/28/09
to ontopia

I'm using a DeclarationContextIF now and it's working fine. However,
parsing the declarations is done in the context of a TopicMapIF, so it
requires re-parsing the declarations for each transaction. If the
declarations don't make reference to specific topics, that is, if they
are all general inference rules with no bound variables, would it be
safe to use a DeclarationContextIF with a TopicMapIF other than the
one used to parse the declarations? Would the DeclarationContextIF be
thread safe? If so, that would allow elimination of huge numbers of
parsing operations.

-- fas

On Dec 5, 12:03 pm, Lars Marius Garshol <lar...@garshol.priv.no>
wrote:

Lars Marius Garshol

unread,
Jan 4, 2010, 4:47:02 AM1/4/10
to ont...@googlegroups.com

* F. Andy Seidl

>
> I'm using a DeclarationContextIF now and it's working fine. However,
> parsing the declarations is done in the context of a TopicMapIF, so it
> requires re-parsing the declarations for each transaction. If the
> declarations don't make reference to specific topics, that is, if they
> are all general inference rules with no bound variables, would it be
> safe to use a DeclarationContextIF with a TopicMapIF other than the
> one used to parse the declarations?

No, unfortunately not, because even built-in predicates like type() keep hard references to the originating topic map. We see now that they shouldn't, but they do.

> Would the DeclarationContextIF be thread safe?

Yes. Once created no changes are made to it, so it's definitely thread-safe.

> If so, that would allow elimination of huge numbers of
> parsing operations.

Yes... We're very much aware of this issue, but it's a fair amount of work to fix it: http://code.google.com/p/ontopia/issues/detail?id=137

Reply all
Reply to author
Forward
0 new messages