Same as rdf_reachable/3, but in addition, MaxD limits the number
of edges expanded and D is unified with the `distance' between
Subject and Object. Distance 0 means Subject and Object are the
same resource. MaxD can be the constant infinite to impose no
distance-limit.