lunes, 8 de octubre de 2012

JSONiq: The JSON Query Language


JSONiq es un nuevo lenguaje de consulta construido sobre xquery, como SQL o LinQ tiene funcionalidad de let, for, group by, where, etc. Veamos un ejemplo:


let $stats := db:find("stats")
for $access in $stats
where $access("response_time") > 5
group by $url := $access("url")
return
{
    "url": $url,
    "avg": avg($access("response_time")),
    "hits": count($access)
}

También permite updates:


let $dbj := collection("users")[ .("name") = "Deadbeat Jim" ]
return insert json { "status" : "credit card declined" } into $dbj


Esta muy bueno que se estandarice la forma de consultar datos json, este estándar esta en pañales pero ya tiene una implementación en el producto Zorba. Promete gran futuro!!

Fuente:
http://www.infoq.com/news/2012/10/JSONiq

Links:
http://www.jsoniq.org/
http://jsoniq.org/docs/spec/en-US/html-single/index.html
http://jsoniq.org/grammars/jsoniq.xhtml
http://www.zorba-xquery.com/html/index

No hay comentarios.:

Publicar un comentario