List Info

Thread: OWL inference problem with Jena




OWL inference problem with Jena
user name
2007-12-10 10:45:10
I'm trying to use OWL inferencing with the Jena adapter. However, type, kind_of? and is_a? methods don't work as I expect.

I've written the following code, which uses the pizza ontology:

require 'rubygems'
require 'active_rdf'

this_dir = File.dirname(File.expand_path(__FILE__))
adapter = ConnectionPool.add_data_source(:type => :jena, :ontology => :owl, :reasoner => :owl_micro)
adapter.load(" http://www.co-ode.org/ontologies/pizza/2007/02/12/pizza.owl";, :format => :rdfxml, :into => :default_model )

Namespace.register :pz, ' http://www.co-ode.org/ontologies/pizza/pizza.owl#';
Namespace.register :test, 'http://www.test.com#'
ObjectManager.construct_classes
a = PZ::Meatypizza.new TEST::new_pizza
a.save           ;       # => NativeException: java.lang.NullPointerException: null from LiteralLabel.java:382:in `com.hp.hpl.jena.graph.impl.LiteralLabel.getDefaultHashcode'
a.type        ;          # => [PZ::Meatypizza, RDFS::Resource, OWL::Thing, PZ:omainconcept, PZ::Food, PZ::Pizza]
a.is_a? PZ::Meatypizza  # => true
a.is_a? PZ::Pizza    ;   # => false ?????

which is wrong, though PZ::Pizza is inferred and listed with a.type

When trying the same with a bad URI, no exceptions are thrown when saving, but no inferencing is done.

a = PZ::Meatypizza.new 'bad_uri'
a.save       ;           # works
a.type         ;         # => [RDFS::Resource, PZ::Meatypizza]
a.is_a? PZ::Meatypizza  # => true
a.is_a? RDFS::Resource     # => false
a.is_a? PZ::Pizza    ;   # => false

Is this normal behaviour? If not, is there a bug in the Jena adapter or ActiveRDF or is there a problem with the ontology?
Re: OWL inference problem with Jena
user name
2007-12-11 07:26:20
Hello Josè!

On 10.12.2007, at 17:45, José Ignacio wrote:

> I'm trying to use OWL inferencing with the Jena
adapter. However,  
> type, kind_of? and is_a? methods don't work as I
expect.

Great to hear from somebody who is trying out Jena and OWL
inferencing.

I myself did not try out the Jena inferencing, but I
forwarded your  
email to the person who wrote the code for utilising jenas
inferencing.

How urgent is the question? This week is a little
inconvenient, as a  
deadline for an important Semantic Web conference is on
Friday :(


_______________________________________________
ActiveRDF mailing list
ActiveRDFlists.deri.org
http
://lists.deri.org/mailman/listinfo/activerdf

Re: OWL inference problem with Jena
user name
2007-12-11 07:53:24
Hi Benjamin!

Thank you for your answer. It's not urgent, and anyway I'll
be happy
to receive some advice/feedback when using OWL with
ActiveRDF (with
Jena preferably or whatever), as I can't find too much info
on this. I
think semantic web is more interesting as long as advanced
inferencing
is possible, so that an added value is obtained when using
ontologies
in comparison to not using them.

2007/12/11, Benjamin Heitmann <benjamin.heitmannderi.org>:
>
> Hello Josè!
>
> On 10.12.2007, at 17:45, José Ignacio wrote:
>
> > I'm trying to use OWL inferencing with the Jena
adapter. However,
> > type, kind_of? and is_a? methods don't work as I
expect.
>
> Great to hear from somebody who is trying out Jena and
OWL inferencing.
>
> I myself did not try out the Jena inferencing, but I
forwarded your
> email to the person who wrote the code for utilising
jenas inferencing.
>
> How urgent is the question? This week is a little
inconvenient, as a
> deadline for an important Semantic Web conference is on
Friday :(
>
>
> _______________________________________________
> ActiveRDF mailing list
> ActiveRDFlists.deri.org
> http
://lists.deri.org/mailman/listinfo/activerdf
>
_______________________________________________
ActiveRDF mailing list
ActiveRDFlists.deri.org
http
://lists.deri.org/mailman/listinfo/activerdf

Re: OWL inference problem with Jena
user name
2007-12-20 05:21:01
It seems that the problem is solved by changing line 314 of activerdf-jena's objectmanager/resource.rb:

before:
 &nbsp;  db.add(self, p, o)

after:
 &nbsp;  db.add(self, p, o) if !o.nil?

I've tried with simpler ontologies, so it might be related with ontology complexity. May it be a problem with a blank node?

Also, I used is_a? instead of instance_of?, which has the behaviour I desired.

2007/12/10, José Ignacio < joseignacio.fernandezgmail.com">joseignacio.fernandezgmail.com >:
I'm trying to use OWL inferencing with the Jena adapter. However, type, kind_of? and is_a? methods don't work as I expect.

I've written the following code, which uses the pizza ontology:

require 'rubygems'
require 'active_rdf'

this_dir = File.dirname(File.expand_path(__FILE__))
adapter = ConnectionPool.add_data_source(:type => :jena, :ontology => :owl, :reasoner => :owl_micro)
adapter.load ("; http://www.co-ode.org/ontologies/pizza/2007/02/12/pizza.owl";, :format => :rdfxml, :into => :default_model )

Namespace.register :pz, ' http://www.co-ode.org/ontologies/pizza/pizza.owl#';
Namespace.register :test, ' http://www.test.com#'
ObjectManager.construct_classes
a = PZ::Meatypizza.new TEST::new_pizza
a.save &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; # => NativeException: java.lang.NullPointerException: null from LiteralLabel.java:382:in `com.hp.hpl.jena.graph.impl.LiteralLabel.getDefaultHashcode'
a.type&nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;  # => [PZ::Meatypizza, RDFS::Resource, OWL::Thing, PZ:omainconcept, PZ::Food, PZ::Pizza]
a.is_a? PZ::Meatypizza  # => true
a.is_a? PZ::Pizza&nbsp;   ; &nbsp; # => false ?????

which is wrong, though PZ::Pizza is inferred and listed with a.type

When trying the same with a bad URI, no exceptions are thrown when saving, but no inferencing is done.

a = PZ::Meatypizza.new 'bad_uri'
a.save &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   # works
a.type &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp; # => [RDFS::Resource, PZ::Meatypizza]
a.is_a? PZ::Meatypizza  # => true
a.is_a? RDFS::Resource  &nbsp;  # => false
a.is_a? PZ::Pizza&nbsp;   ; &nbsp; # => false

Is this normal behaviour? If not, is there a bug in the Jena adapter or ActiveRDF or is there a problem with the ontology?

Re: Re: OWL inference problem with Jena
user name
2007-12-20 09:28:35
On 20.12.2007, at 12:21, José Ignacio wrote:

> It seems that the problem is solved by changing line
314 of  
> activerdf-jena's
> objectmanager/resource.rb:
>
> before:
>     db.add(self, p, o)
>
> after:
>     db.add(self, p, o) if !o.nil?
>
> I've tried with simpler ontologies, so it might be
related with  
> ontology
> complexity. May it be a problem with a blank node?
>
> Also, I used is_a? instead of instance_of?, which has
the behaviour I
> desired.


Thanks for researching this issue, I will take a look at it
as soon  
as possible.
_______________________________________________
ActiveRDF mailing list
ActiveRDFlists.deri.org
http
://lists.deri.org/mailman/listinfo/activerdf

[1-5]

about | contact  Other archives ( Real Estate discussion Medical topics )