pyegeria 5.4.3__py3-none-any.whl → 5.4.3.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- commands/cat/debug_log.2025-08-30_21-15-48_528443.log.zip +0 -0
- commands/cat/debug_log.log +9410 -1431
- commands/cat/dr_egeria_command_help.py +110 -7
- md_processing/__init__.py +6 -11
- md_processing/data/commands.json +150 -6
- md_processing/dr_egeria.py +7 -6
- md_processing/dr_egeria_inbox/glossary_test1.md +18 -3
- md_processing/dr_egeria_inbox/product.md +11 -11
- md_processing/dr_egeria_outbox/friday/processed-2025-08-31 20:57-glossary_test1.md +400 -0
- md_processing/dr_egeria_outbox/monday/processed-2025-09-01 09:26-product.md +210 -0
- md_processing/md_commands/glossary_commands.py +84 -459
- md_processing/md_commands/product_manager_commands.py +10 -7
- md_processing/md_commands/project_commands.py +2 -2
- md_processing/md_processing_utils/common_md_proc_utils.py +9 -6
- md_processing/md_processing_utils/common_md_utils.py +15 -13
- md_processing/md_processing_utils/extraction_utils.py +12 -3
- md_processing/md_processing_utils/md_processing_constants.py +5 -4
- pyegeria/__init__.py +2 -1
- pyegeria/config.py +179 -1
- pyegeria/glossary_manager.py +2 -2
- {pyegeria-5.4.3.dist-info → pyegeria-5.4.3.1.dist-info}/METADATA +1 -1
- {pyegeria-5.4.3.dist-info → pyegeria-5.4.3.1.dist-info}/RECORD +25 -22
- {pyegeria-5.4.3.dist-info → pyegeria-5.4.3.1.dist-info}/LICENSE +0 -0
- {pyegeria-5.4.3.dist-info → pyegeria-5.4.3.1.dist-info}/WHEEL +0 -0
- {pyegeria-5.4.3.dist-info → pyegeria-5.4.3.1.dist-info}/entry_points.txt +0 -0
@@ -14,8 +14,8 @@ from rich.markdown import Markdown
|
|
14
14
|
from md_processing.md_processing_utils.common_md_proc_utils import (parse_upsert_command, parse_view_command,
|
15
15
|
sync_collection_memberships)
|
16
16
|
from md_processing.md_processing_utils.common_md_utils import update_element_dictionary, set_update_body, \
|
17
|
-
set_element_status_request_body,
|
18
|
-
set_rel_request_body, set_create_body, set_object_classifications, set_product_body
|
17
|
+
set_element_status_request_body, set_element_prop_body, set_delete_request_body, set_rel_request_body, set_peer_gov_def_request_body, \
|
18
|
+
set_rel_request_body, set_create_body, set_object_classifications, set_product_body, set_rel_prop_body
|
19
19
|
|
20
20
|
from md_processing.md_processing_utils.extraction_utils import (extract_command_plus, update_a_command)
|
21
21
|
from md_processing.md_processing_utils.md_processing_constants import (load_commands, ERROR)
|
@@ -156,7 +156,7 @@ def process_glossary_upsert_command(egeria_client: EgeriaTech, txt: str, directi
|
|
156
156
|
obj = "Glossary"
|
157
157
|
# Set the property body for a glossary collection
|
158
158
|
#
|
159
|
-
prop_body =
|
159
|
+
prop_body = set_element_prop_body(obj, qualified_name, attributes)
|
160
160
|
prop_body["languager"] = attributes.get('Language', {}).get('value', None)
|
161
161
|
prop_body["usage"] = attributes.get('Usage', {}).get('value', None)
|
162
162
|
|
@@ -527,7 +527,7 @@ def process_term_upsert_command(egeria_client: EgeriaTech, txt: str, directive:
|
|
527
527
|
obj = "GlossaryTerm"
|
528
528
|
# Set the property body for a glossary collection
|
529
529
|
#
|
530
|
-
prop_body =
|
530
|
+
prop_body = set_element_prop_body(obj, qualified_name, attributes)
|
531
531
|
prop_body["aliases"] = attributes.get('Aliases', {}).get('value', None)
|
532
532
|
prop_body["summary"] = attributes.get('Summary', {}).get('value', None)
|
533
533
|
prop_body["examples"] = attributes.get('Examples', {}).get('value', None)
|
@@ -615,460 +615,85 @@ def process_term_upsert_command(egeria_client: EgeriaTech, txt: str, directive:
|
|
615
615
|
else:
|
616
616
|
return None
|
617
617
|
|
618
|
-
def
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
#
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
#
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
618
|
+
def process_link_term_term_relationship_command(egeria_client: EgeriaTech, txt: str,
|
619
|
+
directive: str = "display") -> Optional[str]:
|
620
|
+
""" Relate two terms through the specified relationship. ."""
|
621
|
+
command, object_type, object_action = extract_command_plus(txt)
|
622
|
+
print(Markdown(f"# {command}\n"))
|
623
|
+
|
624
|
+
parsed_output = parse_view_command(egeria_client, object_type, object_action, txt, directive)
|
625
|
+
|
626
|
+
print(Markdown(parsed_output['display']))
|
627
|
+
|
628
|
+
logger.debug(json.dumps(parsed_output, indent=4))
|
629
|
+
|
630
|
+
attributes = parsed_output['attributes']
|
631
|
+
term1_guid = attributes.get('Term 1', {}).get('guid', None)
|
632
|
+
term1_qname = attributes.get('Term 1', {}).get('qualified_name', None)
|
633
|
+
term2_guid = attributes.get('Term 2', {}).get('guid', None)
|
634
|
+
term2_qname = attributes.get('Term 2', {}).get('qualified_name', None)
|
635
|
+
relationship = attributes.get('Relationship', {}).get('value', None)
|
636
|
+
expression = attributes.get('Expression', {}).get('value', None)
|
637
|
+
confidence = attributes.get('Confidence', {}).get('value', None)
|
638
|
+
status = attributes.get('Status', {}).get('value', None)
|
639
|
+
steward = attributes.get('Steward', {}).get('value', None)
|
640
|
+
source = attributes.get('Source', {}).get('value', None)
|
641
|
+
|
642
|
+
|
643
|
+
|
644
|
+
valid = parsed_output['valid']
|
645
|
+
exists = term1_guid is not None and term2_guid is not None
|
646
|
+
|
647
|
+
if not (valid and exists):
|
648
|
+
valid = False
|
649
|
+
|
650
|
+
if directive == "display":
|
651
|
+
return None
|
652
|
+
elif directive == "validate":
|
653
|
+
if valid:
|
654
|
+
print(Markdown(f"==> Validation of {command} completed successfully!\n"))
|
655
|
+
else:
|
656
|
+
msg = f"Validation failed for object_action `{command}`\n"
|
657
|
+
return valid
|
658
|
+
|
659
|
+
elif directive == "process":
|
660
|
+
prop_body = set_rel_prop_body("GlossaryTerm", attributes)
|
661
|
+
prop_body['expression'] = expression
|
662
|
+
prop_body['confidence'] = confidence
|
663
|
+
prop_body['status'] = status
|
664
|
+
prop_body['steward'] = steward
|
665
|
+
prop_body['source'] = source
|
666
|
+
|
667
|
+
try:
|
668
|
+
|
669
|
+
if not valid: # First validate the term before we process it
|
670
|
+
return None
|
671
|
+
|
672
|
+
if object_action == "Link":
|
673
|
+
if not exists:
|
674
|
+
msg = f" Term `{term1_guid}` or {term2_guid} does not exist! "
|
675
|
+
logger.error(msg)
|
676
|
+
return None
|
677
|
+
else:
|
678
|
+
print(Markdown(
|
679
|
+
f"==> Validation of {command} completed successfully! Proceeding to apply the changes.\n"))
|
680
|
+
body = set_rel_request_body(relationship, prop_body)
|
681
|
+
body['properties'] = prop_body
|
682
|
+
body = body_slimmer(body)
|
683
|
+
# todo removing body for now since don't know relationship properties class
|
684
|
+
egeria_client.add_relationship_between_terms(term1_guid, term2_guid, relationship)
|
685
|
+
logger.success(f"Created `{relationship}` relationship between `{term1_qname}` and `{term2_qname}`\n\n___")
|
686
|
+
update_md = (f"\n\n# Update Term-Term Relationship\n\n## Term 1 Name:\n\n{term1_qname}"
|
687
|
+
f"\n\n## Term 2 Name\n\n{term2_qname}\n\n## Term Relationship:\n\n{relationship}")
|
688
|
+
return update_md
|
689
|
+
|
690
|
+
|
691
|
+
except Exception as e:
|
692
|
+
print(f"{ERROR}Error performing {command}: {e}")
|
693
|
+
print_basic_exception(e)
|
694
|
+
return None
|
695
|
+
return None
|
696
|
+
else:
|
697
|
+
return None
|
676
698
|
|
677
699
|
|
678
|
-
def process_term_list_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
|
679
|
-
pass
|
680
|
-
# """ List terms as a markdown table. Filter based on optional search string. """
|
681
|
-
# set_debug_level(directive)
|
682
|
-
# valid = True
|
683
|
-
# command = extract_command(txt)
|
684
|
-
# print(Markdown(f"# {command}\n"))
|
685
|
-
#
|
686
|
-
# search_string = process_simple_attribute(txt, SEARCH_LABELS)
|
687
|
-
# if search_string is None:
|
688
|
-
# search_string = '*'
|
689
|
-
# print(Markdown(f"{pre_command} `{command}` with search string:`{search_string}` with directive: `{directive}`"))
|
690
|
-
#
|
691
|
-
# glossary = process_simple_attribute(txt, ['Glossary', 'In Glossary', "Glossary Name"])
|
692
|
-
# if glossary is not None:
|
693
|
-
# _, glossary_guid, _, glossary_exists = get_element_by_name(egeria_client, "Glossary", glossary)
|
694
|
-
# msg = f"Found glossary `{glossary}` with GUID {glossary_guid}"
|
695
|
-
# print_msg(INFO, msg, debug_level)
|
696
|
-
# else:
|
697
|
-
# glossary_guid = None
|
698
|
-
# msg = f"No glossary found"
|
699
|
-
# print_msg(INFO, msg, debug_level)
|
700
|
-
#
|
701
|
-
# output_format = process_simple_attribute(txt, OUTPUT_LABELS)
|
702
|
-
# if output_format is None:
|
703
|
-
# output_format = "LIST"
|
704
|
-
# elif output_format not in ELEMENT_OUTPUT_FORMATS:
|
705
|
-
# valid = False
|
706
|
-
# print_msg(ERROR, f"Invalid output format: `{output_format}`", debug_level)
|
707
|
-
#
|
708
|
-
# request_display = (f"\n\t* Search String: {search_string}\n\t* Glossary: {glossary}\n\t* Output Format: "
|
709
|
-
# f"{output_format}\n")
|
710
|
-
#
|
711
|
-
# if directive == "display":
|
712
|
-
# print(Markdown(request_display))
|
713
|
-
# return None
|
714
|
-
# elif directive == "validate":
|
715
|
-
# print(Markdown(request_display))
|
716
|
-
# return valid
|
717
|
-
# elif directive == "process":
|
718
|
-
# try:
|
719
|
-
# print(Markdown(request_display))
|
720
|
-
# if not valid: # First validate the term before we process it
|
721
|
-
# return None
|
722
|
-
#
|
723
|
-
# term_list_md = f"\n# Term List for search string: `{search_string}`\n\n"
|
724
|
-
# if output_format == "DICT":
|
725
|
-
# struct = egeria_client.find_glossary_terms(search_string, glossary_guid, output_format=output_format)
|
726
|
-
# term_list_md += f"```{json.dumps(struct, indent=4)}```\n"
|
727
|
-
# else:
|
728
|
-
# term_list_md += egeria_client.find_glossary_terms(search_string, glossary_guid,
|
729
|
-
# output_format=output_format)
|
730
|
-
# print_msg("ALWAYS", f"Wrote Term List for search string: `{search_string}`", debug_level)
|
731
|
-
#
|
732
|
-
# return term_list_md
|
733
|
-
#
|
734
|
-
# md_table = egeria_client.find_glossary_terms(search_string, glossary_guid, output_format=output_format)
|
735
|
-
#
|
736
|
-
# print_msg("ALWAYS", f"Wrote Term list for search string `{search_string}`", debug_level)
|
737
|
-
# return md_table
|
738
|
-
#
|
739
|
-
# except Exception as e:
|
740
|
-
# print(f"{ERROR}Error performing {command}: {e}")
|
741
|
-
# console.print_exception(show_locals=True)
|
742
|
-
# return None
|
743
|
-
# else:
|
744
|
-
# return None
|
745
|
-
#
|
746
|
-
#
|
747
|
-
def process_category_list_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
|
748
|
-
pass
|
749
|
-
# """ List terms as a markdown table. Filter based on optional search string. """
|
750
|
-
# set_debug_level(directive)
|
751
|
-
# valid = True
|
752
|
-
# command = extract_command(txt)
|
753
|
-
# print(Markdown(f"# {command}\n"))
|
754
|
-
#
|
755
|
-
# search_string = process_simple_attribute(txt, SEARCH_LABELS, "INFO")
|
756
|
-
# if search_string is None:
|
757
|
-
# search_string = '*'
|
758
|
-
# print(Markdown(f"{pre_command} `{command}` with search string:`{search_string}` with directive: `{directive}`"))
|
759
|
-
#
|
760
|
-
# output_format = process_simple_attribute(txt, OUTPUT_LABELS, "INFO")
|
761
|
-
# if output_format is None:
|
762
|
-
# output_format = "LIST"
|
763
|
-
# elif output_format not in ELEMENT_OUTPUT_FORMATS:
|
764
|
-
# valid = False
|
765
|
-
# print_msg(ERROR, f"Invalid output format: `{output_format}`", debug_level)
|
766
|
-
#
|
767
|
-
# request_display = f"\n\t* Search String: {search_string}\n\t* Output Format: {output_format}\n"
|
768
|
-
#
|
769
|
-
# if directive == "display":
|
770
|
-
# print(Markdown(request_display))
|
771
|
-
# return None
|
772
|
-
# elif directive == "validate":
|
773
|
-
# print(Markdown(request_display))
|
774
|
-
# return valid
|
775
|
-
# elif directive == "process":
|
776
|
-
# try:
|
777
|
-
# print(Markdown(request_display))
|
778
|
-
# if not valid: # First validate the term before we process it
|
779
|
-
# return None
|
780
|
-
#
|
781
|
-
# cat_list_md = f"\n# Category List for search string: `{search_string}`\n\n"
|
782
|
-
# if output_format == "DICT":
|
783
|
-
# struct = egeria_client.find_glossary_categories(search_string, output_format=output_format)
|
784
|
-
# cat_list_md += f"```{json.dumps(struct, indent=4)}```\n"
|
785
|
-
# else:
|
786
|
-
# cat_list_md += egeria_client.find_glossary_categories(search_string, output_format=output_format)
|
787
|
-
# print_msg("ALWAYS", f"Wrote Category List for search string: `{search_string}`", debug_level)
|
788
|
-
#
|
789
|
-
# return cat_list_md
|
790
|
-
#
|
791
|
-
# except Exception as e:
|
792
|
-
# print(f"{ERROR}Error performing {command}: {e}")
|
793
|
-
# console.print_exception(show_locals=True)
|
794
|
-
# return None
|
795
|
-
# else:
|
796
|
-
#
|
797
|
-
# return None
|
798
|
-
#
|
799
|
-
#
|
800
|
-
def process_glossary_structure_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
|
801
|
-
pass
|
802
|
-
# """ List terms as a markdown table. Filter based on optional search string. """
|
803
|
-
# set_debug_level(directive)
|
804
|
-
# valid = True
|
805
|
-
# command = extract_command(txt)
|
806
|
-
# print(Markdown(f"# {command}\n"))
|
807
|
-
#
|
808
|
-
# known_glossary_guid = ""
|
809
|
-
#
|
810
|
-
# glossary_name = process_simple_attribute(txt, GLOSSARY_NAME_LABELS, "ERROR")
|
811
|
-
#
|
812
|
-
# _, known_glossary_guid, valid, _ = process_element_identifiers(egeria_client, "Glossary", GLOSSARY_NAME_LABELS, txt,
|
813
|
-
# EXISTS_REQUIRED, None)
|
814
|
-
#
|
815
|
-
# print(Markdown(f"{pre_command} `{command}` for glossary:`{glossary_name}` with directive: `{directive}`"))
|
816
|
-
#
|
817
|
-
# output_format = process_simple_attribute(txt, OUTPUT_LABELS, "INFO")
|
818
|
-
# if output_format is None:
|
819
|
-
# output_format = "MD"
|
820
|
-
# elif output_format not in ["DICT", "LIST", "MD"]:
|
821
|
-
# valid = False
|
822
|
-
# print_msg(ERROR, f"Invalid output format: `{output_format}`", debug_level)
|
823
|
-
#
|
824
|
-
# request_display = f"\n\t* Glossary name: {glossary_name}\n\t* Output Format: {output_format}\n"
|
825
|
-
#
|
826
|
-
# if directive == "display":
|
827
|
-
# print(Markdown(request_display))
|
828
|
-
# return None
|
829
|
-
# elif directive == "validate":
|
830
|
-
# print(Markdown(request_display))
|
831
|
-
# return str(valid)
|
832
|
-
# elif directive == "process":
|
833
|
-
# try:
|
834
|
-
# print(Markdown(request_display))
|
835
|
-
# if not valid: # First validate the term before we process it
|
836
|
-
# return None
|
837
|
-
#
|
838
|
-
# glossary_structure_md = f"\n# Glossary Structure for `{glossary_name}`\n\n"
|
839
|
-
# if output_format == "DICT":
|
840
|
-
# struct = egeria_client.get_glossary_category_structure(known_glossary_guid, output_format=output_format)
|
841
|
-
# glossary_structure_md += f"```{json.dumps(struct, indent=4)}```\n"
|
842
|
-
# else:
|
843
|
-
# glossary_structure_md += egeria_client.get_glossary_category_structure(known_glossary_guid,
|
844
|
-
# output_format=output_format)
|
845
|
-
# print_msg("ALWAYS", f"Wrote Glossary Structure for glossary: `{glossary_name}`", debug_level)
|
846
|
-
#
|
847
|
-
# return glossary_structure_md
|
848
|
-
#
|
849
|
-
# except Exception as e:
|
850
|
-
# print(f"{ERROR}Error performing {command}: {e}")
|
851
|
-
# console.print_exception(show_locals=True)
|
852
|
-
# return None
|
853
|
-
# else:
|
854
|
-
# return None
|
855
|
-
#
|
856
|
-
#
|
857
|
-
def process_glossary_list_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
|
858
|
-
pass
|
859
|
-
# """ List terms as a markdown table. Filter based on optional search string. """
|
860
|
-
# set_debug_level(directive)
|
861
|
-
# valid = True
|
862
|
-
# command = extract_command(txt)
|
863
|
-
# print(Markdown(f"# {command}\n"))
|
864
|
-
#
|
865
|
-
# search_string = process_simple_attribute(txt, SEARCH_LABELS, "INFO")
|
866
|
-
# if search_string is None:
|
867
|
-
# search_string = '*'
|
868
|
-
# print(Markdown(f"{pre_command} `{command}` with search string:`{search_string}` with directive: `{directive}`"))
|
869
|
-
# if search_string is None:
|
870
|
-
# search_string = '*'
|
871
|
-
#
|
872
|
-
# output_format = process_simple_attribute(txt, OUTPUT_LABELS, "INFO")
|
873
|
-
# if output_format is None:
|
874
|
-
# output_format = "LIST"
|
875
|
-
# elif output_format not in ELEMENT_OUTPUT_FORMATS:
|
876
|
-
# valid = False
|
877
|
-
# print_msg(ERROR, f"Invalid output format: `{output_format}`", debug_level)
|
878
|
-
#
|
879
|
-
# request_display = f"\n\t* Search String: {search_string}\n\t* Output Format: {output_format}\n"
|
880
|
-
#
|
881
|
-
# if directive == "display":
|
882
|
-
# print(request_display)
|
883
|
-
# return None
|
884
|
-
# elif directive == "validate":
|
885
|
-
# print(request_display)
|
886
|
-
# return valid
|
887
|
-
# elif directive == "process":
|
888
|
-
# try:
|
889
|
-
# print(request_display)
|
890
|
-
# if not valid: # First validate the term before we process it
|
891
|
-
# return None
|
892
|
-
#
|
893
|
-
# glossary_list_md = f"\n# Glossary List for `{search_string}`\n\n"
|
894
|
-
# if output_format == "DICT":
|
895
|
-
# struct = egeria_client.find_glossaries(search_string, output_format=output_format)
|
896
|
-
# glossary_list_md += f"```{json.dumps(struct, indent=4)}```\n"
|
897
|
-
# else:
|
898
|
-
# glossary_list_md += egeria_client.find_glossaries(search_string, output_format=output_format)
|
899
|
-
# print_msg("ALWAYS", f"Wrote Glossary List for search string: `{search_string}`", debug_level)
|
900
|
-
#
|
901
|
-
# return glossary_list_md
|
902
|
-
#
|
903
|
-
# except Exception as e:
|
904
|
-
# print(f"{ERROR}Error performing {command}: {e}")
|
905
|
-
# console.print_exception(show_locals=True)
|
906
|
-
# return None
|
907
|
-
# else:
|
908
|
-
# return None
|
909
|
-
#
|
910
|
-
#
|
911
|
-
def process_term_details_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
|
912
|
-
pass
|
913
|
-
# """ List terms as a markdown table. Filter based on optional search string. """
|
914
|
-
# set_debug_level(directive)
|
915
|
-
# valid = True
|
916
|
-
# command = extract_command(txt)
|
917
|
-
# print(Markdown(f"# {command}\n"))
|
918
|
-
# object_type = command.split(' ')[1].strip()
|
919
|
-
# object_action = command.split(' ')[0].strip()
|
920
|
-
#
|
921
|
-
# term_identifier = process_simple_attribute(txt, TERM_NAME_LABELS, "ERROR")
|
922
|
-
#
|
923
|
-
# print(Markdown(f"{pre_command} `{command}` for term:`{term_identifier}` with directive: `{directive}`"))
|
924
|
-
#
|
925
|
-
# output_format = process_simple_attribute(txt, OUTPUT_LABELS, "INFO")
|
926
|
-
# if output_format is None:
|
927
|
-
# output_format = "REPORT"
|
928
|
-
# else:
|
929
|
-
# output_format = output_format.upper()
|
930
|
-
#
|
931
|
-
# if output_format not in ["DICT", "REPORT"]:
|
932
|
-
# valid = False
|
933
|
-
# print_msg(ERROR, f"Invalid output format: `{output_format}`", debug_level)
|
934
|
-
#
|
935
|
-
# request_display = f"\n\t* Term Identifier: {term_identifier}\n\t* Output Format {output_format}"
|
936
|
-
#
|
937
|
-
# if directive == "display":
|
938
|
-
# print(request_display)
|
939
|
-
# return None
|
940
|
-
# elif directive == "validate":
|
941
|
-
# print(request_display)
|
942
|
-
# return valid
|
943
|
-
# elif directive == "process":
|
944
|
-
# try:
|
945
|
-
# print(request_display)
|
946
|
-
# if not valid: # First validate the term before we process it
|
947
|
-
# return None
|
948
|
-
# output = egeria_client.get_term_details(term_identifier, output_format=output_format)
|
949
|
-
# if output_format == "DICT":
|
950
|
-
# output = f"```{json.dumps(output, indent=4)}```"
|
951
|
-
# print_msg("ALWAYS", f"Wrote Term Details for term: `{term_identifier}`", debug_level)
|
952
|
-
#
|
953
|
-
# return output
|
954
|
-
#
|
955
|
-
# except Exception as e:
|
956
|
-
# print(f"{ERROR}Error performing {command}: {e}")
|
957
|
-
# console.print_exception(show_locals=True)
|
958
|
-
# return None
|
959
|
-
# else:
|
960
|
-
# return None
|
961
|
-
#
|
962
|
-
#
|
963
|
-
def process_term_history_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
|
964
|
-
pass
|
965
|
-
# """ List terms as a markdown table. Filter based on optional search string. """
|
966
|
-
# set_debug_level(directive)
|
967
|
-
# valid = True
|
968
|
-
# command = extract_command(txt)
|
969
|
-
# print(Markdown(f"# {command}\n"))
|
970
|
-
# object_type = command.split(' ')[1].strip()
|
971
|
-
# object_action = command.split(' ')[0].strip()
|
972
|
-
#
|
973
|
-
# element_labels = TERM_NAME_LABELS
|
974
|
-
# element_labels.append('Display Name')
|
975
|
-
#
|
976
|
-
# term_name = process_simple_attribute(txt, element_labels, "ERROR")
|
977
|
-
#
|
978
|
-
# known_q_name, known_guid, valid, term_exists = process_element_identifiers(egeria_client, object_type,
|
979
|
-
# element_labels, txt, object_action, )
|
980
|
-
#
|
981
|
-
# print(Markdown(f"{pre_command} `{command}` for term:`{term_name}` with directive: `{directive}`"))
|
982
|
-
#
|
983
|
-
# output_format = process_simple_attribute(txt, OUTPUT_LABELS, "INFO")
|
984
|
-
# if output_format is None:
|
985
|
-
# output_format = "LIST"
|
986
|
-
# elif output_format not in ["DICT", "LIST"]:
|
987
|
-
# valid = False
|
988
|
-
# print_msg(ERROR, f"Invalid output format: `{output_format}`", debug_level)
|
989
|
-
#
|
990
|
-
# request_display = f"\n\t* Term Name: {term_name}\n\t* Output Format {output_format}\n\t* GUID: {known_guid}\n"
|
991
|
-
#
|
992
|
-
# if directive == "display":
|
993
|
-
# print(request_display)
|
994
|
-
# return None
|
995
|
-
# elif directive == "validate":
|
996
|
-
# print(request_display)
|
997
|
-
# return valid
|
998
|
-
# elif directive == "process":
|
999
|
-
# try:
|
1000
|
-
# print(request_display)
|
1001
|
-
# if not valid: # First validate the term before we process it
|
1002
|
-
# return None
|
1003
|
-
# term_history_md = f"\n# Term History for `{term_name}`\n\n"
|
1004
|
-
# if output_format == "DICT":
|
1005
|
-
# struct = egeria_client.list_term_revision_history(known_guid, output_format=output_format)
|
1006
|
-
# term_history_md += f"```{json.dumps(struct, indent=4)}```\n"
|
1007
|
-
# else:
|
1008
|
-
# term_history_md += egeria_client.list_full_term_history(known_guid, output_format)
|
1009
|
-
# print_msg("ALWAYS", f"Wrote Term History for term `{term_name}`", debug_level)
|
1010
|
-
#
|
1011
|
-
# return term_history_md
|
1012
|
-
#
|
1013
|
-
# except Exception as e:
|
1014
|
-
# print(f"{ERROR}Error performing {command}: {e}")
|
1015
|
-
# console.print_exception(show_locals=True)
|
1016
|
-
# return None
|
1017
|
-
# else:
|
1018
|
-
# return None
|
1019
|
-
#
|
1020
|
-
#
|
1021
|
-
def process_term_revision_history_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
|
1022
|
-
pass
|
1023
|
-
# """ List term revision history as a markdown table or list."""
|
1024
|
-
# set_debug_level(directive)
|
1025
|
-
# valid = True
|
1026
|
-
# command = extract_command(txt)
|
1027
|
-
# print(Markdown(f"# {command}\n"))
|
1028
|
-
# object_type = command.split(' ')[1].strip()
|
1029
|
-
# object_action = command.split(' ')[0].strip()
|
1030
|
-
# known_q_name = None
|
1031
|
-
# known_guid = None
|
1032
|
-
#
|
1033
|
-
# element_labels = TERM_NAME_LABELS
|
1034
|
-
#
|
1035
|
-
# term_name = process_simple_attribute(txt, element_labels, "ERROR")
|
1036
|
-
# print(Markdown(f"{pre_command} `{command}` for term: `{term_name}` with directive: `{directive}` "))
|
1037
|
-
#
|
1038
|
-
# known_q_name, known_guid, valid, _ = process_element_identifiers(egeria_client, object_type, element_labels, txt,
|
1039
|
-
# object_action, )
|
1040
|
-
# output_format = process_simple_attribute(txt, ['Output Format', 'Format'], 'INFO')
|
1041
|
-
# if output_format is None:
|
1042
|
-
# output_format = "LIST"
|
1043
|
-
# elif output_format not in ["DICT", "LIST", "MD"]:
|
1044
|
-
# valid = False
|
1045
|
-
# print_msg(ERROR, f"Invalid output format: `{output_format}`", debug_level)
|
1046
|
-
#
|
1047
|
-
# request_display = f"\n\t* Term Name: {term_name}\n\t* Output Format: {output_format}\n"
|
1048
|
-
#
|
1049
|
-
# if directive == "display":
|
1050
|
-
# print(request_display)
|
1051
|
-
# return None
|
1052
|
-
# elif directive == "validate":
|
1053
|
-
# print(request_display)
|
1054
|
-
# return str(valid)
|
1055
|
-
# elif directive == "process":
|
1056
|
-
# try:
|
1057
|
-
# print(request_display)
|
1058
|
-
# if not valid: # First validate the term before we process it
|
1059
|
-
# return None
|
1060
|
-
# term_history_md = f"\n# Term Revision History for `{term_name}`\n\n"
|
1061
|
-
# if output_format == "DICT":
|
1062
|
-
# struct = egeria_client.list_term_revision_history(known_guid, output_format)
|
1063
|
-
# term_history_md += f"```{json.dumps(struct, indent=4)}```\n"
|
1064
|
-
# else:
|
1065
|
-
# term_history_md += egeria_client.list_term_revision_history(known_guid, output_format)
|
1066
|
-
# print_msg("ALWAYS", f"Wrote Term Revision History for term `{term_name}`", debug_level)
|
1067
|
-
# return term_history_md
|
1068
|
-
#
|
1069
|
-
# except Exception as e:
|
1070
|
-
# print(f"{ERROR}Error performing {command}: {e}")
|
1071
|
-
# console.print_exception(show_locals=True)
|
1072
|
-
# return None
|
1073
|
-
# else:
|
1074
|
-
# return None
|
@@ -13,7 +13,7 @@ from rich.markdown import Markdown
|
|
13
13
|
|
14
14
|
from md_processing.md_processing_utils.common_md_proc_utils import (parse_upsert_command, parse_view_command)
|
15
15
|
from md_processing.md_processing_utils.common_md_utils import update_element_dictionary, set_update_body, \
|
16
|
-
set_element_status_request_body,
|
16
|
+
set_element_status_request_body, set_element_prop_body, set_delete_request_body, set_rel_request_body, set_peer_gov_def_request_body, \
|
17
17
|
set_rel_request_body, set_create_body, set_object_classifications, set_product_body
|
18
18
|
|
19
19
|
from md_processing.md_processing_utils.extraction_utils import (extract_command_plus, update_a_command)
|
@@ -208,10 +208,10 @@ def process_collection_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
208
208
|
else:
|
209
209
|
print(Markdown(
|
210
210
|
f"==> Validation of `{command}` completed successfully! Proceeding to apply the changes.\n"))
|
211
|
-
prop_body =
|
211
|
+
prop_body = set_element_prop_body(obj, qualified_name, attributes)
|
212
212
|
|
213
213
|
body = set_update_body(obj, attributes)
|
214
|
-
body['properties'] =
|
214
|
+
body['properties'] = set_element_prop_body(obj, qualified_name, attributes)
|
215
215
|
|
216
216
|
egeria_client.update_collection(guid, body)
|
217
217
|
if status:
|
@@ -237,7 +237,7 @@ def process_collection_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
237
237
|
|
238
238
|
# if this is a root or folder (maybe more in the future), then make sure that the classification is set.
|
239
239
|
body["initialClassifications"] = set_object_classifications(object_type, attributes, ["Folder", "Root Collection"])
|
240
|
-
body["properties"] =
|
240
|
+
body["properties"] = set_element_prop_body(obj, qualified_name, attributes)
|
241
241
|
parent_guid = body.get('parentGuid', None)
|
242
242
|
if parent_guid:
|
243
243
|
body['parentRelationshipTypeName'] = "CollectionMembership"
|
@@ -440,10 +440,10 @@ def process_agreement_upsert_command(egeria_client: EgeriaTech, txt: str, direct
|
|
440
440
|
else:
|
441
441
|
print(Markdown(
|
442
442
|
f"==> Validation of {command} completed successfully! Proceeding to apply the changes.\n"))
|
443
|
-
prop_body =
|
443
|
+
prop_body = set_element_prop_body(obj, qualified_name, attributes)
|
444
444
|
|
445
445
|
body = set_update_body(object_type, attributes)
|
446
|
-
body['properties'] =
|
446
|
+
body['properties'] = set_element_prop_body(object_type, qualified_name, attributes)
|
447
447
|
|
448
448
|
egeria_client.update_agreement(guid, body)
|
449
449
|
# if status is not None and status !={}:
|
@@ -470,7 +470,7 @@ def process_agreement_upsert_command(egeria_client: EgeriaTech, txt: str, direct
|
|
470
470
|
# if this is a root or folder (maybe more in the future), then make sure that the classification is set.
|
471
471
|
body["initialClassifications"] = set_object_classifications(object_type, attributes,
|
472
472
|
["Data Sharing Agreement"])
|
473
|
-
body["properties"] =
|
473
|
+
body["properties"] = set_element_prop_body(obj, qualified_name, attributes)
|
474
474
|
|
475
475
|
guid = egeria_client.create_agreement(body=body)
|
476
476
|
if guid:
|
@@ -944,6 +944,9 @@ def process_attach_subscriber_command(egeria_client: EgeriaTech, txt: str,
|
|
944
944
|
print(Markdown(f"# {command}\n"))
|
945
945
|
|
946
946
|
parsed_output = parse_view_command(egeria_client, object_type, object_action, txt, directive)
|
947
|
+
if parsed_output is None:
|
948
|
+
logger.error(f"Input error in command `{txt}`")
|
949
|
+
return None
|
947
950
|
|
948
951
|
print(Markdown(parsed_output['display']))
|
949
952
|
|
@@ -17,7 +17,7 @@ from rich.markdown import Markdown
|
|
17
17
|
from md_processing.md_processing_utils.common_md_proc_utils import (parse_upsert_command, parse_view_command,
|
18
18
|
sync_collection_memberships)
|
19
19
|
from md_processing.md_processing_utils.common_md_utils import update_element_dictionary, set_update_body, \
|
20
|
-
set_element_status_request_body,
|
20
|
+
set_element_status_request_body, set_element_prop_body, set_delete_request_body, set_rel_request_body, \
|
21
21
|
set_peer_gov_def_request_body, \
|
22
22
|
set_rel_request_body, set_create_body, set_object_classifications, set_product_body, set_rel_request_body_for_type
|
23
23
|
|
@@ -102,7 +102,7 @@ def process_project_upsert_command(egeria_client: EgeriaTech, txt: str, directiv
|
|
102
102
|
|
103
103
|
# Set the property body for a glossary collection
|
104
104
|
#
|
105
|
-
prop_body =
|
105
|
+
prop_body = set_element_prop_body(obj, qualified_name, attributes)
|
106
106
|
prop_body["identifier"] = attributes.get('Identifier', {}).get('value', None)
|
107
107
|
prop_body["mission"] = attributes.get('Mission', {}).get('value', None)
|
108
108
|
prop_body["purposes"] = attributes.get('Purposes', {}).get('value', None)
|