> For the complete documentation index, see [llms.txt](https://docs.zingg.ai/0.5.0/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zingg.ai/0.5.0/stepbystep/relations.md).

# Combining Different Match Models

When a single match model is not sufficient

[Zingg Enterprise Feature](#user-content-fn-1)[^1]

In many cases, we want to build the identity graph using a combination of different datasets, schemas and matching logic. An example could be having a source system which only contains userids and emails, another one wtih user name and phone numbers and a few others with person information with addresses. Another example could be some systems capturing spousal information, but others to be matched on the basis of lastname and address.

In such cases, Zingg can build the entire graph and relate different models together. In the following case, results of a query with exact match on family Id and a matching model(household) using address and lastname are brought together.

````json
```
{ 
    "vertices" : 
    [ 
        { 
            "name" : "spouse",  
            "vertexType" : "zingg_pipe", 
            "data" : [
                {
                "name" : "spouse", 
                "format" : "snowflake", 
                "props": {
                        "query": "select a.id as id, a.FNAME, a.LNAME, a.STNO, a.ADD1, a.CITY, a.STATE, a.ZINGG_ID_PERSON, b.id as z_id, b.fname as Z_FNAME,b.lname as Z_LNAME,b.stno as Z_STNO,b.add1 as Z_ADD1, b.city as Z_CITY,b.state as Z_STATE, b.ZINGG_ID_PERSON as Z_ZINGG_ID_PERSON from CUSTOMER_RELATE_PARTIAL a, CUSTOMER_RELATE_PARTIAL b where a.familyId = b.familyId"
                        }
                }
                ],
            "edges" :  
            {   "edgeType" : "same_edge",
                "edges":[
                    {
                        "dataColumn" : "zingg_personId",
                        "column" : "zingg_personId",
                        "name" : "zingg_personId1"
                    },
                    {
                        "dataColumn" : "zingg_personId",
                        "column" : "z_zingg_personId",
                        "name" : "zingg_personId2"
                    }
                ]
            }
        },
        { 
            "name" : "household",
            "config" : "$ZINGG_ENTERPRISE_HOME$/zinggEnterprise/configHousehold.json", 
            "strategy" : {
                "vDataStrategy" : "unique_edge",
                "props" : {
                        "column" : "zingg_personId",
                        "edge" : "zingg_personId,z_zingg_personId"
                    }
            },
            "vertexType" : "zingg_match", 
             "edges" :  
            {   "edgeType" : "same_edge",
                "edges":[
                    {
                        "dataColumn" : "zingg_personId",
                        "column" : "zingg_personId",
                        "name" : "zingg_personId1"
                    },
                    {
                        "dataColumn" : "zingg_personId",
                        "column" : "z_zingg_personId",
                        "name" : "zingg_personId2"
                    }
                ]
            }
        }
    ],
    "output" : [{
        "name":"relatedCustomers", 
        "format":"snowflake", 
        "props": {
            "table": "RELATED_CUSTOMERS_PARTIAL"
            }
    }],
    "strategy":"pairs_and_vertices"
}


```
````

[^1]: Zingg Enterprise is an advance version of Zingg Community with production grade features


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.zingg.ai/0.5.0/stepbystep/relations.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
