# Inverse Queries

Inverse queries search for object's inverse keys that are supplied as an argument to a query. The query flag -i (or --inverse) must also be specified with appropriate query flag arguments. Inverse keys are defined in the templates of the RIPE Database objects. (See section 'RPSL Object Types' for more details.) These templates can be listed by querying the RIPE Database. See section 'Accessing the Object Templates' for more details. See Table 3: Query Flag Arguments to the “-” Query Flag and the Corresponding Inverse Keys

By performing an inverse query, the user requests all objects to be returned from the database that contain the specified query argument in the attribute(s) specified in the query flag arguments.

If you are looking for this... ...then type this in the query interface:
All objects where contact person (or role) is XY-RIPE -i person XY-RIPE
All objects that are protected by XY-MNT -i mnt-by XY-MNT
All objects that have XY-MNT as mnt-lower -i mnt-lower XY-MNT
All objects that have XY-MNT as mnt-routes -i mnt-routes XY-MNT
All objects that have ORG-XYZ-RIPE as their organisation object -i org ORG-XYZ-RIPE
All route/route6 objects that are originated by ASx -i origin ASx

Example:

whois -i admin-c <nic-handle>

will return all objects where the "admin-c:" attribute contains the <nic-handle> specified as the query argument.

You can specify several query flag arguments to request searches against several attributes in objects. If you want to do this, the query flag arguments should be entered as a comma-separated list with no white spaces. All the attributes searched must contain the same type of value. In other words, all the values must be maintainers or nic-handles or one of the other values listed in the appendix section on Supported Queries.

Example:

whois --inverse mb,mnt-lower <mntner name>

will return all objects where the "mnt-by:" or the "mnt-lower:" attributes contain the <mntner name> specified as the query argument.

Example:

An inverse query can be used to search for references to a person or role in objects. To find a person or role you could search for matching "admin-c", "tech-c", "abuse-c", "zone-c" attributes, however you need to specify all attributes separately. Instead you can specify "person" or "pn" to search all such attributes.

whois -i admin-c,tech-c,abuse-c,zone-c <person value>

will return the same results as

whois -i pn <person value> or whois -i person <person value>

Finding the references for a person is very useful when someone leaves the company and you want to delete all the registers from this person. Note that you can also specify a role instead of a person:

whois -i pn <role value>