Getting parents' terms of terms tagged into a particular content type nodes This is a bit confusing for me.

I am using Drupal 7 and Views 3.

I have a list of particular content type nodes tagged with a term (from a vocabulary "topic"). Vocabulary "topic" is 2 levels deep and nodes are tagged just with leaf terms. I have those same nodes tagged with another vocabulary ("level" vocabulary).

I'd like to get in a view all parent terms (exactly the term name) from the vocabulary "topic" whose children are tagged into a node which is tagged with a particular level (let's say beginners).

Let me show you an example:

Vocabulary "Level":


Beginners
Intermediate
Advance


Vocabulary "Topic":


Greek philosophy

Introduction to greek philosophy
First stage: Greek
Second stage: Greek

Latin philosophy

Introduction to latin philosophy
First stage: Latin



My content type nodes can be tagged with both vocabularies but in the case of "topic" they are only allowed to be tagged, as I said, with leaf nodes (i.e. Introduction to greek philosophy, first stage:greek, second stage: greek, Introduction to latin philosophy or first stage:latin).

In this context if one particular node  is tagged with "introduction to greek philosophy" and "beginners", I would get "Greek philosophy" on my view. If that same node is not tagged with "beginners" I wouldn't get it on my view.

I know it's a bit complex but I would really appreciate your help and orientation. 

Thanks in advance.
OK, so this solution has many steps, but the good news is that this is possible.

Here's what you need to do in your view:


In your view that lists your nodes, add a relationship to the topic term reference field (called field_topic) in my case.  In the 'Advanced' section, add the 'Content: Topic' field, and rename it if you want in the configuration screen.  As you can see, I did!





Next, add one more relationship (the parent term of this Topic term).  I'm filtering to only see term fields, and choose the 'Taxonomy term: Parent term' option.  Make sure, when you configure this second relationship, to choose that you want the Parent term of the already selected Topic term field.







If you want - at this point you can select the "Taxonomy term: Name" field twice in your fields list (once with the 'Topic term' as the relationship and once with the 'Parent term' as the relationship to see that your two relationship are bringing up the correct terms). 
Finally, you're ready to set up a contextual filter!  What you want is for this view (which I assume is a block view) to pull up only those nodes that share the same topic parent with the current node's topic parent.  Sooooo, in your Contextual filters section (under 'Advanced'), choose the "Taxonomy term: Term ID" option.  Under the 'Relationship' choose, 'Parent topic' (or whatever you named your parent term relationship).  After all, we'll be filtering exactly by that - the term id of the parent of the topic term.
Choose to 'Provide a default' value for this filter when it's not available.  The truth is, we have to get the parent term id from the current node ourselves (I don't know how else to do it).  Choose that we'll provide it with 'PHP Code' and type in the following:

$node = menu_get_object();  // Get current node
$topic_term_id = $node-&gt;field_topic['und'][0]['tid']; // Just gets first topic term
$parents = taxonomy_get_parents($topic_term_id);
reset($parents); // Make sure pointer points to first element
return(key($parents)); // Return first key



Here's what my contextual filter looks like:


Obviously, I'm not really doing many checks in my code to test for the existence of terms, etc, but this should just about get you there.  Let us know if it works.  I just tested it and it works for me!!!