<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Eugen Sopot on Medium]]></title>
        <description><![CDATA[Stories by Eugen Sopot on Medium]]></description>
        <link>https://medium.com/@eugensopot?source=rss-9e5cf3d750c4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*o51hjTznE_PPOxf1</url>
            <title>Stories by Eugen Sopot on Medium</title>
            <link>https://medium.com/@eugensopot?source=rss-9e5cf3d750c4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 03:10:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@eugensopot/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Ancient Almost-Forgotten Technologies Help Fight AI Hallucinations]]></title>
            <link>https://medium.com/@eugensopot/ancient-almost-forgotten-technologies-help-fight-ai-hallucinations-31105af47252?source=rss-9e5cf3d750c4------2</link>
            <guid isPermaLink="false">https://medium.com/p/31105af47252</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[neuro-symbolic-ai]]></category>
            <category><![CDATA[logic-programming]]></category>
            <dc:creator><![CDATA[Eugen Sopot]]></dc:creator>
            <pubDate>Thu, 15 Oct 2026 10:24:06 GMT</pubDate>
            <atom:updated>2026-10-15T10:26:22.434Z</atom:updated>
            <content:encoded><![CDATA[<p>Once upon a time, before 5-inch floppy disks became widespread, when ancient manuscripts were passed from hand to hand on 8-inch floppies, or sometimes even on punch cards, two scientists in the south of France were developing an artificial intelligence. According to some accounts, it was steam-powered. Their names were Alain Colmerauer and Philippe Roussel, and the result of their work was called Prolog.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MlziXWIBX0hSnNnK.jpg" /><figcaption>Art before AI generation was possible</figcaption></figure><p>In those distant times, people communicated with artificial intelligence through text based interfaces connected to large remote computers. Users typed questions, and computers responded with text. Today technology has changed dramatically, we use text interfaces connected to large remote computers, users type questions, and computers respond with text. The machines have become faster, the terminals have become smaller, and artificial intelligence has learned to discuss practically anything. Unfortunately, it has also learned to explain things it knows nothing about, sometimes quite convincingly.</p><p>When I first encountered Cypher and GQL, I couldn’t shake the feeling that I had seen something similar somewhere before. Eventually, I remembered where: in an ancient school computer science textbook. It was Prolog.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/242/1*WCF1VphVb4K9knB-zHysqA.png" /><figcaption>Ancient AI on a tape</figcaption></figure><p>Back then, I had only seen it in textbooks. The idea was to describe facts and relationships between objects and then ask the system questions. For example, to determine who is whose grandparent:</p><pre>grandparent(X, Z) :-<br>    parent(X, Y),<br>    parent(Y, Z).</pre><p>In BigQuery Graph, a similar question can be expressed like this:</p><pre>GRAPH FamilyGraph<br>MATCH<br>  (x:Person)-[:ParentOf]-&gt;(y:Person)<br>  -[:ParentOf]-&gt;(z:Person)<br>RETURN<br>  x.name AS grandparent,<br>  z.name AS grandchild</pre><p>Of course, these are not exactly the same thing. GQL matches patterns against existing graph data, while Prolog allows you to define logical relationships and use them in other rules. Still, the resemblance is quite noticeable. Even after several decades.</p><p>When Google ADK and MCP were gaining popularity, making it relatively easy to connect LLMs to external tools, I started to think: what if I connect a logic programming engine to a language model? Let the LLM do what it is good at: understand the user’s questions and maintain a conversation. The actual application of formal rules could be delegated to a program specifically designed for that purpose. I looked at the logic programming languages and engines available today and settled on Clingo, an Answer Set Programming (ASP) solver. The main reason was its convenient Python API. No particular philosophy behind the choice, just <strong><em>import clingo</em></strong>.</p><p>To test the idea, I decided to use something relatively simple: a five-page document describing PostNord’s terms and conditions for sending parcels. I used Gemini through Google ADK as the conversational interface, Pydantic for input validation, and Clingo for applying the rules. And this is where I noticed something else interesting.</p><p>One of the historical problems with expert systems was the effort required to write and maintain large rule bases. Someone had to read a document, understand it, translate it into a formal language, and account for all the exceptions and dependencies. But now we have LLMs. You can give an LLM a policy document and ask it to write the corresponding ASP program. In my experiment, the effort required to actually write the .lp file dropped to almost zero. Of course, that doesn’t mean the resulting program is automatically correct. But we’ll get back to that.</p><p>Another interesting feature of logic programming is that rules can form chains. The result of one rule becomes a condition for another, which in turn triggers a third, and so on. For example, if we simplify the actual parcel shipping rules a little:</p><pre>overweight :-<br>    weight(W),<br>    W &gt; 20.<br><br>violates_international_limit :-<br>    overweight,<br>    destination(international).<br><br>must_return :-<br>    violates_international_limit.</pre><p>Given the facts: weight(25), destination(international) we can derive must_return.</p><p>If necessary, we can construct a verifiable chain of reasoning, from the input facts through the applicable rules to the final conclusion. Clingo itself does not automatically produce a ready-made, human-readable proof for every answer, of course. Such tracing would have to be implemented separately. But at least the explanation can be based on formal dependencies, rather than asking an LLM to come up with a plausible story about how it reached its conclusion.</p><p>The prototype also includes a tool for searching the original policy document, but it is used to explain the decision, not to make it. So RAG hasn’t disappeared, it has simply stopped being responsible for logical inference.</p><p>Anyway, I asked an LLM to help translate the PostNord rules into ASP, connected Clingo to Gemini through ADK, and asked:</p><p><strong>Can I send 25 kg item to Stockholm using PostNord?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nTMStClQAgE5mYDszsJYfw.png" /><figcaption>And here is the answer</figcaption></figure><p>Naturally, this raises the question of who is supposed to verify the rules that the LLM has written in the .lp file. So somewhere in this architecture, there should be a human who understands the original requirements and can verify the resulting formal model. Preferably before the system starts making real decisions, although we know well how these things go.</p><p>But what interested me most about this experiment wasn’t even the possibility of reducing hallucinations. <strong>It was the ability to provide a verifiable justification for an answer. </strong>Not a probabilistically generated explanation produced after the result, but a sequence of facts and rules from which that result follows.</p><p>Of course, the fact that a conclusion follows correctly from a formal model does not mean that the model itself is correct. But these are two different problems, and at least now they can be addressed separately.</p><p>And besides communicating with the user, the LLM can help create the very formal model that previously required so much manual work.</p><p>The results were tested against PostNord own AI assistant. I have no idea how it works, but this is what it returns for the same question.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/385/1*7dTxC7hm51n38Ur8Vf7SNQ.png" /><figcaption>PostNord chat bot in action</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/389/1*lcY4z5mfIMB112imeRs0Ag.png" /><figcaption>More details found in the app</figcaption></figure><p>And one more thing: Clingo doesn’t need a single LLM token to perform its reasoning.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=31105af47252" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[More than a Semantic Layer]]></title>
            <link>https://medium.com/@eugensopot/dynamic-semantic-layer-b4085e5a3720?source=rss-9e5cf3d750c4------2</link>
            <guid isPermaLink="false">https://medium.com/p/b4085e5a3720</guid>
            <dc:creator><![CDATA[Eugen Sopot]]></dc:creator>
            <pubDate>Wed, 07 Oct 2026 14:11:03 GMT</pubDate>
            <atom:updated>2026-10-07T15:17:12.257Z</atom:updated>
            <content:encoded><![CDATA[<p>In my previous post, I considered how BigQuery Graph could be used as a semantic layer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LQJxN-H2VM2f1Dt8asd7JA.png" /><figcaption>What ChatGpt thinks is a complex knowledge graph</figcaption></figure><p>The idea was to use the graph as a model of the available analytical data rather than to define a separate analytical model for every use case. The graph contains entities, their properties and relationships, as well as the mappings to particular BigQuery tables.</p><p>My Google Sheets and Looker Studio plugins explored this model using GQL. The user selected what should be analyzed, and the plugins used the graph to determine which related entities and properties could participate in the analysis. This produced a particular projection of the graph for a particular analytical task. SQL was then used to retrieve the data from the underlying BigQuery tables.</p><p>Initially this separation was not even intentional. The main reason it was implemented this way was that GRAPH_EXPAND() cannot be used with an arbitrary graph and, moreover, cannot be used with a subgraph.</p><p>One thing is important here: a different starting point could produce a different projection from the <strong>same graph</strong>. An analysis of trades could expose instruments, counterparties, traders and other entities related to trades. An analysis of cashflows could expose another set of entities and relationships. The graph remained the same. The analytical model was created for the analysis being performed. By a user selecting a starting point, in this case.</p><h3>Snowflake Semantic Views</h3><p>Snowflake and AtScale provide an XMLA interface for Snowflake Semantic Views, allowing them to be consumed by Excel and Power BI, which is in some way very similar to what my plugins do for Sheets and Looker Studio.</p><p>The Snowflake / Google Sheets version of my plugin was even easier to implement, as Semantic Views contain elements like dimensions and measures explicitly. The plugin just discovered the dimensions and metrics defined in a Semantic View and presented them through the same kind of pivot interface. The user’s selections were translated into SEMANTIC_VIEW queries and executed by Snowflake.</p><p>However, the Snowflake experiment showed a significant difference from the BigQuery Graph version. Yes, a Semantic View is already a particular analytical model. A client can discover its dimensions and metrics and let the user construct different queries, but the user is still exploring the analytical space defined by that Semantic View. This is closer to the way Looker Explores work.</p><p>An Explore defines a particular analytical space available to the user. There may be many possible combinations of dimensions, measures and filters inside it, but the boundaries of the model are already established. Converting a complete BigQuery Graph into such a model is therefore not as straightforward as it may initially appear, even for the small 19-node graph I created for these experiments.</p><p>The graph may describe trades, positions, books, desks, traders, instruments, counterparties, cashflows and the relationships between all of them. There is no single obvious Semantic View or Explore corresponding to this graph.</p><p>A trade-oriented model and a cashflow-oriented model may use the same graph but expose different entities, relationships and measures. Trying to represent the entire graph as one traditional analytical model creates a different problem: not everything that is connected in the organizational data model necessarily belongs in one analytical view. This was exactly what the BigQuery Graph plugins avoided.</p><p>Instead of converting the graph into one predefined semantic model, they used the graph to construct the required model when the user selected what to analyze.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F93gka0_iGHM%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D93gka0_iGHM&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F93gka0_iGHM%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/afc54ab412a28bc75e198661076b11b2/href">https://medium.com/media/afc54ab412a28bc75e198661076b11b2/href</a></iframe><h3>Conversational Analytics</h3><p>Then I looked at a different problem: continuing the analysis of tabular results returned by Conversational Analytics.</p><p>A BigQuery Data Agent can use the complete graph when answering a question. The user does not have to select an Explore or a Semantic View first. The agent receives the question, examines the graph and determines which entities, properties and relationships are required.</p><p>For example, consider:</p><p><em>Give me trade counts by country and asset class.</em></p><p>The graph may contain many entities unrelated to this particular question. The Data Agent only needs the relevant part and can produce:</p><p><em>GRAPH `project.dataset.TradingGraph`<br>MATCH (t:Trade)-[:TradeToInstrument]-&gt;(i:Instrument),<br> (t)-[:TradeToCounterparty]-&gt;(c:Counterparty)<br>RETURN c.country AS country,<br> i.asset_class AS asset_class,<br> COUNT(t) AS trade_count<br>ORDER BY trade_count DESC</em></p><p>For this question, Trade, Instrument and Counterparty form the required analytical model. Another question may use a completely different part of the same graph. This is very similar to what my original plugins were doing. The plugins received an analytical context from the user and explored the graph to construct the required projection.</p><p>The Data Agent receives the context as a natural-language question and selects the required projection itself. In both cases the graph represents the larger data model, while the analytical model is generated for the particular task.</p><h3>Continuing in Google Sheets</h3><p>Conversational Analytics returns the answer and the resulting tabular data, but currently there is no direct way to continue working with that result in Google Sheets as a live BigQuery data source.</p><p>Copying the rows is easy, but that produces a snapshot. I wanted the result to become a Connected Sheet, with the query remaining in BigQuery and the spreadsheet acting as an analytical client. And the reason for that was simple: this is actually one of the first things end users ask for after trying Conversational Analytics with BigQuery Data Agents.</p><p>The Data Agent had already done the most important part of the work. It had interpreted the question and selected the required part of the graph. The remaining problem was technical: the analysis was expressed as GQL, while Connected Sheets requires SQL. Suddenly, the approach used by my original plugins fit this case almost exactly.</p><p>The GQL tells us which nodes, relationships and properties the Data Agent selected. The Property Graph definition tells us how these elements map to the underlying BigQuery tables and columns.</p><p>For example:</p><p><em>(t:Trade)-[:TradeToInstrument]-&gt;(i:Instrument)</em></p><p>identifies the exact relationship selected by the Data Agent.</p><p>The Property Graph definition contains the physical tables and keys implementing Trade, Instrument and TradeToInstrument.</p><p>The same applies to:</p><p><em>(t)-[:TradeToCounterparty]-&gt;(c:Counterparty)</em></p><p>There is no need to find another path between these entities. The Data Agent has already selected the path as part of answering the question.</p><p>The RETURN clause provides the required properties and aggregations. Predicates provide the filters. This information can be mapped to the corresponding SQL query over the underlying tables. The generated SQL is then executed independently.</p><p>The Data Agent has already returned the result of its GQL query, so the two result sets can be compared. If they match, the SQL can be used to create the Connected Sheet. I implemented this flow in a web client for BigQuery Data Agents.</p><p>The video shows the complete sequence: a question is sent to the Data Agent, the agent answers it using the graph, its GQL is mapped to SQL using the Property Graph definition, the SQL result is checked against the Data Agent result, and the analysis is continued in Google Sheets.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fc2Gxg0JRB0U%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dc2Gxg0JRB0U&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fc2Gxg0JRB0U%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/fc7e317382d463539f27c3a01270b746/href">https://medium.com/media/fc7e317382d463539f27c3a01270b746/href</a></iframe><h3>BigQuery Graph and semantic layers</h3><p>The experiments show an important difference between BigQuery Graph and the usual semantic layer model.</p><p>A Semantic View or an Explore (or SSAS cube, or BO Universe, or OBIEE Subject Area) defines an analytical model first. The user then explores the data within that model.</p><p>BigQuery Graph can represent the complete connected data model of an organization at once. A particular analytical model can be derived from it when it is needed. A Data Agent effectively does this each time it answers a question. My original plugins did this based on the analytical context selected by the user.</p><p>The graph therefore does not have to be converted into one universal Semantic View or divided in advance into every Explore that users may eventually need. It can remain the common model of the data, while different analytical projections are <strong>dynamically </strong>generated for different questions.</p><p>The closest thing I can think of is the Logical Table Source in Oracle BI, where the BI Server generates a particular database query depending on the set of columns requested by the user.</p><p>Taking this analogy further, I would consider the current BigQuery Graph a kind of “physical” graph model, since physical keys have to be defined explicitly.</p><p>I could imagine another, “logical” graph on top of it, where a logical node could be mapped to one or more physical nodes, while a logical edge would have only semantic meaning and could rely on one or more physical edges to build a path that can eventually be mapped to a particular database query.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b4085e5a3720" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[BigQuery Graph as a semantic layer]]></title>
            <link>https://medium.com/@eugensopot/bigquery-graph-as-a-semantic-layer-5d5e1a6c20cd?source=rss-9e5cf3d750c4------2</link>
            <guid isPermaLink="false">https://medium.com/p/5d5e1a6c20cd</guid>
            <dc:creator><![CDATA[Eugen Sopot]]></dc:creator>
            <pubDate>Wed, 23 Sep 2026 16:04:33 GMT</pubDate>
            <atom:updated>2026-09-23T17:09:52.505Z</atom:updated>
            <content:encoded><![CDATA[<p>There are many very smart definitions of what a semantic layer is, as well as many implementations by major software vendors.</p><p>Here, by a semantic layer I mean metadata over a database that maps physical database objects to logical objects such as metrics and the dimensional spaces in which those metrics live. In other words, it tells us what can be measured, by what, and how to get there.</p><p>As for implementations, there is a full spectrum, with different combinations of capabilities and limitations. But they all provide the same basic functionality: logical entities, mappings between those entities and physical database objects, and relationships between them. Of course, there can be discussions about the complexity of Oracle’s implementation and complaints about the inability to use composite keys in SSAS Tabular, but the basics are the same.</p><p>When talking about semantic layer ecosystems, one part is normally overlooked: how they are consumed by end users. This often leads to cruel and unusual use of technology. For instance, Apache Kylin provides a multidimensional analytical model, but consuming it from tools such as Excel or Power BI may ultimately mean going through SQL and ODBC. Or take SSAS: until recently, it was not possible to combine Import and directQuery within the same model. Or try connecting Power BI to an XMLA source such as SSAS Multidimensional or Atoti.</p><p>It got even worse with cloud databases like Snowflake and BigQuery. There was a dark age of semantic layers, when BI tools had to consume all that power through ODBC connectors, and a significant part of the semantic layer migrated into custom SQL embedded in those connections. I know this because I have personally built inhuman creatures like SSAS Tabular fetching data from Snowflake just to provide a familiar interface to Excel and Power BI users, because there was simply no other way to meet the requirements. And of course, all those 300-column wide denormalized and materialized tables.</p><p>Even during the dark age, there were islands of stability. For instance, Oracle BI could deal with Snowflake much the same way as with other databases. But that was for those who still remembered what Oracle BI was and could live with its dashboards, WebLogic, Smart View, and admintool.exe for Windows. For Google users, there was also Looker.</p><p>Looker deserves a separate paragraph. It was obviously created by brilliant programmers thinking about other brilliant programmers. LookML is powerful, explicit and remarkably flexible. It gives you a proper modelling layer over a modern cloud database without pretending that SQL no longer exists. Problems start when you try to build a model with two fact tables at different grains and a few common dimensions. And they continue with things like: “You can combine up to 5 Explores on one dashboard.” Explores look and behave much like SSAS cubes in Google Sheets, but not in Excel or Power BI.</p><p>And then came BigQuery Graph. And indeed, it contains pretty much everything needed to build a semantic layer: logical entities, properties, relationships, and mappings to physical database objects.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1jZSVhW-GkrWu7QkYd5q4Q.png" /></figure><p>I do not see why this cannot be called a semantic layer in the traditional sense. Everything is in place: measures, dimensions, relationships. The only thing missing is a way to consume it. Your options are essentially either to write GQL or to put a BigQuery data agent on top of it. And that agent can produce GQL or SQL, provide tables and charts, but it cannot create spreadsheets and dashboards. This is quite a strange gap, given almost 50 years of spreadsheet history and the analytical workflows that already exist in organizations.</p><p>Recently I vibe-coded two tools: a connector for Looker Studio and a plugin for Google Sheets. What I am trying to achieve with my tools is to close this gap, or at least to show how it can be closed. The basic idea is that each node containing measures is a candidate fact table, and all nodes reachable from it through N:1 relationships are candidate dimensions. GQL is then used to discover this semantic structure, and SQL is used to fetch the data requested by the user.</p><p>Below are two videos showing how it works.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FMDHwEpgSMEk%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DMDHwEpgSMEk&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FMDHwEpgSMEk%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/c4ae6211918e8ff0d29490a93e4b858f/href">https://medium.com/media/c4ae6211918e8ff0d29490a93e4b858f/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FMJCyGft_TzY%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DMJCyGft_TzY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FMJCyGft_TzY%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/7c873bb86870c91976dca3b01f496b01/href">https://medium.com/media/7c873bb86870c91976dca3b01f496b01/href</a></iframe><p>There are still many problems to solve, especially around multiple fact tables, different grains and ambiguous paths. But as a proof of concept, this seems to work: the graph describes the semantics, GQL discovers them, SQL fetches the data, and the user gets a spreadsheet or a dashboard.</p><p>Which, after all, was the missing part.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5d5e1a6c20cd" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>