class hierarchy and transitive closure

42 views
Skip to first unread message

Inanc Seylan

unread,
Mar 10, 2014, 1:26:26 PM3/10/14
to elk-reasone...@googlegroups.com
Hi,

Suppose I have the ontology:

A \sqsubseteq B
B \sqsubseteq C

When I compute the class hierarchy of this ontology using ELK, it does not return the inclusion A \sqsubseteq C.

Does ELK compute the transitive closure of the class hierarchy internally? If so, how can I access this information? The problem is that I do not want to recompute the transitive closure if it is already done by ELK.

Thanks,

Inanc

Yevgeny Kazakov

unread,
Mar 10, 2014, 1:49:26 PM3/10/14
to elk-reasone...@googlegroups.com
Hi Inanc,

On Mon, Mar 10, 2014 at 6:26 PM, Inanc Seylan <inanc....@gmail.com> wrote:
> Hi,
>
> Suppose I have the ontology:
>
> A \sqsubseteq B
> B \sqsubseteq C
>
> When I compute the class hierarchy of this ontology using ELK, it does not
> return the inclusion A \sqsubseteq C.

What do you mean by that? How do you query for subclass relations?

In OWL API there are two methods which you can use to retrieve the
class hierarchy:

getSubClasses(OWLClassExpression ce, boolean direct)

getSuperClasses(OWLClassExpression ce, boolean direct)

If you set "direct" to "false", you will obtain all sub-classes,
respectively all super-classes.

Here is the documentation:

http://owlapi.sourceforge.net/javadoc/org/semanticweb/owlapi/reasoner/OWLReasoner.html

You can adapt the example from here accordingly:

https://code.google.com/p/elk-reasoner/wiki/QueryingComplexClasses

>
> Does ELK compute the transitive closure of the class hierarchy internally?
> If so, how can I access this information? The problem is that I do not want
> to recompute the transitive closure if it is already done by ELK.

Internally ELK computes all subsumption relations, but it applies
transitive reduction to obtain a more compact representation. So it
stores only direct subsumptions.
If you query for all sub-classes/super-classes of a given class then
ELK computes the transitive closure for the selected class "on the
fly". So, retrieving all sub/super classes is somewhat more expensive
than only the direct ones (which is basically a lookup).

Best regards,

Yevgeny


>
> Thanks,
>
> Inanc
>
> --
> You received this message because you are subscribed to the Google Groups
> "elk-reasoner-discussion" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elk-reasoner-disc...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Inanc Seylan

unread,
Mar 11, 2014, 12:26:55 PM3/11/14
to elk-reasone...@googlegroups.com
Thanks Yevgeny. I will use these methods from the OWLReasoner interface then. The way I was querying the subclass relations was as follows:

OWLReasonerFactory reasonerFactory = new ElkReasonerFactory();
OWLReasoner reasoner = reasonerFactory.createReasoner(ontology);
reasoner.precomputeInferences(InferenceType.CLASS_HIERARCHY);
InferredSubClassAxiomGenerator gen = new InferredSubClassAxiomGenerator();
for (OWLSubClassOfAxiom gci : gen.createAxioms(manager, reasoner)) {
  // do stuff
}

Btw, there is no call to

reasoner.precomputeInferences(InferenceType.CLASS_HIERARCHY);

in the example in https://code.google.com/p/elk-reasoner/wiki/QueryingComplexClasses

I guess ELK computes directly the class hierarchy for a given ontology in reasonerFactory.createReasoner(ontology)?

Cheers,

Inanc

Yevgeny Kazakov

unread,
Mar 11, 2014, 1:06:59 PM3/11/14
to elk-reasone...@googlegroups.com
Hi Inanc,

On Tue, Mar 11, 2014 at 5:26 PM, Inanc Seylan <inanc....@gmail.com> wrote:
> Thanks Yevgeny. I will use these methods from the OWLReasoner interface
> then. The way I was querying the subclass relations was as follows:
>
> OWLReasonerFactory reasonerFactory = new ElkReasonerFactory();
> OWLReasoner reasoner = reasonerFactory.createReasoner(ontology);
> reasoner.precomputeInferences(InferenceType.CLASS_HIERARCHY);
> InferredSubClassAxiomGenerator gen = new InferredSubClassAxiomGenerator();
> for (OWLSubClassOfAxiom gci : gen.createAxioms(manager, reasoner)) {
> // do stuff
> }
>
> Btw, there is no call to
>
> reasoner.precomputeInferences(InferenceType.CLASS_HIERARCHY);
>
> in the example in
> https://code.google.com/p/elk-reasoner/wiki/QueryingComplexClasses
>
> I guess ELK computes directly the class hierarchy for a given ontology in
> reasonerFactory.createReasoner(ontology)?

No. ELK tries to perform all computations lazily, including loading of
the ontology. It will load and compute the hierarchy (or whatever is
necessary) only when the first reasoning result needs to be returned.
It is thus not necessary to force ELK to precompute any inferences.

Yevgeny
>> > email to elk-reasoner-disc...@googlegroups.com.
>> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "elk-reasoner-discussion" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elk-reasoner-disc...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages