How can I get the path length between two nodes? For example, given the organizational hierarchy, how can I determine how far apart are the parents and the descendant organization? Consider the following scenarios:
OrgA -hasSubOrganization-> OrgB, OrgC
This is a very simplified case when I want to get all the immediate suborganizations of an entity. Therefore, the path length is 1.
OrgA -> OrgB -> OrgC
or general case
OrgA -> OrgB - - - - - - - - OrgZ
I want to cross the graph recursively and find each organization belonging to another organization through the hasSubOrganization property. To get all recursive sub-organizations, I can use property paths , for example, the + operator:
OrgA hasSubOrganization+ ?subOrg
This will give me all the suborganizations right down to the leaf nodes. But my ultimate goal is to create an organization hierarchy, but information about the "number of nodes / steps / levels / hops from suborganization" is lost. This means that I cannot recreate the org structure for visualization.
How can I capture information about the "number of nodes" in addition to the name of the suborganization?
rdf jena sparql
Chantz
source share