Knowledge Graph Source Reference| Hitchhikers Platform
With the Knowledge Graph source, the records being passed into Streams are Entities, meaning there will be one entity passed into Streams as an input for every entity which matches the filter.
With the Knowledge Graph source, the accepted filter types are:
Filters of the same type will be OR’d together, but different entityType and savedFilterIds will be AND’d together. For example, for a Stream with
- entityTypes = [“location”, “healthcareProfessional”] and savedFilterIds = [“123”, “456”]
the logic would be:
- [(EntityType in [“location”, “healthcareProfessional”]) AND (savedFilter in [“123”, “456”])
Source vs. Referenced Entities
The filter only applies to the base records processed by Streams; this means that entities which do not match the filter can still be accessed when traversing relationships. However, this relationship data will always be produced in the context of the base record(s).
For example, if my Stream was filtered only to Healthcare Professional entity types, I could still access data across linked condition entity types, and linked facilities where the doctor worked. However, Streams would only produce outputs (unique records) for Healthcare Professionals, and the data from the other types would be in the context of each Healthcare Professional.
The fields property is used to define the list of fields from the source records (see: Entities) which are included in the Stream. These fields are accessed using their Knowledge Graph Field IDs, which are the External IDs for fields across Yext APIs and Configuration as Code.
Accessing Data Across Entity Relationships
In KG, relationships are stored in fields. For example, I might have a field on my
healthcareProfessional entity type called
c_worksAt, which is a relationship (entity reference) field. In that field, I would store a pointer to all of the
healthcareFacility entity types which a given doctor works at.
We access data across relationships using dot notation. A user specifies the field that the relationship is stored in, and the field on the entity across the relationship, with a period as the delimiter. For example, if I want to access the names of the Facilities which a doctor works at in the example above, I would use the syntax
c_worksAt.name. Again, in this example, the
c_worksAt field is part of the schema of the
healthcareProfessional entityType, and the fields accessed across the relationship are part of the schema of the
Streams-Specific KG Fields
There are a number of fields which can be accessed from the Knowledge Graph source which are not a part of the specific entity schema. These fields can be included for any Stream from the KG source.
||integer||The Entity UID. This UID is generated by Yext and is globally unique. It is not editable by users. This UID is the primary key for the Knowledge Graph source, meaning you can use this ID for a Get by ID API request on a Streams Endpoint with the Knowledge Graph Source.|
||string||The external Entity ID. This ID is editable by users in Knowledge Graph. It is unique within a single account.|
||object||An object containing specific metadata about the entity.|
||Array of ref_listings objects||An object containing data about the entity’s listings on certain publishers.
You must specify individual sub-fields of the ref_listings object - supplying just the ref_listings field will not return readable data.
||Array of ref_reviewsAgg objects||An object containing data about the entity’s reviews aggregate data (average rating and review count) on certain publishers.
You must specify individual sub-fields of the ref_reviewsAgg object - supplying just the ref_reviewsAgg field will not return readable data.
All other Knowledge Graph fields are available from the Knowledge Graph Streams source. These fields should be referenced using the Field ID (fka API Name).|
||string||The Knowledge Graph locale code of the specific profile.|
||string||The Knowledge Graph entity type of the entity.|
||string||The timestamp of the most recent change to this entity record.|
||string||The UID of the specific listing. Constructed as a combination of the publisher-entityUid pair.|
||string||The publisher of the listing.|
||string||The URL of the listing|
||string||The UID of the specific reviewsAgg object. Constructed as a combination of the publisher-entityUid pair.|
||string||The publisher which the review is associated with.|
||number||The average rating of the entity on the publisher.|
||number||The number of reviews for the entity on the publisher.|