First off, you can save people a lot of time if you post a tiny script to create your sample graph, instead of a picture. Something like this:
g.addV("Person").property("Name","Person 1").as("p1").
addV("Person").property("Name","Person 2").as("p2").
addV("Person").property("Name","Person 3").as("p3").
addV("Person").property("Name","Person 4").as("p4").
addV("Skill").property("skillName","MS OFFICE").
property("skillVAL","PASS").as("msoP").
addV("Skill").property("skillName","MS OFFICE").
property("skillVAL","FAIL").as("msoF").
addV("Skill").property("skillName",".NET").
property("skillVAL","PASS").as("net").
addV("Skill").property("skillName","Accounting").
property("skillVAL","FAIL").as("acc").
addV("Skill").property("skillName","Python").
property("skillVAL","PASS").as("py").
addV("Business").property("Name","Random INC").as("rnd").
addE("scored").from("p1").to("msoP").
addE("scored").from("p2").to("net").
addE("scored").from("p2").to("acc").
addE("scored").from("p2").to("py").
addE("scored").from("p3").to("msoP").
addE("scored").from("p4").to("py").
addE("scored").from("p4").to("msoF").
addE("isManagerOf").from("p1").to("p2").
addE("isManagerOf").from("p1").to("p3").
addE("isManagerOf").from("p3").to("p4").
addE("employs").from("rnd").to("p1").
addE("employs").from("rnd").to("p2").
addE("employs").from("rnd").to("p3").
addE("employs").from("rnd").to("p4").iterate()
Now, to get the result in (almost) the exact format you described, your query would look like this:
g.V().hasLabel("Person").as("p").
project("name","skills","orgPath").
by("Name").
by(out("scored").
group().
by("skillName").
by(values("skillVAL"))).
by(__.as("v").
until(select("v").hasLabel("Business")).
repeat(select("v").
coalesce(__.in("isManagerOf"),
__.in("employs")).
project("i","v").
by(loops()).
by().as("iv")).
select(all, "iv").unfold().
order().
by(select("i"), decr).
select("v").values("Name").
fold()).
group().
by(select("name")).
by(select("skills","orgPath")).unfold()
All the group()
ing is unnecessary in my opinion and is really just there to bring the result in the expected format. The only thing that doesn't match your expectation is the orgPath
- it's a list of Strings rather than a single delimited String; that's because TinkerPop doesn't support any String operations (yet).
Anyway, let me emphasize again that the query is only as complex as it is because you wanted to get the result in a very specific format. Without this requirement, the query would only consist of a few projections.
That said, the result of the query above looks like this:
==>Person 1={skills={MS OFFICE=PASS}, orgPath=[Random INC]}
==>Person 2={skills={Accounting=FAIL, .NET=PASS, Python=PASS}, orgPath=[Random INC, Person 1]}
==>Person 3={skills={MS OFFICE=PASS}, orgPath=[Random INC, Person 1]}
==>Person 4={skills={MS OFFICE=FAIL, Python=PASS}, orgPath=[Random INC, Person 1, Person 3]}