-
Notifications
You must be signed in to change notification settings - Fork 560
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
Fix #280: Added container.py for adding container class and seq, alt and bag as it's subclasses #997
Conversation
- Should address RDFLib#357
- Also, fixing batching
- unittest.mock is not available in Python 2.7
Adding container functionality with subclasses rdf:seq, rdf: alt and rdf:bag to RDFLib
update as per comment 1 of pull request
I'm not sure if we have settled on a coding standard, but (mainly) following PEP8 is prudent, e.g. by running code through the pep8 tool. I haven't done so, but I suspect some things'll crop up, e.g. consistently surrounding operators ( |
Updated code as per pep8 standards rdf: Seq correction made in Seq class
@niklasl |
@niklasl |
rdflib/container.py
Outdated
pred_uri = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type' | ||
container_uri = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#' | ||
container_uri += str(self._type) | ||
container = self.uri | ||
self.graph.add((container, URIRef(pred_uri), URIRef(container_uri)))#adding triple corresponding to container type | ||
|
||
# adding triple corresponding to container type | ||
self.graph.add((container, URIRef(pred_uri), URIRef(container_uri))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use from rdflib.namespace import RDF
in the import section, and then use RDF.type
here (preferably directly in the call to self.graph.add
to avoid declaring this once-used pred_uri
variable), and then either use RDF[typee]
, or (IMHO preferably) pass RDF.Bag
in the call from Bag
, RDF.Seq
from Seq
and RDF.Alt
from Alt
.
(Also, I think type_
is preferred over typee
(which sounds like "the thing to be typed". But that's probably nit-picking. It would be good to have a convention for the name of a type in Python though (I commonly use rtype
in Python-code dealing with RDF... Anyone have an opinion on this?)(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@niklasl
I have made the required changes.
@kushagr08 The changes look good, and I'll chime in on this and possibly other pull requests when I can. But I cannot be counted on as an official reviewer or proper representative of RDFLib at this time I'm afraid, as I do this on my spare time and am currently bound to taking care of my daughter who is very ill. |
@niklasl I am making this request since I am contributing to this open-source project as part of a course on Semantic Web at my university ( IIIT Delhi, India ). Therefore, I would really appreciate if I could get quick reviews on a daily basis, so that my work proceeds at a steady pace. |
@kushagr08 I understand. Alas, I'm not sure that anyone has the capacity to assist you as reviewers in such a prompt fashion. Mostly people step up if they can manage the time (or some time, as I did). |
@niklasl All other members of the RDFLib organization are also welcome to join in as per their availability and convenience. Thanking You Sincerely and Best Regards, |
Adding a wrapper for batching add() calls to a Graph
Add requests to the tests_requirements
Improved logo
Signed-off-by: t0b3 <thomas.bettler@gmail.com>
add test with ubuntu 20.04
Add SERVICE clause to documentation
Namespaces improvements
# Conflicts: # rdflib/namespace.py
@nicholascar |
Hi @kushagr08, thanks for making those changes. I'll just see PR #1051 through first, since it removes all Python2 references, and then I'll merge the result into this, test and merge this PR back in. |
Removal of six & styling
…o rdflib.__init__, refered to it in Sphinx docco
I've just enhanced code documentation and indicated in the main Sphinx docs that this class and |
Adding container functionality with subclasses rdf:seq, rdf: alt and rdf:bag to RDFLib. This is in accordance with as proposed by me in the discussion of issue 280 of RDFLib.