Mariadb query to update * for json structure - mariadb

I have a json structure like
{"items": {"itemA": {"id": 1,"qty": 5},"itemB": {"id": 0,"qty": 10},"itemC": {"id": 0,"qty": 3}}}
What would be the mariaDb query to update qty for all items to 0.

Related

can't push data from AWS IoT Core to AWS TimeStream

i finished 2 days trying to search and solve my problem but no result, i wish i can get some help from you.
i am pushing data from local pc running KEPServerEX to AWS IoT Core using MQTT Agent. i can see the data updating on AWS without issue. Then i created a DB and table on TimeStream called respectively Kep_DB & Table_Kep1.
my issue is that i am trying to create a Rule on AWS IoT Core to send data to the DB table. a rule to work it require to create an SQL like statement and Dimensions.
below what i have tried:
`SELECT (SELECT v FROM values) as value FROM 'iotgateway'`
Then as dimension i put 1 dimension like below:
name: id value: ${id}
my pyload on AWS IoT Core is having this format:
`{
"timestamp": 1668852877344,
"values": [
{
"id": "Simulation Examples.Functions.Random1",
"v": 7,
"q": true,
"t": 1668852868880
},
{
"id": "Simulation Examples.Functions.Ramp2",
"v": 161,
"q": true,
"t": 1668852868880
},
{
"id": "Simulation Examples.Functions.Sine4",
"v": 39.9302559,
"q": true,
"t": 1668852868880
}
]}`
I am still not able to see to data coming to my DB even i tried several dimension name and several SQL statement format.
Any experience on this please ?

/film/film/runtime always returns null

Whenever I try to query for the length of a film I get lists of null. The query I use is directly from the "Build query" button on their site and looks like this:
[{
"id": null,
"name": null,
"type": "/film/film",
"/film/film/runtime": []
}]
Ufortunately all the responses I get look like this:
{
"name": "4D Man",
"type": "/film/film",
"/film/film/runtime": [
null
],
"id": "/en/4d_man"
}
I can hover over the links you can see on the query page and see the runtime (in this case 85 minutes) but as you can see all I get from the query is null. This may be a Freebase bug, but any help is appreciated. Thank you.
There's not a single runtime of a film, the same film can have different runtimes (original version, director's cut, etc...) Freebase use the film_cut type to contain the different runtimes of a movie
You can use this query to get the runtimes:
[{
"id": null,
"name": null,
"/film/film/runtime": [{
"runtime": null
}]
}]
Tune this query to your needs, you may need type_of_film_cut or film_release_region.

Return notable_for in mql

My code:
[{
"id": null,
"name": null,
"/common/topic/alias": [],
"/common/topic/notable_for": [],
"limit": 100,
"type": "/sports/sport"
}]
Link
"/common/topic/alias" is returned fine however notable_for is always empty. I also tried: null, [{}], {} and /common/notable_for which gives a schema error.
How can I return the notable_for value per instance in the /sports/sport example above?
The notable_for data is computed separately from other facts in Freebase and is not accessible from the MQL API. It is however available from the Search API, the Topic API and the RDF data dumps.
Search API:
https://www.googleapis.com/freebase/v1/search?filter=(all+type:/sports/sport)&output=(/common/topic/alias)
Topic API:
https://www.googleapis.com/freebase/v1/topic/m/071k0

Freebase MQL query - Get data by a social link

I'm having a hard time trying to get data about a person from Freebase using his social link - by a MQL query.
How could this be done?
Something like:
https://www.googleapis.com/freebase/v1/mqlread?query={
"*":[{}],
"/common/topic/social_media_presence":[{
"value":"http://twitter.com/JustinBieber"
}]
}
Those links are really stored as keys and the links are generated from templates with they key plugged in. You can see all the keys here: https://www.freebase.com/m/06w2sn5?keys=
A modified version of your query would be:
[{
"key": [{
"namespace": {
"id": "/authority/twitter"
},
"value": "JustinBieber"
}],
"*": [{}]
}]
You can do the same thing with other namespaces like /authority/facebook or /authority/musicbrainz as well as the various language wikipedias e.g. /wikipedia/en
I'm not sure how complete the coverage or currency of the social media info is though...

Freebase MQL Query - Getting Frequency for Award

I'm new to Freebase mql querying and would like to get the /time/recurring_event/current_frequency for all awards (/award/award).
That query looks like this in MQL:
[{
"type": "/award/award",
"name": null,
"/time/recurring_event/current_frequency": [{
"id": null,
"name": null
}]
}]
In order to get all the results, you'll need to use a cursor to page through the results set.

Resources