<?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 Chimezie Ogbuji on Medium]]></title>
        <description><![CDATA[Stories by Chimezie Ogbuji on Medium]]></description>
        <link>https://medium.com/@chimezie?source=rss-9344b33e7a8a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*wcJs6em5zxFN7U2Y.</url>
            <title>Stories by Chimezie Ogbuji on Medium</title>
            <link>https://medium.com/@chimezie?source=rss-9344b33e7a8a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 16:01:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@chimezie/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[Why I Think Capoeira Is an Internal Martial Art]]></title>
            <link>https://chimezie.medium.com/why-i-think-capoeira-is-an-internal-martial-art-276ca317f2c8?source=rss-9344b33e7a8a------2</link>
            <guid isPermaLink="false">https://medium.com/p/276ca317f2c8</guid>
            <category><![CDATA[philosophy]]></category>
            <category><![CDATA[afro-brazilian-culture]]></category>
            <category><![CDATA[martial-arts]]></category>
            <category><![CDATA[cultural-syncretism]]></category>
            <dc:creator><![CDATA[Chimezie Ogbuji]]></dc:creator>
            <pubDate>Sun, 29 Nov 2026 16:51:37 GMT</pubDate>
            <atom:updated>2026-11-29T17:51:48.317Z</atom:updated>
            <content:encoded><![CDATA[<h4>The perspective of a syncretic practitioner of Chinese and Afro-Brazilian (internal) martial arts.</h4><p>According to Wikipedia:</p><blockquote>Neijia (內家) is a term in Chinese martial arts, grouping those styles that practice neijing, usually translated as <strong>internal martial arts</strong>, occupied with <em>spiritual</em>, <em>mental</em> or <strong>qi-</strong>related aspects, as opposed to an “external” approach focused on physiological aspects.</blockquote><p>I have been doing Tai Chi for some time. The form of Tàijíquán (太極拳) I practice now is <a href="https://en.wikipedia.org/wiki/Chen-style_taijiquan#Chen_Village_(Chenjiagou)">Chen-style Tàijíquán</a>, and I started studying it under the lineage of <a href="https://en.wikipedia.org/wiki/Chen_Zhenglei">Chen Zhenglei</a>, a Chen Village master, in 2011. My first teacher trained formally under one of his students, but also trained with (and translated for) him on several occasions. She practiced multiple martial arts styles, including Wushu and Shaolin kung fu, which she taught my oldest.</p><p>After her, in 2016, I began training at <a href="https://greendragontaichi.com/">Green Dragon Tai Chi</a>, owned and run by a talented Black man and mixed martial artist, with whom I have trained mainly in that same style, but via a different one of the “4 Tigers” (Chen Xiaowang). The style includes primary, open-hand “foundational” forms, more kinetic variants, larger ones, weapon forms (broadsword, double broadswords, standard sword, staff, etc.), and so on. Prior to that, I didn’t focus my study on a particular Taiji style; I was primarily curious about Tàijí through its relationship with the traditional Chinese philosophies that always interested me.</p><p>I never really practiced any hard arts other than <a href="https://en.wikipedia.org/wiki/Pushing_hands">“push hands” (tui shou)</a>, which I did off and on between 2013 and about 2017.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*KcOHhOQmTrugpopjrLtIGg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/165/1*upMvB18OcNgkfLLfZpFsnA.jpeg" /></figure><p>Perhaps as a direct result of my research on “ontology engineering,” particularly on automatically building related conceptualizations of domain expertise, I have always been interested in learning systems bottom-up, starting with how each element relates to, or builds on, the foundation. This is true of how I learn systematic topics, and because of its historical grounding in philosophy, I always intended the internal martial arts I learn to be the foundation for any combination of other martial arts I learned later in life: a kind of scaffolding for the biomechanics and for how the mind is honed to accommodate the physical practice.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JS8G7eMbLLwihEbMhfhemg.png" /><figcaption>My Chen-style Lineage Tree (Claude Code). Note that my line is through my first Chen teacher and then my current teacher, via his, and students of Chen Xiaowang</figcaption></figure><p>My interest in push hands deepened after reading <em>The Art of Learning: An Inner Journey to Optimal Performance </em>by Joshua Waitzkin in 2010. It is about a Chess champion who retired from Chess tournament competition and went into international push hands competition. In it, he discusses how he applied some of his experience from chess tournament training to this new competition. According to the Wikipedia article on push hands, it</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oGO1HqDN_cPRlVxohxnnjg.png" /><figcaption>First 12 postures of <a href="https://en.wikipedia.org/wiki/Chen-style_tai_chi#Large_Frame:_Old_Frame_(Laojia)_tradition">Large Frame: Old Frame (Laojia) tradition</a> from Chen Xin’s <strong>Chen Family Taijiquan Illustrated and Explained (陳氏太極拳圖說) </strong>(Claude Code)</figcaption></figure><blockquote>works to undo a person’s natural instinct to resist force with force, teaching the body to yield to force and redirect it [..][and] allows students to learn how to respond to external stimuli using techniques from their forms practice. Among other things, training with a partner allows a student to develop ting jin (listening power), the sensitivity to feel the direction and strength of a partner’s intention.</blockquote><p>After major traumatic events in my life, 2021 was the first year I started regularly practicing striking martial arts with <em>Chen Taiji</em> at the Green Dragon and Capoeira Brazil academies. At Green Dragon, we incorporated Brazilian Jiu-Jitsu (BJJ), <a href="https://en.wikipedia.org/wiki/Chin_Na">Chin Na</a>, and other styles for self-defense. Chin Na is a set of joint-lock techniques used in Chinese martial arts to neutralize an opponent’s fighting ability by controlling or locking their joints or muscles/tendons so they cannot move.</p><p>At the same time, my world was about to be blown open by the influence of Afro-Brazilian martial arts and musical performance as I began my long relationship with Capoeira: first with Capoeira Regional alone, and then with both Regional and Capoeira Angola.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QhNkqlN8d8fG26aDvnrtAw.jpeg" /></figure><p>The story of Capoeira and its connection to Equatorial Africa through the chattel slave trade is too much to fully dig into here. It is a cultural anthropological miracle given how much music, dance, language, and martial arts tradition was transmitted and preserved through it. Suffice it to say, it was illegal for a while, primarily because it was used as training and war music for guerrilla warfare by revolting slaves; it had its roots mainly in Capoeira Angola, which was a less culturally assimilated foundation of the components brought by the slaves; Mestre Bimba (<a href="https://en.wikipedia.org/wiki/Manuel_dos_Reis_Machado">Manuel dos Reis Machado</a>) helped to legalize it as a martial art in Brazil, incorporating elements of other martial arts, and making a form called Capoeira Regional. Later, from the combination of the two, emerged Capoeira Contemporânea,</p><blockquote>a modern interpretation and evolution of the traditional Afro-Brazilian martial art of Capoeira. It represents a fusion of the traditional elements of Capoeira Angola and Capoeira Regional</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7lZMtmcx0QmWw73g.jpg" /><figcaption><a href="https://pareiacomunicacao.com.br/festival-reune-mestres-e-grupos-de-capoeira-angola-em-alto-paraiso-de-goias/">Treinel Fabrício (Comunidade Angoleira do Cerrado) and Treinel Kamila (Alagbedê Tocantins) Photo: Natie Paz / Caboca Filmes</a></figcaption></figure><p>Capoeira is very internal for two reasons. The first is the extent to which the Afro-Brazilian percussion ensemble, or bateria, that metaphorically closes the circle or roda in which the <em>joga</em> / “game” is played, drives so much of the rules of the game, its rhythm, and the (almost) liminal spirit of the energy in the circle and the <strong>many</strong> call-and-response feedback loops within it.</p><p>At higher levels, you need to be focused to perceive the intention of the (often) elder Capoeira practitioner (or capoeirista) running the roda through his/her tone, the Portuguese words of the songs sung, the calls, and the rhythms, or toque, on the Gunga Berimbau. The kind of game dictates what is permissible in the roda and the energy that conducts it.</p><p>The other way in which it is internal is best characterized by a certain spiritual element of the practice, embodied in a Brazilian-Portuguese word that doesn’t translate well into English: <a href="https://en.wikipedia.org/wiki/Capoeira"><strong><em>mandingueiro</em></strong></a>. It is</p><blockquote>someone who embodies <strong>mandinga</strong> [, which] originates from the name of Mandinka people.</blockquote><p>It is a certain Kabuki theatre-like aesthetic that is expressive and sometimes theatrical, especially in the Angola style, but deceptive and meant to hide the practitioner&#39;s mischievous or even malicious intention (malícia). More properly, mandinga</p><blockquote><a href="https://capoeirawiki.org/wiki/Mandinga">historically referred to magical protection and ritual knowledge, and in contemporary usage denotes cunning, strategic intelligence, and expressive skill within the roda (capoeira circle)</a>.</blockquote><p>The movements and energy in the Angola style remind me of West African masquerades.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/0*jfOGj-Yrfa9NTcdG.jpg" /><figcaption><a href="https://papoeira.com/en/the-8-training-sequences-of-mestre-bimba/">Mestre Bimba and one of his students</a></figcaption></figure><p>In practice, it naturally corresponds to push hands principles. Capoeira trains a student to use many primary techniques while responding to improvised sparring with another person, and to develop sensitivity to their intention, acting on it strategically. In push hands, the goal is posture supremacy via sensing, anticipation, and counter-attack. In Capoeira, it is combat, psychological, and even comic supremacy by similar means.</p><p>When you enter a roda, ringed by your fellow Capoeiristas, who echo powerful polyrhythmic music and energy, you are at your best when you empty your mind and focus on your opponent&#39;s dynamic and intention, as well as the roda’s energy and music.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/0*d7E2UwlJHeT4F3IN" /><figcaption><a href="https://pt.wikipedia.org/wiki/Mestre_Pastinha">Mestre Pastinha</a>, the standard bearer of Capoera Angola</figcaption></figure><p>As I circled back to doing more push-hands about 4-5 years into Capoeira, I experienced a feedback loop: conceptualizing it as a proper internal martial art, and seeing how it has shaped my learning curve and my personal growth through periods of great tragedy and trauma. A Capoeira Mestre once told us that Capoeira is a powerful vehicle for healing, and I couldn’t agree more. This return to push-hands has also come alongside a more concerted, parallel practice of Capoeira Angola, using both as the internal scaffolding on which I have grown.</p><p>But for me, as a first-generation Nigerian, there is another dimension to its internal nature. Both in the United States and when I was in Nigeria for about 8 years, I have found many barriers to the millennial traditions of my people (when amongst them), buffered by a certain brand of evangelical Christianity that permeates and treats such practices with contempt. The best example is the barriers to the cosmological foundations of my Igbo or Umon culture.</p><p>Ironically, within Afro-Brazilian spaces and practices, I sometimes feel I have a more formidable and sustained link to my precolonial heritage, especially when fully within the throes of playing in a Capoeira or Batucada bateria. In those moments, as I’m connected to the polyrhythms, feeling simultaneously like I’m participating in a masquerade in Ikot Ana or Umunakanu, dancing in or performing music for a Cuban Salsa rueda, or speaking in <em>tongues as tonque</em>, it feels like a unique spinal tap to my genetic and cultural history: call-and-response all the way down to my mitochondria.</p><p>So, to me, Capoeira is an internal martial art in its culture, spirit, and physical practice. It is also a philosophical framework beyond just being a martial art in its own right.</p><p>For these reasons, I intend to practice both Taijiquan and Capoeira to my last days.</p><p>After all, as Mestre Pastinha is <a href="https://www.jstor.org/content/oa_chapter_monograph/j.ctv33p9zh0.5?seq=1">famously quoted</a> as saying:</p><blockquote>Capoeira is everything the mouth eats.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=276ca317f2c8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Semantic Web Reasoning Series 3/3]]></title>
            <link>https://chimezie.medium.com/semantic-web-reasoning-series-3-3-65e99c5a0741?source=rss-9344b33e7a8a------2</link>
            <guid isPermaLink="false">https://medium.com/p/65e99c5a0741</guid>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[semanticweb]]></category>
            <category><![CDATA[ontology]]></category>
            <dc:creator><![CDATA[Chimezie Ogbuji]]></dc:creator>
            <pubDate>Fri, 27 Nov 2026 04:24:36 GMT</pubDate>
            <atom:updated>2026-11-27T05:08:00.806Z</atom:updated>
            <content:encoded><![CDATA[<p>SEMANTIC WEB REASONING SERIES 3/3</p><h3>Efficiently Verbalizing and Using Semantic Web Knowledge with Reasoning Language Model Systems</h3><p>Incorporating Expert System and Semantic Web Agent principles into harness architecture</p><p><a href="https://chimezie.medium.com/semantic-web-query-mediation-with-fuxi-over-large-sparql-datasets-df13ff535caf">Earlier</a>, I wrote about how OWL_DSL can render an ontology&#39;s meaning in natural language. I created OWL_DSL primarily to help reasoning language models, but hadn’t yet come back around to a larger idea of how it could help realize what I refer to as <a href="https://medium.com/@chimezie/domain-specific-biomedical-ontologies-ralm-and-generative-medical-expert-systems-3236922b19db">generative expert systems</a>.</p><p>After an earlier release of OWL_DSL, when I asked colleagues about modern Python libraries for OWL engineering, they pointed me to an experimental bridge (<a href="https://github.com/ontology-tools/py-horned-owl">py-horned-ow</a>l) from <a href="https://github.com/phillord/horned-owl"><em>Horned-OWL</em></a> to Python that would let me stop relying on a deprecated OWL API library (owlready2). At the time, I needed something that could keep pace with the reasoning efficiency of ELK and FuXi, so I replaced much of owlready2 as I could with py-horned-owl and made a mental note to eventually come back to the possibility of leveraging</p><blockquote>the characteristics of Rust to be performant and competitive against other libraries for [ontology] manipulation [and] allowing ontologies with millions of terms.</blockquote><figure><img alt="Great Horned Owl" src="https://cdn-images-1.medium.com/max/497/1*0Wz-ktYi0oJWNFz4BztoIw.jpeg" /><figcaption>Bubo virginianus / Great Horned Owl (credit: Peregrine Fund)</figcaption></figure><blockquote>Great Horned Owls are referred to as “the tiger of the sky” because of their keen hunting skills and their ability to capture a wide variety of prey sometimes larger or heavier than the owls themselves. — <a href="https://peregrinefund.org/explore-raptors-species/owls/great-horned-owl">The Peregrine Fund / Great Horned Owl</a></blockquote><p>OWL_DSL uses py-horned-owl as the ontology-access layer, which can be thought of as an Object Ontology Layer (OOL), turning OWL files into a structured axiom model that the rendering code can traverse and use for serialization. It divides the work with <a href="https://github.com/dice-group/owlapy/">owlapy</a>, a Python framework for modern Ontology Engineering. py-horned-owl handles the loading and rendering, and owlapy handles ELK reasoning and Manchester syntax parsing. Because py-horned-owl is Rust-backed, it is fast and memory-efficient on large biomedical ontologies.</p><p><a href="https://en.wikipedia.org/wiki/Symbolic_artificial_intelligence">Symbolic Artificial Intelligence (AI</a>) represents knowledge through explicit formal structures, logical propositions, rules, and symbolic expressions, manipulated by inference procedures. Historical limitations of Symbolic AI include the prohibitive cost of manually encoding world knowledge, the fact that many logic-based formal languages fail to capture the full spectrum of natural language semantics, and the computational complexity of symbolic inference, which can limit scalability.</p><p>Historically, <a href="https://dl.acm.org/doi/10.5555/170641.170650">expert systems</a> were computer programs designed to utilize expertise to assist with various problems, and were distinguished from conventional software by several key desiderata:</p><ul><li>They reason using domain-specific knowledge that is both mathematical and symbolic</li><li>They perform as well as human specialists within their specific problem area</li><li>They make their knowledge and the reasoning behind their answers understandable to the user.</li><li>They can be modified and extended.</li></ul><p><a href="https://en.wikipedia.org/wiki/Knowledge_representation_and_reasoning">Knowledge Representation</a> is a field of Artificial Intelligence focused on providing computers with access to structured collections of information and sets of inference rules to conduct automated reasoning. A central principle of building expert systems was that “in the knowledge lies the power,” emphasizing the importance of a knowledge base and substantial domain-specific knowledge.</p><p>OWL ontologies are a form of symbolic AI. Ontology editing tools like Controlled Natural Languages (CNL) were <a href="https://www.researchgate.net/profile/Tobias-Kuhn-2/publication/242713323_Controlled_English_for_Knowledge_Representation/links/0c96052f6428bcae46000000/Controlled-English-for-Knowledge-Representation.pdf">historically</a> developed to address the prohibitive cost of manually encoding domain-specific knowledge, and generating (or <strong>verbazing) </strong>the axioms of an ontology in natural language was an early motivation. OWL_DSL extends this capability, going further to address the shortcomings of logic-based formal languages in capturing the full spectrum of natural language semantics and in serving as an interface with generative agent models and systems.</p><p>Beyond refactoring OWL_DSL to use py-horned-owl when rendering Description Logic constructs into natural language and removing its reliance on owlready2 for everything except verbalizing proof traces, I also added the ability to render rules and a formalized annotation ontology as part of the major update. The terms in that ontology can be used to annotate ontologies, defining a domain-specific natural language for verbalizing them.</p><p>In a previous article, I showed that certain property semantics cannot be captured in the common Description Logic languages:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*NBX_mzbjEFTNoOMqYnkaOQ.jpeg" /></figure><p>We can define this rule in the following N3 file (<em>has_actress.n3</em>):</p><pre>@prefix imdb: &lt;https://www.imdb.com/&gt; .<br>{ ?movie     imdb:principal ?principal .<br>  ?principal imdb:role      &quot;actress&quot;;<br>             imdb:person    ?person    } =&gt; { ?movie imdb:has_actress ?person } .</pre><p>Below are the annotation ontology terms recently added to OWL_DSL:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/923/1*zedjhZGuz0Qc8V8UtVvZ6Q.png" /><figcaption><a href="https://github.com/chimezie/OWL_DSL/tree/main/ontology_configurations">https://github.com/chimezie/OWL_DSL/tree/main/ontology_configurations</a></figcaption></figure><p>The rule above can be verbalized by first creating an OWL 2 ontology that defines the IMDB properties in the rule (<strong><em>imdb:principal</em></strong>, <strong><em>imdb:role</em></strong>, and <strong><em>imdb:principal),</em></strong> using the <strong>OWL_DSL_000001</strong> annotation to specify a CNL for them and render the N3 rule. The ontology can be constructed using FuXi’s InfixOWL library and annotate those properties:</p><pre>import pyhornedowl<br>from fuxi.Syntax.InfixOWL import (GraphContext, Property, Ontology)<br>from owl_dsl.annotations import configure_cnl_from_annotations<br>from owl_dsl.rule_renderer import RuleRenderer<br>from fuxi.Horn.HornRules import horn_from_n3<br>from rdflib import Namespace, RDF, RDFS, URIRef, Graph, Literal, XSD<br><br>OWL_NS = Namespace(&quot;http://www.w3.org/2002/07/owl#&quot;)<br>ANNOTATION_NS = Namespace(&quot;http://purl.org/ontology-dsl#&quot;)<br>IMDB_NS = Namespace(&quot;https://www.imdb.com/&quot;)<br><br># Namespace bindings<br>NS_BINDINGS = {<br>    &quot;rdf&quot;: RDF,<br>    &quot;rdfs&quot;: RDFS,<br>    &quot;owldsl&quot;: ANNOTATION_NS,<br>    &quot;imdb&quot;: IMDB_NS<br>}<br><br>XSD_STRING = XSD.string<br><br>tbox_graph = Graph()<br>with GraphContext(graph, NS_BINDINGS):<br>    # Needed to create a py-horned-owl indexed ontology from an <br>    # rdflib OWL graph<br>    Ontology(comment=[Literal(&quot;Ontology of IMDB properties&quot;)])<br>    # Get a handle on the singular CNL rendering template annotation property<br><br>    # Create the classes and properties using FuXi&#39;s InfixOwl<br>    singular_cnl = Property(<br>                     ANNOTATION_NS.OWL_DSL_000001<br>                   ).declare_annotation_property(ANNOTATION_NS.OWL_DSL_000001)<br><br>    person_property = Property(IMDB_NS.person, label=Literal(&quot;person&quot;))<br>    role_property = Property(IMDB_NS.role, <br>                             range=XSD_STRING, <br>                             label=Literal(&quot;movie role&quot;))<br>    principal_property = Property(IMDB_NS.principal, <br>                                  label=Literal(&quot;movie principal&quot;))<br>    has_actress = Property(IMDB_NS.has_actress, label=Literal(&quot;has actress&quot;))<br><br>    # Annotate the properties, providing them a CNL for rule and ontology<br>    # verbalization<br>    has_actress.set_annotation(singular_cnl, &quot;has {} as an actress&quot;)<br>    principal_property.set_annotation(singular_cnl, &quot;has {} as a principal&quot;)<br>    role_property.set_annotation(singular_cnl, &quot;plays the role of {}&quot;)<br>    person_property.set_annotation(singular_cnl, &quot;is played by {}&quot;)</pre><p>Then, we create a py-horned-owl ontology from the serialization, instantiate a rule renderer, configure it using the ontology annotations, and print a natural language rendering of the rule.</p><pre># Convert the RDFLib OWL 2 graph into a py-horned-owl indexed ontology<br>owl_rdf_xml = tbox_graph.serialize(format=&quot;xml&quot;)<br>pyhornedowl_ont = pyhornedowl.open_ontology(owl_rdf_xml, serialization=&quot;rdf&quot;)<br><br># Create a rule renderer for the py-horned-owl indexed ontology<br>renderer = RuleRenderer(pyhornedowl_ont, IMDB_NS)<br><br># Configure the rule renderer and its CNL from the ontology annotations<br>configure_cnl_from_annotations(renderer, tbox_graph)<br><br>with (current_dir / &#39;has_actress.n3&#39;).open(&#39;r&#39;) as f:<br>    #Iterate over rules in has_actress.n3 using FuXi rule parser<br>    for rule in horn_from_n3(f):<br>        #print them using the render<br>        print(renderer.render_rule(rule))</pre><p>The output is:</p><blockquote>If ?movie has ?principal as a principal, ?principal plays the role of ‘actress’, and ?principal is played by ?person, then ?movie has ?person as an actress.</blockquote><p>Capturing the full spectrum of natural-language semantics from logic-based knowledge representation by verbalizing it can facilitate <a href="https://medium.com/@chimezie/domain-specific-biomedical-ontologies-ralm-and-generative-medical-expert-systems-3236922b19db"><strong>generative expert systems</strong></a>. Historically, expert systems mostly relied on rule-based knowledge representations. With OWL_DSL, we can verbalize both rule-based and Description Logic representations and provide them as an interface to generative reasoning language models, which are excellent natural language processors.</p><p>Much of the resurgent Semantic Web open-source work I have been doing lately is motivated by trying to recreate the environment of the Semantic Web Interest Group (SWIG): a community-built ecosystem for discussing and acquiring heterogeneous knowledge, representing it through shared knowledge graph interfaces, applying explicit rules, and exposing the results through applications. It also involved a lot of skunk-work projects in the <a href="https://swig.planetrdf.com/">SWIG IRC channel</a> back in the day, circa 2001–2007, where many of us tinkered with interactive IRC bots that acted on Linked Data.</p><p>Starting as an itch to scratch/revisit some of the agent-based automation we were trying to achieve back then, I created a library of two skills: <a href="https://github.com/chimezie/semantic-web-reasoner-skill"><strong>semantic-web-agent </strong>and <strong>ontology-engineering</strong></a>. They are both coding agent scaffolding that codify principles of Expert systems, Linked Data, ontology engineering, and World Wide Web architecture as guidance. For OpenCode usage, they also include a medical reasoning <a href="https://opencode.ai/docs/agents/">subagent</a> and <a href="https://opencode.ai/docs/commands">command</a> for delegating clinical terminology questions to a terminology specialist model instead of reasoning about unfamiliar medical terms directly. Both skills are opinionated about which tools to use (<a href="https://github.com/chimezie/owl_dsl">OWL_DSL</a>, <a href="https://robot.obolibrary.org/">ROBOT</a>, <a href="https://github.com/chimezie/fuxi-reincarnate">Fuxi-reincarnate</a>, <a href="https://jena.apache.org/documentation/io/">riot</a>) and how to use them, but provide comprehensive support of Semantic Web agent behavior.</p><p>The <strong>semantic-web-agent</strong> skill incorporates many of the best practices collected by the SWIG community over the years, such as (for example) <a href="https://www.w3.org/wiki/LinkedData">Linked Data principles</a>, <a href="http://Cool URIs for the Semantic Web">Cool URIs</a>, and <a href="https://link.springer.com/chapter/10.1007/978-3-662-43796-4_16">“Follow Your Nose”</a>, into operational routing, constraints, examples, and validation steps for use by LLMs in coding harnesses such as Opencode and Claude code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MgqQ6fkHRgjBYteIEKkxWw.png" /><figcaption>Gemini Notebook overview infographic of both skills</figcaption></figure><p>The <strong>ontology-engineering</strong> skill incorporates guidance from ontology engineering principles of the <a href="https://obofoundry.org/">Open Biological and Biomedical Ontology (OBO) Foundry</a> and Alan <a href="https://protege.stanford.edu/conference/2006/submissions/slides/4.1_rector_Modularisation-normalisation-rector-protege-2006-presented.pdf">Rector’s ontology normalization approaches and methods</a> for decomposing a domain ontology into independent, disjoint “skeleton taxonomies.” It also documents the selection of OWL 2 Profiles, a general workflow for constructing a domain ontology, and the use of <a href="https://bfo-ontology.github.io/">BFO ontologies</a> for applicable domains.</p><p>The <strong>semantic-web-agent </strong>skill<strong> </strong>includes tools for an agent to use with <a href="https://chimezie.medium.com/evolving-domain-specific-natural-languages-for-owl-ontologies-owl-dsl-8314c85b2b7f">OWL_DSL</a> to inspect an ontology&#39;s contents by verbalizing its logical axioms (and their entailments) as context, listing its terms and metadata, searching for terms, validating ontologies, and running <a href="https://chimezie.medium.com/semantic-web-query-mediation-with-fuxi-over-large-sparql-datasets-df13ff535caf">SPARQL interlocution against remote RDF data</a>. In this way, users of such harnesses can build applications in the image of expert systems, capturing symbolic, domain-specific knowledge, relying on verbalization of ontology content and entailment to guide agents and explain automated behavior (i.e., <a href="https://en.wikipedia.org/wiki/Explainable_artificial_intelligence">XAI</a>), and that are easily extended via modification of the knowledge base using OWL 2 tooling as well as further customization of generative AI harnesses.</p><p>I plan to add additional skills to that library, but these two are the core.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=65e99c5a0741" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Semantic Web Query Mediation with FuXi over large SPARQL datasets]]></title>
            <link>https://chimezie.medium.com/semantic-web-query-mediation-with-fuxi-over-large-sparql-datasets-df13ff535caf?source=rss-9344b33e7a8a------2</link>
            <guid isPermaLink="false">https://medium.com/p/df13ff535caf</guid>
            <category><![CDATA[reasoning]]></category>
            <category><![CDATA[sparql]]></category>
            <category><![CDATA[knowledge-graph]]></category>
            <category><![CDATA[semanticweb]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Chimezie Ogbuji]]></dc:creator>
            <pubDate>Tue, 06 Oct 2026 18:29:13 GMT</pubDate>
            <atom:updated>2026-10-06T18:29:13.290Z</atom:updated>
            <content:encoded><![CDATA[<h4>SEMANTIC WEB REASONING SERIES 2/3</h4><h4>Independent, logic-based reasoning over very large semantic webs and knowledge graphs</h4><p>As described in the <a href="https://chimezie.medium.com/the-origin-story-of-a-reborn-semantic-web-reasoner-and-query-mediator-9185bc1e55e7">previous part of this series</a>, many Semantic Web logical reasoning systems have struggled to evolve beyond brute-force materialization to facilitate intelligent or <em>expert systems</em>. To capture the “meaning” of a vocabulary, traditional rule-based Semantic Web systems pre-calculate every possible inference and store the results. Though this might work well for small, one-off situations, it is otherwise computationally expensive and fundamentally rigid. It is certainly not the kind of behavior expected of today’s generative, “<em>agentic</em>” systems.</p><p>In this new, bullish era of AI architecture, semantic web systems must evolve toward a more dynamic paradigm: reasoning at query time against independent, possibly changing sources. Ideally, the reasoning should be both generative and logical (<em>symbolic</em>), but “sideways information passing” (SIP) strategies and research that helped traditional relational database systems with virtual tables can help symbolic reasoning systems and Semantic Web ones in particular evolve beyond the archetypal use case. This is the use case of accessing a very large, rich knowledge base that uses terms from a heavily reused, expert-defined vocabulary, and taking advantage of the vocabulary&#39;s rich semantics with something like a <a href="https://www.w3.org/TR/sparql11-entailment/">SPARQL entailment regime</a> to intelligently answer queries over the knowledge base. This is a huge opportunity for data integration and semantic interoperability, but the initial, lackluster solutions to these kinds of use cases are one reason the earlier web architecture and logic-based AI vision fizzled out.</p><p>A TBox contains statements about terminology (class names, descriptions, property names, their descriptions, restrictions on both, and their hierarchies) and is where the vast majority of domain semantics are crafted. However, with the right RDF substrate (triple store, middleware, etc.), we can create a high-performance <em>instance</em> layer (ABox) and rationalize it with the TBox on top. As a hands-on example, we will <a href="https://docs.qlever.dev/quickstart/#using-qlever">use QLever (“<em>Clever</em>”)</a>, a graph database that implements the RDF and SPARQL standards and efficiently loads and queries very large datasets (100 billion+ triples). However, you could use any other SPARQL service library, such as <a href="https://virtuoso.openlinksw.com/">Virtuoso</a>.</p><p>Our example creates a high-performance, self-contained SPARQL endpoint from transformed public IMDB data, and the approach can be used for any other domain where the vocabulary and data are captured similarly. QLever’s <strong>qlever-control</strong> workflow automates the transition in stages: collecting data for ingestion, building a high-speed full-text search index, and using it to launch a containerized SPARQL endpoint managed with Docker for over 363 million triples.</p><p>Within this architecture, a <a href="https://docs.qlever.dev/qleverfile/">Qleverfile</a> is a streaming shell pipeline for massive, compressed delimited data that avoids the overhead of large intermediary disk writes by transforming raw, compressed data into RDF in a single pass. By processing the data directly from the input stream, the system handles sanitization, schema mapping, and graph construction on the fly. This approach is efficient and domain-agnostic, allowing any structured dataset to be ingested through unified transformation logic. The “[data]” section of a Qleverfile is where much of this is done. For our example, each <strong>GET_IMDB_* </strong>row<strong> </strong>follows the same pattern:</p><pre>FILE=title.basics.tsv.gz; curl -sLO -C - ${IMDB_DATA_URL}/$${FILE}; ...; rm -f $${FILE}</pre><p>The process never redundantly reads from disk and streams the transformations:</p><pre>gunzip -c $${FILE} | sed 1d | awk -F&#39;\t&#39; &#39;{ … }&#39;  </pre><p>Finally, the data is assembled with <strong>GET_DATA_CMD</strong>:</p><pre>GET_DATA_CMD = (${GET_PREFIXES}; ${GET_IMDB_BASICS}; ${GET_IMDB_ACTOR_DIRECTOR}; ${GET_IMDB_NAMES}) &gt; ${NAME}.ttl</pre><p>The <strong>(…)</strong> groups four pipelines so a single &gt; imdb.ttl captures their combined stdout. The full Qleverfile is below:</p><pre>[data]<br>NAME             = imdb<br>IMDB_DATA_URL    = https://datasets.imdbws.com<br>GET_PREFIXES     = echo &quot;@prefix imdb: &lt;https://www.imdb.com/&gt; . @prefix rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt; . &quot;<br>GET_IMDB_BASICS  = FILE=title.basics.tsv.gz; curl -sLO -C - ${IMDB_DATA_URL}/$${FILE}; gunzip -c $${FILE} | sed 1d | awk -F&#39;\t&#39; &#39;{ gsub(&quot;\\\\&quot;, &quot;\\\\&quot;, $$3); gsub(&quot;\&quot;&quot;, &quot;\\\&quot;&quot;, $$3); if ($$6 == &quot;\\N&quot;) printf &quot;imdb:%s imdb:id \&quot;%s\&quot; ; imdb:type \&quot;%s\&quot; ; imdb:title \&quot;%s\&quot; .\n&quot;, $$1, $$1, $$2, $$3; else printf &quot;imdb:%s imdb:id \&quot;%s\&quot; ; imdb:type \&quot;%s\&quot; ; imdb:title \&quot;%s\&quot;; imdb:year %s .\n&quot;, $$1, $$1, $$2, $$3, $$6 }&#39;; rm -f $${FILE}<br>GET_IMDB_RATINGS = FILE=title.ratings.tsv.gz; curl -sLO -C - ${IMDB_DATA_URL}/$${FILE}; gunzip -c $${FILE} | sed 1d | awk -F&#39;\t&#39; &#39;{ printf &quot;imdb:%s imdb:averageRating %s ; imdb:numVotes %s .\n&quot;, $$1, $$2, $$3 }&#39;; rm -f $${FILE}<br>GET_IMDB_ACTOR_DIRECTOR = FILE=title.principals.tsv.gz; curl -sLO -C - ${IMDB_DATA_URL}/$${FILE}; gunzip -c $${FILE} | sed 1d | awk -F&#39;\t&#39; &#39;{ printf &quot;imdb:%s imdb:principal [ imdb:role \&quot;%s\&quot; ; imdb:person imdb:%s ] .\n&quot;, $$1, $$4, $$3 }&#39;; rm -f $${FILE}<br>GET_IMDB_NAMES = FILE=name.basics.tsv.gz; curl -sLO -C - ${IMDB_DATA_URL}/$${FILE}; gunzip -c $${FILE} | sed 1d | awk -F&#39;\t&#39; &#39;$$2 !~ /[\\&quot;]/ { printf &quot;imdb:%s rdfs:label \&quot;%s\&quot; .\n&quot;, $$1, $$2 }&#39;; rm -f $${FILE}<br>GET_DATA_CMD     = (${GET_PREFIXES}; ${GET_IMDB_BASICS}; ${GET_IMDB_ACTOR_DIRECTOR}; ${GET_IMDB_NAMES}) &gt; ${NAME}.ttl<br>VERSION          = $$(date -r imdb.ttl +&quot;%d.%m.%Y %H:%M&quot; || echo &quot;NO_DATE&quot;)<br>DESCRIPTION      = IMDb, CSV from ${IMDB_DATA_URL}, converted to RDF TTL using awk, version ${VERSION}<br>TEXT_DESCRIPTION = All literals, search with [ ql:contains-word &quot;...&quot;; ql:contains-entity ?literal ]<br><br>[index]<br>INPUT_FILES     = ${data:NAME}.ttl<br>CAT_INPUT_FILES = cat ${INPUT_FILES}<br>SETTINGS_JSON   = { &quot;num-triples-per-batch&quot;: 1000000 }<br>TEXT_INDEX      = from_literals<br>STXXL_MEMORY     = 10G<br><br>[server]<br>PORT               = 7000<br>ACCESS_TOKEN       = ${data:NAME}<br>MEMORY_FOR_QUERIES = 10G<br>TIMEOUT            = 600s<br><br>[runtime]<br>SYSTEM = native<br>IMAGE  = docker.io/adfreiburg/qlever:latest<br><br>[ui]<br>UI_CONFIG = imdb</pre><p>The<strong> GET_IMDB_BASICS</strong> definition involves the extraction of <a href="https://developer.imdb.com/non-commercial-datasets/#titlebasicstsvgz"><em>title.basics.tsv.gz</em></a><em>, </em>which has the following fields/column values (among others):</p><ul><li><strong>tconst</strong> (string): alphanumeric unique identifier of the title</li><li><strong>titleType</strong> (string): the type/format of the title (e.g., movie, short, tvseries, tvepisode, video, etc)</li><li><strong>primaryTitle</strong> (string): the more popular title / the title used by the filmmakers on promotional materials at the point of release</li></ul><p>producing <a href="https://www.w3.org/TR/turtle/">Turtle</a> output that captures statements about a movie (its identifier, type, and title), TV series, etc., and can be expressed via these statements:</p><pre><strong>@prefix</strong> imdb:  &lt;https://www.imdb.com/&gt;<br>imdb:..tconst.. imdb:id    &quot;<em>..tconst..</em>&quot; ; <br>                imdb:type  &quot;<em>..titleType..</em>&quot; ; <br>                imdb:title &quot;<em>..primaryTitle..</em>&quot;</pre><p><strong>GET_IMDB_ACTOR_DIRECTOR</strong> defines a command that downloads <em>title.principals.tsv.gz, </em>which defines the following data fields:</p><ul><li><strong>tconst</strong> (string): alphanumeric unique identifier of the title</li><li><strong>nconst</strong> (string): alphanumeric unique identifier of the name/person</li><li><strong>category</strong> (string): the category of job that person was in</li></ul><p>and produces Turtle output like this, capturing information about a <em>role</em> played by a <em>person</em>:</p><pre><strong>@prefix</strong> imdb:  &lt;https://www.imdb.com/&gt;<br>imdb:..tconst.. imdb:principal [ imdb:role   &quot;<em>..category..</em>&quot; ; <br>                                 imdb:person imdb:..nconst.. ]<br></pre><p>Finally, <strong>GET_IMDB_NAMES</strong> defines a command that downloads and transforms <em>name.basics.tsv.gz</em>, which has the following fields:</p><ul><li><strong>nconst</strong> (string): alphanumeric unique identifier of the name/person</li><li><strong>primaryName</strong> (string): name by which the person is most often credited</li></ul><p>producing Turtle output per the following template, capturing the name of the person, among other attributes and relations in the RDF graph:</p><pre><strong>@prefix</strong> imdb:  &lt;https://www.imdb.com/&gt;<br>imdb:..nconst.. rdfs:label &quot;..primaryName..&quot;<br></pre><p>Altogether, these are RDF statements about the directors, actors, movies, movie titles, etc. in the dataset:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*QAgd2WMgigVtjLJBOscVSw.png" /><figcaption>IMDB RDF statements</figcaption></figure><p>One common way the vocabulary of a deployed RDF dataset evolves is when a new term is introduced whose meaning is a composite of existing vocabulary terms, for some unanticipated sub-domain. For our example, we can define semantics for intermediary object properties as placeholders for useful patterns in the IMDB RDF graph. In particular, we can define a (<em>derived</em>) <strong>imdb:has_actress</strong> property <em>between</em> a movie (<strong>?movie</strong>) and a person (<strong>?person</strong>) that serves as a shortcut for this Basic graph pattern:</p><pre>PREFIX imdb:  &lt;https://www.imdb.com/&gt;<br>{<br>    ?<strong>movie</strong>  imdb:principal [ imdb:role   &quot;<em>actress</em>&quot;;<br>                             imdb:person ?<strong>actress</strong>  ]<br>}</pre><p>We capture this in RIF Core (with equivalent N3 shown for readability):</p><pre>--- W3C RIF-Core<br>Document(<br>    Prefix( imdb &lt;https://www.imdb.com/&gt; )<br>    Group (<br>        Forall ?person ?movie ?principal ( <br>            imdb:has_actress(?movie ?person) :- And( imdb:person(?principal <br>                                                                 ?person) <br>                                                imdb:role(?principal &quot;actress&quot;) <br>                                                imdb:principal(?movie ?principal)))<br>    )<br>)<br><br>--- N3 <br>@prefix imdb: &lt;https://www.imdb.com/&gt; .<br>@prefix log: &lt;http://www.w3.org/2000/10/swap/log#&gt;.<br>{ ?principal imdb:role      &quot;actress&quot;;<br>             imdb:person    ?person   .<br>  ?movie     imdb:principal ?principal } =&gt; { ?movie imdb:has_actress ?person } .</pre><p>We can verbalize the meaning as</p><blockquote><em>Every movie related to a principal with a role of ‘actress’ stands in an </em><strong><em>imdb:has_actress</em></strong><em> relation with that person</em></blockquote><p>For demonstration purposes of how this would all work in principle, we start off with this initial query:</p><pre>PREFIX rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;<br>PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;<br>PREFIX owl: &lt;http://www.w3.org/2002/07/owl#&gt;<br>PREFIX imdb: &lt;https://www.imdb.com/&gt;<br>PREFIX xsd: &lt;http://www.w3.org/2001/XMLSchema#&gt;<br>    <br>SELECT DISTINCT,  ?movie ?title ?director ?director_name ?year<br>WHERE {<br>          ?movie      imdb:principal  [ imdb:role   &quot;director&quot;;<br>                                        imdb:person ?director  ];<br>                      imdb:title      ?title;<br>                      imdb:year       ?year .<br>          ?director   rdfs:label      ?director_name<br>          FILTER ( ?year &gt; 2010 &amp;&amp; ?year &lt; 2020 &amp;&amp;<br>                   ?director_name IN (&quot;Joel Coen&quot;, &quot;Ethan Coen&quot;))<br>}</pre><p>This is for all productions directed by one of the two Coen brothers (Joel or Ethan) and created after 2010 and before 2020 (not including either, so effectively <em>between 2011 and 2019</em>).</p><p>Our motivation is to make use of the newly defined property to conveniently query for all the actresses of these productions, for example:</p><pre>PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;<br>PREFIX imdb: &lt;https://www.imdb.com/&gt;<br>SELECT ?person ?name WHERE {<br>       &lt;https://www.imdb.com/tt0475290&gt;    imdb:has_actress    ?person .<br>       ?person                             rdfs:label          ?name<br>}</pre><p>This query involves predicates of the Extensional Database (EDB) <strong>and</strong> predicates whose semantics are defined entirely in the vocabulary (i.e., the derived predicate <strong>imdb:has_actress</strong>) by a rule or ontology. The meta-interpreter (described in the previous article) resolves queries like this by analyzing the involved rules at three levels. First, consider the <strong><em>has_actress</em></strong> rule shown earlier, then as RIF-Core with magic-sets/SIP <em>adornment</em>:</p><pre>Forall ?principal ?person ?movie (<br> imdb:has_actress_bf(?movie ?person)<br>     :- And( imdb:principal(?movie ?principal)<br>             imdb:role(?principal &quot;actress&quot;)<br>             imdb:person(?principal ?person) ) ): grounded has_actress demo returns 4</pre><p>Where <strong>_bf</strong> is an example of <em>adornment</em> and means “bound/free, i.e., at the time the rule is being used, the first term for <strong><em>has_actress</em></strong><em> (</em><strong>?movie)</strong> is bound, but the second (<strong>?person</strong>) is not.</p><p>And then finally, as 3 meta-interpreter network rules derived from this single rule:</p><pre>1. <br>Forall ?person ?movie (<br>   imdb:has_actress_bf(?movie ?person)<br>       :- And( imdb:has_actress_query_bf(?movie) bfp:evaluate(rule:1 3) ) )<br>2. <br>Forall ?movie (<br>   bfp:evaluate(rule:1 0) :- imdb:has_actress_query_bf(?movie) )<br><br>3. <br>Forall ?principal ?movie (<br>   imdb:principal_query(?movie ?principal) :- bfp:evaluate(rule:1 0) )</pre><p>Where <strong>bfp:evaluate</strong>(rule:N M) indicates M of rule N’s body terms have been evaluated. These can be paraphrased as:</p><blockquote><strong><em>Rule 1</em></strong><em>: To derive </em>has_actress<em> requires that it was queried (with the first term bound and the second one free) and 3 terms in the rule body have been evaluated .</em><br><strong><em>Rule 2:</em></strong><em> The evaluation of the body of the rule is triggered by a query for </em>has_actress<em> where the first term was bound and the second was free.</em><br><strong><em>Rule 3:</em></strong><em> The EDB conjunctive query that begins with </em>principal_query<em> is triggered when the first term of the body of the rule has been evaluated</em>.</blockquote><p>This third rule takes advantage of the solutions threaded from earlier SIP invocations to create a single, efficient conjunctive query for <strong>?principal </strong>and <strong>?person</strong> bindings, involving the <strong>imdb:principal</strong>, <strong>imdb:role</strong>, and <strong>imdb:person</strong> predicates, and evaluating the rule by efficient query mediation and propagating solutions:</p><pre>SELECT ?principal ?person {<br>    imdb:tt0475290 imdb:principal ?principal .<br>    ?principal imdb:role &quot;actress&quot; .<br>    ?principal imdb:person ?person<br>}</pre><p>Because of the meta-interpreter’s design, we can also collect truth-maintenance data during evaluation. This includes information useful for deterministic explanations of logical entailments and for <a href="https://en.wikipedia.org/wiki/Explainable_artificial_intelligence">Explainable AI (XAI) capabilities</a>.</p><p>The diagram below shows the inferred (dashed) <strong>imdb:has_actress</strong> property, juxtaposed against the assertions about the movie that the inference is based on (in red):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RMRLz6WOS1Lj9mnjuMbKAQ.png" /><figcaption>Inferring Scarlet Johansson is an actress in “Hail, Caesar” in IMDB RDF knowledge graph</figcaption></figure><p>FuXi’s SPARQL Interlocutor begins with rules, adorned with respect to the first triple pattern:</p><pre>&lt;https://www.imdb.com/tt0475290&gt; <strong>imdb:has_actress</strong> ?person</pre><p>or, more properly, with respect to this term, which corresponds to a way of encoding that query:</p><pre>imdb:has_actress_query<strong>_bf</strong>(<em>imdb:tt0475290</em>)</pre><p>Note the bolded adornment of the <strong>imdb:has_actress_query </strong>predicate, which the meta-interpreter uses to optimize how queries against EDB predicates are resolved and goals are solved, indicating that the first argument is bound while the second is free. Because the meta-interpreter executes forward-chaining while simulating backward-chaining reasoning, it is initiated with this query as a fact (a “<em>goal query assertion</em>”). This goal assertion can be interpreted as meaning:</p><blockquote>The assertion of a query for an instance of a <strong><em>imdb:has_actress</em></strong> relationship between the resource <em>imdb:tt0475290</em> (the movie “Hail, Caesar!”) and a free variable that we wish to solve for (the <strong>?person</strong>).</blockquote><p>EDBs are a set of facts, explicitly stored as physical relations in a knowledge base or database. SIP strategies create an “information passing” graph that captures how bindings from goals propagate through rule evaluation, starting with the <strong>imdb:has_actress</strong> predicate <em>queried</em> in the head of a rule used to solve the query. The adornments on the adorned rule that derives this predicate are created with respect to this query, its initial bindings, and how they flow through the reasoning process.</p><p>A good way to visualize this is to follow along the rule from left to right (from the head across the terms in the body):</p><pre><strong>imdb:has_actress</strong>(<em>?movie</em> ?person) :- And( imdb:principal(<em>?movie</em> ?principal) <br>                                         imdb:role(?principal &quot;actress&quot;) <br>                                         imdb:person(?principal ?person) )</pre><p>In the first step, the bindings for the movie whose actress we are solving for propagate from <strong>imdb:has_actress</strong> to the first EDB predicate we need to solve for (<strong>imdb:principal</strong>). We then evaluate the corresponding triple pattern with <strong><em>?movie</em></strong> bound to the same value and <strong>?principle </strong>unbound, retrieving solutions for the latter, if any. A visual representation of this SIP mechanism is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*4YQD6rtIbzPWi8AJ79Bu5w.png" /></figure><p>Here, a query for the <strong>imdb:has_actress</strong> predicate with bindings (a “<em>bound head</em>”) passes that information to <strong>imdb:principle</strong>, the first EDB predicate in the rule body (or <em>antecedent</em>), as bindings for the <strong><em>?movie</em></strong> variable.</p><p>In the second step, the solutions for <strong><em>?principle</em></strong> from the initial step are passed on (from the 2 previously-solved terms <strong>imdb:has_actress</strong> and <strong>imdb:principal)</strong> to the next one (<strong>imdb:role</strong>), which is evaluated to only return solutions for <strong><em>?principle</em></strong> that have “<em>actress</em>” as the value of their <strong>imdb:role</strong> property (i.e., actresses only).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*pZWQM_VLRzsOIQFr7QebIg.png" /></figure><p>Finally, in the third step, the process passes the remaining values for <strong><em>?principal</em></strong> to the last EDB predicate, <strong>idb:person, </strong>leaving <strong><em>?person</em></strong> unbound, retrieving solutions, and using them to infer the proper <strong>imdb:has_actress</strong> relationship between <strong>?movie</strong> and <strong>?person</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*dtedMIfNkS_rYE2xVZgLlg.png" /></figure><p>The SIP collection is stored internally as an RDF graph that uses reification. These rule-binding propagation graphs, and the automated theorem-proving capabilities they facilitate, are the output of the SPARQL interlocution process. In principle, a small but efficient production-rule evaluation network implements this, calculating answers to intermediate SPARQL queries based on solutions to, and questions from, the initial, larger ones.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6KHvp2rHdBObIos-X3YXqw.png" /><figcaption>“.. intuitive illustration of how FuXi can be used to perform idempotent SPARQL 1.1 Entailment Regimes over a remote, independent SPARQL service. It should also demonstrate how this is an analogy to traditional data warehouse architecture with virtual views that create a logical abstraction layer over source data. The visual language should feel crisp, simple, and clear.[..]</figcaption></figure><p>It is also worth noting that the semantics of the <strong>imdb:has_actress</strong> derived predicate cannot be captured in an <a href="https://www.w3.org/TR/owl2-syntax/#Object_Subproperties">ObjectPropertyChain</a> axiom. This is an example of a situation where an interchangeable, rules-based knowledge representation can safely extend beyond the semantics of OWL terms to accommodate the meaning used in the domain.</p><p>Most of the various knobs associated with the meta-interpretation mechanism are abstracted away from the user into several main SPARQL entailment APIs (two in fuxi.SPARQL.utilities and the last in fuxi.predicates, involving <a href="https://www.w3.org/TR/sparql11-federated-query">SPARQL Federated Query Extension</a> entailment but not listed here):</p><ul><li><strong>owl_entailment_regime_graph</strong>(<em>owl_plus_abox_graph</em>)</li><li><strong>sparql_interlocution_basic_graph_pattern</strong>(query, top_down_store, generate_proofs=False, [..])</li></ul><p>Since the previous article, <a href="https://github.com/chimezie/FuXi-reincarnate/releases/tag/v2.1.0">FuXi 2.1.0 has been released</a>, with various <a href="https://github.com/chimezie/FuXi-reincarnate/blob/master/CHANGELOG.md">improvements</a>, including support for ASK conjunctive queries with SPARQL interlocution.</p><p>The first API (owl_entailment_regime_graph) supports a fully local setup, where both the TBox and the RDF dataset are loaded in memory. This way, a developer can develop their own local vocabularies that capture domain meaning within a medium-sized knowledge base, enabling them to ask and answer queries intelligently and efficiently, using an interlocutor.</p><p>Later in their development, the second API can connect remote RDF datasets to query mediators in a communal, non-invasive way (without materializing RDF) and mutually incorporate other vocabularies and datasets created similarly.</p><p>Below is an example of how FuXi 2.1.0 can be used to set up a connection to a remote SPARQL endpoint, such as the QLever one we set up earlier, providing it an optional set of rules, telling it to identify hybrid predicates by querying the service, and providing it an rdflib graph of the OWL 2 ontology that, along with the rules, specifies the semantics of the terms in any SPARQL query to <strong>entailing_graph:</strong></p><pre>from fuxi.SPARQL.service import SPARQLServiceGraph<br>from fuxi.predicates import SPARQLPredicatePartitioner<br><br># Remote SPARQL endpoint serves as EDB (instance data)<br>sparql_graph = SPARQLServiceGraph(&quot;http://service/url&quot;)<br><br>entailment_builder = SPARQLPredicatePartitioner(sparql_graph,<br>                                                rules = program,<br>                                                identify_hybrid_predicates = True,<br>                                                tbox_only_graph = tbox_graph)<br>entailing_graph = entailment_builder.create_entailing_store()</pre><p>Finally, a new <strong>TruthMaintenanceGraphSerializer</strong> converts complex logical proofs into textual explanations by taking FuXi’s internal RDF graph of the reasoning process, retrieving detailed information about inference steps, including conclusions, descriptions, and variable mappings. It provides granular justifications for both rule-based inferences and query-based results as output of the logic used by the meta-interpretation engine, transforming the logic into transparent theorem-proving provenance (serialized as an RDF graph written in the <a href="https://en.wikipedia.org/wiki/Provenance_Markup_Language">PML</a> vocabulary) or human-readable text as natural language for human and LLM consumption:</p><pre>The conclusion imdb:has_actress(imdb:tt0475290 ?person) is justified by:<br>  The rule: <br>      imdb:has_actress_bf(?movie ?person) :- And( <br>                                               imdb:has_actress_query_bf(?movie) <br>                                               bfp:evaluate(rule:1 3) <br>                                             ), <br>  the response from the query below and any bindings it may have used, <br>      and the antecedent(s) that follow:<br>          ASK {<br>              imdb:tt0475290 imdb:principal ?principal .<br>              ?principal imdb:role &quot;actress&quot; .<br>              ?principal imdb:person imdb:nm0424060<br>          }<br>          ?principal -&gt; _:bn5225118<br>          ?person -&gt; &lt;https://www.imdb.com/nm0424060&gt;<br>          ?movie -&gt; &lt;https://www.imdb.com/tt0475290&gt;<br><br>  The conclusion imdb:principal_query(imdb:tt0475290 ?principal) is justified by:<br>      The rule: imdb:principal_query(?movie ?principal) :- bfp:evaluate(rule:1 0), any bindings shown below, and the antecedent(s) that follow:<br>      ?movie -&gt; &lt;https://www.imdb.com/tt0475290&gt;<br>      ?person -&gt; &lt;https://www.imdb.com/nm0424060&gt;<br><br>The conclusion bfp:evaluate(rule:1 0) is justified by:<br>  The rule: bfp:evaluate(rule:1 0) :- imdb:has_actress_query_bf(?movie), any bindings shown below, and the antecedent(s) that follow:<br>      movie -&gt; &lt;https://www.imdb.com/tt0475290&gt;<br><br>The conclusion imdb:has_actress_query_bf(imdb:tt0475290) is justified by:<br>  Goal query assertion</pre><p>An <a href="https://chimezie.medium.com/evolving-domain-specific-natural-languages-for-owl-ontologies-owl-dsl-8314c85b2b7f">earlier article</a> discusses <a href="https://github.com/chimezie/owl_dsl">OWL_DSL</a>, a Python Library for creating and managing Domain Specific Languages (DSL) for OWL ontologies using Controlled Natural Languages (CNLs) and their rendering of term definitions. This is useful for working with and ingesting the TBoxes of systems like this. It too has undergone recent <a href="https://github.com/chimezie/OWL_DSL/blob/main/CHANGELOG.md">major changes</a>, including serializing rules with CNLs. The final article in this series will discuss how to synthesize and use these capabilities together.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=df13ff535caf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Origin Story of a Reborn Semantic Web Reasoner and Query Mediator]]></title>
            <link>https://chimezie.medium.com/the-origin-story-of-a-reborn-semantic-web-reasoner-and-query-mediator-9185bc1e55e7?source=rss-9344b33e7a8a------2</link>
            <guid isPermaLink="false">https://medium.com/p/9185bc1e55e7</guid>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[biomedical-informatics]]></category>
            <category><![CDATA[ontology]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Chimezie Ogbuji]]></dc:creator>
            <pubDate>Mon, 18 May 2026 19:25:36 GMT</pubDate>
            <atom:updated>2026-05-22T20:43:03.287Z</atom:updated>
            <content:encoded><![CDATA[<h4>Semantic Web reasoning series 1/3</h4><h3>The Origin Story of a Reborn Semantic Web Reasoner and Interlocutor</h3><h4>Reasoning algorithms, meta-interpretation, and revisiting the open world assumption</h4><h4>The Extensible Database System Origins</h4><p>A core principle of my interest in AI systems in my career has been in their use in a recursively introspective way. I.e., in a way that uses their abilities to reason about or automate some aspect of how they function to do it more effectively or usefully. That is why, after I left the Cleveland Clinic and then Case Western, I created my own company named <strong>Meta</strong>cognition LLC, because that principle was a straight throughline from the database management methods we were developing in the experimental Advanced Database (or informatics) department of the Cardiothoracic Surgery Research department at the Cleveland Clinic, the tinkering and building during the Semantic Web activity period, and the evolution of FuXi from a tool used as a reasoning component of data management methods in the latter part of the first decade of the 2000s.</p><p>The methods documented in the expired patent are among the few surviving architectural documents from our work with the Cardiovascular Information Registry (CVIR). The patent described a system that:</p><blockquote>included a <strong>domain interpreter</strong> [programmed] or configured to manage and interpret [a] domain model. [It] includes one or more tool generators (e.g., functions or methods) programmed to generate one or more data management tools that facilitate interaction, use, and management of [a] domain model and of corresponding domain instance [representations]. — <a href="https://patents.google.com/patent/US7836097B2/en">Extensible database system and method (</a>US7836097B2<a href="https://patents.google.com/patent/US7836097B2/en">)</a></blockquote><p>A <strong>domain expert</strong> specified a domain model as an <em>RDF Graph</em> (a logical and semantic representation of statements about resources identified via URIs), and an <em>interpreter or logical reasoner</em> was needed to interpret the model, <em>generating data management tools</em> for representing the domain model as XML documents. It also generated <em>XSLT transformations</em> that performed various tasks: producing RDF graph representations of the content in each XML document; validating the documents; producing XForms documents that implement dynamic, web-based interfaces using a declarative Model-View-Controller architecture for rendering them from and binding them to each XML document; and other data management components.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*me_iRyoxRALRDrdavTUvoQ.png" /><figcaption>Notebook LLM infographic “ in [a] concise, sketch mode using the Master Automated Architect analogy that is more modern and less steampunk [..]”</figcaption></figure><p>The model needed to capture domain-specific knowledge and presentation semantics to facilitate the automated generation of these artifacts. This framework can be used for any particular domain, but in our case, the domain was outcomes research of cardiothoracic procedures:</p><blockquote>All patients undergoing cardiac surgery at the Cleveland Clinic are entered into the Cardiovascular Information Registry (CVIR), which includes a collection of preoperative demographic and comorbidity data, indications for surgery, operative variables, in-hospital complications, and operative mortality</blockquote><blockquote>— <a href="https://www.annalscts.com/article/view/5148/6706">Minimally invasive aortic valve surgery: Cleveland Clinic experience</a> Sep 07, 2014</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i7zl29lDumczMkTWin4_hQ.png" /><figcaption>Notebook LLM re-imagination of “A database full of heart information connected with many wires” (Watercolor)</figcaption></figure><p>It was from this particular role, as <em>a domain interpreter </em>for this content management framework during my immersion in early Semantic Web engineering, architecture, and W3C specification development, that FuXi emerged.</p><p>We used Early Notation 3 (N3) reasoners (<a href="https://www.w3.org/2000/10/swap/doc/cwm.html">CWM</a>, <a href="https://github.com/eyereasoner/eye">Euler</a>, and Pychinko), but eventually needed one that could handle the volumes we faced (hundreds of thousands of patients). In the spirit of our skunkworks approach, when I wasn’t working on the outcomes patient registry architecture, I was developing a <em>de novo</em>, open-source version.</p><h4><strong>Technical Evolution: From RETE to RETE-UL</strong></h4><p>At first, circa late 2006, it <a href="https://copia.posthaven.com/progress-on-two-reference-implementations-for">continued in the footsteps of Pychinko</a>, which used an implementation of the original RETE network as a basis for production rule matching. Then later, it adapted the methods described in Robert B. Doorenbos’ 1995 thesis (<em>“Production Matching for ‘Large Learning Systems’” [1]</em>), which builds on the strong foundation with various algorithms, most of which I implemented in FuXi.</p><p>The thesis describes a modification of the original Rete algorithm that limits its fact syntax to 3-item tuples, which correspond quite nicely to the RDF abstract syntax. It also describes methods for using hash tables to improve the efficiency of alpha nodes and beta nodes, the internal structures of an efficient RETE-UL rule and rule-action evaluation network.</p><p>The production matching process was a <em>forward-chaining</em> mechanism which:</p><blockquote>starts with the available data and uses inference rules to extract more data (from an end user, for example) until a goal is reached.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/1*nM-C_g55ohezU-XgOkNGWQ.png" /><figcaption>The RETE-UL representation of a pair of N3 rules: “If X begat Y, then Y has X as their ancestor” and “If Y is X’s ancestor and Z is Y’s ancestor, then Z is X’s ancestor.” via Inkscape</figcaption></figure><h4>Balancing Expressiveness and Computational Tractability</h4><p>From that time until my eventual departure from the Cleveland Clinic in 2011 to become a PhD student and Medical Informatics fellow at Case Western Reserve University, I gained a better understanding of the mathematics underlying Description Logics and ontologies, and gained experience using them over time. During that same time, there was significant development of the various Description Logic languages.</p><p>While at Case Western, I took a <a href="https://api.pageplace.de/preview/DT0400.9781439863534_A37606181/preview-9781439863534_A37606181.pdf">graduate-level mathematics course on Kurt Gödel’s (in)completeness theorems</a> that was quite timely, covering mathematical logic, model theory, proof theory, and deductive reasoning machines, further helping my understanding, development, and design of Semantic Web reasoning systems.</p><p>In developing Description Logic languages or other logic-based knowledge representations, there is often a fundamental trade-off between the expressiveness of the language (the ability to express a particular kind of restriction, for example) and its computational tractability, i.e., how well it scales into the extraordinarily large number of terms and data typically required of the medical domain, for example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*0AuPdmWw3NpnhdiDT2Y7Aw.png" /><figcaption>August 2010 Omnigraffle diagram export to SVG (Inkscape) showing expressiveness/tractability relationships between various logic-based Knowledge Representations</figcaption></figure><p>One influential approach for navigating this balance that emerged during this period of time was “Description logic programs: Combining logic programs with description logic,” from 2003 [2], which included many ideas that started to take hold in 2008 [3] when I described it as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*nWxwKE-P4ha_0apErypmZw.png" /></figure><blockquote>[an] algorithm [that] provides a direct mapping from a subset of Description Logic into an equivalent Logic Program. InfixOWL can be used as a framework for composing OWL RDF graphs and converting them into a customized ruleset using the DLP implementation. — <strong>Ogbuji, C. (2008). InfixOWL: An Idiomatic Interface for OWL. In OWLED (Vol. 432).</strong></blockquote><p>Back then, it had seemed there was either something in particular about medical data that requires a more expressive knowledge representation than just the use of so-called <em>Horn rules</em>, on the one hand, or, on the other, just DL-based ontology terminology systems: one that allowed both to work in tandem to express what was needed adequately.</p><h4>Meta-Interpretation and the Backward Fixpoint Procedure</h4><p>One advantage of Horn rules is that they support useful paradigms, such as <em>meta-interpreters </em>and <em>meta-programs, </em>which originated in an even earlier logic-based AI era: from the middle to the end of the 80’s. Back then, there was foundational research on “<em>Magic Sets and other strange ways to implement logic programs</em>.” [4,5] and algorithms that can efficiently rewrite and evaluate recursive queries via “sideways information passing” (SIP) strategies, which we will describe further later.</p><p>Eventually, this matured into a field of [6]:</p><blockquote>A meta-interpreter for a language [as] an interpreter for the language written in the language itself.</blockquote><p>A key meta-interpreter is Bry’s Backward Fixpoint Procedure [7]</p><p>Before we look more closely at how it works, I need to clarify the differences between how rules are represented in classical systems and in Semantic Web rule systems. Whereas we write N3 rules with the premise and conclusion going left to right and using infix notation:</p><pre>{ ?x <strong>begat</strong> ?y } =&gt; { ?y <strong>ancestor</strong> ?x }</pre><p>Logic Programming rules are written in the other direction and with postfix notation:</p><pre><strong>ancestor</strong>(x y) :- <strong>begat</strong>(x y)</pre><p>Also, we often indicate the conjunction of terms in the <em>body</em>, or <em>premise,</em> of a rule with the caret symbol (^) or a comma. The Backward Fixpoint Procedure is defined this way:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*4grp1H6H-LqQchZqSzlSmQ.png" /><figcaption>Each rule that the meta-interpeter ‘interprets’</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/956/1*S1EEvESGFP5MpvSJKazgpw.png" /><figcaption>The meta-interpretation rules generated for each rule: 1) rule firing, 2–3) continuance of a query, 4) generation of a query</figcaption></figure><p>Usually, when working <em>backward</em> from a goal using rules, the starting point is the <em>rule’s head</em>, or <em>consequent</em>. So, we usually begin by asserting this term, contributing variable bindings for later solutions and sub-goals or ‘queries’:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/154/1*vzZGw6ctP_jnUldRAbXuSA.png" /></figure><p>which intuitively means “query for p of some x, (a set of 0, 1, or more variables)” which can trigger</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/175/1*QXFUZNgsDv4x3NRywl_D_Q.png" /></figure><p>which can be read as “The evaluation of rule <strong>k</strong>, starting from its first term in its body, and for all its terms (<strong>x</strong>).” A key principle of the Backward Fixpoint Procedure is that the assertion of facts by a rule triggers the generation of new queries (i.e., terms with a <em>query</em> prefix) and an evaluation of a rule (i.e., terms with an <em>evaluate</em> predicate).</p><p>This approach allows a forward-chaining logical reasoner to simulate <em>backward-chaining reasoning</em>:</p><blockquote>an inference method [that works] backward from the goal. It is used in automated theorem provers, inference engines, proof assistants, and other artificial intelligence applications. [It] is implemented in logic programming by <strong>SLD resolution</strong>.</blockquote><p>Sometime after becoming familiar with this mechanism and in mid-2011, I began to adapt it as a basis for implementing an efficient backward-chaining approach for RDF, RDFS, some OWL, and N3 using RETE-UL networks for rule evaluation. This diagram from then is of the architectural design of a SPARQL reasoning meta-interpreter as an extension of the RETE-UL algorithm:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/743/1*YkREP5ThJwCD6RTnDIgPEw.png" /><figcaption>July 2011 Omnigraffle diagrams exported to SVG (Inkscape)</figcaption></figure><h4>SPARQL Interlocution and Sideways Information Passing</h4><p>A perennial challenge that arises from the combined use of SPARQL services with reasoning capabilities is inferring RDF triples that are logically entailed from an ontology, and/or a set of rules, and determining whether to persist them and (if so) how to keep them synchronized with changes to the original set of RDF facts, rules, ontology, etc. There were, as now, many standards of practice and approach: <a href="https://www.w3.org/submissions/spin-overview/">SPARQL Inferencing Notation</a> and the current iteration of <a href="https://www.w3.org/TR/shacl12-rules/">SHACL Rules</a>, both of which treat reasoning entirely as <em>forward-chaining</em> inference rather than as truly <em>declarative (</em>independent of the implementation of the inference mechanism).</p><p>Relational databases, which were the primary application of techniques such as the Backward Fixpoint Procedure and Magic Sets, have evolved beyond this equivalent point in their development history, despite the world of Semantic Web logical reasoning seemingly unable to do the same.</p><p>For example, we take for granted that a <a href="https://en.wikipedia.org/wiki/View_(SQL)">view</a> on a relational database table:</p><blockquote>does not form part of the physical schema [but is] is a virtual table computed or collated <strong>dynamically</strong> from data in the database when access to that view is requested</blockquote><p>These techniques are collectively referred to as Sideways Information Passing (SIP) strategies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pq2nohXKbjj00tjv8nR1qA.png" /><figcaption>Notebook LLM: “Using report as a basis, generate a version of the source diagram that illustrates how a Rete network is utilized to execute interlocution and how meta-interpretation facilitates query mediation over a SPARQL 1.1 Entailment Regime, but doing so as an analogy for the role of FuXi in Yijing theory and ancient Chinese history. [..] Use a scientific, colorful, concise infographic style and integrate knowledge of the SPARQL interlocution architecture over a RETE-UL network.”</figcaption></figure><p>Later, in an <a href="https://www.researchgate.net/publication/317176541_Semantic_Web_Query_Mediation_via_RDF-entailment_under_Dynamic_Rule_Sets?_sg%5B0%5D=TYufhMYDs48etDToqgD4lCK2s78a0gF1DeY36fLT9kc6JIkXlqwGPuG-Cb0j0TTja6fBMGg7pULBlNgVba8oVGTLaagnsE2uT6MsqxTA.ORYuEkSh78uJbFXFbejERYpnA48nrAiYvkMWmunAZN_e5LKVTt0TaJ2fgh_E9Qrpa4Av_tdbDSpN2N0v2Ii5PQ&amp;_tp=eyJjb250ZXh0Ijp7ImZpcnN0UGFnZSI6ImhvbWUiLCJwYWdlIjoicHJvZmlsZSIsInByZXZpb3VzUGFnZSI6InByb2ZpbGUiLCJwb3NpdGlvbiI6InBhZ2VDb250ZW50In19">unpublished work</a>, developed in collaboration with a colleague and primarily motivated by this paradigm, a formal extension of this meta-interpretation mechanism was described as a:</p><blockquote>meta-interpreter [that provides] the same answers (and intermediate derivations) as applying a magic set transformed ruleset against an entire database, [but] the way [its] answers are computed is very different. [..] sub-queries are generated for idempotent evaluation against a database.</blockquote><p>The meta-interpreter was called an <em>interlocutor:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/951/1*uV3ZWGOAMuTzrrKPrFM94Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/989/1*WbuzJY8k5oJItYYZXmg5fg.png" /><figcaption>Incorporating SPARQL evaluation into the original meta-interpeter</figcaption></figure><p>We extended Bry’s meta interpreter with constructs to support interaction with a SPARQL service over an RDF graph. The process, which produces only relevant facts and queries in response to intermediate answers and generates <em>open queries</em> when necessary, was called <strong><em>SPARQL interlocution</em></strong>.</p><p>The implementation, as described by contributor Graham Higgins in 2013:</p><blockquote>Uses the specialized BFP meta-interpretation rules to build a RETE-UL decision network that is modified to support the propagation of bindings from the evaluate predicates into a supplimental magic set sip strategy and the generation of subqueries. The end result is a bottom-up simulation of SLD resolution with complete, sound, and safe memoization [even when the rules are recursive]</blockquote><p>Around this time (2012), soon after I left Case Western, I was involved in a project called Sherlock, which sought to translate scientific textbook content into an accurate axiomatization of Cell Biology as mathematical logic. From working with Cyc at the Cleveland Clinic to this point, the unsolved, intractable problem of NLP via deterministic brute force remained the major challenge.</p><h4>Modernization and an owl:inverseOf Case Study</h4><p>Now, many years later, transformer-based “reasoning” language models, consortia like the <a href="https://medium.com/@chimezie/evolving-domain-specific-natural-languages-for-owl-ontologies-owl-dsl-8314c85b2b7f">Open Biomedical Ontologies (OBO), and their use of logic-based knowledge representation for interoperable domain consensus</a> are obliterating the systemic changes we faced back then in NLP and knowledge representation.</p><p>With this moment in mind, FuXi has been undergoing a recent resurrection, modernizing its various components in an evolutionary response to changes in Python and rdflib in the interim. In particular, I wanted to ensure it retained its ability to do:</p><ul><li>OWL 1.1/2.0 reasoning (<a href="https://www.w3.org/TR/owl-test/">OWL Web Ontology Language Test Cases</a>, <a href="https://www.w3.org/TR/owl2-conformance/">OWL 2 Web Ontology Language Conformance (Second Edition)</a>)</li><li>RIF/RDFS/RDF reasoning (<a href="https://www.w3.org/TR/rif-test/">RIF Test Cases (Second Edition)</a>)</li><li>SPARQL Entailment (<a href="https://www.w3.org/2009/sparql/docs/tests/README.html#entailevaltests">SPARQL 1.1 Entailment Evaluation Tests</a>)</li></ul><p>Thanks to its <a href="https://github.com/rdflib/fuxi">archive</a> by Graham Higgins and co., I was able to start with a <a href="https://github.com/rdflib/fuxi">snapshot</a> that included a harness for running the original <a href="http://OWL Web Ontology Language Test Cases">OWL Web Ontology Language Test Cases</a>. To demonstrate some of the capabilities described above, we will walk through a particular test case: <a href="https://www.w3.org/TR/2004/REC-owl-test-20040210/byFunction#function-inverseOf">7.1.24. owl:inverseOf</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/487/1*ZySVsRgnLXQYnlQiX8o_Tg.png" /><figcaption>Premise Graph 7.1.24. owl:inverseOf</figcaption></figure><p>The description of the test case is:</p><blockquote>If the pair (x,y) is an instance of P, than the pair (y,x) is an instance of the named property.</blockquote><p>We visualized the RDF graph as partitioned into 2 parts: the <a href="https://en.wikipedia.org/wiki/Description_logic#TBox_vs_Abox">TBox (terminological box) and the ABox (assertional box)</a>. The TBox contains statements about the terminology (class names, descriptions, properties, their descriptions, restrictions to both, and their hierarchies). In contrast, the ABox contains grounded statements that refer to individuals, including the classes they belong to in the hierarchy, their relationships, and where those relationships belong in the hierarchy of relationships. Intuitively, the TBox defines the vocabulary used to describe a world, and the ABox uses that vocabulary to describe the world.</p><p>The diagram uses green to indicate terms from the test case vocabulary and red to indicate instances or individuals. Most of the magic occurs via the <strong>owl:inverseOf</strong> predicate in the TBox to relate two properties: <strong>hasBrother</strong> and <strong>isBrotherOf</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yZa_pqtkJ_QD9tJ-b3C4Hw.png" /><figcaption>Notebook LLM infographic about (T/R/A) boxes</figcaption></figure><p>We can use Description Logic Programs to <em>compile</em> Horn rules from the semantics of OWL inverse axioms:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*kY2zibwlZxIzKqQs1s9AgQ.png" /><figcaption>The semantics of Description Logic inverse and transitive roles</figcaption></figure><p>FuXi provides an implementation of the transformations they define, which compiles the following equivalent Horn rules (rendered as N3) from the <strong>owl:inverseOf</strong> assertion:</p><pre>{ ?X :<strong>isBrotherOf</strong> ?Y } =&gt; {?Y :<strong>hasBrother</strong> ?X} .<br>{ ?Y :<strong>hasBrother</strong> ?X }  =&gt; {?X :<strong>isBrotherOf</strong> ?Y }.</pre><p>This rule compilation is similar (at least operationally) to how meta-interpreters compile rules into equivalent Horn clauses for evaluation and use in SPARQL interlocution.</p><p>This rule can be verbalized from top to bottom as:</p><blockquote>If <strong>?Y</strong> has <strong>?X</strong> as a brother, then <strong>?X</strong> is the brother of <strong>?Y</strong></blockquote><p>and</p><blockquote>If <strong>?X</strong> is the brother of <strong>?Y</strong>, then <strong>?Y</strong> has <strong>?X</strong> as a brother</blockquote><p>which is a more direct encapsulation of the premise graph than via a generic rule for owl:inverseOf, typically used:</p><pre>{?property1 <strong>owl:inverseOf</strong> ?property2. ?S ?<strong>property1</strong> ?O} <br>  =&gt; <br>{?O ?<strong>property2</strong> ?S}.</pre><p>As FuXi adopts the W3C’s <a href="https://www.w3.org/TR/rif-bld/">Rule Interchange Format (RIF) Basic Logic Dialect (BLD)</a> as its abstract syntax and API, we will use it to describe the rules in the example. Still, it can serialize rules as either BLD or N3:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/565/1*4Xj3jCfSymmvOSaXQ4x7SQ.png" /><figcaption>RIF/Horn rule equivalent of <strong>owl:inverseOf</strong> semantics in RIF BLD</figcaption></figure><h4>Semantic Web Reasoning and the Open World Assumption</h4><p>The test case expects the <em>logical entailment</em> of the following RDF statement:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*eOYSatwzw3pTl4SSKgsuSg.png" /><figcaption>Bob is the brother of Joe</figcaption></figure><p>Even if this statement is not in the <em>premise graph</em>, any reasoning-aware application can assume it is present and match SPARQL queries against it, as it follows from the premise graph, its vocabulary, and OWL, RDF, or RDFS semantics.</p><p>So, the following SPARQL query should return True when evaluated against the TBox graph (even if that statement is absent):</p><pre>ASK {<br>    :bob isBrotherOf :joe<br>}</pre><p>This expectation is part of what is often called the “<em>open world assumption (or semantics)</em>” of both OWL and RDF, and, by extension, of the Semantic Web. The motivating principle is that (for example) I wouldn’t want to be required to enumerate the full chain of progeny that led to me to be able to speak usefully about the concept of genetic ancestry.</p><p>Some criticisms of the open world assumption arise from a combination of misunderstanding the declarative nature of logic-based knowledge representation expressed in rules and a resulting, unstated assumption that forward-chaining is the <strong>sole</strong> mechanism for logical inference, a <em>forward-chaining as necessary semantics assumption.</em></p><p>Section “1.3 Extensions to Basic Graph Pattern Matching” of the <a href="https://www.w3.org/TR/sparql11-entailment/">SPARQL 1.1 Entailment Regimes recommendation</a> describes how a SPARQL entailment regime specifies the extension of basic graph patterns to not only match a query pattern against what is explicitly in the RDF dataset but also provide answers such that if substituted into the patterns, they would result in RDF graphs logically entailed by the RDF graph. SPARQL entailment is defined declaratively and doesn’t expect an implementation to rely on any particular reasoning strategy or query rewriting to achieve this, just that the answers it produces follow from SPARQL basic graph pattern matching and entailment between RDF graphs under various reasoning <em>regimes</em>.</p><h4>Using FuXi and Proof Visualization</h4><p>FuXi was <a href="https://github.com/chimezie/FuXi-reincarnate/releases/tag/v2.0.1">recently released as version 2.0.1</a>, a major revision that incorporates significant changes to restore it to a functional state.</p><p>Once you have it installed, you can simulate this particular OWL test case via the following commands:</p><pre>$ uv run --active fuxi.owl --output man-owl \<br>         --ns first=http://www.w3.org/2002/03owlt/TransitiveProperty/premises001# <br>         test/OWL/TransitiveProperty/premises001.rdf <br>[..snip..]<br>ObjectProperty( first:path TransitiveProperty )</pre><p>Assuming we want to demonstrate that the SPARQL query from before properly answers, we can use this command-line:</p><pre>fuxi.owl --method=bfp --dlp --hybrid \<br>         --ns eg=http://example.net/vocab# \<br>         --ns your=http://example.net/vocab# \<br>         --why &quot;ASK { eg:bob your:isBrotherOf eg:joe }&quot; \<br>         --output proof-graph-svg \<br>         test/OWL/inverseOf/premises001.rdf &gt; proof.svg</pre><p>to generate this <em>SPARQL interlocution proof trace</em> (as an SVG document) with Fuxi:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/405/1*4i9iDtmNiXeV_xPn611xKw.png" /><figcaption>SVG, edited in Inkscape</figcaption></figure><p>To demonstrate how it leverages SIP strategies, consider this alternative command-line that uses a SELECT query instead, selecting Bob’s brothers and passing information from bindings you have (Bob) to terms you don’t (<strong>?brother</strong>):</p><pre>$ fuxi.owl --method=bfp --dlp --hybrid \<br>           --ns eg=http://example.net/vocab# \<br>           --ns your=http://example.net/vocab# \<br>           --why &quot;SELECT ?brother { eg:bob your:isBrotherOf ?brother }&quot; \<br>           --output proof-graph-svg test/OWL/inverseOf/premises001.rdf &gt; proof.svg</pre><p>renders</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/1*uYcII4fguaMzSqJ5qHvypg.png" /></figure><p>In each case, FuXi creates a RETE-UL network from the meta-interpretation rules, which are a compilation of the original ruleset and the goal, and FuXi can generate them as PNG or SVG via:</p><pre>$ fuxi.proof --method=bfp --dlp --hybrid \<br>           --ns eg=http://example.net/vocab# --ns your=http://example.net/vocab# \<br>           --why &quot;ASK { eg:bob your:isBrotherOf eg:joe }&quot; \<br>           --output rete-network-svg \<br>           test/OWL/inverseOf/premises001.rdf &gt; rete_network.svg</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZzfVXNSG8243DmRCEqfADw.png" /><figcaption>RETE-UL meta-interpreter network exported as SVG from fuxi.proof and edited in Inkscape, adding SVG from (<a href="https://www.svgrepo.com/">SVG Repo</a>)</figcaption></figure><p>As the Backward Fixpoint Procedure and SPARQL interlocution are SIP strategies, you can also render the information passed from run-goal-time bindings (SIP collection graphs):</p><pre>$ fuxi.proof --method=bfp --dlp --hybrid \<br>             --ns eg=http://example.net/vocab# \<br>             --ns your=http://example.net/vocab# \<br>             --why &quot;ASK { eg:bob your:isBrotherOf eg:joe }&quot; \<br>             --output sip-collection-svg \<br>             test/OWL/inverseOf/premises001.rdf</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/357/1*_xm3ndMg6h12uYuja75IiQ.png" /><figcaption>SIP Collection graph exported as SVG from fuxi.proof and edited in Inkscape</figcaption></figure><p>Called with a SELECT instead of an ASK (providing one less binding):</p><pre>$ fuxi.owl --method=bfp --dlp --hybrid \<br>           --ns eg=http://example.net/vocab# \<br>           --ns your=http://example.net/vocab# \<br>           --why &quot;SELECT ?brother { eg:bob your:isBrotherOf ?brother }&quot; \<br>           --output sip-collection-svg test/OWL/inverseOf/premises001.rdf</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*iI3JdeK2ETcFkM2qC22Ftw.png" /><figcaption>SIP Collection with bindings of b (‘bound’) and f (‘free’) that adorn the rules</figcaption></figure><p>Fuxi can render the rules adorned with SIP graphs, showing how bindings pass through rule evaluation.</p><pre>$ fuxi.owl --method=bfp --dlp --hybrid \<br>           --ns eg=http://example.net/vocab# \<br>           --ns your=http://example.net/vocab# \<br>           --why &quot;SELECT ?brother { eg:bob your:isBrotherOf ?brother }&quot; \<br>           --output adornment test/OWL/inverseOf/premises001.rdf <br>Forall ?X ?_:3 ( :isBrotherOf_bf(?X ?_:3) :- my:hasBrother(?_:3 ?X) )<br>Forall ?X ?_:4 ( :isBrotherOf_bf(?X ?_:4) :- my:hasBrother(?_:4 ?X) )</pre><p>And finally, you can render the proof graph using the <a href="https://www.sciencedirect.com/science/article/abs/pii/S0306437905000281">Provenance Markup Language (PML)</a>:</p><pre>$ fuxi.proof --method=bfp --dlp --hybrid \<br>             --ns eg=http://example.net/vocab# \<br>             --ns your=http://example.net/vocab# \<br>             --why &quot;ASK { eg:bob your:isBrotherOf eg:joe }&quot; \<br>             --output pml test/OWL/inverseOf/premises001.rdf </pre><h4>Future Outlook: Generative Expert Systems</h4><p>The next article will focus on using FuXi’s new SPARQL service and reasoning capabilities with an ontology to enable high-performance reasoning via an independent, efficient SPARQL endpoint. A subsequent article will discuss using FuXi with OWL_DSL to verbalize OWL ontologies, rules, and their proofs, leveraging the recent updates to OWL_DSL <a href="https://medium.com/@chimezie/evolving-domain-specific-natural-languages-for-owl-ontologies-owl-dsl-8314c85b2b7f">discussed earlier</a>.</p><p>These are part of a larger suite of tools created to better investigate how expert systems from two disparate AI eras can be used to build <a href="https://medium.com/@chimezie/domain-specific-biomedical-ontologies-ralm-and-generative-medical-expert-systems-3236922b19db">generative expert systems</a>.</p><p>[1] Doorenbos, R. B. (1995). <em>Production matching for large learning systems</em>. Carnegie Mellon University.</p><p>[2] Grosof, B. N., Horrocks, I., Volz, R., &amp; Decker, S. (2003, May). Description logic programs: Combining logic programs with description logic. In <em>Proceedings of the 12th International Conference on World Wide Web</em> (pp. 48–57).</p><p>[3] Ogbuji, C. (2008). InfixOWL: An Idiomatic Interface for OWL. In <em>OWLED</em> (Vol. 432).</p><p>[4] Beeri, C., &amp; Ramakrishnan, R. (1987, June). On the power of magic. In <em>Proceedings of the sixth ACM SIGACT-SIGMOD-SIGART symposium on Principles of database systems</em> (pp. 269–284).</p><p>[5] Bancilhon, F., Maier, D., Sagiv, Y., &amp; Ullman, J. D. (1985, June). Magic sets and other strange ways to implement logic programs. In <em>Proceedings of the fifth ACM SIGACT-SIGMOD symposium on Principles of database systems</em> (pp. 1–15).</p><p>[6] Serebrenik, A., &amp; De Schreye, D. (2005). On termination of meta-programs. <em>Theory and Practice of Logic Programming</em>, <em>5</em>(3), 355–390.</p><p>[7] Bry, F. (1990). Query evaluation in recursive databases: bottom-up and top-down reconciled. <em>Data &amp; Knowledge Engineering</em>, <em>5</em>(4), 289–312.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9185bc1e55e7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Evolving Domain-specific Natural Languages for OWL Ontologies: OWL_DSL]]></title>
            <link>https://chimezie.medium.com/evolving-domain-specific-natural-languages-for-owl-ontologies-owl-dsl-8314c85b2b7f?source=rss-9344b33e7a8a------2</link>
            <guid isPermaLink="false">https://medium.com/p/8314c85b2b7f</guid>
            <category><![CDATA[naturallanguageprocessing]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[biomedical-informatics]]></category>
            <category><![CDATA[ontology]]></category>
            <dc:creator><![CDATA[Chimezie Ogbuji]]></dc:creator>
            <pubDate>Tue, 03 Mar 2026 05:55:46 GMT</pubDate>
            <atom:updated>2026-03-07T21:57:15.284Z</atom:updated>
            <content:encoded><![CDATA[<p>I&#39;ve been an ontology engineer for quite some time. As the word engineer is better known than the word ontology, I’ll give my elevator pitch description of what an ontology is. It is a rigorously specified conceptualization of a domain in mathematical logic. It is usually expressed as hierarchies of collections, relationships, properties, and restrictions on these. Ontologies are meant for automated processing by logical reasoning tools in the original sense of the word <em>reasoning. </em>This sense of the word &quot;reasoning&quot; is decidedly different from how it is used to describe some of today&#39;s Large Language Models (LLMs).</p><p>One of the central representational devices in ontologies is modeling class inclusion relationships. These are often called concept inclusion, subsumption, subclass, or superclass relationships. The latter two are borrowed from object-oriented programming (OOP) terminology. They can be intuitively visualized as concentric circles:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/813/1*1fkO9BxDskC8Jl7LuhQwHg.png" /><figcaption>The class of Ontologies and Conceptualizations</figcaption></figure><p>If you consider the class of all ontologies and the class of all things that are conceptualizations, the diagram above shows this relationship between the two, where everything that is an ontology is also a conceptualization. In this diagram, ontology is the <em>subclass</em> of conceptualization, and conceptualization is the <em>superclass</em> of ontology.</p><p>Throughout my time as an ontology engineer, the opacity of the Ontology Web Language (OWL) syntax and of Description Logic (DL), its underlying knowledge representation, has been a perennial problem. It is a problem I had been thinking about as far back as 2008, when I wrote <a href="https://www.academia.edu/download/31937624/owled2008eu_submission_19.pdf">&quot;InfixOWL: An Idiomatic Interface for OWL&quot;</a>, about a native, idiomatic Python API I developed for constructing and manipulating OWL. It was motivated by <a href="https://www.w3.org/TR/owl2-manchester-syntax/">the Manchester OWL syntax</a> and its adoption of an infix notation.</p><p><a href="https://en.wikipedia.org/wiki/Model_theory">Model Theory</a> is a very powerful framework for describing semantics, but its very mathematical nature makes it less intuitive than other representations for conveying the meaning it captures to the uninitiated. This challenge motivated the evolution of OWL syntaxes not just with the introduction of Manchester OWL, but with the introduction of a related approach to serializing mathematical logic in natural language: <a href="https://attempto.ifi.uzh.ch/site/pubs/papers/reasoningweb2008_fuchs.pdf">&quot;Attempto Controlled English for Knowledge Representation.&quot;</a></p><p>Back then, the main argument for a better syntax was the poor readability of the canonical OWL serialization (RDF/XML). However, I think time has made it clear that the real challenge in the adoption of ontology tools by non-logicians was more fundamental, and the learning curve for domain experts who were not fully versed in the underlying mathematical logic that powers OWL for using ontology tools, such as Protégé, was another important motivation.</p><p>As that was an era when full Natural Language Processing (NLP) was considered an unsolved problem, the possibility of leveraging a more natural language approach to writing down the meaning encapsulated in an ontology to enable machine interoperability was not on the radar. The goal was to connect domain experts to ontology authoring tools. However, now that we are in an era where that problem has essentially been solved, we need to start considering the value of natural language as an interface between ontologies and domain experts on the one hand, and between ontologies and today&#39;s intelligent machines.</p><p>This latter value has been the main motivation for my more contemporary tinkering in this space: <a href="https://huggingface.co/datasets/cogbuji/MrGrammaticalOntology_anatomist">Mr. Grammatical Ontology: Anatomist</a>. I created this Hugging Face dataset using a script I wrote over a year ago, which marked my first return to Semantic Web development in some time. I originally used <a href="https://owlready2.readthedocs.io/">owlready2</a> to produce a serialization of the Foundational Model of Anatomy (FMA) in a Controlled Natural Language (CNL), specific to the ontology rather than a general-purpose one for logic-based knowledge representations. Recently, when I started circling back to this effort, it was suggested that I consider a more modern anatomy ontology instead of the FMA, which has many <a href="https://github.com/cmungall/fma-fixes/issues/1">issues</a> with its <a href="https://bioportal.bioontology.org/ontologies/FMA">OWL ontology</a>.</p><p><a href="https://obophenotype.github.io/uberon/">Uberon</a> is a cross-species anatomical ontology of body parts, organs, and tissues, with a focus on vertebrates, designed for seamless integration with other ontologies in the Open Biological and Biomedical Ontologies (OBO) Foundry, a group of people who build and maintain ontologies related to the life sciences. I had used Uberon and the FMA in the past for research on taking advantage of the logical connections from the Gene Ontology (GO), a foundational ontology in the OBO foundry, to Uberon, and to the FMA</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*CnV6OWLUTYvkKfadRtqwEA.jpeg" /><figcaption>Research Method (2014)</figcaption></figure><p>These connections were used to link knowledge of anatomical development processes to knowledge of the developing anatomy to elucidate relationships between the gene products involved in the physiology of anatomical development: &quot;<a href="https://www.researchgate.net/profile/Chimezie-Ogbuji/publication/260229792_Lattices_for_representing_and_analyzing_organogenesis_Preprint/links/0c960530f612d5b3aa000000/Lattices-for-representing-and-analyzing-organogenesis-Preprint.pdf">Lattices for Representing and Analyzing Organogenesis.</a>&quot; Perhaps with the notable exception of <a href="https://www.snomed.org/what-is-snomed-ct">SNOMED CT</a>, the ontologies managed by the OBO foundry arguably represent the most successful use of ontologies in medical science. The results demonstrated that these ontologies contained significant biologically relevant and experimentally verifiable information, and this has been the reason for my prolonged interest in applying anatomy ontologies to biomedical informatics problems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*e8tqKBQKe5svaLWMHhARGg.jpeg" /><figcaption>Atrioventricular valve development concept (sub-)lattice (2014)</figcaption></figure><p>To get a better sense of some of the challenges with the readability of ontologies, we will take a close look at one of the OWL classes defined in Uberon: &quot;<em>vestibular aqueduct</em>&quot;</p><p>One of the <a href="https://obofoundry.org/principles/fp-000-summary.html">principles</a> of the OBO foundry is the expectation that every ontology in it &quot;has textual definitions for the majority of its classes and for top level terms in particular.&quot; For example, this OWL class has the following textual definition in Uberon:</p><blockquote>At the hinder part of the medial wall of the vestibule is the orifice of the vestibular aqueduct, which extends to the posterior surface of the petrous portion of the temporal bone. It transmits a small vein, and contains a tubular prolongation of the membranous labyrinth, the ductus endolymphaticus, which ends in a cul-de-sac between the layers of the dura mater within the cranial cavity. [WP,unvetted].</blockquote><p>Classes and Properties in OWL ontologies are all identified by a Uniform Resource Identifier (URI), and this class has the following URI:</p><p><a href="http://purl.obolibrary.org/obo/UBERON_0036074">http://purl.obolibrary.org/obo/UBERON_0036074</a></p><p>The URIs in an ontology often share a common prefix, the <a href="https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#Resolution">base URI</a>, which is usually bound to a prefix. In OBO ontologies, the base URI &quot;<a href="http://purl.obolibrary.org/obo/">http://purl.obolibrary.org/obo/</a>&quot; is associated with the &#39;<strong>obo</strong>&#39; prefix. So, another common way you can refer to this class is via its <a href="https://en.wikipedia.org/wiki/QName">qualified name (QName)</a>: <strong>obo:UBERON_0036074</strong></p><p>But, as a rose by any other name would smell as sweet, it is not the name (the URI or the label) that provides the meaning of the term, but rather its logical definition within an ontology. Below is a snippet of owlready2 Python code that parses the OWL ontology from its URL and prints its definition in the mathematical syntax of DL:</p><pre>from owlready2 import default_world, get_namespace, get_ontology<br>from owlready2.dl_render import dl_render_class_str<br><br>NS = get_namespace(&#39;http://purl.obolibrary.org/obo/&#39;)<br>ontology = get_ontology(&quot;http://purl.obolibrary.org/obo/uberon/uberon-base.owl&quot;).load()<br>owl_class = NS[&#39;UBERON_0002279&#39;]<br>print(dl_render_class_str(owl_class))</pre><p>You can read the owlready2 documentation for more details, but the <strong>get_namespace</strong> function creates an instance of the <a href="https://owlready2.readthedocs.io/en/v0.50/namespace.html"><strong>owlready2.namespace.Namespace</strong></a><strong> </strong>class instance that we later use to fetch the OWL class by its local name, the part after the base URI, instead of using the full URI against the Uberon ontology. The ontology is parsed and loaded from this URL: <a href="http://purl.obolibrary.org/obo/uberon/uberon-base.owl">http://purl.obolibrary.org/obo/uberon/uberon-base.owl</a>.</p><p>The <strong>dl_render_class_str</strong> method prints a string representation of the logical DL axioms that define the class. Local names are used to refer to the terms involved in the logical definition of the class, and are all Uberon classes except for <strong><em>RO_0002570</em></strong>, which is an object property in the <a href="https://obofoundry.org/ontology/ro.html">relations ontology</a>, and <strong><em>BFO_0000050</em></strong>, which is an object property in the Basic Formal Ontology (BFO), the top-level foundational ontology that coordinates the semantics of all the ontologies in the OBO foundry.</p><p>If, like me, you are well-versed in the mathematics underlying DL, you can interpret the output and the semantics they capture regarding this anatomical term. Otherwise, it probably looks like gibberish to you:</p><p>UBERON_0002279 ≡ UBERON_0013685 ⊓ ∃ RO_0002570 .UBERON_0036074<br>UBERON_0002279 ⊑ UBERON_0013685<br>UBERON_0002279 ⊑ ∃ BFO_0000050 .UBERON_0005236<br>UBERON_0002279 ⊑ ∃ RO_0002570 .UBERON_0036074</p><p>The ⊑ symbols refer to concept inclusion.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T6Wz3tQpnG2M4HW0KVbHNQ.png" /><figcaption>Credit: M. Koubarakis Slide on Description Logic</figcaption></figure><p>In OWL, concept inclusion axioms are written using the <a href="https://en.wikipedia.org/wiki/RDF_Schema#Properties">rdfs:subClassOf</a> object RDF property. Below is how we can get the human-readable labels for each of the terms in these Description Logic expressions via the owlready2 API from the Uberon ontology:</p><pre>print(NS[&#39;UBERON_0013685&#39;].label)<br>[&#39;foramen of skull&#39;]<br><br>print(NS[&#39;BFO_0000050&#39;].label)<br>[&#39;part of&#39;, locstr(&#39;part of&#39;, &#39;en&#39;)]<br><br>print(NS[&#39;RO_0002570&#39;].label)<br>[&#39;conduit for&#39;]<br><br>print(NS[&#39;UBERON_0005236&#39;].label)<br>[&#39;osseus labyrinth vestibule&#39;]<br><br>print(NS[&#39;UBERON_0036074&#39;].label)<br>[&#39;vein of vestibular aqueduct&#39;]<br><br>print(NS[&#39;UBERON_0002279&#39;].label)<br>[&#39;vestibular aqueduct&#39;]</pre><p>With this, we can render the logical definition for this class using the OWL 2 Manchester Syntax, taking advantage of its support for using the label of an OWL class for the sake of readability:</p><pre>Class: UBERON_0002279<br>    SubClassOf: &#39;foramen of skull&#39; <br>    SubClassOf: &#39;part of&#39; <strong>SOME</strong> &#39;osseus labyrinth vestibule&#39;<br>    SubClassOf: &#39;conduit for&#39; <strong>SOME</strong> &#39;vein of vestibular aqueduct&#39;<br>    EquivalentTo: &#39;foramen of skull&#39; <strong>THAT</strong> &#39;conduit for&#39; <strong>SOME</strong> &#39;vein of vestibular aqueduct&#39;<br></pre><p>This is significantly less opaque, but it still leaves much to be desired from a natural-language perspective.</p><p>The recent return to the software I wrote to generate the Hugging Face dataset using a CNL specific to an anatomy ontology had me wondering about whether the approach could be generalized into a configurable framework to do the same for <em>any</em> ontology such as those in the OBO foundry enriched with not just logical definitions of terms that adhered to domain expert consensus but also textual content as well. So, over the last few weeks, as I refamiliarized myself with the world of ontology engineering, a bit surprised at how much had not changed, I re-worked that script into a tool called <a href="https://github.com/chimezie/owl_dsl">OWL_DSL</a>, a Python Library for creating and managing Domain Specific Languages (DSL) for OWL ontologies using CNLs and naturally rendered definitions of its terms.</p><p>It can be installed via:</p><pre>$ pip install owl_dsl</pre><p>We will be demonstrating natural language phrasing of Uberon terms as well as those in the relations ontology. Due to the way OBO ontologies are <a href="https://oboacademy.github.io/obook/explanation/owl-format-variants/">packaged</a>, the <a href="http://purl.obolibrary.org/obo/uberon/uberon-base.owl">Uberon base ontology</a> needs to be merged with the relations ontology. <a href="https://robot.obolibrary.org/">ROBOT</a>, a tool for working with Open Biomedical Ontologies that is also used by OWL_DSL, can be used for this purpose. Once we have installed ROBOT, we can merge the two (<a href="https://github.com/obophenotype/uberon/blob/master/src/ontology/imports/ro_import.owl">ro_import.owl</a> is included in the Uberon Github repository) into a file named uberon-base-plus-ro.owl:</p><pre>$ robot merge --input uberon-base.owl --input ro_import.owl  --output ../uberon-base-plus-ro.owl</pre><p>We can then load the merged ontology using the <strong>owl_dsl.review</strong> command-line tool:</p><pre>$ owl_dsl.review --ontology-uri &quot;http://purl.obolibrary.org/obo/uberon/uberon-base.owl#&quot; \<br>                 --ontology-namespace-baseuri http://purl.obolibrary.org/obo/ \<br>                 --sqlite-file /tmp/ontology.sqlite3 \<br>                 -a load_owl uberon-base-plus-ro.owl<br>Loading Uberon ontology from uberon-base-plus-ro.owl, a IRI or local path.<br>Saved uberon-base.owl to http://purl.obolibrary.org/obo/uberon/uberon-base.owl#</pre><p>This loads the merged ontology with owlready2, which uses SQLite to store the ontology in the specified <em>/tmp/ontology.sqlite3 </em>file, with the given ontology URI and base URI. After loading this ontology, we can now attempt to generate a natural language rendering of Uberon&#39;s definition of <em>vestibular aqueduct:</em></p><pre>$ owl_dsl.review --ontology-uri &quot;http://purl.obolibrary.org/obo/uberon/uberon-base.owl#&quot; \<br>                 --ontology-namespace-baseuri http://purl.obolibrary.org/obo/ \<br>                 --sqlite-file /tmp/ontology.sqlite3  \<br>                 --configuration-file ontology_configurations/OBO.CNL.yaml \<br>                 -a render_class --class-reference &quot;vestibular aqueduct&quot;<br>Loaded ontology<br>Warning: Could not find label for property http://purl.obolibrary.org/obo/BSPO_0001102<br>Warning: Could not find label for property http://purl.obolibrary.org/obo/BSPO_0015005<br># http://purl.obolibrary.org/obo/UBERON_0002279 (vestibular aqueduct) # <br>## Textual definition ##<br>At the hinder part of the medial wall of the vestibule is the orifice of the vestibular aqueduct, which extends to the posterior surface of the petrous portion of the temporal bone. It transmits a small vein, and contains a tubular prolongation of the membranous labyrinth, the ductus endolymphaticus, which ends in a cul-de-sac between the layers of the dura mater within the cranial cavity. [WP,unvetted]. <br><br>## Logical definition ##<br>The vestibular aqueduct is defined in Uber-anatomy ontology as a foramen of skull that is a conduit for a vein of vestibular aqueduct. It is a foramen of skull. It is part of an osseus labyrinth vestibule. It is a conduit for a vein of vestibular aqueduct</pre><p>Notice the use of the &#39;— class-reference&#39; option to specify the label of the class we want to render. In addition to the rendering of the textual definition of the class, it also provides the following generated natural language sentences that capture the definition of the term using the CNL specified in the configuration file and the annotations in the ontology (the labels of terms that refer to classes or properties in the ontology are indicated in <strong>bold</strong>):</p><blockquote>The <strong>vestibular aqueduct</strong> is defined in Uber-anatomy ontology as a <strong>foramen of skull</strong> that is a <strong>conduit</strong> for a <strong>vein of vestibular aqueduct</strong>. It is a <strong>foramen of skull</strong>. It is <strong>part of</strong> an <strong>osseus labyrinth vestibule</strong>. It is a <strong>conduit</strong> for a <strong>vein of vestibular aqueduct</strong></blockquote><p>Note that the command complains about not finding labels for certain properties, none of which are involved in the logical definition of this class. These labels are important as the library relies on the ontology annotations (for the ontology itself as well as classes and properties) and the CNL configuration file to generate this human-readable definition.</p><p>Below are excerpts from the configuration file for the object properties involved in the definition, showing how it determines how they are rendered:</p><pre>standard_role_restriction_is_phrasing:<br>  - http://purl.obolibrary.org/obo/BFO_0000050<br><br>role_restriction_phrasing:<br>  &#39;http://purl.obolibrary.org/obo/RO_0002570&#39;:<br>    - &#39;is a conduit for {}&#39;<br>    - &#39;is a conduit for {}&#39;<br>    - &#39;What is a conduit for {}?&#39;</pre><p>The full specification of the configuration file is covered in the OWL_DSL documentation, but including the <strong><em>BFO_0000050</em></strong> BFO object property (which has an <a href="https://en.wikipedia.org/wiki/RDF_Schema">rdfs:label</a> of &quot;part of&quot;) in the first section is what allows OWL_DSL to know how to render the phrase &quot;It is <strong>part of</strong> an osseus labyrinth vestibule.&quot;</p><p>OWL_DSL provides other capabilities, such as the ability to search an ontology for classes and properties by their labels (either via substring or full REGEX matching), but the capability that takes this evolution of using a natural language syntax for OWL ontologies further is the ability to reason about these ontologies and render the explanations about their logical entailments in a natural language syntax as well.</p><p>It is a common practice for biomedical ontologies, such as Uberon or SNOMED CT, to be distributed with all the logically inferred relationships of this kind included in the distributed ontology for the sake of completeness. For OBO ontologies such as Uberon, there is the full version of the &quot;ontology with all its imports merged in, and classified using a reasoner,&quot; and there is the base version we used, which doesn&#39;t include logically inferred axioms generated by a reasoner such as ROBOT.</p><p>Including the axioms that result from fully classifying an ontology is a bit like distributing an uncompressed version of the ontology. Continuing with this analogy, a reasoner can be used to decompress the rich, implied semantics from an ontology&#39;s compressed version without loss of meaning. Doing so with a tool that allows us to serialize these compressed semantics in a manner that is readable to laypeople (or LLMs as was the case with the Hugging Face dataset) was the primary motivation for OWL_DSL.</p><p>For this, the library provides another command-line tool: <strong>owl_dsl.reason</strong>. It can be used to identify all unstated but logically inferred <a href="https://en.wikipedia.org/wiki/Subclass_(set_theory)">subclass/superclass</a> relationships for a given class:</p><pre>$ owl_dsl.reason --ontology-uri &quot;http://purl.obolibrary.org/obo/uberon/uberon-base.owl#&quot; \<br>                 --ontology-namespace-baseuri http://purl.obolibrary.org/obo/ \<br>                 --sqlite-file /tmp/ontology.sqlite3  \<br>                 --configuration-file ontology_configurations/OBO.CNL.yaml \<br>                 --class-reference &quot;vestibular aqueduct&quot; \<br>                 -a explain_logical_inferences uberon-base-plus-ro.owl </pre><p>Here, the <strong>owl_dsl.reason</strong> command&#39;s &#39;<em>explain_logical_inferences</em>&#39; action is specified and the merged ontology is given as the final argument, which is used to distinguish between unstated axioms inferred by the reasoner and those that are in the original ontology. With this distinction, it is able to not only render the sub and superclasses for vestibular aqueduct, but it can also provide a justification or explanation for the inference rendered in natural language:</p><pre>$ owl_dsl.reason --ontology-uri &quot;http://purl.obolibrary.org/obo/uberon/uberon-base.owl#&quot; \<br>                 --ontology-namespace-baseuri http://purl.obolibrary.org/obo/ \<br>                 --sqlite-file /tmp/ontology.sqlite3  \<br>                 --configuration-file ontology_configurations/OBO.CNL.yaml   \<br>                 --class-reference &quot;vestibular aqueduct&quot; \<br>                 -a explain_logical_inferences uberon-base-plus-ro.owl <br>[main] INFO org.semanticweb.elk.reasoner.Reasoner - ELK reasoner was created<br>[..snip..]<br>How is every &#39;vestibular aqueduct&#39; (UBERON_0002279) a &#39;bone foramen&#39;?<br><br>  Every vestibular aqueduct is a foramen of skull that is a conduit for a vein of vestibular aqueduct and vice versa.<br>    Every foramen of skull is a bone foramen<br>------------------------------------------------------------<br>How is every &#39;vestibular aqueduct&#39; (UBERON_0002279) a &#39;anatomical conduit&#39;?<br><br>  Every vestibular aqueduct is a foramen of skull that is a conduit for a vein of vestibular aqueduct and vice versa.<br>    Every foramen of skull is a bone foramen<br>      Every bone foramen is an anatomical conduit that is part of a bone element and vice versa.<br>------------------------------------------------------------</pre><p>It skips subsumption axioms that are stated and also skips any from a list that can be specified in the configuration file, to avoid logical entailments with classes too high up the ontology to have any practical semantic value. The explanation/justification trace is generated by ROBOT and transforms its Manchester OWL syntax into a readable natural language text, using the same mechanism OWL_DSL uses to render the logical definition of OWL classes, with some additional phrasing. ROBOT can be used with several logical reasoners, but OWL_DSL currently only uses <a href="https://github.com/liveontologies/elk-reasoner">Elk, a Java-based OWL 2 EL reasoner</a></p><p>Finally, there is a &#39;justify_gci&#39; action that allows you to provide a justification for subsumption by an arbitrary class. In particular, you can specify a class by its label (or identifier) and also specify an OWL class expression using Manchester OWL syntax to request that the <strong>owl_dsl.reason</strong> command generates an explanation of how the class (specified by label) is related via an rdfs:subClassOf with (i.e., is subsumed by) the class written out as Manchester OWL syntax.</p><p>The example below uses a different class than the one we have been using to demonstrate a more complex but similarly legible rendering of the proof trace in natural language. First, we merge the Gene Ontology (go-plus, which was downloaded from <a href="https://purl.obolibrary.org/obo/go/extensions/go-plus.owl">here</a>) with our earlier merged version of Uberon and the relations ontology into a file named go-plus-uberon-and-ro.owl:</p><pre>$ robot merge --input go-plus.owl  --input uberon-base-plus-ro.owl  --output go-plus-uberon-and-ro.owl</pre><p>Then we load it locally into a different ontology URI and SQLite file:</p><pre>$ owl_dsl.review --ontology-uri &quot;http://purl.obolibrary.org/obo/go/extensions/go-plus.ofn#&quot; \<br>                 --configuration-file ontology_configurations/Uberon.CNL.yaml \<br>                 --sqlite-file /tmp/go.sqlite3  \<br>                 --ontology-namespace-baseuri=http://purl.obolibrary.org/obo/ \<br>                 -a load_owl go-plus-uberon-and-ro.owl</pre><p>We can request an explanation of how exocytosis is subsumed by the class of all biological processes caused by some cellular component:</p><pre>$ owl_dsl.reason --ontology-uri &quot;http://purl.obolibrary.org/obo/go/extensions/go-plus.ofn#&quot; \<br>                 --configuration-file ontology_configurations/OBO.CNL.yaml \<br>                 --sqlite-file /tmp/go.sqlite3  \<br>                 --ontology-namespace-baseuri=http://purl.obolibrary.org/obo/ go-plus-uberon-and-ro.owl \<br>                 -a justify_gci --class-reference &quot;exocytosis&quot; \<br>                 --manchester-owl-expression &quot;&#39;biological_process&#39; and &#39;process has causal agent&#39; some &#39;cellular_component&#39;&quot;</pre><p>This is the Manchester OWL expression specified in the command-line used to capture all biological processes caused by some cellular component :</p><blockquote>‘biological_process’ <strong>and</strong> ‘process has causal agent’ <strong>some</strong> ‘cellular_component’</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wd5QoEACUHCvDvOE7mCTIw.jpeg" /><figcaption>Exocytosis (Wikimedia Commons)</figcaption></figure><blockquote>The exocytosis is defined in Gene Ontology as a <strong>vesicle-mediated transport</strong> that is <strong>caused</strong> by an <strong>exocytic vesicle</strong>. It is a <strong>vesicle-mediated transport</strong>. It is a <strong>secretion by cell</strong>. It has a <strong>vesicle fusion to plasma membrane</strong> as <strong>a part</strong>. It is <strong>caused</strong> by an <strong>exocytic vesicle</strong></blockquote><p>The full result of the justification, which includes the textual definition of exocytosis as well as the CNL rendering of its logical definition (above):</p><pre># http://purl.obolibrary.org/obo/GO_0006887 (exocytosis) # <br>## Textual definition ##<br>A process of secretion by a cell that results in the release of intracellular molecules (e.g. hormones, matrix proteins) contained within a membrane-bounded vesicle. Exocytosis can occur either by full fusion, when the vesicle collapses into the plasma membrane, or by a kiss-and-run mechanism that involves the formation of a transient contact, a pore, between a granule (for example of chromaffin cells) and the plasma membrane. The latter process most of the time leads to only partial secretion of the granule content. Exocytosis begins with steps that prepare vesicles for fusion with the membrane (tethering and docking) and ends when molecules are secreted from the cell. <br><br>## Logical definition ##<br>The exocytosis is defined in Gene Ontology as a vesicle-mediated transport that is caused by an exocytic vesicle. It is a vesicle-mediated transport. It is a secretion by cell. It has a vesicle fusion to plasma membrane as a part. It is caused by an exocytic vesicle<br>------------------------------------------------------------<br>How is every &#39;exocytosis&#39; (GO_0006887) a &#39;biological_process&#39; and &#39;process has causal agent&#39; some &#39;cellular_component&#39;?<br><br>  Every exocytosis is a vesicle-mediated transport<br>    Every vesicle-mediated transport is a transport that is caused by a vesicle and vice versa.<br>      Every vesicle is a membrane-bounded organelle<br>        Every membrane-bounded organelle is an organelle<br>          Every organelle is a cellular anatomical structure<br>  Every exocytosis is a secretion by cell<br>    Every secretion by cell is an export from cell<br>      Every export from cell is a cellular process<br>        Every cellular process is a biological_process<br>  Every cellular_component is a protein-containing complex, a virion component, or a cellular anatomical structure and vice versa.</pre><p>If you run the same command with the ‘ — verbose’ option, you can see the original lines of justification from the logical reasoner as well, showing how they are converted into the natural language text:</p><pre>------------------------------------------------------------<br>How is every &#39;exocytosis&#39; (GO_0006887) a &#39;biological_process&#39; and &#39;process has causal agent&#39; some &#39;cellular_component&#39; (&#39;exocytosis&#39; SubClassOf &#39;biological_process&#39; and &#39;process has causal agent&#39; some &#39;cellular_component&#39;)?<br><br>Running command:  robot explain --input go-plus-uberon-and-ro.owl --reasoner ELK --axiom &#39;exocytosis&#39; SubClassOf &#39;biological_process&#39; and &#39;process has causal agent&#39; some &#39;cellular_component&#39; --explanation /tmp/explanation.md<br><br>  - [exocytosis](http://purl.obolibrary.org/obo/GO_0006887) SubClassOf [vesicle-mediated transport](http://purl.obolibrary.org/obo/GO_0016192)<br>  Every exocytosis is a vesicle-mediated transport<br>    - [vesicle-mediated transport](http://purl.obolibrary.org/obo/GO_0016192) EquivalentTo [transport](http://purl.obolibrary.org/obo/GO_0006810) and ([process has causal agent](http://purl.obolibrary.org/obo/RO_0002608) some [vesicle](http://purl.obolibrary.org/obo/GO_0031982))<br>    Every vesicle-mediated transport is a transport that is caused by a vesicle and vice versa.<br>      - [vesicle](http://purl.obolibrary.org/obo/GO_0031982) SubClassOf [membrane-bounded organelle](http://purl.obolibrary.org/obo/GO_0043227)<br>      Every vesicle is a membrane-bounded organelle<br>        - [membrane-bounded organelle](http://purl.obolibrary.org/obo/GO_0043227) SubClassOf [organelle](http://purl.obolibrary.org/obo/GO_0043226)<br>        Every membrane-bounded organelle is an organelle<br>          - [organelle](http://purl.obolibrary.org/obo/GO_0043226) SubClassOf [cellular anatomical structure](http://purl.obolibrary.org/obo/GO_0110165)<br>          Every organelle is a cellular anatomical structure<br>  - [exocytosis](http://purl.obolibrary.org/obo/GO_0006887) SubClassOf [secretion by cell](http://purl.obolibrary.org/obo/GO_0032940)<br>  Every exocytosis is a secretion by cell<br>    - [secretion by cell](http://purl.obolibrary.org/obo/GO_0032940) SubClassOf [export from cell](http://purl.obolibrary.org/obo/GO_0140352)<br>    Every secretion by cell is an export from cell<br>      - [export from cell](http://purl.obolibrary.org/obo/GO_0140352) SubClassOf [cellular process](http://purl.obolibrary.org/obo/GO_0009987)<br>      Every export from cell is a cellular process<br>        - [cellular process](http://purl.obolibrary.org/obo/GO_0009987) SubClassOf [biological_process](http://purl.obolibrary.org/obo/GO_0008150)<br>        Every cellular process is a biological_process<br>  - [cellular_component](http://purl.obolibrary.org/obo/GO_0005575) EquivalentTo [protein-containing complex](http://purl.obolibrary.org/obo/GO_0032991) or [virion component](http://purl.obolibrary.org/obo/GO_0044423) or [cellular anatomical structure](http://purl.obolibrary.org/obo/GO_0110165)<br>  Every cellular_component is a protein-containing complex, a virion component, or a cellular anatomical structure and vice versa.</pre><p>With these tools, OWL_DSL allows you to provide the textual building blocks for rendering the meaning encapsulated in an ontology as natural language, render the logical entailments in the ontology, and render the explanations of these entailments in a DSL for the ontology. The tools we once used to connect domain experts to ontology authoring can now be used to connect these same ontologies to the intelligent NLP machines of today, and possibly (via transitivity) connect domain experts and their consensus knowledge to the language capabilities of LLMs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r_tZZ64GoFbY2xmvS3rQbQ.png" /><figcaption>CNL as Color &amp; Amplification to Ontologies (NotebookLLM)</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8314c85b2b7f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Family, Nigerian Ancestry, and Non-Western Languages / Language Models]]></title>
            <link>https://chimezie.medium.com/my-family-nigerian-ancestry-and-non-western-languages-language-models-7dfd2b4a9265?source=rss-9344b33e7a8a------2</link>
            <guid isPermaLink="false">https://medium.com/p/7dfd2b4a9265</guid>
            <category><![CDATA[language]]></category>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[nigeria]]></category>
            <category><![CDATA[cosmology]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Chimezie Ogbuji]]></dc:creator>
            <pubDate>Sun, 01 Feb 2026 23:21:20 GMT</pubDate>
            <atom:updated>2026-02-05T21:58:03.157Z</atom:updated>
            <content:encoded><![CDATA[<p>I&#39;ve been developing AI systems for well over 20 years now. I first cut my teeth on the SemanticDB project at the Cleveland Clinic [1], building a novel architecture that interfaced with investigators, allowing them to submit natural-language questions to identify patient populations in the Heart and Vascular Institute&#39;s Outcome Registry.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*66nNyjmx4LFDY9EwmhtVEQ.png" /><figcaption>The Semantic Research Assistant (SRA). Query for patients who had a coronary artery bypass graft (CABG) between 2008 and 2010 (inclusive) and after a percutaneous coronary intervention (PCI)</figcaption></figure><p>Working there was a fortuitous opportunity to work with some incredible minds in the field of logic-based Artificial Intelligence (AI), starting with the late Doug Lenat. He was one of the principal AI architects and engineers at the dawn of the modern era of logic-based AI. I learned a lot working with him and his amazing team, including (at the time): Chris Deaton, Michael Witbrock, and Keith Goolsby. He was one of my mentors at the time and wrote a letter of reference for my application to Case Western Reserve University&#39;s PhD program in Computer Science/Engineering, where I was a Bioinformatics and Medical Informatics fellow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i0FLtUGLQ205zfFff7zonA.png" /><figcaption>Diagram is from “History of artiﬁcial intelligence in medicine” [2]</figcaption></figure><p>So, those of us involved in this project were implementing Natural Language AI systems two full decades before the current Large Language Model (LLM) era, in which many of the goals are the same, but the AI approach emphasizes language over logic and meaning. This distinction is beyond what I discuss here, but I bring it up because AI software development and architecture have been the background of my career from near the beginning.</p><p>Having left my primary field, I entered the current AI era from the ground up, building my expertise not by using LLMs but by training them and learning the nuances of data science and the software architecture involved. Most of that came from becoming an early, regular contributor to Apple&#39;s amazing open-source <a href="https://opensource.apple.com/projects/mlx/">mlx software library</a> (first to what was originally their <a href="https://github.com/ml-explore/mlx-examples/graphs/contributors">mlx-examples repository</a>, which later became <a href="https://github.com/ml-explore/mlx-lm/graphs/contributors">mlx-lm</a>). Contributing to the core infrastructure used to train LLMs accelerated my understanding of how these systems are trained and the various aspects of this dark art.</p><p>I have mostly been focusing on training LLMs to become experts at medical terminology using a particular approach I developed during this time and described in my presentation to Rockwell Automation&#39;s Generative AI Innovation Hub about a year ago (<a href="https://www.slideshare.net/slideshow/reference-domain-ontologies-and-large-medical-language-modelspptx/267024290">&quot;Reference Domain Ontologies and Large Medical Language Models&quot;</a>).</p><p>Recently, however, the topic of the distance between myself and the language of my ancestors has come to the fore of my mind. This was made even more poignant with the <a href="https://www.linkedin.com/pulse/full-circle-adaeze-linus-ogbuji-chimezie-ogbuji-wej7c/">passing</a> of my father in October of last year.</p><p>He was a researcher and engineer in electron microscopy and made many contributions to the next-generation space shuttle rocket engine materials being developed at NASA at the time, while serving as the QSS Chief Scientist of Aerospace and Propulsion Materials at the NASA Glen Research Center.</p><p>In his <a href="https://uche.ogbuji.net/mirrors/cutthebabble.com/index.html%3Fp=77.html">words</a>:</p><blockquote>I garnered over 120 scholarly articles in scientific journals and bulletins, as well as some 50 technical publications in conference proceedings. I also authored more that two dozen publications in NASA technical reports and other outlets; some of those were of classified nature (not accessible to the public) and a few of them won special NASA and Aerospace awards.</blockquote><p>Although my older brother was the first catapult that launched me into the field of Computer Engineering, by teaching me to program in BASIC when I was an 8-year-old in Nigeria, my father was the second. While at NASA, he helped me join the center&#39;s Summer High School Apprenticeship Program (SHARP) and, later, as a University intern. Following in my father&#39;s footsteps, the group I worked with as an intern won the Software of the Year award from NASA for our work on Embedded Web Technology used to develop experiment interfaces for the International Space Station in January 1998, while I was a student at the University of Illinois in Computer Engineering.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_JgJgQflgUeLyMSEAyvpqQ.jpeg" /><figcaption>Where is Waldo? My father’s earliest picture at the Gordon Research Conference, the year I was born.</figcaption></figure><p>Before my father passed, he and I tried to find the works of his that won the awards he referenced above, and we found these:</p><ul><li><a href="https://ntrs.nasa.gov/api/citations/20010092700/downloads/20010092700.pdf">Process‐Induced Carbon Sub‐Layer in Sic\Bn\Sic Composites: Characterization and Consequences</a></li><li><a href="https://ntrs.nasa.gov/api/citations/19960038407/downloads/19960038407.pdf">High-temperature oxidation behavior of reaction-formed silicon carbide ceramics</a></li></ul><p>Most of the technical details of these works fly over my head, but I bring them up because my father also had two major interests that made for an interesting juxtaposition with his academic and professional career: <a href="https://uche.ogbuji.net/mirrors/cutthebabble.com/2017/05/index.html">language</a> and metallurgy in ancient Nigeria.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*3lP_QoSoI6euSz_ZRCx0Fw.jpeg" /><figcaption>“My first public lecture in Cleveland, OH.”</figcaption></figure><p>I have never met anyone as obsessed and deeply familiar with the spoken and written mechanics of the English language. He was the most accomplished speaker I ever knew, a walking etymological database. He could give a contemporaneous 45-minute to an hour lecture on any of his favorite topics with peer-review-level rigor.</p><p>However, his lecture on metalwork in ancient Nigeria was a clear intersection of his expertise and his interest in the lost grandeur of our ancestral heritage as Igbo people.</p><p>On the other side of my family tree is my mother, who is a literal polyglot [2]:</p><blockquote>individuals who have achieved proficiency in at least five or more languages</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QbnLkvcbXaEe8g3wiv4tsg.jpeg" /><figcaption>Mom and Amanze, her grandchild</figcaption></figure><p>In particular, she fluently speaks the following languages:</p><ol><li>English</li><li><a href="https://en.wikipedia.org/wiki/Igbo_language">Igbo</a> (of Volta–Niger family of languages)</li><li><a href="https://en.wikipedia.org/wiki/Umon_language">Umon</a> (of Upper Cross River language of Nigeria)</li><li><a href="https://en.wikipedia.org/wiki/Efik_language">Efik</a> (major dialect cluster of the Cross River branch of Benue–Congo)</li><li><a href="https://en.wikipedia.org/wiki/Hausa_language">Hausa</a> (of Hausa–Gwandara languages of the Afro-Asiatic)</li></ol><p>Although she knew these languages, she taught me only English and a little Igbo and Umon, enough to navigate our life in Nigeria. I imagine much of that had to do with perceptions at the time on the continent about the relationship between privilege and languages and between ours and those left by our colonizers. The result is that I could have been multilingual but am mostly monolingual, even though I speak German decently and a little of various languages of interest, as well as what I have recently learned through my practice of Capoeira over the last 4+ years (Portuguese).</p><p>One of the side effects of practicing Capoeira is that it gives me a different lens through which to understand the impact of colonialism on my language learning and the dissonance it creates, which is hard to articulate. Reaching higher levels of Capoeira requires advancing your understanding of Brazilian Portuguese. That particular part of my development in it has been complicated by the cognitive dissonance of: my interest (later in life) in learning the languages of my people, what I know and have learned about how language is used as a suppressive tool by the colonial mechanism, and the fact that Capoeira was a tool of escape and cultural preservation created by the Africans enslaved by the Portugese, whose language is a core component of Capoeira.</p><p>This is something I have found hard to communicate to my fellow Capoeiristas, who can&#39;t empathize with this dissonance. It is also important because it serves as a metaphor for some of the challenges I face as a monolingual, itinerant, first-generation Nigerian.</p><p>The other source of dissonance, caused by speaking only one language and none of my people&#39;s languages, is particularly problematic but also interesting on many levels. When I was a younger man here in the U.S., almost invariably at a Nigerian event, an Igbo elder would approach me and say &quot;<em>Kedu</em>&quot; (&quot;How are you?&quot;), and I would respond &quot;<em>Odimma</em>&quot; (&quot;I&#39;m doing well&quot;).</p><p>Thereafter, they would say something to me in more complex Igbo, and I would be forced to tell them I don&#39;t speak Igbo. Then, they would look to some other Igbo elder nearby and, speaking in Igbo, say something derogatory about the shame of my not knowing my own language. Only later in life did it occur to me to ask them, if it ever were to happen again, from whom <strong><em>they</em></strong> learned Igbo and (if from their parents) whether they felt <strong><em>my</em></strong> parents deserved the same for not teaching it to <strong>me</strong>.</p><p>I haven&#39;t had that moment yet. Now I&#39;m much older, much more experienced in life, and in possession of sooo many grey hairs, which changes the dynamic even though my language situation is still mostly the same.</p><p>Mostly triggered by my recent interest in Afro-Brazilian percussion and culture through Capoeira, I have begun to explore my own intersectionality within my professional expertise, language, and ancestry. The latter two (language and ancestry) are underrepresented in my field in many ways, most notably because most Language Model research and development is extremely Anglo-centric.</p><p>So when my older brother Uche, whose interest in data analysis and Igbo severely predates mine (<a href="https://github.com/uogbuji/okwu-igbo">okwu-igbo</a>), mentioned his <a href="https://github.com/OoriData/igbo.gen">igbo.gen</a> project earlier last year, I began thinking about what it would take to train Large Language Models that could not only speak and translate among the languages of my people, but could serve as tools for learning our languages, many of which are dying (Umon is in danger of being lost to us from my mother&#39;s side of the family).</p><p>Initially, I planned to start with Igbo, the <a href="https://github.com/Niger-Volta-LTI/igbo-text">Igbo-text</a> corpus, and other artifacts, works, and research from the <a href="https://github.com/Niger-Volta-LTI">Niger-Volta Language Technologies Institute</a>, and perform <em>continued pretraining</em> with this corpus on foundation models like <a href="https://qwenlm.github.io/blog/qwen3/">Qwen3</a>, which are already good with non-Western languages. <a href="https://docs.aws.amazon.com/nova/latest/userguide/customize-fine-tune-hyperpod-cpt.html">Continued pretraining is</a>:</p><blockquote>a technique that extends a pre-trained language model’s capabilities by training it on new domain-specific data while preserving its general language understanding.</blockquote><p>Then, a few weeks ago, while monitoring new models on <a href="https://www.igmguru.com/blog/what-is-hugging-face">Hugging Face</a>, an open-source AI platform for using, building, and sharing ready-made machine learning models, I came across Google&#39;s new family of lightweight, state-of-the-art open translation models from Google Translate, based on the Gemma 3 family of models: <a href="https://huggingface.co/google/translategemma-27b-it">TranslateGemma</a>.</p><p>LLMs have essentially made language translation tools like old-school Google Translate obsolete. My many successful attempts to translate Capoeira songs in detail using Qwen3, along with what I have observed about the new features in Google Translate for customizing curricula, etc., have left me feeling this is the future of (human) language learning. What better way to further my interest in this intersection than to use TranslateGemma directly for translations and to learn my ancestral languages? According to their model card, they can translate to/from Igbo and Hausa. I was very skeptical of this, so I wanted to experiment first.</p><p>Many times, I have asked my father to help me learn not only Igbo but also our people&#39;s pre-colonial traditions, such as their millennial system of cosmology. These are hard to learn now because of the amount of erasure that has happened in the wake of the adoption of Christianity in the region and disdain for our older traditions.</p><p>So, I thought he would be the perfect person to teach me these things, but he was always reluctant to do so because he wasn&#39;t a formal Igbo linguist or scholar. My father was a scientist through and through and would not teach about that which he did not know thoroughly. When my father passed away, I lost not only my closest friend but also my best tutor of Igbo.</p><p>However, his most common suggestion was that I read <a href="https://www.amazon.com/After-God-Dibia-Cosmology-Divination/dp/090701559X/">After God Is Dibia: Igbo Cosmology, Divination and Sacred Science in Nigeria</a> by John Anenechukwu Umeh.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*EoTh7b9U_i1um83nlsOP2A.jpeg" /><figcaption>“These volumes elucidate, from an initiate (1947), the exegesis of African philosophical meditation and practices at their highest and most authentic.”</figcaption></figure><p>This book has since had a powerful effect on my sense of identity and opened a new philosophical door inside of me. The name &quot;<em>Dibia</em>&quot; also happens to be the name of the family of logic-based medical LLMs I&#39;ve been developing recently using the approach mentioned earlier.</p><p>Its cosmological content and implications for my identity as a First-Generation Nigerian-American, born in Cleveland, Ohio, but having returned to the U.S. after spending my formative years in Nigeria, are something I would like to write more about later.</p><p>However, the content of this important book was the perfect source for testing how well TranslageGemma translates some &quot;very ancient Igbo aphorisms&quot; in the book. To test this and to address the fact that TranslateGemma <a href="https://github.com/ml-explore/mlx-lm/issues/783">relies on some non-standard chat template usage</a> to indicate the source and target languages, I developed an mlx Python script to help me download a compressed (&quot;quantized&quot;) version of that model and run some attempts at translation:</p><pre>import click<br>from mlx_lm import load, generate<br>from mlx_lm.sample_utils import make_sampler<br><br>@click.command()<br>@click.option(&quot;--input-language&quot;, help=&quot;Input language&quot;)<br>@click.option(&quot;--output-language&quot;, default=&quot;en&quot;, help=&quot;Output language&quot;)<br>@click.option(&quot;--temperature&quot;, default=1, help=&quot;Sampling temperature&quot;)<br>@click.option(&quot;--text&quot;,help=&quot;Text to translate&quot;)<br>@click.option(&quot;--verbose&quot;, default=False, is_flag=True, help=&quot;Enable verbose output&quot;)<br>def main(input_language, output_language, temperature, text, verbose):<br>    model, tokenizer = load(&quot;mlx-community/translategemma-27b-it-4bit&quot;)<br>    tokenizer.add_eos_token(&quot;&lt;end_of_turn&gt;&quot;)<br>    messages = [<br>            {&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: [<br>                {&quot;type&quot;: &quot;text&quot;,<br>                 &quot;source_lang_code&quot;: input_language,<br>                 &quot;target_lang_code&quot;: output_language,<br>                 &quot;text&quot;: text}<br>            ]}<br>        ]<br>    prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True)<br>    print(generate(model,<br>                   tokenizer,<br>                   prompt=prompt,<br>                   verbose=verbose,<br>                   max_tokens=2048,<br>                   sampler=make_sampler(temp=temperature)))<br><br>if __name__ == &#39;__main__&#39;:<br>    main()</pre><p>I won&#39;t go over the details of installing and using this script, as this is meant to be more about the implications of language and culture in the modern age than about the technical details of how these new dark arts work.</p><p>Below are my initial attempts to translate some of the earliest Igbo aphorisms from that book, using the proper characters and accents, with the Igbo-text corpus as a reference, ensuring that the Igbo was not only semantically but also lexically correct.</p><blockquote>Ezi okwu bụ ndụ. Okwu asị bụ ọnwụ</blockquote><pre>% python ./translate.py --input-language &quot;ig&quot; --text &quot;Ezi okwu bụ ndụ.  Okwu asị bụ ọnwụ&quot;<br>Fetching 12 files: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 12/12 [00:00&lt;00:00, 27518.67it/s]<br>Download complete: : 0.00B [00:00, ?B/s]                                                                                                                               | 0/12 [00:00&lt;?, ?it/s]<br>Truth is life. Falsehood is death.</pre><p>This translation is word-for-word the same as that of John Umeh, so I was impressed:</p><blockquote>Truth is life. Falsehood is death.</blockquote><p>I tried something a bit semantically and lexographically complex:</p><blockquote>Mba na-asụ. N’onu n’onu. Ma egbuchaa ikili. Ọ bụlụ ofu</blockquote><pre>% python ./translate.py --input-language &quot;ig&quot; --text &quot;Mba na-asụ.  N&#39;onu n&#39;onu. Ma egbuchaa ikili. Ọ bụlụ ofu&quot;<br>Fetching 12 files: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 12/12 [00:00&lt;00:00, 21657.34it/s]<br>Download complete: : 0.00B [00:00, ?B/s]                                                                                                                               | 0/12 [00:00&lt;?, ?it/s]<br>The world is noisy. Word of mouth. But the truth prevails. It is one.</pre><p>This result was the first failed translation, and I wasn&#39;t very surprised, given the complexity of the meaning in the author&#39;s translation:</p><blockquote>Different peoples/countries/races</blockquote><blockquote>Speak in different tongues/dialects;</blockquote><blockquote>But when the throat is cleared</blockquote><blockquote>It conveys the same meaning</blockquote><p>The author&#39;s translation definitely conveys the very <em>Igbotic</em> nature of our sayings, which are both humorous and very metaphorical. It is also a commentary on language and non-language communication.</p><p>Below is the next aphorism:</p><blockquote>Mmụọ na mmadụ na-azụ afịa . Mana ofeke amarọọ</blockquote><p>TranslateGemma&#39;s translated this as &quot;The spirit and the human are both seeking sustenance. But regret is bitter,&quot; whereas the author had:</p><blockquote>The Spirits and human beings are in constant communication/exchanges</blockquote><blockquote>But the unitiated does not know</blockquote><p>This translation, again, failed to capture the metaphorical nature of the author&#39;s intent, but I&#39;m not enough of an Igbo speaker or linguist to know how much of it resulted from attempting to transliterate the metaphor. Also, the reference to initiation suggests (as is often the case with translting <a href="https://en.wikipedia.org/wiki/Lucum%C3%AD_language">Lucumí</a> as colloquial Yoruba) that there may be levels of metaphor made complex not just because of the indirection but because of the oral and secretive nature of the secret societies that governed the practice of Dibia, in this case, or Orisha-based cosmology systems such as Candomblé or Santaria.</p><p>My final attempt at using the model to translate Igbo from this book was:</p><blockquote>Ụwa na-ehughalị ehughalị</blockquote><p>TranslateGemma translates this as &quot;The world keeps changing,&quot; and the author translates this as:</p><blockquote>The world is in constant changes</blockquote><p>This particular translation by the author triggered two thoughts in me, one of which was pure distraction. First, this is the fundamental principle underlying the <a href="https://en.wikipedia.org/wiki/I_Ching">Yijing</a>&#39;s cosmology, which I have studied extensively, moreso than that of my own people. The first logical reasoner I built, <a href="https://github.com/RDFLib/FuXi">FuXi</a>, was named after one of the founders of the Yijing cosmological system. It hadn&#39;t quite hit me until then how much time I spent building a logic-based reasoner named and inspired by ancient Chinese cosmology, in contrast to the time I have spent considering that of my own people.</p><p>The second thought was surprise at the correct translation, putting aside the lexicographical distinctions in both that do not change the intended meaning.</p><p>So, as a further experiment on the first day of Black History Month in the United States, I thought about my mother and called her. I asked her to confirm the languages she could speak fluently, and she did. During the conversation, however, I also learned that the multilingual nature of her family flowed from her mother, Ubu Ana.</p><p>She was the original Ubu Ana. None of her children were given her name, but the oldest daughter of my mother’s younger brother was named Ubu, after her. She was an extraordinary beacon of humanity (also a Materials Engineer like my father) who died before her time and was the closest thing to a sister that I ever had. Her younger sister, Mbang, named her first daughter Ubu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6eL4zVkty2pd0xyZbfYmHQ.png" /><figcaption>From left to right: Ejike (my younger brother), Mom, her Father (Chief of Ikot Ana), me, her Mother (Ubu Ana), and Uche (my older brother)</figcaption></figure><p>My mother told me that it was the first Ubu, through her desire to connect with people of all languages and her inherent multilingual talent, who learned so many languages and passed many of them down to her and her siblings. For example, my mother speaks Hausa because her mother and father lived much of their lives in Northern Nigeria before the civil war, not in their ancestral lands, where her father was chief: Ikot Ana.</p><p>Despite being a polyglot and the owner and administrator of Amara Home Care, the family Home Healthcare business I left my industry to join and now work for, my mother has a heart that is as big as she is modest.</p><p>While speaking with her, I tried the main, decent Hausa word I know (the others are anything but decent) to see how they would translate:</p><blockquote>Sanu</blockquote><p>As this word is about as common as it gets in Hausa, I wasn&#39;t surprised that TranslateGemma translated it correctly and provided additional, useful context:</p><blockquote>Hello. / Greetings. / Hi. (Can be used to start a conversation or as a general greeting.)</blockquote><p>So, I asked her if, to humor my early-afternoon experiment, she could provide some other common Hausa phrases to challenge the model properly. First, we tried</p><blockquote>Zo ka chi abunchi</blockquote><p>The model translated it as &quot;Come and eat some food,&quot; and she said a more direct translation would be &quot;Come and eat.&quot;</p><p>Next, we tried &quot;Na ge ji,&quot; which TranslateGemma translated as:</p><blockquote>I have arrived. / I am here.</blockquote><p>My mom said this is a correct translation. So, as a final test, she suggested we try having it translate the following <strong>from</strong> English <strong>to</strong> Hausa:</p><blockquote>I am tired</blockquote><p>To which, TranslateGemma responded with:</p><blockquote>Ina jin gajiya</blockquote><p>Which she said was technically correct, but not how it would be said colloquially.</p><p>After this excursion through my ancestry, my family, and the language of my people, the possibility of using my technical experience towards building out this intersection has opened a door I want to explore.</p><p>Far off in the, perhaps, fanciful distance, I can envision the empowerment of my ancestral heritage through technology and the development of tools that take advantage of the <a href="https://www.cs.columbia.edu/~johnhew/instruction-following.html">instruction following capabilities</a> of these modern software marvels of Neural Network biomimicry to help us keep our languages from fading away, preventing them and their speakers from being sidelined in the breakneck pace of this new frontier.</p><p>If TranslateGemma proves to be as good as would be required to do some interesting things with these languages, I will be curious about interleaving its translations with conversational interactions with some of the &quot;reasoning &quot;models of this current generation that have decent language skills (such as those from the Qwen3 family) as a basis for learning these languages and making curricula for doing using the <a href="https://arxiv.org/pdf/2404.11018">multi-shot learning</a> skills of these models, about which we still have so much to learn.</p><p>[1] D Pierce, C., Booth, D., Ogbuji, C., Deaton, C., Blackstone, E., &amp; Lenat, D. (2012). Semanticdb: A semantic web infrastructure for clinical research and quality reporting. <em>Current Bioinformatics</em>, <em>7</em>(3), 267–277.</p><p>[2] Kaul, Vivek, Sarah Enslin, and Seth A. Gross. &quot;History of artificial intelligence in medicine.&quot; <em>Gastrointestinal endoscopy</em> 92.4 (2020): 807–812.</p><p>[3] Malik-Moraleda, Saima, et al. &quot;Functional characterization of the language network of polyglots and hyperpolyglots with precision fMRI.&quot; Cerebral Cortex 34.3 (2024): bhae049.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7dfd2b4a9265" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[LLM Plumbing, Self-describing Service and Prompt Engineering Architecture]]></title>
            <link>https://chimezie.medium.com/generative-redfoot-and-server-architecture-for-the-4th-ai-wave-238df67bfae3?source=rss-9344b33e7a8a------2</link>
            <guid isPermaLink="false">https://medium.com/p/238df67bfae3</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[web-architecture]]></category>
            <category><![CDATA[llm-applications]]></category>
            <category><![CDATA[information-architecture]]></category>
            <category><![CDATA[semanticweb]]></category>
            <dc:creator><![CDATA[Chimezie Ogbuji]]></dc:creator>
            <pubDate>Fri, 21 Nov 2025 22:24:36 GMT</pubDate>
            <atom:updated>2025-11-22T14:46:49.736Z</atom:updated>
            <content:encoded><![CDATA[<h3>LLM Plumbing, Self-describing Service, and Prompt Engineering Architecture</h3><p>I have had a long-standing interest in tinkering with self-describing, web-based automata of the AI kind. This was the original promise of the Semantic Web, the 3rd generation of AI systems after the 2nd AI winter, a topic for another article (both the Semantic Web promise and the AI winters). I used to tinker with Daniel Krech’s <a href="https://github.com/eikeon/redfoot/">redfoot</a> library, a</p><blockquote>framework for building distributed data-driven web applications with RDF and Python — <a href="https://jtauber.com/redfoot/">James Tauber</a></blockquote><p>What I liked the most about it was how it allowed code and data to coexist in a common interlingua (<a href="https://en.wikipedia.org/wiki/Resource_Description_Framework">RDF</a>). The system used a vocabulary that identified their separate purpose and a framework for developing web-based <strong>agents</strong> that execute instructions to consume declarative, self-describing data, other instructions, and act on them. When I use the word <em>agent</em>, I mean it in the sense in which it was used in previous AI generations, particularly the last one (<a href="https://www.w3.org/2000/10/swap/doc/paper/">Semantic Web agents</a>).</p><p>This library, redfoot, was one of two Semantic Web projects that got me into this topic; the other was <a href="https://www.w3.org/2000/10/swap/doc/cwm.html">cwm</a>. Both, along with the work I was doing at the W3C, got me onto the <a href="http://github.com/RDFLib/rdflib/">RDFLib</a> project.</p><p>One architectural consideration at that time that the LLM dev ops tooling of today could benefit from is relying more on architectural serendipity rather than defining more web architecture protocols than needed. This is not a new principle, first introduced to me as a concept in Steve Vinoski’s very well-written <a href="https://steve.vinoski.net/pdf/IEEE-Serendipitous_Reuse.pdf">Serendipitous Reuse</a> from that time in 2008, which had a pronounced effect on how I thought about web protocols and architecture:</p><blockquote>The Web is, in effect, an expansive application framework. If you implement your resources to obey its uniform interface and other constraints and plug those resource implementations into the Web framework, they’ll be fairly consistent as well as instantly usable by a wide variety of clients [..] [that will] <strong>serendipitously </strong>reuse them in unforeseen ways</blockquote><p>I rely more on the web architecture middleware I use when connecting applications to LLMs, and haven’t yet had a reason to explicitly incorporate the <a href="https://modelcontextprotocol.io/docs/getting-started/intro">Model Context Protocol (MCP)</a> into my design. I’m sure I will eventually, but it would be just another interface to adapt to for the sake of integration. For now, I create endpoints that encapsulate the components I need and use their uniform interfaces and organization (basic REST). Semantic Web agents of their day demonstrated the mileage you can get from common vocabularies written in expressive knowledge representations, discoverable and self-describing, and relying serendipitously on the underlying application framework. So, perhaps it is not a surprise that I haven’t had the need to use MCP just yet.</p><p>Another useful feature of systems from that era is more reliance on declarative syntax to define the resources an agent consumes. JavaScript and its related data format (JSON) are effective for basic data interchange. Still, sometimes overuse can lead to situations such as using <a href="https://en.wikipedia.org/wiki/Jinja_(template_engine)">Jinja</a>, a web template engine, as a chat template or for tooling purposes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MGRd-B6o8XMMOcPeabsBnQ.png" /><figcaption><a href="https://www.linkedin.com/posts/chimezie_sotwareengineering-declaritive-templating-activity-7341179120942313473-R61F">Yuck</a></figcaption></figure><p>The desire to see more of this approach in today’s AI tooling ecosystem motivated the <a href="https://github.com/chimezie/generative_redfoot">generative_redfoot</a> project and its use of Prompt Declaration Language (PDL), a YAML-based declarative approach to prompt programming, where prompts are at the forefront, and <a href="https://github.com/OoriData/WordLoom">Word Loom</a>, a convention for expressing language text and templates for AI language model-related uses. It underwent major changes in <a href="https://github.com/chimezie/generative_redfoot/blob/main/CHANGELOG.md#02---20251119">version <strong>0.2</strong></a>. In particular:</p><ul><li>Incorporation of mlx-lm’s caching capabilities for efficient inference and cache preparation directives</li><li>The use of <a href="https://fastapi.tiangolo.com/">FastAPI</a> services to efficiently deploy PDL programs with RESTful API endpoints and support for form data processing</li><li>Changes to extend the capabilities regarding PDF processing with OCR support and their extensions for use in PDL programs</li><li>Support for speculative decoding for faster inference</li><li>Basic service orchestration by binding request body content to context variables for use with Word Loom markers</li></ul><p>Consider this original redfoot Program (<a href="https://github.com/eikeon/redfoot/blob/master/programs/helloworld"><em>programs/helloworld</em></a>), described as an RDF graph (I use the standard RDF graph notation throughout, with the slight exception of showing RDF datatypes within angular braces, above and to the right of their literal values, so the ‘print “Hello World!”’ string has a datatype of redfoot:Python):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/565/1*bOqfEJCs8K16-emBiwRwUw.png" /><figcaption>Original redfoot Hellow World program</figcaption></figure><p>This general idea can be similarly described in PDL:</p><pre>#The typical first example program, Hello World<br>description: Hello World<br>text:<br>  - &quot;Hello World&quot;</pre><p>The original redfoot also allowed you to describe web pages in RDF to allow dynamic, self-describing site rendering:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RpiUEf2INgjwsjqF6quX8Q.png" /><figcaption>A more involved example of a web site as a redfoot Page, Site, and PagePartHandler</figcaption></figure><p>Here, the self-describing site indicates it has a section for the root resource labeled “Home” which gets its content from a <em>server:PagePartHandler</em> that returns an HTML template with a parameter reference.</p><p>Below is an example of how this could be captured in generative_redfoot, using YAML’s <a href="https://yaml-multiline.info/">multiline string syntax</a>, with the new service definition capabilities, but without handling the (<em>redfoot.uri</em>) template parameter:</p><pre>server:<br>  path: /<br>description: Home<br>text:<br>  - |<br><br>      &lt;span&gt;<br>        &lt;h2&gt;Welcome&lt;/h2&gt;<br>        &lt;p&gt;You are running: /&lt;/p&gt;<br>     &lt;/span&gt;</pre><p>It adds a <strong>server</strong> block that defines a web service running on the local machine and responding to HTTP requests at the / URL path. You can see the generative_redfoot documentation <a href="https://github.com/chimezie/generative_redfoot/blob/main/README.md#service-deployment">section on service deployment</a> for more on how this can be further configured.</p><p>Now imagine you wanted to define a service that receives a PDF document and responds with a summary of its main findings, generated by a Hugging Face (HF) model, such as <a href="https://huggingface.co/mlx-community/Qwen3-4B-Instruct-2507-4bit">mlx-community/Qwen3–4B-Instruct-2507-DDWQ</a>. We can first define a Word Loom file for our prompts:</p><pre>lang = &quot;en&quot;<br><br>[system_prompt]<br>_ = &quot;&quot;&quot;You are a helpful assistant that answers questions a layperson asks about a research publication, making sure<br>to keep your answers entirely based on the research document they provide&quot;&quot;&quot;<br><br>[analyze_paper]<br>_ = &quot;&quot;&quot;The document below is a peer-reviewed research publication. Summarize it by providing each of the following as<br>4-5 sentence paragraphs that concisely but accurately summarize the methods used in the resarch, the main findings,<br>and any discussion in the research publication.<br><br>= Document =<br><br>&quot;&quot;&quot;</pre><p>This file defines two Word Loom <a href="https://github.com/OoriData/WordLoom/blob/main/wordloom_spec.md#language-items">language items</a>:</p><ul><li>system_prompt</li><li>analyze_paper (the user prompt)</li></ul><p>We can save the file as <strong>chat_research_prompts.toml</strong> and then define a PDL document (called <strong>chat_research_service.pdl</strong>) that references it using generative_redfoot extension directives :</p><pre>server:<br>  host: 0.0.0.0<br>  port: 8667<br>  request_body_marker: document_pdf                #Context variable binding (word loom marker) for request body content<br>  path: /research_pdf                              #Path to serve the service on<br>  log_level: debug                                 #Log level to use<br><br>description: Summarize research PDF<br>text:<br>  - text:<br>    - role: system<br>      read_from_wordloom: chat_research_prompts.toml<br>      items: system_prompt<br>      contribute: [context]<br>    - role: user<br>      read_from_wordloom: chat_research_prompts.toml<br>      items: analyze_paper<br>      contribute: [context]<br>    - role: user<br>      PDF_raw_read_ocr: { $document_pdf }      #OR PDF_raw_read_txt<br>      contribute: [ context ]<br>    - model: mlx-community/Qwen3-4B-Instruct-2507-DDWQ<br>      parameters:<br>        max_tokens: 2000<br>        temperature: 0.3<br>        top_p: 0.95<br>        top_k: 20<br>        min_p: 0.0<br>        repetition_penalty: 1.1<br></pre><p>This first server section includes additional directives for the port and hostname of the server (0.0.0.0 and 8667<strong>):</strong></p><pre>server:<br>  host: 0.0.0.0<br>  port: 8667<br>  request_body_marker: document_pdf                #Context variable binding (word loom marker) for request body content<br>  path: /research_summary                          #Path to serve the service on<br>  log_level: debug</pre><p>It also includes a <strong>request_body_marker</strong> directive that specifies which context variable the body of the HTTP request (the PDF) will be transmitted through in response to the request (“<em>document_pdf</em>”<strong> </strong>in this case). Finally, the logging level and the URL path to which the service binds are also indicated.</p><p>The portion of the PDL document following the server directive describes how the request is evaluated by the <em>mlx-community/Qwen3-4B-Instruct-2507-DDWQ</em> model on HF, using the specified system and user prompts defined in local <strong>chat_research_prompts.toml </strong>Word Loom file, identified by the corresponding named language items.</p><pre>text:<br>  - text:<br>    - role: system<br>      read_from_wordloom: chat_research_prompts.toml<br>      items: system_prompt<br>      contribute: [context]<br>    - role: user<br>      read_from_wordloom: chat_research_prompts.toml<br>      items: analyze_paper<br>      contribute: [context]<br>    - role: user<br>      PDF_raw_read_ocr: { $document_pdf }      #OR PDF_raw_read_txt<br>      contribute: [ context ]<br>    - model: mlx-community/Qwen3-4B-Instruct-2507-DDWQ<br>      parameters:<br>        max_tokens: 2000<br>        temperature: 0.3<br>        top_p: 0.95<br>        top_k: 20<br>        min_p: 0.0<br>        repetition_penalty: 1.1</pre><p>The <strong>PDF_raw_read_ocr</strong> directive is given a context variable reference to <strong>document_pdf</strong><em>,</em> so text is extracted from the received PDF content via Optical Character Recognition (OCR), and the response is appended to the user prompt.</p><p>With these files, we can now launch a generative_redfoot server with the PDL file. First, install generative_redfoot along with <a href="https://uvicorn.dev/">uvicorn</a> and <a href="https://fastapi.tiangolo.com/">fastapi</a> (which are needed for the HTTP service support) and the other dependent applications:</p><pre>% pip install generative_redfoot python-multipart uvicorn fastapi pymupdf</pre><p>Then, launch the service on one machine:</p><pre>% generative_redfoot chat_research_service.pdl --verbose</pre><pre>[..] - generative_redfoot.cli.generative_redfoot_service - INFO - Starting generative redfoot service with config: [..]/chat_research_service.pdl<br>[..] - generative_redfoot.cli.generative_redfoot_service - INFO - Service will be available at: http://0.0.0.0:8667/research_summary<br>INFO:     Started server process [..]<br>INFO:     Waiting for application startup.<br>INFO:     Application startup complete.<br>INFO:     Uvicorn running on http://0.0.0.0:8667 (Press CTRL+C to quit)</pre><p>And submit requests to summarize research PDFs in the command-line of another machine:</p><pre>$ curl -X POST &quot;http://localhost:8667/research_summary&quot;  \<br>       -F &quot;document_pdf=@/path/to/resarch.pdf&quot;</pre><p>Finally, if we wanted the user to be able to specify the actual query posed to the PDF content, we could refine our Word Loom file:</p><pre>lang = &quot;en&quot;<br><br>[system_prompt]<br>_ = &quot;&quot;&quot;You are a helpful assistant that answers questions a layperson asks about a research publication, making sure<br>to keep your answers entirely based on the research document they provide&quot;&quot;&quot;<br><br>[analyze_paper]<br>_ = &quot;{query}&quot;<br>_m = [&quot;query&quot;]</pre><p>Here, the analyze_paper language item is modified to use Word Loom <a href="https://github.com/OoriData/WordLoom/blob/main/wordloom_spec.md#templating">templating</a><a href="https://github.com/OoriData/WordLoom/blob/main/wordloom_spec.md#templating">,</a> so a <strong>query</strong> template marker or variable provides the user prompt, which is filled at run-time. The PDL document can remain the same, and a request such as the following can be used to specify the query for the document as well as the document itself:</p><pre>$ curl -X POST &quot;http://localhost:8667/research_summary&quot;  \<br>       -F &quot;document_pdf=@/path/to/resarch.pdf&quot; \<br>       -F &quot;query=Summarize the paper in one paragraph&quot;</pre><p>The generative_redfoot server will route the HTTP POST request value bound to <strong>query</strong> (“<em>Summarize the paper in one paragraph</em>”) to the evaluation context. The context is used to evaluate the Word Loom template, fill in the dynamically specified user query, and route the PDF content bound to <strong>document_pdf</strong> for OCR extraction, appending the resulting text to the user query.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*vDG2DtYsWxiTYCg9gUwQQQ.png" /><figcaption>Web client requests flow to a generative_redfoot service for Word Loom and PDL evaluation against a model</figcaption></figure><p>With this architecture, there is a clean separation between the Natural Language chunks I want to use for prompt engineering, web services, and textual composition, and the PDL documents that describe how they are used to evaluate a request against a model and how arguments are routed through the process.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=238df67bfae3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using a Visual Pattern for Latin Harmony and Rhythm with a Music Abacus]]></title>
            <link>https://rocknheavy.net/using-a-visual-pattern-for-latin-harmony-and-rhythm-with-a-music-abacus-b318d4041cd8?source=rss-9344b33e7a8a------2</link>
            <guid isPermaLink="false">https://medium.com/p/b318d4041cd8</guid>
            <category><![CDATA[percussion]]></category>
            <category><![CDATA[afro-latin]]></category>
            <category><![CDATA[music]]></category>
            <category><![CDATA[data-visualisation]]></category>
            <category><![CDATA[music-theory]]></category>
            <dc:creator><![CDATA[Chimezie Ogbuji]]></dc:creator>
            <pubDate>Mon, 21 Apr 2025 03:18:35 GMT</pubDate>
            <atom:updated>2025-04-25T18:07:45.205Z</atom:updated>
            <content:encoded><![CDATA[<p>I’ve <a href="https://chimezie.medium.com/the-basic-clapping-patterns-of-capoeira-0cc59fd5fdc8">recently</a> started learning and regularly rehearsing Batucada, an Afro-Brazilian percussive subgenre of samba in a local percussion ensemble / <a href="https://en.wikipedia.org/wiki/Bateria"><em>Bateria</em></a> called <a href="https://www.sambadacidade.org/">Samba Da Cidade</a>. More recently. After taking a break following a year of more traditional piano lessons to develop a foundation for jazz piano improvisation, I returned to a longer-term interest in playing the Latin piano style and understanding its music theory, arpeggios, and comping forms.</p><p>Below is a Montuno in C minor from Paul Tobey’s <a href="https://www.youtube.com/watch?v=EekXPNQT59c">“How to Play Salsa Montuno on Piano” </a>video:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jbqumA8Ry3Z5JKbm7oihVw.png" /><figcaption>Montuno rythmic pattern in 4/4 time</figcaption></figure><p>This is the key of C minor, but a pattern can be generalized as an abstraction for any key. That first section between the piano grand staff notation that begins the time of the music and the first ‘bar’ indicates the first of four measures.</p><p>The notes are what the piano plays (the C note). The first is a quarter note on C, which lasts a quarter of the bar, a “beat”, or the entire “one” if you are counting along. The second and third notes are eighth notes on the 2nd and the second-and-a-half beat (usually counted “and” after the “two”). They each last for half a quarter note or the distance from the beginning of a beat to the ‘and’ after it.</p><p>Then you have a rest notation for an eighth note, which lasts the same duration as each of the previous two, but instead of playing a note for that duration, nothing is played for that duration, through to the “three and”.</p><p>There are four measures of this, and all four represent sequential and modular components of the style that repeat across chords in different keys. For some visual learners, it may be best to visualize this as circular, concentric arcs that divide the measures in this repeating space:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kP0zl-DZkT29kqmpz5Ne4A.png" /><figcaption>4 bars of 4/4 music visualized as circular arc sections</figcaption></figure><p>The red arcs are the first 4 bars of the first measure, the orange the 4 bars of the second measure, the blue of the third measure, and the green the last 4 bars of the final measure. The grey radial lines that emerge from the overall center mark the beats in a measure. The color marks the measures from one another, and the circular arrangement indicates that the pattern repeats.</p><p>In this style, the piano is often accompanied by a Tumbao rhythm, as a separate instrument or via the left hand of the piano. These are outlined by the first measure of the foundational <a href="https://www.thejazzpianosite.com/jazz-piano-lessons/jazz-genres/afro-cuban-latin-jazz/">clave rhythm, a 2-bar pattern that is repeated throughout the entire song</a>. We can add an interior part of the diagram that captures the cycle of the Tumbao, as shown below: the beat and measure markings for the first measure of the Tumbao and the corresponding Tumbao rhythm. The inner purple circle indicates the Tumbao pattern, and the three purple dots along the black arc, the Tumbao rhythmic pattern for the first measure:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*Vmn4W8e9QeCkZ_r7LQZuZg.png" /><figcaption>Arcs for 1st measure with Timbao note</figcaption></figure><p>Sweeping along the arcs from the bottom (6 o&#39;clock position) to the right (3 o’clock position), we count out four measures and the three rhythm notes of the Tumbao, indicated by the purple dots at:</p><ol><li>The first beat</li><li>The ‘and’ of the 2nd beat (in between 2 and 3)</li><li>The 4th beat.</li></ol><p>These correspond to the first measure of the 3/2 son clave (<a href="https://www.thejazzpianosite.com/jazz-piano-lessons/jazz-genres/afro-cuban-latin-jazz/">from Afro-Cuban Latin Jazz Explained</a>):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*9Gcy-GUSWgAh50LytcvdMw.png" /><figcaption>Corresponding Son Clave 3/2: the three notes in the first bar/measure correspond to the three notes of the Tumbao pattern along the inner path in black within the purple middle</figcaption></figure><p>We can now include the Montuno notes, referring to them by the degree of the key it is in, and refer to the Tumbao notes in the same way:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wm_Ww1y0_PEnHtiTwuEJgw.png" /><figcaption>Arcs for 1st measure with Timbao and Montuno notes</figcaption></figure><p>The three notes of the first part of the 3/2 clave are three notes spaced out by a beat and a half. The Montuno fills in all the places in the rhythm between them. It plays the 5th note of the key on the 1st beat, the 1st and 3rd notes of the key on the 2nd beat together (an interval), the sharped 5th note of the key on the ‘and’ after the 2nd beat, the 1st and 3rd notes of the key on the ‘and’ of the 3rd beat and the 1st note on the ‘and’ of the 4th beat.</p><p>The <strong>im</strong> indicates that the notes shown here are those from the <a href="https://en.wikipedia.org/wiki/Tonic_(music)">triad formed on the minor tonic chord</a>. The “m” and the lower-case “<em>i</em>” denote that it is the minor key, and the use of i (instead of ii, iii, etc.) indicates that it is for the tonic, or the <em>first note</em> of the key.</p><p>The ‘and’ beats (or off beats) can be identified visually by their placement between the beat gray markers that point radially outward from the center. These Montuno notes are arpeggiations of the triad (made up of the 1st, 3rd, and flattened 5th notes of the Minor key. As a reference for chord construction, see my earlier <a href="https://chimezie.medium.com/a-music-theory-abacus-112d31620bdd">music abacus</a>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7_UJf4kREMvuBC-5yFckNg.png" /><figcaption>Full Abacus</figcaption></figure><p>For C minor, we have:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f3Nx-WVE6M0Su792iydlkw.png" /><figcaption>Abacus row for parallel keys of C Minor &amp; C Major</figcaption></figure><p>You can read <a href="https://medium.com/@chimezie/a-music-theory-abacus-112d31620bdd">my article</a> for more information on how to interpret rows and identify the tones of each chord using this visual device, but the blue shapes enumerate the notes of the C minor key from left to right: C, D, E-flat, F, G, A-flat, and A-sharp. The full diagram is below and applies to each of the 12 keys (rows in the abacus):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y5XX3Uy2sIpplGf7QPklyg.png" /><figcaption>Full Latin Music Visual Style</figcaption></figure><p>The Tumbao rhythmic pattern is from this useful YouTube video: “<a href="https://www.youtube.com/watch?v=V1zUyhtvGYo&amp;list=PLlk5RZNiHyuo_Z0luncug5RL0EpSLZ248&amp;index=23&amp;t=310s">Latin Piano Exercises — Get 7 Exercises To Improve Your Latin Playing Style</a>”, which also covers the Montuno.</p><p>The outermost arc has two segments: one is gray and the other is black. The gray portion indicates where (in the cycle) the im chords, chords rooted in the first degree of each minor key, are being arpeggiated, and the black portion where the dominant V chords (G7 for the key of C minor) are being arpeggiated, demonstrating how Latin music resonates across many rhythmic, tonal, contrasting, and cyclic axes.</p><p>If you wanted to incorporate blues improvisation in the current key, you could do it during the black parts of the path (where a dominant 7th tonality is being used).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b318d4041cd8" width="1" height="1" alt=""><hr><p><a href="https://rocknheavy.net/using-a-visual-pattern-for-latin-harmony-and-rhythm-with-a-music-abacus-b318d4041cd8">Using a Visual Pattern for Latin Harmony and Rhythm with a Music Abacus</a> was originally published in <a href="https://rocknheavy.net/">Rock n’ Heavy</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Composable fine tuning and input masking with mlx-tuning-fork]]></title>
            <link>https://chimezie.medium.com/composable-fine-tuning-and-input-masking-with-mlx-tuning-fork-9ae8667e75c8?source=rss-9344b33e7a8a------2</link>
            <guid isPermaLink="false">https://medium.com/p/9ae8667e75c8</guid>
            <category><![CDATA[open-source-software]]></category>
            <category><![CDATA[medical-informatics]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Chimezie Ogbuji]]></dc:creator>
            <pubDate>Sat, 22 Feb 2025 22:49:27 GMT</pubDate>
            <atom:updated>2025-02-23T15:13:31.010Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t1NDsSriNYqpAEaqroRhWg.jpeg" /><figcaption><a href="https://commons.wikimedia.org/wiki/File:B.B._King_3011710050.jpg">https://commons.wikimedia.org/wiki/File:B.B._King_3011710050.jpg</a></figcaption></figure><p>It’s been a long time coming (as BB King said), but <strong>mix-tuning-fork</strong> has a new release, version 0.4.0. Most of the changes are due to those in MLX, which has gone through significant modifications during this time. In particular, mlx_lm now supports input masking during instruction fine tuning.</p><p>Support for this capability in MLX was the main motivation behind creating <a href="https://github.com/chimezie/mlx-tuning-fork">mlx-tuning-fork</a>, so now that this is a core part of <a href="https://pypi.org/project/mlx-lm/">mlx_lm</a>, it is nice to retire this functionality to rely on their reference implementation and focus on other motivations such as ease of use similar to that of <a href="https://axolotl-ai-cloud.github.io/axolotl/">axolotl</a>.</p><p>To understand input masking during instruction fine tuning (or <em>completion-only training</em>), it is important to understand what logits are and what instruction fine tuning is.</p><p>Instruction fine tuning with labeled instruction data is a straightforward, supervised training method for adapting Large Language Models (LLMs) to follow instructions using annotated input-output text pairs. The instructions can stand on their own or have, as a component, input data that they are meant to act upon and are paired with the resulting output or a <em>completion</em>. Ideally, when an LLM is sampled with an instruction, it would provide output equivalent or similar to the <em>label</em> in the pair.</p><p>For example, consider training an LLM to follow instructions to provide a formal definition from a domain reference model of canonical human anatomy like the FMA. You can use the <a href="https://huggingface.co/datasets/cogbuji/MrGrammaticalOntology_anatomist">cogbuji/MrGrammaticalOntology_anatomist dataset</a> for this instruction fine tuning. There are no inputs for this kind of instruction, just a request to define an anatomy term.</p><p>Below is an example of an instruction data record for the left lateral ventricle:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/749/1*8qdpgK2Enu3TCjw7RK_EsQ.png" /><figcaption>Example instructions for defnining “left lateral ventricle”</figcaption></figure><p>In practice with <a href="https://arxiv.org/abs/2501.09223/">transformer-based decoder models</a>, this works by:</p><ul><li>taking records such as these from the training set, encoding (or <em>tokenizing</em>) them into the internal representation the Neural Network uses during its <em>autoregressive inference</em></li><li>calculating the loss or how accurately the probabilistic model infers, completes, or produces the completion <em>tokens</em>, encodings of the corresponding text.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/1*bKxu-ojV0VZQU9LzvwL8Jg.png" /><figcaption>Tokenization or encoding of instruction task data (training data)</figcaption></figure><p>The key component of the autoregressive inference process is a <a href="https://en.wikipedia.org/wiki/Conditional_probability">conditional probability</a> distribution over the content given to the model as tokens, which the model produces in response. These are called <em>logits</em>. Conditional probability measures the probability of an event occurring, given that another event is already known to have happened. The logits capture conditional probabilities — at each token position — over all possible tokens (the model’s <em>vocabulary</em>) of having a particular token in the vocabulary at that position, <em>given</em> that it is preceded by all the tokens up to that place thus far from left to right and along the tokens given to the model. In the example below, the logits at position C₂ are conditioned on being preceded by <strong>all</strong> the input tokens in black and the C₀ and C₁ completion tokens.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*BXS7cnkhbzYbeeLSWpSUUg.png" /><figcaption>Logits, masking, and loss calculation</figcaption></figure><p>During the instruction fine tuning, the loss is calculated using these logits. At this point, the loss is usually calculated using a <a href="https://www.datacamp.com/tutorial/the-cross-entropy-loss-function-in-machine-learning">cross-entropy loss function</a>, which can consider the loss over the entire sequence of tokens provided to the model or just those that correspond to the completion or target tokens. <strong>Input masking</strong> or <strong>prompt masking</strong> is how the latter is done, which is useful for avoiding penalizing the model for not reproducing the instruction or input exactly as provided in the training data record.</p><p>This is a high-level abstraction of the initial process of LLM training that shares much in common with benchmark evaluation and is more formally defined and shown below from the appendix of the <a href="https://arxiv.org/abs/2405.14782">paper</a> associated with the highly popular and influential <a href="https://github.com/EleutherAI/lm-evaluation-harness">Language Model Evaluation Harness</a> used and referenced in hundreds of papers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XAdZ1i97DxfuD2bmJWNr6g.png" /><figcaption>Appendix A2 of Stella Biderman, et al.’s “Lessons from the Trenches on Reproducible Evaluation of Language Models”</figcaption></figure><p>For what is being discussed here, loglikelihood can just be considered a normalized form of logits. However, it still captures the conditional probability that is the engine of the autoregressive modeling whose accuracy we measure in evaluation on the one hand and update during training on the other. It is also the same engine from which sampling is done to generate responses from the LLM during language tasks.</p><p>During training, the loss described earlier is minimized via <a href="https://en.wikipedia.org/wiki/Backpropagation"><em>backpropagation</em>, or <em>backward propagation</em></a>, and this step is not related to benchmark evaluation. It occurs after producing the conditional probability from the models as logits, which is common to both. Backward propagation, however, is how the underlying neural network is trained by updating its parameters to minimize the loss or <em>error</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*el-beq8gIjuIoLl1qFmJAA.gif" /><figcaption>From <a href="https://jalammar.github.io/how-gpt3-works-visualizations-animations/">“How GPT3 Works — Visualizations and Animations”</a></figcaption></figure><p>With MLX (mlx_lm), it is the ‘<em>masking</em>’ described earlier that distinguishes self-supervised pre-training from supervised instruction fine-tuning. These two training tasks are the main components of how foundational models are built and can be used to first train a model on one task (performing <a href="https://arxiv.org/abs/2004.10964"><em>continued pretraining</em></a>) using a large corpus of unlabeled text from a specific, new domain and to transfer and take advantage of the resulting model&#39;s capabilities in learning another task, i.e., <a href="https://en.wikipedia.org/wiki/Transfer_learning">transfer learning</a>.</p><p>Support for input or prompt masking and being able to chain mlx-tuning-fork training tasks using configuration files in a composable way, performing one configuration-based training task after another, and using the resulting adapters from one step as the basis for a subsequent one were the major changes in this release.</p><p>In this way, configurations can orchestrate the use of MLX for domain-adaptive pretraining followed by instruction tuning to produce domain-specific models from existing foundational models using domain-specific training data publicly available on Hugging Face or local data.</p><p>So, using a configuration file with the following content (in a file called <strong>clinical-pretraining.yaml</strong>) :</p><pre>model: &quot;mlx-community/Mistral-Small-24B-Instruct-2501-4bit&quot;<br>train: true<br>hf_dataset:<br>    name: &quot;cogbuji/medqa_corpus_en&quot;<br>    train_split: &quot;train[:-10%]&quot;<br>    valid_split: &quot;train[-10%:]&quot;<br>    text_feature: &quot;text&quot;<br><br>num_layers: 20<br>batch_size: 2<br><br>epochs: 1<br>evals_per_epoch: 1<br><br>learning_rate: 5e-6</pre><p>and another with the following (in a file called <strong>anatomist-coder-instruction-fine-tuning.yaml</strong>):</p><pre>model: &quot;mlx-community/Mistral-Small-24B-Instruct-2501-4bit&quot;<br>train: true<br>mask_prompt: true<br>hf_dataset:<br>  - name: &quot;cogbuji/MrGrammaticalOntology_anatomist&quot;<br>    train_split: &quot;train&quot;<br>    valid_split: &quot;validation&quot;<br>    prompt_feature: &quot;input&quot;<br>    completion_feature: &quot;output&quot;<br>  - name: &quot;cogbuji/MrGrammaticalOntology_clinical_coding&quot;<br>    train_split: &quot;train&quot;<br>    valid_split: &quot;validation&quot;<br>    prompt_feature: &quot;input&quot;<br>    completion_feature: &quot;output&quot;<br><br>batch_size: 2<br><br>epochs: 2<br>evals_per_epoch: 1<br>learning_rate: 5e-6<br></pre><p>Notice the new <strong>mask_prompt: true</strong> directive, which tells mlx_lm to apply prompt masking to the Huggingface datasets. You can have mlx-tuning-fork perform the following training tasks:</p><ul><li>Continued pertaining of the <a href="https://huggingface.co/mistralai/Mistral-Small-24B-Instruct-2501">Mistral Small 3 ( 2501 ) model</a>, <a href="https://huggingface.co/mlx-community/Mistral-Small-24B-Instruct-2501-4bit">quantized</a> to 4-bits over an epoch of the <a href="https://huggingface.co/datasets/cogbuji/medqa_corpus_en">cogbuji/medqa_corpus_en</a> Huggingface dataset, partitioning the first 90% of the training collection for training and the final 10% for validation/evaluation purposes, using QLoRA, a batch size of 2, on 20 out of the 40 MLX layers of the model.</li><li>Instruction fine tuning of the result over two epochs of the combination of the <a href="https://huggingface.co/datasets/cogbuji/MrGrammaticalOntology_anatomist">cogbuji/MrGrammaticalOntology_anatomist</a> and <a href="https://huggingface.co/datasets/cogbuji/MrGrammaticalOntology_clinical_coding">cogbuji/MrGrammaticalOntology_clinical_coding</a> instruction datasets.</li></ul><p>via the following command line that demonstrates using the training task configurations in a composable way:</p><pre>$ mlx_tuning_fork_training --train-type lora \<br>     /path/to/clinical-pretraining.yaml \<br>     /path/to/anatomist-coder-instruction-fine-tuning.yaml</pre><p>See the <a href="https://github.com/chimezie/mlx-tuning-fork/blob/main/CHANGELOG.md#040---20250222">change log</a> for a more detailed list of the changes in this release.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ae8667e75c8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How recent policy changes affect the life of a 1st generation Nigerian-American / American-Nigerian]]></title>
            <link>https://chimezie.medium.com/how-recent-policy-changes-affect-the-life-of-a-1st-generation-nigerian-american-american-nigerian-6f8d7752bb02?source=rss-9344b33e7a8a------2</link>
            <guid isPermaLink="false">https://medium.com/p/6f8d7752bb02</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[essay]]></category>
            <category><![CDATA[research]]></category>
            <category><![CDATA[culture]]></category>
            <dc:creator><![CDATA[Chimezie Ogbuji]]></dc:creator>
            <pubDate>Sat, 22 Feb 2025 01:56:12 GMT</pubDate>
            <atom:updated>2025-02-22T02:13:40.781Z</atom:updated>
            <content:encoded><![CDATA[<p>I saw my local congresswoman, Shontel Brown, of the 11th Ohio district, yesterday at a very emotional town hall and responded to a call for our stories from her and her team. This is an elaboration of what I wrote.</p><p>I’m an enterprise data / AI architect, medical informatician, and inventor with over 20 years of experience. I left the in-patient healthcare technology industry, took a journeyman detour through a circuitous route, and eventually joined my family’s small home healthcare agency (HHA).</p><p>My parents are naturalized Nigerian immigrants currently transitioning to retirement. They bootstraped their 23-year-old agency with retirement funds, which they had paid into their professional careers.</p><p>I say both Nigerian-American and <em>American-Nigerian</em> because — in a <strong>very</strong> ironic and complicated way, some other gen Niaja-1s (as I call us) or first-generationers would be able to understand — I consider myself culturally Nigerian but nationally American, as a born US citizen and dual-passport holder who remembers being considered “<strong>oyibo</strong>” when I lived in Nigeria for almost a decade during my formative years and the period when my parents returned to Nigeria before returning to <em>the states</em> yet again.</p><p>Same as that of my full last name, I think identification to that particular, latter hyphenation order is more pronounced for me because, although I am not an Atheist like my father, a NASA materials scientist, or a born-again or evangelical Christian like my mother, a maternity nurse, I <strong>believe</strong> very strongly in the egalitarian intention and meaning of the words of our constitution (its “semantics” if you will), even if the syntax hasn&#39;t worn entirely well through US history. I strongly believe my parents do as well and that it wasn’t <strong>just</strong> because they were fleeing the after-effects of the Nigerian Biafran war that they came and planted deep roots (19 grandchildren) here with their three sons.</p><p>I joined the agency in late 2017 to bring my technology experience to help the family business and a very underserved population more directly (compared to those within in-patient facilities, for example). Most of this population relies on Medicaid coverage for their home healthcare services, the reimbursement of which is a significant part of the revenue we rely on for the services we provide and to remain in business in an industry with incredibly razor-thin margins. Disruptive changes to Medicaid healthcare coverage and the privatization of Medicare have a severe impact on our patients, who are already very vulnerable and with needs that only grow, independent of the winds of political change due to what we know about fundamental trends of chronic disorders in the population.</p><p>Along with a multi-disciplinary group, we recently applied for a grant from the Artificial Intelligence/Machine Learning Consortium to Advance Health Equity and Researcher Diversity (AIM-AHEAD) program, established by the National Institutes of Health (NIH). The program aims to enhance diversity in artificial intelligence and machine learning (AI/ML), emphasizing reducing health disparities and promoting health equity. The purpose of the grant was to bring together stakeholders in Northeast Ohio to identify how the current revolution in AI can be leveraged to solve health equity issues for patients and HHAs and to build novel solutions for this purpose.</p><p>Even if diversity now has a controversial connotation in popular US culture, it has a very specific quantitative denotation in the medical sciences, especially regarding how data scientists and epidemiologists interpret and produce evidence-based knowledge and the <em>raison d’être</em> of programs like this.</p><p>Recent attacks on DEI programs and attempts to freeze NIH grant programs threaten opportunities (local and nationwide) to address health equity issues, improve home healthcare, and keep the country competitive in the ongoing global AI arms race. These opportunities impact the cost of lifetime healthcare for patients and the budgets of local governments.</p><p>Playing culture wars games in a zero-sum game world during perilous times can have epidemiological consequences and is plain stupid. We can&#39;t simultaneously be foolish and want to be <em>great</em> or <em>greater</em>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6f8d7752bb02" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>