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

Drop processing of literals with LiteralProxies class #18

Merged
merged 27 commits into from
Nov 27, 2018

Conversation

wrobell
Copy link
Contributor

@wrobell wrobell commented Oct 18, 2018

This is possible, because RDFLib supports literals in subject position now (see discussion in issue #13).

As a consequence

  1. The change improves performance of the library, for the script below, by
    about 14%.

  2. Related blocks of code, which swallow exceptions are removed.

  3. Unit tests for the following OWL 2 RL rules are implemented

    • cax-dw
    • cls-avf
    • cls-maxc1
    • cls-maxc2
    • cls-maxqc1
    • cls-maxqc2
    • cls-maxqc3
    • cls-maxqc4
  4. Unit tests for RDFS closure implemented

    • adding datatype axioms
    • one time rules
  5. Unit tests for OWL 2 RL extras closure implemented

    • one time rules

Testing script

import io
import sys
import time
import owlrl
from rdflib import Graph, Namespace, BNode, Literal, XSD

T = Namespace('http://test.net/')

DATA = """
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix owl: <http://www.w3.org/2002/07/owl#>.
@prefix : <http://test.net/>.

:C a owl:Class.
:dprop a owl:DatatypeProperty;
    rdfs:domain :C;
    rdfs:range xsd:integer.
""" 

test_name = sys.argv[1]

dprop = T.dprop
print('test,graph_size,time')
for _ in range(10):

    g = Graph()
    g.parse(io.StringIO(DATA), format='n3')

    for i in range(10):
        d = BNode()
        for j in range(200):
            b = BNode()
            g.add((b, dprop, Literal(j * 10, datatype=XSD.integer)))

    t = time.time()
    owlrl.DeductiveClosure(owlrl.OWLRL_Semantics).expand(g)
    duration = time.time() - t
    print('{},{},{:.6f}'.format(test_name, len(g), duration))

@ashleysommer
Copy link
Collaborator

@wrobell are you done pushing commits to this PR? Let us know when it is ready for review.

@wrobell
Copy link
Contributor Author

wrobell commented Oct 29, 2018

Hi, sorry, I have raised this pull request too early. I will have few more fixes. I will comment once its done.

@ashleysommer
Copy link
Collaborator

@wrobell we've noticed no new commit to this branch since November 7.
Is this ready to review and merge?

@wrobell
Copy link
Contributor Author

wrobell commented Nov 22, 2018

Unfortunately, this still needs work. I hope to have some time to work on it today.

@wrobell
Copy link
Contributor Author

wrobell commented Nov 22, 2018

This pull request is ready. Please review.

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

Successfully merging this pull request may close these issues.

2 participants