MCPcopy Create free account
hub / github.com/alibaba/GraphScope / _ensure_consistent_label

Function _ensure_consistent_label

python/graphscope/framework/context.py:795–812  ·  view source on GitHub ↗

Ensure the labels in all selectors are same label. Note this method assumes that the selector is valid.

(context_type, selector)

Source from the content-addressed store, hash-verified

793
794
795def _ensure_consistent_label(context_type, selector):
796 """Ensure the labels in all selectors are same label.
797 Note this method assumes that the selector is valid.
798 """
799 if context_type in ("vertex_data", "vertex_property"):
800 return True
801 if context_type in ("labeled_vertex_data", "labeled_vertex_property"):
802 label_set = set()
803 for _, value in selector.items():
804 # The format is x:y or x:y.z
805 label = value.split(":")[1].split(".")[0]
806 if label_set and label not in label_set:
807 raise SyntaxError(
808 f"Found different labels: {label_set.pop()} and {label}."
809 )
810 else:
811 label_set.add(label)
812 return True

Callers 3

to_dataframeMethod · 0.85
to_vineyard_dataframeMethod · 0.85
outputMethod · 0.85

Calls 4

itemsMethod · 0.80
splitMethod · 0.80
addMethod · 0.65
popMethod · 0.45

Tested by

no test coverage detected