impossible to create SKOSReasoner

59 views
Skip to first unread message

Paola Montorio

unread,
May 16, 2012, 3:37:07 AM5/16/12
to skos...@googlegroups.com
Hi,
I can not create a skos reasoner,
I perform the steps that are:

SKOSManager manager = new SKOSManager();
SKOSDataset dataSet = manager.loadDatasetFromPhysicalURI(URI.create(path));
 SKOSReasoner reasoner = new SKOSReasoner(manager, (OWLReasoner) new Reasoner.ReasonerFactory());
  reasoner.loadDataset(dataSet);
            reasoner.classify();
----
the exception is generated:

java.lang.ClassCastException: org.semanticweb.HermiT.Reasoner$ReasonerFactory cannot be cast to org.semanticweb.owl.inference.OWLReasoner
    at itslab.api.testReasoner.loaderGlobal(testReasoner.java:75)
    at itslab.api.testReasoner.main(testReasoner.java:49)

How can I create a SKOSseasoner object?

regards
Paola

Simon Jupp

unread,
May 16, 2012, 4:07:06 AM5/16/12
to skos...@googlegroups.com
Hi,
Sorry, the online example is out of date. You missed a few things:

SKOSManager manager = new SKOSManager();
SKOSDataset dataSet = manager.loadDatasetFromPhysicalURI(URI.create(path));
SKOStoOWLConverter converter = new SKOStoOWLConverter();
OWLReasoner reasoner=new
Reasoner.ReasonerFactory().createReasoner(converter.getAsOWLOntology(dataSet));
SKOSReasoner skosreasoner = new SKOSReasoner(manager, reasoner);

It is a good idea to have the SKOS-DL also loaded into your
SKOSManager so you get all the SKOS inferences.

Cheers
Simon
> --
> You received this message because you are subscribed to the Google Groups
> "skos-dev" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/skos-dev/-/d0WXspHAR1EJ.
> To post to this group, send email to skos...@googlegroups.com.
> To unsubscribe from this group, send email to
> skos-dev+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/skos-dev?hl=en.

Paola Montorio

unread,
May 16, 2012, 5:49:57 AM5/16/12
to skos...@googlegroups.com
Hi Simon,
API reasoner which uses is
com.hp.hpl.jena.reasoner.Reasoner ?
or
org.semanticweb.HermiT.Reasoner; ?
or what?
I don't found which Reasoner  API you use in the code below (
new  Reasoner.ReasonerFactory().createReasoner(converter.getAsOWLOntology(dataSet)); )
thanks in advance
Paola
> skos-dev+unsubscribe@googlegroups.com.

Simon Jupp

unread,
May 16, 2012, 6:34:20 AM5/16/12
to skos...@googlegroups.com
Sorry, you need the HermiT reasoner in your classpath from
http://www.hermit-reasoner.com. You could also use Pellet or Fact++.


On Wed, May 16, 2012 at 10:49 AM, Paola Montorio
>> > skos-dev+u...@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/skos-dev?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "skos-dev" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/skos-dev/-/qmJeEveKJzIJ.
>
> To post to this group, send email to skos...@googlegroups.com.
> To unsubscribe from this group, send email to
> skos-dev+u...@googlegroups.com.

Paola Montorio

unread,
May 16, 2012, 7:10:33 AM5/16/12
to skos...@googlegroups.com
Sorry,
but I have an compilation error on invocation "createReasoner" in the step:

--------------
    OWLReasoner reasoner=new
        Reasoner.ReasonerFactory().createReasoner(converter.getAsOWLOntology(dataSet));
----------------
where reasoner is an HermiT reasoner

how can I create a SKOSReasoner without the creation of Hermit reasoner?
Can I use a reasoner to create a jena reasoner SKOS? if so, how is it done?
bye Paola
>> > skos-dev+unsubscribe@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/skos-dev?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "skos-dev" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/skos-dev/-/qmJeEveKJzIJ.
>
> To post to this group, send email to skos...@googlegroups.com.
> To unsubscribe from this group, send email to
> skos-dev+unsubscribe@googlegroups.com.

Simon Jupp

unread,
May 16, 2012, 8:03:51 AM5/16/12
to skos...@googlegroups.com
What was the error?

At the moment the SKOSReasoner only uses reasoners with an OWL API
implementation (e.g. Pellet, HermiT and Fact++).
>> >> > skos-dev+u...@googlegroups.com.
>> >> > For more options, visit this group at
>> >> > http://groups.google.com/group/skos-dev?hl=en.
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "skos-dev" group.
>> > To view this discussion on the web visit
>> > https://groups.google.com/d/msg/skos-dev/-/qmJeEveKJzIJ.
>> >
>> > To post to this group, send email to skos...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > skos-dev+u...@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/skos-dev?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "skos-dev" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/skos-dev/-/XYnbN6sd8Y8J.
>
> To post to this group, send email to skos...@googlegroups.com.
> To unsubscribe from this group, send email to
> skos-dev+u...@googlegroups.com.

Paola Montorio

unread,
May 16, 2012, 8:37:00 AM5/16/12
to skos...@googlegroups.com
the error in compile time is :

The method createReasoner(OWLOntology) in the type Reasoner.ReasonerFactory is not applicable for the arguments (OWLOntology)

Paola
>> >> > skos-dev+unsubscribe@googlegroups.com.
>> >> > For more options, visit this group at
>> >> > http://groups.google.com/group/skos-dev?hl=en.
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "skos-dev" group.
>> > To view this discussion on the web visit
>> > https://groups.google.com/d/msg/skos-dev/-/qmJeEveKJzIJ.
>> >
>> > To post to this group, send email to skos...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > skos-dev+unsubscribe@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/skos-dev?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "skos-dev" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/skos-dev/-/XYnbN6sd8Y8J.
>
> To post to this group, send email to skos...@googlegroups.com.
> To unsubscribe from this group, send email to
> skos-dev+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages