gtfierro / reasonable

OWL 2 Reasoner built on DataFrog
BSD 3-Clause "New" or "Revised" License
73 stars 4 forks source link

owl:FunctionalProperty is wrongly interpreted #13

Closed severin-lemaignan closed 2 years ago

severin-lemaignan commented 2 years ago

When a predicate is set to be an OWL functional property, it appears to add spurious owl:sameAs relationships.

The following minimal example exhibits the error with rdflib 4.2.2 and reasonable 0.1.53 (installed via pip)

import reasonable
import rdflib

g = rdflib.Graph() 

r = reasonable.PyReasoner() 

N3_PROLOGUE='@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>. @prefix owl: <http://www.w3.org/2002/07/owl#>. @base <http://example.org>.  @keywords a,true,false.  '

g.parse(data=N3_PROLOGUE + " p1 rdf:type owl:FunctionalProperty .", format="n3") 
g.parse(data=N3_PROLOGUE + " s1 p1 o1 .", format="n3") 
g.parse(data=N3_PROLOGUE + " s2 p1 o2 .", format="n3") 

r.from_graph(g) 
triples = r.reason()

triples

triples lists o1 owl:sameAs o2 which should not be inferred.

severin-lemaignan commented 2 years ago

@gtfierro gentle ping!

gtfierro commented 2 years ago

Apologies! And thanks for the reminder :) This got away from me; I've got a deadline Friday but I can get back to this early next week

severin-lemaignan commented 2 years ago

brilliant. Let us know if you need help testing things.

gtfierro commented 2 years ago

Hi @severin-lemaignan ; I believe I fixed the bug here, and it should be released in reasonable==0.1.59.

I had a little trouble getting the Python package to build again, but I think it is all working now. Can you give it a try?

severin-lemaignan commented 2 years ago

hi! thanks for working on this! After upgrading the python bindings to reasonable-0.1.64, I get this error:

>>> import reasonable
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/severinlemaignan/.local/lib/python3.8/site-packages/reasonable/__init__.py", line 4, in <module>
    from reasonable.reasonable import PyReasoner
ImportError: cannot import name 'PyReasoner' from 'reasonable.reasonable' (/home/severinlemaignan/.local/lib/python3.8/site-packages/reasonable/reasonable/__init__.py)

Does it ring a bell? missing dependency?

gtfierro commented 2 years ago

This might be an issue with the cross compilation setup I have just have to python package. What OS and architecture are you running on?


From: Séverin Lemaignan @.> Sent: Tuesday, August 16, 2022 1:34:20 AM To: gtfierro/reasonable @.> Cc: Gabriel Fierro @.>; Mention @.> Subject: [External] Re: [gtfierro/reasonable] owl:FunctionalProperty is wrongly interpreted (Issue #13)

hi! thanks for working on this! After upgrading the python bindings to reasonable-0.1.64, I get this error:

import reasonable Traceback (most recent call last): File "", line 1, in File "/home/severinlemaignan/.local/lib/python3.8/site-packages/reasonable/init.py", line 4, in from reasonable.reasonable import PyReasoner ImportError: cannot import name 'PyReasoner' from 'reasonable.reasonable' (/home/severinlemaignan/.local/lib/python3.8/site-packages/reasonable/reasonable/init.py)

Does it ring a bell?

— Reply to this email directly, view it on GitHubhttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fgtfierro%2Freasonable%2Fissues%2F13%23issuecomment-1216257406&data=05%7C01%7Cgtfierro%40mines.edu%7C770afc4123c94e00f14708da7f59bc3c%7C997209e009b346239a4d76afa44a675c%7C0%7C0%7C637962320658024207%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=oYHWYYTE5b3zfrcZJiqka7Ph%2F4WuAHpt7jnz69B9cdI%3D&reserved=0, or unsubscribehttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAAANRCUKUEOAUOHK3SLTVC3VZM77ZANCNFSM5ZIQIHSQ&data=05%7C01%7Cgtfierro%40mines.edu%7C770afc4123c94e00f14708da7f59bc3c%7C997209e009b346239a4d76afa44a675c%7C0%7C0%7C637962320658024207%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=d3jdW93fqAfA0%2BG%2FaZDTPu%2F10c%2FDh7Mm8OwnslGzwoM%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.***>

severin-lemaignan commented 2 years ago

Ubuntu 20.04, x64

gtfierro commented 2 years ago

Can you try v0.1.65? I was able to install that successfully

severin-lemaignan commented 2 years ago

Same issue. Tested with Python 3.8.10, on Ubuntu 20.04:

$ pip3 install --upgrade reasonable
Collecting reasonable
  Downloading reasonable-0.1.65-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (95.6 MB)
...
  Successfully installed reasonable-0.1.65

$ python3
> import reasonable
ImportError                               Traceback (most recent call last)
<ipython-input-1-cb465344bbbe> in <module>
----> 1 import reasonable
      2 import rdflib
      3 
      4 g = rdflib.Graph()
      5 

~/.local/lib/python3.8/site-packages/reasonable/__init__.py in <module>
      2 Python interface to reasonable
      3 """
----> 4 from reasonable.reasonable import PyReasoner

ImportError: cannot import name 'PyReasoner' from 'reasonable.reasonable' (/home/skadge/.local/lib/python3.8/site-packages/reasonable/reasonable/__init__.py)
severin-lemaignan commented 2 years ago

Same issue reported in #17

severin-lemaignan commented 2 years ago

FYI, reasonable-0.1.59 works well (and the original bug is fixed). As the issue with v. > 0.1.59 is tracked in #17, I close this issue.