Is there a way to export breadcrumb of asset for a given domain in bulk ?
Hello,
I’m looking for a way to export the Breadcrumb of all assets for a given domain using workflows. I saw there is a javaapi to get the breadcrumb by passing the asset id. If we want to leverage the breadcrumb java api should we make separate/multiple calls for each assets to get breadcrumb information or is there a way we can export breadcrumb of all the assets for a given domain in one single call ? Please advise.
Thanks.
praveenramkumar
Posted 4 years ago · Edited 1 year ago·Last reply 4 years ago
1 comment
arthurburkhardt
·4 years ago · EditedI don’t think so… The easiest way is probably to build a map of communities/domains yourself.
e.g. in python, given a pandas dataframe that looks like
you can reconstruct the hierarchy with the help of the networkx library (or roll your own recursive algorithm)
net = nx.from_pandas_edgelist(comms, "parent.id", "id", create_using=nx.DiGraph()) comms['breadcrumb'] = comms['id'].apply(lambda x: ' > '.join([comms.loc[y]['name'] for y in nx.shortest_path(net, np.nan, x)[1:]]))Example (comms, doms and assets are pandas dataframesrepresenting communities, domains and assets)
import networkx as nx net = nx.from_pandas_edgelist(comms, "parent.id", "id", create_using=nx.DiGraph()) comms['breadcrumb'] = comms['id'].apply(lambda x: ' > '.join([comms.loc[y]['name'] for y in nx.shortest_path(net, np.nan, x)[1:]])) doms['breadcrumb'] = doms['community.id'].map(comms['breadcrumb']) + " > " + doms['name'] assets['breadcrumb'] = assets['domain.id'].map(doms['breadcrumb'])Which gives the following resuls (in this case, for over 14k assets in a matter of seconds):