Skip to content

Commit

Permalink
Added dict filters support in demo store
Browse files Browse the repository at this point in the history
  • Loading branch information
MFSY committed Mar 14, 2021
1 parent 7470d5f commit 43e88b0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions kgforge/specializations/stores/demo_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from kgforge.core.commons.execution import not_supported
from kgforge.core.conversions.json import as_json, from_json
from kgforge.core.wrappings.dict import wrap_dict
from kgforge.core.wrappings.paths import create_filters_from_dict


class DemoStore(Store):
Expand Down Expand Up @@ -114,6 +115,8 @@ def search(self, resolvers: Optional[List[Resolver]], *filters, **params) -> Lis
if params:
# TODO DKE-145.
print("DemoStore does not support 'resolving' and 'lookup' parameters for now.")
if filters and isinstance(filters[0], dict):
filters = create_filters_from_dict(filters[0])
conditions = [f"x.{'.'.join(x.path)}.{x.operator}({x.value!r})" for x in filters]
records = self.service.find(conditions)
return [_to_resource(x) for x in records]
Expand Down

0 comments on commit 43e88b0

Please sign in to comment.