<!-- 
RSS generated by JIRA (1001.0.0-SNAPSHOT#100246-sha1:7a5c50119eb0633d306e14180817ddef5e80c75d) at Thu Feb 08 23:05:32 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary add field=key&field=summary to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>FOLIO Jira</title>
    <link>https://folio-org.atlassian.net</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>1001.0.0-SNAPSHOT</version>
        <build-number>100246</build-number>
        <build-date>07-02-2024</build-date>
    </build-info>

<item>
            <title>[FOLIO-405] implement CQL-to-Postgres/JSONB translator</title>
                <link>https://folio-org.atlassian.net/browse/FOLIO-405</link>
                <project id="10290" key="FOLIO">FOLIO</project>
                    <description>&lt;p&gt;To be implemented as a stand-alone tool with an API that can be, eventually, consumed in the raml-module-builder and/or particular modules. Possibly a command-line interface if it simplifies testing/demoing.&lt;/p&gt;

&lt;p&gt;Unless there is a reason not to, the tool should live in it&apos;s own git repo.&lt;/p&gt;

&lt;p&gt;In short, given a JSON Schema for a particular object/document and the CQL-query, the tool generates a matching SELECT or WHERE clause that can be executed on the JSONB column in Postgres containing the objects.&lt;/p&gt;

&lt;p&gt;The tool should be structured in a way that the JSON Schema traversal (to look up JSON object&apos;s key path(s) and type(s)) and Postgres query translation is as independent as possible to open up possibilities for implementation of translators to other query languages (e.g SOLR). &lt;/p&gt;

&lt;p&gt;In the first iteration a general structure of the boolean query (AND/OR/NOT) should be translated, search indices should be mapped to equivalent (same name) JSON fields, and the &apos;=&apos; relation opertor should be mapped to a substring match (_LIKE &apos;%s%&apos;).&lt;/p&gt;

&lt;p&gt;We will also want to have the most basic suppor for specifying sort order using the &lt;tt&gt;sortBy&lt;/tt&gt; keyword (which should be translated into &lt;tt&gt;ORDER BY&lt;/tt&gt;): &lt;tt&gt;sortBy fieldName&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;Repo:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/julianladisch/cql2pgjson-java&quot; class=&quot;external-link&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/julianladisch/cql2pgjson-java&lt;/a&gt;&lt;/p&gt;</description>
                <environment></environment>
        <key id="80103">FOLIO-405</key>
            <summary>implement CQL-to-Postgres/JSONB translator</summary>
                <type id="10002" iconUrl="https://folio-org.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10322?size=medium">New Feature</type>
                                            <priority id="10001" iconUrl="https://dev.folio.org/assets/jira-priority/jira-p2.svg">P2</priority>
                        <status id="6" iconUrl="https://folio-org.atlassian.net/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="green"/>
                                    <resolution id="10003">Done</resolution>
                                                        <assignee accountid="5ee89462f7aa140abd82d11d">Julian Ladisch</assignee>
                                                                <reporter accountid="557058:b8e64633-1f7c-402d-9caf-9959a5ba5d0d">Jakub Skoczen</reporter>
                                    <labels>
                            <label>sprint4</label>
                            <label>sprint5</label>
                    </labels>
                <created>Tue, 6 Dec 2016 13:27:48 +0000</created>
                <updated>Mon, 12 Nov 2018 14:23:21 +0000</updated>
                            <resolved>Mon, 19 Dec 2016 13:38:35 +0000</resolved>
                                                                        <due></due>
                            <votes>0</votes>
                                    <watches>6</watches>
                                                    <timespent seconds="3600">1 hour</timespent>
                                <comments>
                                                            <comment id="188348" author="5bffed52a1b46046f530c8f7" created="Wed, 7 Dec 2016 11:49:31 +0000"  >&lt;p&gt;I assume you&apos;ll base this on the existing CQL-Java?&lt;/p&gt;</comment>
                                                            <comment id="188350" author="5ee89462f7aa140abd82d11d" created="Wed, 7 Dec 2016 11:55:13 +0000"  >&lt;p&gt;Yes, on &lt;a href=&quot;https://github.com/indexdata/cql-java&quot; class=&quot;external-link&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/indexdata/cql-java&lt;/a&gt;&lt;/p&gt;</comment>
                                                            <comment id="188352" author="62a121a0122dfd006906b41f" created="Wed, 7 Dec 2016 11:57:52 +0000"  >&lt;p&gt;That&apos;s definitely the plan. I was thinking that if the long term goal is to have the CQL-to-JSONB conversion as an instance of a general CQL-to-Native conversion interface, that it might be a good idea to actually add the capability to CQL-Java itself, as this seems like a fairly common need for users of CQL in Java. Although that seems like a decision that those more experienced with CQL-Java and its history could better decide.&lt;/p&gt;</comment>
                                                            <comment id="188355" author="557058:b8e64633-1f7c-402d-9caf-9959a5ba5d0d" created="Wed, 7 Dec 2016 12:11:15 +0000"  >&lt;p&gt;Let&apos;s make that decision later. I&apos;d say right now let&apos;s build this as a seperate tool. The reason not to make it part of the CQL-java is forcing all CQL-java users to pull new dependencies, like JSON Schema parser.&lt;/p&gt;</comment>
                                                            <comment id="188357" author="557058:b8e64633-1f7c-402d-9caf-9959a5ba5d0d" created="Wed, 7 Dec 2016 12:14:04 +0000"  >&lt;p&gt;So to clarify &amp;#8211; the tool should be packaged as a &lt;b&gt;jar&lt;/b&gt; using Maven to pull dependencies (like CQL-java)&lt;/p&gt;</comment>
                                                            <comment id="188359" author="62a121a0122dfd006906b41f" created="Wed, 7 Dec 2016 12:14:06 +0000"  >&lt;p&gt;Yes, and long term an XML parser as well. Good point.&lt;/p&gt;</comment>
                                                            <comment id="188361" author="5bffed52a1b46046f530c8f7" created="Wed, 7 Dec 2016 12:17:47 +0000"  >&lt;p&gt;When I originally wrote this parser, the idea was that any back-end could be supported just by walking the tree produced by `parser.parse(String)`. That works fine &amp;#8211; but the translation to CQL, XCQL and BER is done with methods added to the tree-node classes. Either way is fine.&lt;/p&gt;

&lt;p&gt;BTW., I just updated the CQL-Java README a little, and translated it into Markdown.&lt;/p&gt;</comment>
                                                            <comment id="188362" author="62a121a0122dfd006906b41f" created="Wed, 7 Dec 2016 12:34:08 +0000"  >&lt;p&gt;It looks like the JSON data specs like this one: &lt;a href=&quot;https://github.com/folio-org/mod-users/blob/master/ramls/schemas/userdata.json&quot; class=&quot;external-link&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/folio-org/mod-users/blob/master/ramls/schemas/userdata.json&lt;/a&gt;&lt;br/&gt;
are based on an ad-hoc spec of their own rather than one I have found online. Am I missing it?&lt;/p&gt;</comment>
                                                            <comment id="188364" author="557058:b8e64633-1f7c-402d-9caf-9959a5ba5d0d" created="Wed, 7 Dec 2016 13:13:34 +0000"  >&lt;p&gt;Yes, but I would discourage adding any new translation methods to the parse tree classes. This is generally bad design &amp;#8211; doing so in opposition to the Single Responsibility Principle. The toXCQL method is special as it does not need any configuration and is just an alternative representation of the parse tree. The toPQF should most likely be moved to a different module, but that&apos;s ancient history not worth spending time on &lt;img class=&quot;emoticon&quot; src=&quot;/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;.&lt;/p&gt;

&lt;p&gt;Beside the parse tree classes that you can traverse &quot;manually&quot; (and do explicit casting for node types), I have added the CQLNodeVisitor interface that implements the visitor pattern. Unfortunately it is optimized for generating &quot;prefix&quot; notations (like the already mentioned PQF). For &quot;infix&quot; notation like the WHERE SQL clause you would need to keep your own &quot;stack&quot; to figure out where in the tree are you. Give it a shot, you could also implement another visitor traversal method directly in the parser, if it makes sense.&lt;/p&gt;</comment>
                                                            <comment id="188366" author="5bffed52a1b46046f530c8f7" created="Wed, 7 Dec 2016 13:19:46 +0000"  >&lt;p&gt;I&apos;d agree with all of that. My inclination is to make a &lt;tt&gt;CQLNodeVisitor.inOrderTraverse()&lt;/tt&gt; method and use that.&lt;/p&gt;

&lt;p&gt;And, yes, we might later on decide for hygiene reasons to move some of the existing back-end methods out of the node classes.&lt;/p&gt;</comment>
                                                            <comment id="188367" author="557058:b8e64633-1f7c-402d-9caf-9959a5ba5d0d" created="Tue, 13 Dec 2016 12:55:00 +0000"  >&lt;p&gt;Added info about sort.&lt;/p&gt;</comment>
                                                            <comment id="188369" author="712020:32bb56ac-50e7-4787-b4af-ed3089d9401c" created="Thu, 15 Dec 2016 18:54:29 +0000"  >&lt;p&gt;guys, good to have a peek at this - really important to get this into the RMB - currently there is a simple RMB postgres query language (not mongo native as was for the mongo client) which is translated into postgres jsonb queries by the postgres client wrapper in the RMB - this will need to replace that&lt;/p&gt;</comment>
                                                            <comment id="188370" author="5ee89462f7aa140abd82d11d" created="Mon, 19 Dec 2016 13:38:35 +0000"  >&lt;p&gt;The basic CQL-to-Postgres support is complete: &lt;a href=&quot;https://github.com/julianladisch/cql2pgjson-java&quot; class=&quot;external-link&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/julianladisch/cql2pgjson-java&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10000">
                    <name>Blocks</name>
                                            <outwardlinks description="blocks">
                                        <issuelink>
            <issuekey id="61037">STRIPES-119</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10002">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="80049">FOLIO-427</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10003">
                    <name>Relates</name>
                                            <outwardlinks description="relates to">
                                        <issuelink>
            <issuekey id="80088">FOLIO-420</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10000" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummarycf">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10019" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|hzxib3:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10020" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10024" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>[CHART] Date of First Response</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Wed, 7 Dec 2016 11:49:31 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10025" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>[CHART] Time in Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                    </customfields>
    </item>
</channel>
</rss>