values vs name/id
The shortcut:
"/music/artist/active_start": [{}]
The explanation:
There's a bit of a trick to this. MQL divides the world into "values"
and "objects". If you look at the expected_type of a property (try the query
{ "query0":
{ "query":
{ "id": "<a-property-like-/music/artist/active_start>",
"type": "/type/property",
"expected_type": null
}
}
}
You will find out if a property expects a value (one of /type/id,
/type/key, /type/text, /type/rawstring, /type/int, /type/float,
/type/boolean and /type/uri) or an object (anything else)
Then you can ask
[{ "name": null, "id": null, "type": [], "optional": true }]
for the objects and
[{ "value": null, "type": null, "optional": true }]
for the values. (the optional: true ensures the query doesn't fail if
the property is missing)
[{}]
asks MQL to automatically inspect the expected_type for you and insert
one or other of the clauses you see above, depending on which is
appropriate. It's what we use internally 90% of the time.
"/music/artist/active_start": [{}]
The explanation:
There's a bit of a trick to this. MQL divides the world into "values"
and "objects". If you look at the expected_type of a property (try the query
{ "query0":
{ "query":
{ "id": "<a-property-like-/music/artist/active_start>",
"type": "/type/property",
"expected_type": null
}
}
}
You will find out if a property expects a value (one of /type/id,
/type/key, /type/text, /type/rawstring, /type/int, /type/float,
/type/boolean and /type/uri) or an object (anything else)
Then you can ask
[{ "name": null, "id": null, "type": [], "optional": true }]
for the objects and
[{ "value": null, "type": null, "optional": true }]
for the values. (the optional: true ensures the query doesn't fail if
the property is missing)
[{}]
asks MQL to automatically inspect the expected_type for you and insert
one or other of the clauses you see above, depending on which is
appropriate. It's what we use internally 90% of the time.
Recent Discussions about values vs name/id
There are no conversations on this topic. Would you like to start one?
Start the Discussion
