from dotenv import load_dotenv, find_dotenv
import avesterra as av
import orchestra.env as env
from utils import (
create_person_entity,
how_to_get_facets_from_entities,
set_person_facets,
set_person_facts,
)
[docs]
def main():
# Initialize connection to AvesTerra server at IP Address
load_dotenv(find_dotenv())
host = env.get_or_raise("AVESTERRA_HOST")
cert_dir = env.get_or_raise("AVESTERRA_CERTIFICATE_DIR_PATH")
auth = env.get_or_raise("AVESTERRA_AUTH", av.AvAuthorization)
av.initialize(server=host, directory=cert_dir, socket_count=2)
# Create the person
john_entity = create_person_entity.create_entity("John Smith", auth=auth)
# Set some facts
set_person_facts.set_person_facts(
john_entity, "John Smith", "101 South Home", "Software Engineer", "IBM", auth
)
# Set the facet on the fact
set_person_facets.set_facet_and_factors(
john_entity, "101 South Home", "101 Work Lane", auth
)
# Show how to get facets
how_to_get_facets_from_entities.examples_of_get_facets_by_retrieve(
entity=john_entity, auth=auth
)
how_to_get_facets_from_entities.examples_of_get_facets_by_brute_force(
entity=john_entity, auth=auth
)
# Show how to get factors
how_to_get_facets_from_entities.examples_of_get_factors_by_retrieve(
entity=john_entity, auth=auth
)
how_to_get_facets_from_entities.examples_of_get_factors_by_brute_force(
entity=john_entity, auth=auth
)
print("")
print("----------------Lookup these Entity IDs in Maestro or avu ----------------")
print(f"john entity: {john_entity}")
print("------------------------------------------------------------------")
av.finalize()
if __name__ == "__main__":
main()