How do I search entities by existence of certain relations?

Question

How can I perform a search on entities by having certain Relations, but this isn't an option in the Reltio Platform UI.

Answer

Get Relations between two objects

This operation would fetch all relations between 2 entities specified in the objectsUris section, filtered by relationTypes.  If we have no relationTypes section, it will return all relations

Request

POST {TenantURL}/relations/getByObjectUris

 

 Example

Request - find "configuration/relationTypes/HasAddress" relations between objects entities/0000Dqr and entities/00009ab

 

POST {TenantURL}/relations/getByObjectUris
Headers: Authorization: Bearer 204938ca-2cf7-44b0-b11a-1b4c59984512
{
    "objectUris": [
        "entities/0000Dqr",
      "entities/00009ab"
    ],
    "relationTypes": [
        "configuration/relationTypes/HasAddress"
    ]
}

Relationships Search

This operation performs a search for relationships - by its start and/or end objects, attribute values, tags, type.

Request

GET {TenantURL}/relations&filter=({Condition Type}[AND/OR {Condition Type}]*)

Enables relations filtering by a condition. 

  • Find active relations by 2005-10-17:
filter=(gt(activeness.startDate, 1129507200) and lt(activeness.endDate,1129507200)
  • Filter by relationship type:
filter=(equals(type,'configuration/relationTypes/Spouse'))
  • Filter by start entity:
filter=(equals(startObject,'entities/1'))

There are many Condition Types:

  • equals(property, value) - exact match condition ignoring case
  • equalsCaseSensitive(property, value) - exact match condition considering case
  • not equals(property, value) - not equals condition
  • containsWordStartingWith(property, value) - prefix condition; returns relations that have condition property starting with condition value
  • startsWith(property, stricted value) - prefix condition; returns relations that have condition property starting with condition value
  • fullText(property, value) - full text search; returns relations that have condition property with condition value (any place).
  • missing(property) - returns relations with fields that have no values for 'property' or 'property' value is empty.
  • exists(property- returns relations having some not empty value for 'property'.
  • range(property, from, to) - returns relations having 'property' within specified range.
  • gt(property, value) - returns relations having 'property' greater than specified value.
  • lt(property, value) - returns relations having 'property' less than specified value.
  • gte(property, value) - returns relations having 'property' greater or equals than specified value.
  • lte(property, value) - returns relations having 'property' less or equals than specified value.
  • contains(property, *value or ?value) - Passed if property satisfies a wildcard record. Supported wildcards are *, which matches any character sequence (including the empty one), and ?, which matches any single character.
  • in(property, value): Passed if property is one of the comma-separated values.
    value must contain a comma-separated value for the in filter clause. in(attributes.Title,"Title1,Title2") 
  • not Negates condition. Applicable to other operators.

 property in this condition is dot-delimited path till property to search on: type, attributes.Name, attribute.Education.Degree.

Search relation events with the cursor

This function returns records that match specified criteria with the strongly defined order. It works like the cursor in relational databases and returns  character sequence as part of the response. and all consequent requests with this cursor would return next portion of data in the defined order (no data repeats should occur in the whole returned dataset)

Request

POST {TenantURL}/relations/_events/_scan
  • Filter by entity_uri:
filter=(equals(relation_uri, 'relations/005ZBhp')
  • Filter by entityType:
filter=(equals(relation_type, 'HasAddress')
  • Filtering by event timestamp:
filter=(gt(timestamp, 1373288685810) and lt(timestamp,1373288903390))

 

References

https://docs.reltio.com/relationsapi/relationsearch.html

https://docs.reltio.com/relationsapi/filtering.html

 

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.