|
6 | 6 | from citrine._serialization.properties import List as PropertyList |
7 | 7 | from citrine._serialization.properties import Optional as PropertyOptional |
8 | 8 | from citrine._serialization.properties import String, LinkOrElse, Object |
| 9 | +from citrine.resources._default_labels import _inject_default_label_tags |
9 | 10 | from citrine.resources.object_specs import ObjectSpec, ObjectSpecCollection |
10 | 11 | from gemd.entity.attribute.property_and_conditions import PropertyAndConditions |
11 | 12 | from gemd.entity.file_link import FileLink |
@@ -47,6 +48,11 @@ class MaterialSpec( |
47 | 48 | A template bounding the valid values for this material's properties. |
48 | 49 | file_links: List[FileLink], optional |
49 | 50 | Links to associated files, with resource paths into the files API. |
| 51 | + default_labels: List[str], optional |
| 52 | + An optional set of default labels to apply to this material spec. |
| 53 | + Default labels are used to: |
| 54 | + - Populate labels on the ingredient spec, if none are explicitly |
| 55 | + specified, when the material spec is later used in an ingredient spec |
50 | 56 |
|
51 | 57 | """ |
52 | 58 |
|
@@ -75,12 +81,14 @@ def __init__(self, |
75 | 81 | process: Optional[GEMDProcessSpec] = None, |
76 | 82 | properties: Optional[List[PropertyAndConditions]] = None, |
77 | 83 | template: Optional[GEMDMaterialTemplate] = None, |
78 | | - file_links: Optional[List[FileLink]] = None): |
| 84 | + file_links: Optional[List[FileLink]] = None, |
| 85 | + default_labels: Optional[List[str]] = None): |
79 | 86 | if uids is None: |
80 | 87 | uids = dict() |
| 88 | + all_tags = _inject_default_label_tags(tags, default_labels) |
81 | 89 | super(ObjectSpec, self).__init__() |
82 | 90 | GEMDMaterialSpec.__init__(self, name=name, uids=uids, |
83 | | - tags=tags, process=process, properties=properties, |
| 91 | + tags=all_tags, process=process, properties=properties, |
84 | 92 | template=template, file_links=file_links, notes=notes) |
85 | 93 |
|
86 | 94 | def __str__(self): |
|
0 commit comments