Convert JCSDL to CSDL


How to covert JSCDL to CSDL that we get by creating query on query builder and store it into mongo db


JCSDL will run as CSDL as expected. When you have compiled your JCSDL, you will be given a stream hash - you simply need to use this stream hash when setting up a Push subscription, as you would do with any other CSDL stream hash.


thanks for info jason. Here what i actually need to do; i want to integrate jquery query builder plugin in my website and pull data based on saved stream using the code written in is it possible to do that otherwise can you provide sample java code for push subscription. My another question is when i will get stream hash and how can i store it in mongodb


Most of this is covered in the Query Builder Documentation. I would recommend first looking at the Getting Started with the Query Builder page - this provides a walkthrough for how to get started with embedding and configuring the Query Builder, then saving your queries. You will be able to save CSDL stream hashes via an AJAX call to your back-end application, where you can store it in MongoDB. 

If you are setting up a Push Subscription, you will not be able to receive your data via something like the example script. It is possible to set up a Push subscription, pushing data directly into your MongoDB instance. You should simply follow the steps laid out in the example. Resources detailing how to set up push subscriptions can be found at:

- /push/create API endpoint

Push API Step-by-Step Guide


but with query builer code i am only getting jcsdl not csdl can i directly compile jcsdl. If not, then how to convert jcsdl to csdl


A JCSDL compiles to CSDL. JCSDL is essentially just CSDL with some additional comments, which are parsed by the Query Builder. 

For example, compiling the following JCSDL:

// JCSDL_MASTER b04591342ee71a2baa468d9d2a340ec8 AND
// JCSDL_START 0980a5f2ef935c4ed153bf975879eac0 twitter.text,contains_any,27-52
twitter.text contains_any "obama, santorum, gingrich, romney, ronpaul, ron paul"
// JCSDL_START f7c18a6fedd90c6b4d77acc14a3a8e5c interaction.type,in,21-29
interaction.type in "twitter,facebook,digg,youtube"

will give you exactly the same stream hash as you would get from compiling this CSDL:

twitter.text contains_any "obama, santorum, gingrich, romney, ronpaul, ron paul"
interaction.type in "twitter,facebook,digg,youtube"