Skip to content
This repository was archived by the owner on Apr 4, 2018. It is now read-only.

Schema introspection (_isUniqueObject) should be lazy or flagged #1

Open
chimezie opened this issue Sep 30, 2009 · 1 comment
Open

Comments

@chimezie
Copy link

Currently, any attribute access will triger a call to schema introspection to determine the cardinality of the set returned. This is not efficient for large schema graphs. Ideally, either schema introspection should be a global flag set by the user, or Thing.getattr should just return a generator over RDF objects and leave it up to the user to worry about the possibility of more than one RDF term being yielded

rdflib.util has a first utility method which is very useful when you only want the first item returned by a generator. However, using it with the attribute overrides of Sparta does not avoid the (possibly prohibitive) schema introspection. So, perhaps the use of a method like first renders the value of schema introspection moot (especially when you consider the cost of doing it)?

@mnot
Copy link
Owner

mnot commented Oct 2, 2009

Hi Chimezie,

That makes a certain amount of sense. An alternate approach would be to cache the cardinality of different attributes (since most accesses will be repeats in common usage); have you considered that?

Feel free to fork or contribute patches!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants