Skip to content

SPARQLStore.tiples should not be passing custom parameters through context graph attributes #2056

@aucampia

Description

@aucampia

def triples(self, spo, context=None):

**context** may include three parameter
to refine the underlying query:
* LIMIT: an integer to limit the number of results
* OFFSET: an integer to enable paging of results
* ORDERBY: an instance of Variable('s'), Variable('o') or Variable('p') or, by default, the first 'None' from the given triple

if (
hasattr(context, LIMIT)
or hasattr(context, OFFSET)
or hasattr(context, ORDERBY)
):

For reference, context is the Graph in which the queried triples should occur in.

This approach is not ideal as it passes arguments to a function through the state of another object, one of the side effects of this is that it won't be thread safe, and furthermore it is also awkward to use, and there is no way to pass in these parameters without also passing in a context, so a whole host of the domain of the function is deleted by making it impossible to use with these custom parameters.

There are better ways to achieve the same thing that should be used instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    breaking changeThis involves or proposes breaking RDFLib's public API.enhancementNew feature or requestpluginRelates to a plugin of RDFLibstoreRelated to a store.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions