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

Added DateTime arithmetic operations for Literals - Extension of #629 #1089

Closed

Conversation

Akash-Sharma-1
Copy link
Contributor

This PR adds some additional set of operations - dateTime / date / time subtraction to the Literals of RDFLib. This is an extension to the #629 issue of adding these operations to Literals in addition to the SPARQL queries.

@coveralls
Copy link

coveralls commented May 28, 2020

Coverage Status

Coverage increased (+0.008%) to 75.773% when pulling 936306e on Akash-Sharma-1:dateTime-Sub-operations into 037ea51 on RDFLib:master.

@JervenBolleman
Copy link
Contributor

@Akash-Sharma-1 thank you! it looks correct to me.

@nicholascar
Copy link
Member

Hi @Akash-Sharma-1, this looks great but, what happens for other Literals that are not dates? Your function returns None fro all non dates but since you've declared a __sub__ function in term, we (maintainers) are concerned that this might override normal Python subtraction.

Can you please add a couple of tests to test_literal to show that this function doesn't bread integer, float and decimal subtraction? If so, we will merge in.

@FlorianLudwig
Copy link
Contributor

@nicholascar I would suggest to throw a TypeError if subtraction is not supported for the types in question. That's what python does for other types, e.g. subtracting two strings.

@ghost ghost mentioned this pull request Apr 25, 2022
8 tasks
aucampia added a commit that referenced this pull request May 16, 2022
rebased PR #1089 from 2 yrs ago, adding DateTime arithmetic operations for Literals - an extension of #629, additional tests of numerics added, as requested in #1089 (comment) and limited modernisation of `test/test_literal/test_literal.py`

Co-authored-by: Iwan Aucamp <[email protected]>
@ghost
Copy link

ghost commented Jun 4, 2022

Rebased and committed in #1870

@ghost ghost closed this Jun 4, 2022
This pull request was closed.
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.

5 participants