PREFIX vivo: <http://vivoweb.org/ontology/core#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>

CONSTRUCT {
    ?advisee <http://purl.obolibrary.org/obo/RO_0000053> _:AdviseeRole .
    _:AdviseeRole <http://purl.obolibrary.org/obo/RO_0000052> ?advisee .
    _:AdviseeRole a vivo:AdviseeRole .
    _:AdviseeRole vivo:relatedBy ?advisingRelationship .
    ?advisingRelationship vivo:relates _:AdviseeRole .
    ?advisingRelationship vivo:relates ?advisee .
    ?advisee vivo:relatedBy ?advisingRelationship .
} WHERE {
    ?advisee vivo:adviseeIn ?advisingRelationship .
    FILTER NOT EXISTS {
        ?advisee <http://purl.obolibrary.org/obo/RO_0000053> ?adviseeRoleNode .
        ?adviseeRoleNode vivo:relatedBy ?advisingRelationship .
    }
}
