Data Governance
Also available as:
PDF
loading table of contents...

Searching for Entities Associated with Classifications

In Cataloging Metadata, we saw how Business Taxonomy Classification instances can be associated with entities, and thereby add the additional metadata information that the Classification conveys. Once the association is made, we can also search for entities associated with a given Classification.

The main advantage of using Classification-based search is that it can provide precise results, but the results are not restricted to a specific Type (as is the case with DSL search).

For example, you can use the PublicData Classification to search among all assets in a metadata repository, including HBase tables, for assets that contain content obtained by crawling public data.

Classification search is a special form of DSL search.

Search Among All Entities

Request:

GET http://<atlas-server-host:port>/api/atlas/discovery/search/dsl?query=%60Classification_name%60

The dsl_query_string should be encoded using standard URL encoding criteria. The %60 encoding represents the back-tick character.

Response:

{
	"requestId": string,
	"query": Classification_name_within_backticks,
	"queryType": "dsl",
	"count": int,
	"results": [{
		"$typeName$": "__tempQueryResultStruct...",
		"instanceInfo": {
			"$typeName$": "__IdType",
			"guid": guid of entity associated to Classification,
			"typeName": type of entity associated to Classification
		},
		"ClassificationDetails": null
	}, ....],
	"dataType": {
		"typeName": "__tempQueryResultStruct...",
		"typeDescription": null,
		"attributeDefinitions": [{
			"name": "ClassificationDetails",
			"dataTypeName": Classification name,
			"multiplicity": {
				"lower": 0,
				"upper": 1,
				"isUnique": false
			},
			"isComposite": false,
			"isUnique": false,
			"isIndexable": true,
			"reverseAttributeName": null
		}, {
			"name": "instanceInfo",
			"dataTypeName": "__IdType",
			"multiplicity": {
				"lower": 0,
				"upper": 1,
				"isUnique": false
			},
			"isComposite": false,
			"isUnique": false,
			"isIndexable": true,
			"reverseAttributeName": null
		}]
	}
}

Response field descriptions:

  • query – The unencoded version of the dsl_query_string passed in the request.

  • queryType – The query type (dsl).

  • count – The number of results returned.

  • results – Each result element contains an instanceInfo map, which in turn contains the following attributes:

    • guid – Contains the GUID of the entity associated with the Classification.

    • typeName – Contains the Type of the entity associated with the Classification.

  • dataType – A partial TypesDef Struct (defined in Important Atlas API Datatypes) that describes the search result type. The dataType structure contains the ClassificationDetails and instanceInfo attribute definitions.

Example Request:

GET http://<atlas-server-host:port>/api/atlas/discovery/search/dsl?query=%60PublicData%60

Example Response:

{
	"requestId": "qtp221036634-965 - a42d6e7f-a6c7-494d-8560-915e2b055ec2",
	"query": "`PublicData`",
	"queryType": "dsl",
	"count": 1,
	"results": [{
		"$typeName$": "__tempQueryResultStruct132",
		"instanceInfo": {
			"$typeName$": "__IdType",
			"guid": "a8984af2-4a4e-4281-a14d-f58ecaa8a76e",
			"typeName": "hbase_table"
		},
		"ClassificationDetails": null
	}],
	"dataType": {
		"typeName": "__tempQueryResultStruct132",
		"typeDescription": null,
		"attributeDefinitions": [{
			"name": "ClassificationDetails",
			"dataTypeName": "PublicData",
			"multiplicity": {
				"lower": 0,
				"upper": 1,
				"isUnique": false
			},
			"isComposite": false,
			"isUnique": false,
			"isIndexable": true,
			"reverseAttributeName": null
		}, {
			"name": "instanceInfo",
			"dataTypeName": "__IdType",
			"multiplicity": {
				"lower": 0,
				"upper": 1,
				"isUnique": false
			},
			"isComposite": false,
			"isUnique": false,
			"isIndexable": true,
			"reverseAttributeName": null
		}]
	}
}

Search Among a Specific Type

Definition:

You can use the DSL isa operator to restrict a search to only a given type of assets.

Request Structure:

<DSL Query>: <type_nameisa <tag_or_Classification_name>

Request Format:

GET http://<atlas-server-host:port>/api/atlas/discovery/search/dsl?query={type_name}+isa+%60{tag_or_Classification_name}%60

The dsl_query_string should be encoded using standard URL encoding criteria. The %60 encoding represents the back-tick character.

Response:

The response takes the same form as in the previous “Search API” section.

Example Request:

GET http://<atlas-server-host:port>/api/atlas/discovery/search/dsl?query=hbase_table+isa+%60PublicData%60

Example Response:

{
	"requestId": "qtp221036634-867 - 3448a43c-bc07-4b5d-abdd-247acac687f4",
	"query": "hbase_table isa `PublicData`",
	"queryType": "dsl",
	"count": 1,
	"results": [{
		"$typeName$": "hbase_table",
		"$id$": {
			"id": "a8984af2-4a4e-4281-a14d-f58ecaa8a76e",
			"$typeName$": "hbase_table",
			"version": 0,
			"state": "ACTIVE"
		},
		"namespace": {
			"id": "d3eb90fa-53c8-473b-bc41-37e46c250bf0",
			"$typeName$": "hbase_namespace",
			"version": 0,
			"state": "ACTIVE"
		},
		"qualifiedName": "default.webtable@cluster2",
		"isEnabled": true,
		"description": "Table that stores crawled information",
		"columnFamilies": [{
			"$typeName$": "hbase_column_family",
			"$id$": {
				"id": "00b16f6d-ee04-4587-b68e-1ee70dac6b11",
				"$typeName$": "hbase_column_family",
				"version": 0,
				"state": "ACTIVE"
			},
			"qualifiedName": "default.webtable.anchor@cluster2",
			"blockSize": 128,
			"columns": [{
				"id": "f7ce9fbb-7242-4304-b42a-f65309bad8b0",
				"$typeName$": "hbase_column",
				"version": 0,
				"state": "ACTIVE"
			}, {
				"id": "80708552-56b8-4989-9ba7-281bcc97a1a6",
				"$typeName$": "hbase_column",
				"version": 0,
				"state": "ACTIVE"
			}],
			"owner": "crawler",
			"compression": "zip",
			"versions": 3,
			"description": "The anchor column family that stores all links",
			"name": "anchor",
			"inMemory": true
		}, {
			"$typeName$": "hbase_column_family",
			"$id$": {
				"id": "959a3b0e-5c14-4927-bc42-fd99146107d4",
				"$typeName$": "hbase_column_family",
				"version": 0,
				"state": "ACTIVE"
			},
			"qualifiedName": "default.webtable.contents@cluster2",
			"blockSize": 1024,
			"columns": [{
				"id": "fc711cee-185f-4f09-a2f9-a96e0173f51b",
				"$typeName$": "hbase_column",
				"version": 0,
				"state": "ACTIVE"
			}],
			"owner": "crawler",
			"compression": "lzo",
			"versions": 1,
			"description": "The contents column family that stores the crawled content",
			"name": "contents",
			"inMemory": false,
			"$Classifications$": {
				"Retainable": {
					"$typeName$": "Retainable",
					"retentionPeriod": 100
				}
			}
		}],
		"name": "webtable",
		"$Classifications$": {
			"Catalog.term2": {
				"$typeName$": "Catalog.term2",
				"available_as_tag": false,
				"description": "Changing description for term",
				"name": "Catalog.term2",
				"acceptable_use": null
			},
			"PublicData": {
				"$typeName$": "PublicData"
			}
		}
	}],
	"dataType": {
		"superTypes": ["DataSet"],
		"hierarchicalMetaTypeName": "org.apache.atlas.typesystem.types.ClassType",
		"typeName": "hbase_table",
		"typeDescription": null,
		"attributeDefinitions": [{
			"name": "namespace",
			"dataTypeName": "hbase_namespace",
			"multiplicity": {
				"lower": 1,
				"upper": 1,
				"isUnique": false
			},
			"isComposite": false,
			"isUnique": false,
			"isIndexable": true,
			"reverseAttributeName": null
		}, {
			"name": "isEnabled",
			"dataTypeName": "boolean",
			"multiplicity": {
				"lower": 0,
				"upper": 1,
				"isUnique": false
			},
			"isComposite": false,
			"isUnique": false,
			"isIndexable": true,
			"reverseAttributeName": null
		}, {
			"name": "columnFamilies",
			"dataTypeName": "array<hbase_column_family>",
			"multiplicity": {
				"lower": 1,
				"upper": 2147483647,
				"isUnique": false
			},
			"isComposite": true,
			"isUnique": false,
			"isIndexable": true,
			"reverseAttributeName": null
		}]
	}
}