Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FuXi example code fails #13

Open
doriantaylor opened this issue Oct 8, 2015 · 2 comments
Open

FuXi example code fails #13

doriantaylor opened this issue Oct 8, 2015 · 2 comments

Comments

@doriantaylor
Copy link

Tried this:

from FuXi.Horn.HornRules import HornFromN3
rs=HornFromN3('http://www.agfa.com/w3c/euler/rdfs-rules.n3')

Got this:

  File "/usr/local/lib/python2.7/dist-packages/FuXi-1.4.dev-py2.7.egg/FuXi/Rete/RuleStore.py", line 396, in add
    isinstance(obj, (URIRef, Literal)) and obj or obj.identifier))
AttributeError: 'Literal' object has no attribute 'identifier'

(Note, I tried the same with Python 3. This is against the latest rdflib.)

https://github.com/RDFLib/FuXi/blob/master/lib/Rete/RuleStore.py#L396 says:

isinstance(obj, (URIRef, Literal)) and obj or obj.identifier))

I'm not sure where obj.identifier is supposed to come from but it doesn't look like it's anywhere in the source of rdflib.

@doriantaylor
Copy link
Author

Oh IIIIIIII see. Check this out:

> /usr/local/lib/python2.7/dist-packages/FuXi-1.4.dev-py2.7.egg/FuXi/Rete/RuleStore.py(396)add()
-> isinstance(obj, (URIRef, Literal)) and obj or obj.identifier))
(Pdb) p obj
rdflib.term.Literal(u'false', datatype=rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#boolean'))
(Pdb) if not obj: 'hi'
'hi'

Somebody set "false"^^xsd:boolean to be actually False in Python. I can patch this but I'm still not sure where .identifier is coming from. Perhaps more accurately, I'm not sure what that code is actually supposed to do.

@wwaites
Copy link
Member

wwaites commented Jan 11, 2017

This appears to be fixed in the gjhiggins branch. Hopefully it will be merged in shortly. seeAlso #15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants