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

Remove LiteralProxies class to improve the performance of processing #13

Open
wrobell opened this issue Oct 13, 2018 · 4 comments
Open

Comments

@wrobell
Copy link
Contributor

wrobell commented Oct 13, 2018

The RDFClosure/Literals.py states

The issue is that pure literals cannot appear in subject position according to the current rules on RDF. That means that different types of conclusions cannot properly finish.

However, rdflib seems to support literals in subject position.

I wonder if we could remove LiteralProxies class and therefore speedup the whole processing?

@wrobell wrobell changed the title Remove LiteralProxies class Remove LiteralProxies class to improve the performance of processing Oct 13, 2018
@ashleysommer
Copy link
Collaborator

This would be a rather large architectural change to the tool. I believe the original author @iherman would need to comment on this.

@iherman
Copy link
Contributor

iherman commented Oct 13, 2018

@wrobell, if rdflib supports literals as subjects today (it did not when this code was written...), then, of course, LiteralProxies may go, I agree. As @ashleysommer says, it is a rather large architectural change, but probably the rest of the code may be oblivious to the change...

@wrobell
Copy link
Contributor Author

wrobell commented Oct 13, 2018

The following script works. Is there any other RDFlib feature which should be tested with literals in subject position?

import io

from pprint import pprint
from rdflib import Graph, Literal, RDF, XSD

DATA = """  
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
                                    
1 a xsd:integer.                    
"""                                 
                                    
g = Graph()                         
g.parse(io.StringIO(DATA), format='n3')
g.add((Literal(1.1), RDF.type, XSD.float))
pprint(list(g))                     
                                    
pprint(list(g.objects(Literal(1), RDF.type)))
pprint(list(g.objects(Literal(1.1), RDF.type)))
                                    
pprint(list(g.subjects(RDF.type, XSD.integer)))
pprint(list(g.subjects(RDF.type, XSD.float)))

@wrobell
Copy link
Contributor Author

wrobell commented Oct 15, 2018

In pull request #16 I have implemented two tests for semantic of datatypes (table 8 at https://www.w3.org/TR/owl2-profiles/#Reasoning_in_OWL_2_RL_and_RDF_Graphs_using_Rules).

I believe dt-type2, dt-eq and dt-diff rules are skipped on purpose?

Do you mind if I ask you to suggest others tests to be implemented before I start removal of LiteralProxies class?

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

3 participants