-
Notifications
You must be signed in to change notification settings - Fork 546
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
Suggested method on Graph for BNode Closure #123
Comments
I think I agree with drew that also getting all triples about subject would be useful. (bnodes as predicates are forbidding in RDF, for some arbitrary reason) Also, the method should be rewritten to recurse with generators, and only create a graph at top level. Now many graph object may be created. It would be nice to implement using the transitiveClosure method, but 1. it breaks on loops (#206), and it does not let you have separate conditions for including the triple and recursing. |
should we maybe also name this Concise Bounded Description? |
I vote for supporting any kind of node in all positions of the triple (i.e. supporting generalized RDF triples) whenever it does not increase complexity too much. For example, reasoners may produce such triples. The in-memory store supports them. Maybe it should be configurable in which position blank nodes are followed? I too, would prefer iterators. Unfortunately, it does not seem straight forward to implement, as you must somehow remember which nodes you have already visited. Another option is to create the graph on the toplevel and hand it down the recursive calls. |
I like the |
@gjhiggins we are likely to implement a version of this as a precursor to facilitating SPARQL |
I don't have any comments on this. My role here was simply one of housekeeping - in this instance, transcribing a suggestion made in the group mailing list. |
Thanks for letting us know Graham! |
Implemented in #1502 |
wwai...@gmail.com, 2010-07-22T16:05:40.000Z
Comment 1 by wwai...@gmail.com
Supporting methods:
Comment 2 by wwai...@gmail.com
improved original function that won't loop in case of silly bnode loops (thanks gromgull):
Comment 3 by wwai...@gmail.com
This code comes from:
Comment 4 by vfaronov
Graphs support the
in
operator, soexists
is unnecessary, I believe.Comment 5 by drewpca
one() should raise an exception instead of returning None. The functionality is the same either way (though the exception can include a helpful message), but with None, every caller is obligated to check the type of the output. Forgetting to do so will lead to TypeErrors later on (when someone tries to unpack the None value).
'bnc' should have a descriptive name, possibly 'bnode_closure' or 'bnode_closure_graph'. Why doesn't a subject (or predicate) bnode cause recursion? (None, FOAF.name, Literal("Drew")) might be the IFP that I use to find a person, and wouldn't bnode_closure be the right way to get the other triples about that person? If I'm getting the use case wrong, please revise the docstring to explain why only objects are checked for BNode.
The text was updated successfully, but these errors were encountered: