Skip to content
Snippets Groups Projects
Commit f7f443e56208 authored by Denis Laxalde's avatar Denis Laxalde
Browse files

Handle kwargs in composite_entities_graph

And pass them to composite_schema_graph.
parent 2bed23a2ab76
No related branches found
No related tags found
No related merge requests found
...@@ -82,10 +82,10 @@ ...@@ -82,10 +82,10 @@
yield relation, ends yield relation, ends
def composite_entities_graph(parent): def composite_entities_graph(parent, **kwargs):
"""Yield arcs of a graph of compositely-related entities reachable from """Yield arcs of a graph of compositely-related entities reachable from
`parent` entity. `parent` entity.
An "arc" is a tuple `(child entity, (rtype, role), parent entity)`. An "arc" is a tuple `(child entity, (rtype, role), parent entity)`.
""" """
for (rtype, role), ends in composite_schema_graph(parent._cw.vreg.schema, for (rtype, role), ends in composite_schema_graph(parent._cw.vreg.schema,
...@@ -86,11 +86,12 @@ ...@@ -86,11 +86,12 @@
"""Yield arcs of a graph of compositely-related entities reachable from """Yield arcs of a graph of compositely-related entities reachable from
`parent` entity. `parent` entity.
An "arc" is a tuple `(child entity, (rtype, role), parent entity)`. An "arc" is a tuple `(child entity, (rtype, role), parent entity)`.
""" """
for (rtype, role), ends in composite_schema_graph(parent._cw.vreg.schema, for (rtype, role), ends in composite_schema_graph(parent._cw.vreg.schema,
parent.cw_etype): parent.cw_etype,
**kwargs):
for child_etype in ends: for child_etype in ends:
rset = parent.related(rtype, role=role, targettypes=[child_etype]) rset = parent.related(rtype, role=role, targettypes=[child_etype])
for child in rset.entities(): for child in rset.entities():
yield child, (rtype, neg_role(role)), parent yield child, (rtype, neg_role(role)), parent
...@@ -93,8 +94,8 @@ ...@@ -93,8 +94,8 @@
for child_etype in ends: for child_etype in ends:
rset = parent.related(rtype, role=role, targettypes=[child_etype]) rset = parent.related(rtype, role=role, targettypes=[child_etype])
for child in rset.entities(): for child in rset.entities():
yield child, (rtype, neg_role(role)), parent yield child, (rtype, neg_role(role)), parent
for x in composite_entities_graph(child): for x in composite_entities_graph(child, **kwargs):
yield x yield x
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment