Titan doesn't have a way to define rules in the way you are describing them. Titan expects you to handle that kind of logic in your application. More specifically, implement both of those rule examples as Gremlin traversals and expose those traversals as functions in your application. This article might help provide some inspiration:
http://thinkaurelius.com/2013/07/25/developing-a-domain-specific-language-in-gremlin/