DQL supports many of the standard comparison operators found in most languages.
The colon/contains operator tests for equality between a field and its value. The contains operator is not case-sensitive. To perform a case-sensitive search, see the
If the value is a double-quoted string, the entire string is treated as a single query. If the search string has multiple words, the query will allow for up to one missing word between each consecutive pair of words, and an unlimited number of surrounding words.
For example: To find all organizations that have “Facebook” within any one of their known aliases, including Facebook, Facebook Advertising, etc.:
This will do a “contains” search against all names (
allNames) associated with an entity.
To narrow the results, you might use the
Corporation sub-type and the
strict operator with the formal company name. For example:
The Not Equals operator
!= specifies that entities matching a particular field value should be omitted from the results.
This query returns all Organization entities in San Francisco, except for those companies whose name is "San Francisco State University":
This query returns all Organizations located in the city of San Francisco that are not local businesses:
The Not Equals operator can also be used with the regex operator. This query returns all Organizations whose name does not begin with "University":
To exclude entities compiled from one or more data sources, i.e. origins, specify:
The above example excludes all Organizations whose origins do not include Wikipedia or Wikidata.
We can apply the
> (greater than),
< (less than),
>= (greater than or equal to) and
<= (less than or equal to) operators to specify that the value of a field should fall within a particular range.
This query will match all Articles published to “*.nytimes.*” since Mar 1, 2022:
This query will match companies who have between 500 and 1000 employees:
The strict operator modifies a text search on a field, so that the field value must be exactly equal to the search string in order for a match to occur.
We have seen in all of the examples above how the colon operator (
:) is used to match a field with a value, similar to the equals operator in most programming languages. It is important to note that the colon does not perform an exact match. It will account for a single missing word in the result. To perform an exact match you must apply the strict operator.
For example: To match only Facebook, and not Facebook affiliates:
Updated 3 months ago