OWL-RL icon indicating copy to clipboard operation
OWL-RL copied to clipboard

Remove `LiteralProxies` class to improve the performance of processing

Open wrobell opened this issue 7 years ago • 4 comments

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 avatar Oct 13 '18 00:10 wrobell

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

ashleysommer avatar Oct 13 '18 01:10 ashleysommer

@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...

iherman avatar Oct 13 '18 04:10 iherman

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 avatar Oct 13 '18 20:10 wrobell

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?

wrobell avatar Oct 15 '18 22:10 wrobell