Graph Back Link Queries

Graph back link queries find the objects pointing at a particular object. They are helpful to explore, often complex, relationships. For instance, think the product, component, supplier relationships in a supply chain. Or alternatively, the interconnected and diverse data needs for regulatory compliance.

In TerminusCMS you can use both WOQL and GraphQL to perform graph back link queries. The video shows how to construct these queries in GraphQL. I’ll include it below for those that prefer the written word.

Graph Back Links with GraphQL

Using the cloneable Star Wars project from the TerminusCMS dashboard, we’ll run a graph back link query for the following request –

Show me one person and list the starships they pilot, and then list the films those starships stared in.

				
					query {
  People(limit: 1) {
    label
    _pilot_of_Starship {
      label
      _starship_of_Film {
        label
      }
    }
  }
}
				
			

This brings back the following results in JSON.

				
					{
  "data": {
    "People": [
      {
        "label": "Luke Skywalker",
        "_pilot_of_Starship": [
          {
            "label": "X-wing",
            "_starship_of_Film": [
              {
                "label": "A New Hope"
              },
              {
                "label": "The Empire Strikes Back"
              },
              {
                "label": "Return of the Jedi"
              }
            ]
          },
          {
            "label": "Imperial shuttle",
            "_starship_of_Film": [
              {
                "label": "The Empire Strikes Back"
              },
              {
                "label": "Return of the Jedi"
              }
            ]
          }
        ]
      }
    ]
  }
}
				
			

TerminusCMS makes back link queries very simple to construct

TerminusCMS makes it simple to run graph back link queries as it automatically constructs the syntax from your project’s schema.

It also has some neat features to help, such as autofill and the ability to press Ctrl C to get a list of available prompts for the document class you are querying.  

Look at the GraphQL How-To Guides for more information about querying with GraphQL, or for a more in-depth understanding read our GraphQL Reference Guide.  

What are back link queries useful for?

Here are some examples of how a large business might use back link graph queries in the way you described:

  1. Supply chain management: A large business might use graph backlink queries to track the flow of products and materials through their supply chain. By identifying the components of a finished product and the suppliers who provide those components, they can more easily manage their inventory, optimize their production process, and ensure the timely delivery of goods.

  2. Customer relationship management: A large business might use graph backlink queries to better understand their customers and their buying patterns. By identifying the products or services that customers have purchased in the past, they can more effectively target their marketing efforts and personalize their interactions with individual customers.

  3. Network analysis: A large business might use graph backlink queries to analyze its internal network of employees and teams. By identifying the relationships between different individuals and groups, they can more effectively manage their workforce, streamline communication and collaboration, and identify areas where additional training or resources may be needed.

  4. Asset management: A large business might use graph backlink queries to track the maintenance and repair history of their assets, such as manufacturing equipment or vehicles. By identifying the components of each asset and the maintenance tasks that have been performed, they can more effectively manage their maintenance schedule and avoid costly downtime.

TRY IT OUT

There are many more uses across business and academia. If you want to try, sign up to TerminusCMS for free and clone a project to experiment with. If you get stuck, find us on Discord to answer questions and provide assistance.

Clone a demo product and try out graph back link queries