Searching the VKG: metadataFilter
When searching the VKG, there is an option to provide metadataFilter
s that will allow you to narrow down search results to nodes with desired metadata. The supported filters are:
oneOf
moreThan
moreThanEq
lessThan
lessThanEq
These should be specified the same way default
and type
are specified, inside a wrapped metadataFilter
JSON:
{
"metadataFilter": {
"artist": {
"oneOf": ["billie eilish", "metallica", "the weeknd", "michael jackson"]
},
"year": {
"moreThanEq": "2005"
}
}
}
All the filters are key-value pairs with the exception of oneOf which takes in a list of values. Nodes pass when they contain "one of" the list of values in their metadata.
Note that comparisons with numbers that are typed to string
or any
may not be what you expect for the comparison filters moreThan
, moreThanEq
, lessThan
, and lessThanEq
:
2 > 10
is True, because2
appears ahead of10
alphanumerically.a > 1
is True, becausea
appears ahead of1
alphanumerically.
Due to the ISO standard, datetimes will compare normally. However, as best practice, avoid using the any
type and doing comparisions on string
s or any
s.