<?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 Peter Crocker on Medium]]></title>
        <description><![CDATA[Stories by Peter Crocker on Medium]]></description>
        <link>https://medium.com/@peter.crocker?source=rss-2ef284cfaf5b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*X9FoUWNaqlGeNeiV2_lrdA.jpeg</url>
            <title>Stories by Peter Crocker on Medium</title>
            <link>https://medium.com/@peter.crocker?source=rss-2ef284cfaf5b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 16:30:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@peter.crocker/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[Reasonable Vehicles Rule the Road]]></title>
            <link>https://medium.com/data-science/reasonable-vehicles-rule-the-road-7a605ac2e1be?source=rss-2ef284cfaf5b------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a605ac2e1be</guid>
            <category><![CDATA[knowledge-graph]]></category>
            <category><![CDATA[autonomous-driving]]></category>
            <category><![CDATA[rdfox]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[reasoning]]></category>
            <dc:creator><![CDATA[Peter Crocker]]></dc:creator>
            <pubDate>Thu, 01 Jul 2021 12:41:19 GMT</pubDate>
            <atom:updated>2021-07-01T12:41:19.845Z</atom:updated>
            <content:encoded><![CDATA[<h4>Semantic Reasoning and Ontologies for Autonomous Vehicles</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w5TkZn7KagOPifFjw-vgog.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@andreasdress">Andreas Dress</a> on <a href="https://unsplash.com/">Unsplash</a></figcaption></figure><p>Autonomy is a central pillar of the fourth industrial revolution. However, fully autonomous vehicles remain an area of development. Autonomous vehicles operate in a high-risk environment — if something goes wrong, lives could be at risk. To function effectively, the system needs human-like reasoning and decision-making capabilities.</p><p>There is a growing interest in ontology-based road environment modelling within the Intelligent Transportation Systems community. Ontologies offer many benefits for the development of autonomous vehicles; they have been used in representing road intersections, creating driving decision-making systems, and for providing meaning and context, both implicit and explicit, to sensor data, for example the relationships between perceived road objects.</p><p>Various levels of ontologies can be integrated using semantic reasoning (rules) to create a “common high-level ontology resulting in a unified knowledge base”.[1] Using an ontological approach allows the road environment to be modelled and road situations to be reasoned over.</p><p>The necessary knowledge for decision-making and vehicle motion planning can be deduced from this unified knowledge base. Ontologies provide a flexible architecture, as various lower-level maps can be used to feed information to the high-level ontology.</p><p>To complement this article, we have also created an animated video, ‘Reasoning on The Road’, which illustrates the capabilities of RDFox with broad strokes. Continue reading as we explore its themes in detail below.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FxIhWVCzQzRM%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DxIhWVCzQzRM&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FxIhWVCzQzRM%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/c1d05f98a2e81f5a3c4e1c84f03f4f7a/href">https://medium.com/media/c1d05f98a2e81f5a3c4e1c84f03f4f7a/href</a></iframe><blockquote>This article is inspired by award winning research undertaken by Haonan Qiu, and colleagues at the BMW Group and the University of Ulm.[2] The views expressed herein are those of the author.</blockquote><blockquote>For the full white Paper <a href="https://uploads-ssl.webflow.com/5ed7f18d11a068aa460ce2e9/5fd7947eeb97b765f466a1df_Reasonable%20Vehicles%20Rule%20the%20Road%20low%20res.pdf">click here</a>.</blockquote><h3>Semantic Reasoning for Autonomous Vehicles</h3><p>Researchers at BMW have suggested a novel approach for the progression of autonomous vehicles, which uses<a href="http://www.oxfordsemantic.tech/"> RDFox, a semantic reasoning engine</a>, in its knowledge-spatial architecture.</p><p>Semantic reasoning is the <a href="https://www.oxfordsemantic.tech/glossary">“ability to make logical deductions from the information that is explicitly available”</a>. This approach models the road environment, provides a dynamic update mechanism, and has semantic reasoning at its core. Reasoning allows information to be aggregated and integrated leading to knowledge of the environment and effective decision-making, e.g. changing lanes at an appropriate time so the car leaves the motorway.</p><p>RDFox provides a comprehensive software component that can be used to process and integrate data, in real-time, with constrained processing power. RDFox can deal with large, constant streams of data due to its incremental processing capabilities. This means that as new data comes in, only the calculations which are affected are updated.</p><p>Using rules RDFox can make real-time decisions resulting in motion control. By harnessing the power of semantic reasoning, logic can be integrated into the software. This means the rules and best practices associated with driving can be embedded within the system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_ZujMbUMblq3jkEvD9qkxA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@createdbyconnor?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Connor Williams</a> on <a href="https://unsplash.com/s/photos/busy-road?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h3>‘Reasonable’ driving</h3><p>There are numerous benefits associated with the advent of autonomous vehicles, including increasing safety on the roads, real-time route optimisation, increased lane capacity, reduced energy consumption and time efficiency for the users. RDFox is suitable for this application because, like a (competent) human driver, it is a sophisticated reasoner, which can scale, and is optimised for fast, incremental reasoning. Speed of thought is critical in an autonomous vehicle because a difference measured in milliseconds could be an incident on the motorway.</p><p>In reality, the safe operating parameters of autonomous vehicles will determine whether and how they operate. This will determine, for example, maximum speeds, minimum distances between vehicles, and the minimum conditions that must be satisfied before manoeuvres are permitted, such as lane changes. The faster and more accurate the reasoning, the larger and more flexible the safe operating window, and the greater the benefits of autonomous transportation.</p><p>The in-memory solution and economical storage that RDFox offers also bolster its viability, as it provides the ability to hold information on-board the vehicle effectively, whilst also integrating various datatypes.</p><blockquote><strong>Whilst RDFox has all of the capabilities synonymous with graph databases, its incremental semantic reasoning capability make it uniquely suitable to meet the demands of autonomous driving.</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pMIcV63AUdTde_DY6okxUQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@josephcooper?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Joseph Cooper</a> on <a href="https://unsplash.com/s/photos/busy-road?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h3>Autonomous Vehicles need Semantic Reasoning</h3><p>Semantic reasoning is the key to giving autonomous systems salient information and decision-making capabilities whilst reducing their dependency on big data feeds and huge processing power.</p><p>The contribution made by researchers at BMW demonstrates improvements in various areas, including: the ability to embed domain knowledge on safe driving practices; data volume issues; monitoring of sensors; and explainability.</p><h4>1. Safe driving practices</h4><p>Rules and common sense help humans plan and infer responsible driving behaviour for situations on the road. A driver might slow down when driving through a residential neighbourhood on a sunny weekend because they expect more pedestrians and children playing with balls near the road. Semantic reasoning makes it possible to model these implicit concepts so that the appropriate decisions can be applied at scale without having to explicitly state each variation individually.</p><p>An autonomous vehicle must also be able to anticipate potential outcomes and respond in real-time. For example, if someone walks out into the road unexpectedly, the car must respond. By modelling domain expertise on safe driving practices into the system we can improve the safety element of autonomous vehicles.</p><p>Furthermore, of the mistakes made by humans driving,<a href="https://trid.trb.org/view/689647"> 98.3% are due to inattention or ineffective driving</a>. When such errors are combined with a deliberate reduction of the safety margin, through excessive speed or driving too close to the vehicle in front, the result is a serious and potentially fatal incident. By removing the human element that is prone to lethally combining these errors and violations, there will likely be a reduction in road incidents, which result in more than <a href="https://www.fiafoundation.org/our-work/road-safety">1.2 million deaths and 50 million injuries </a>a year, globally. While you can never eliminate human error (after all, software must be written and sensors designed), by shifting the decision-making moment from a time-critical situation to that of a lab, the likelihood of disaster is decreased to be comparable with other manufacturing tolerances, such as a break failing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uJbFj3oVLBno-i9iDy0uLg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@ross_sokolovski?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Ross Sokolovski</a> on <a href="https://unsplash.com/s/photos/road?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h4>2. Data volume</h4><p>The volume and computation pressure of data processing is a huge concern for those developing methods using HD Maps. Qiu and her colleagues have found that using RDFox, they can retain all relevant information, for as long as is required, in in-memory data stores.</p><p>By using spatial reasoning, a ‘spatial window’ can be created. This defines a range using a specific distance around the car that information will be stored for. It determines information to pre-load for areas soon to come into the spatial window, and once beyond the range, the information will be incrementally deleted from the system.</p><p>This limits the amount of data stored and processed at any given time, greatly improving processing efficiency. The map is incrementally updated whilst progressing along a route. For the first time, it’s possible to do all this on board directly.</p><h4>3. Data integration</h4><p>At present, the various maps accessible by manufacturers are in incompatible formats due to the lack of standardisation. RDFox is well suited to solving this issue due to its ability to integrate data from various locations and formats, into a unified knowledge graph which can then be reasoned over.</p><p>By using RDFox the manufacturer can integrate the existing map knowledge base into their system, and build upon this, rather than starting from scratch. This represents a serious breakthrough in map development.</p><h4>4. Sensors</h4><p>Rules offer the solution to safety concerns over sensors. When information is incomplete because sensors are erroneous or missing, rules can be used to determine decision-making, and can rely on the wealth of other information incorporated into the system. For example, if a sensor fails, then the car will be able to aggregate the information from other sensors to ensure that safe driving continues.</p><p>Additionally, when sensor data is inconsistent, rules can be used to flag this to the car in real-time. For example, rules can prevent false emergency breaks by validating the consistency of the derived knowledge from the fused sensor and map data ontologies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hWjtF1n1uGg-Z4VFzShsTA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@nabeelsyed?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Nabeel Syed</a> on <a href="https://unsplash.com/s/photos/busy-road?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h4>5. Explainability</h4><p>As safety is a huge concern for integrating autonomous vehicles into the mainstream road systems, being able to explain a vehicle’s actions is of interest to the developers. At present, machine learning techniques are unable to provide explainability. Should an incident occur, or should the user be interested in why the autonomous vehicle took a specific path, they can’t get an explanation from the system.</p><p>With RDFox, the system can provide explainability. This would allow for accountability, and also provides transparent information to the Manufacturer and investigators. Just as the black box, together with a learning culture, has helped transform safety in flight, transparency in autonomous vehicle control systems will help achieve the same for road transport. It is, in fact, astonishing to think that aviation is orders of magnitude safer than driving.</p><h3>Looking forward</h3><p>There is a growing body of research which uses ontologies and semantic reasoning in autonomous vehicles and other autonomous applications. The novel approach put forward in the research conducted by Haonan Qiu, colleagues at BMW and the University of Ulm, explored the use of ontological approaches for dynamic map processing, and reasoning for decision-making and motion control.</p><p>The inclusion of RDFox in environmental modelling and knowledge-spatial architecture for the facilitation of autonomous vehicle decision-making opens new possibilities for applying human-like reasoning to this field. The choice of RDFox was integral to this research, due to its unique ability to perform with speed and correctness in the acutely constrained and time-sensitive cockpit of the autonomous vehicle.</p><p>The results are encouraging, and suggest that the ontological approach using semantic reasoning could contribute to the strive for full autonomy in vehicles and, of course, other areas of robotics.</p><h4>Additional References</h4><ol><li>Belouaer, Bouzid, and Mouaddib. (2010). Ontology based spatial planning for human- robot interaction. In <em>17th Int. Symposium on Temporal Representation and Reasoning (TIME 2010)</em>, pages 103–110, Los Alamitos, CA, USA. IEEE Computer Society.</li><li>Qiu, Ayara, and Glimm (2020a). A Knowledge Architecture Layer for Map Data in Autonomous Vehicles. Institute of Artificial Intelligence, University of Ulm.</li><li>Qiu, Ayara and Glimm (2020b). Ontology-Based Processing of Dynamic Maps in Automated Driving. In KEOD.</li></ol><p><em>The video featured in this article is the property of Oxford Semantic Technologies.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a605ac2e1be" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/reasonable-vehicles-rule-the-road-7a605ac2e1be">Reasonable Vehicles Rule the Road</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Determining compatibility]]></title>
            <link>https://medium.com/data-science/determining-compatibility-b952d941c22a?source=rss-2ef284cfaf5b------2</link>
            <guid isPermaLink="false">https://medium.com/p/b952d941c22a</guid>
            <category><![CDATA[configuration-management]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[reasoning]]></category>
            <category><![CDATA[knowledge-graph]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Peter Crocker]]></dc:creator>
            <pubDate>Thu, 09 Jul 2020 13:41:25 GMT</pubDate>
            <atom:updated>2020-07-09T17:11:46.134Z</atom:updated>
            <content:encoded><![CDATA[<h4>A configuration management example</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*frjoNOO05P5gf0MP5SJvww.jpeg" /></figure><p>Across various industries and business models, companies seek to assess compatibility; for example, in regards to industrial configuration management, terms in contracts, points of a supply chain, buyers and suppliers, and so on.</p><p>Whether this process is in relation to assemblies, production or data analysis, it can require checking millions of combinations to assess whether components fit together and if they meet certain requirements. The large volumes of data, complex process and issue of scalability mean that traditional approaches are inefficient.</p><p>This article will demonstrate how RDFox can be used to make compatibility solutions correct, with almost unnoticeable iteration times, and operate 50–100 times faster than other RDF stores. It will use the example of an industrial configuration management solution.</p><p>For example, see the <a href="https://www.oxfordsemantic.tech/case-studies">Festo case study</a>. Or follow along with the Configuration Solution webinar<strong> </strong><a href="https://www.youtube.com/watch?v=tpB_tl1Vc0A&amp;t=1284s"><strong>here.</strong></a></p><h3>Traditional Solutions</h3><p>Traditionally, SQL databases can be used to determine compatibility. However, the process is long and requires the creation of tables for each component, joining tables to form bigger tables and bigger tables, and so on. The complete system is then used to assess compatibility.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h2Q9uIiC9MqkBr8LunD3nw.png" /><figcaption>Determining Compatibility with an SQL Database</figcaption></figure><p>As there could be thousands of components with many different characteristics and no universal schema, this process is extremely complex and tiresome with limited scalability. For a database of tens of thousands of components, this process can take hours.</p><p>For businesses with time pressures and restrictions, this imposes a challenge, and could limit competitive viability. Each time a component is added or removed the whole system needs to be updated, resulting in long iterations in the development or modification process.</p><h3>Why RDFox?</h3><p>RDFox is a high-performance knowledge graph and semantic reasoning engine. A knowledge graph is composed of a graph database to store the data and a reasoning layer to interpret and manipulate it. Relational databases like the SQL example above, store data in a strict tabular structure, while graph databases store information as nodes (data point, i.e. subject or object) and edges (relationships between data points). These structural differences provide significant advantages for use cases which require the calculation of compatibility, as knowledge graphs overcome the flexibility limitations of relational databases, allowing data points to be encoded as richly connected entities.</p><p>RDFox is an in-memory solution which makes it extremely fast. The powerful reasoning engine is unmatched in efficiency and reasoning capabilities, and by using rules it can provide flexible, incremental addition and retraction of data, as well as, fast parallel materialisation of new facts.</p><p>But what does reasoning mean in the context of a configuration solution?</p><blockquote>In this context, reasoning is understanding and applying the logic of how components are assembled to meet customer’s requirements.</blockquote><h3>The configuration challenge</h3><blockquote>“Build me an assembly that can spin at 2,000rpm and provide 800 g cm of torque”</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*_JxA0V9feibr6hH9sHGHRA.png" /><figcaption>An example of a configuration management interface built on RDFox.</figcaption></figure><p>For this example we have created a simple configuration management web application, which allows us to query the database for configuration solutions which provide specific requirements. The results are updated live, and can be seen on the right.</p><p>For a database which contains tens of thousands of components, including motors, gears, switches, power supplies and controllers, we need to check millions of potential combinations to determine compatibility. This is done by calculating if the components fit together and to see if they meet each others requirements. Each component has certain requirements and is responsible for certain provisions; for example, if the batteries supply and motors require a compatible amount of voltage.</p><p>To begin the process, we map each component’s attributes into the knowledge graph. For this example we have 500 components.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ePHxolmRLsOBpNFf80kxbg.png" /><figcaption>Each component is added to the graph. This image provides an example of a particular DC motor, its provisions and requirements.</figcaption></figure><p>Additionally, we can add an ontology of the components to the graph. This captures component hierarchies and is encoded into the system, providing subclasses and relationships. Using ontologies helps during the process of querying the dataset for the particular configuration solutions, as well as when writing rules.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1015/1*su75Yc9wkWnKJLHmzcWX0w.png" /></figure><p>Once the data for all the components is stored within the knowledge graph, we can use the power of reasoning to establish the compatibility of components. Using rules expressed in datalog, we can inscribe the logic of component compatibility, easily and correctly, into the system.</p><p>Rules allow the constraints for components to be compared with component attributes, resulting in the determination of compatibility and the provision of options for compatibility solutions. The compatible configuration solutions can then be stored in the knowledge graph as new edges (relationships) between nodes (data points, in this case, components).</p><p>This is an example of a compatibility rule in datalog which could lead to the following result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/231/1*7uIdaUfoz7uQY9lH3keDMA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*X9112rGN0e3E1572n_mqEw.png" /></figure><p>On inspection of this particular rule, it is evident that rules are expressions of logic and datalog provides a clear language to encode the rule. Rules read as an “if… then” statement. For example: The formula to the left of the :- operator is the rule head <em>(</em>the <em>‘then’</em> part<em>) </em>and the formula to the right is the rule <em>body (</em>the <em>‘if’ </em>part<em>).</em></p><p>Intuitively, this rule says, if the power supply provides a DC Voltage, a voltage of a specific amount, and a current of a specific amount, and the motor requires a DC Voltage, a voltage of the same amount, and a current of the same amount, then the two are compatible. This example shows that these two components are compatible with each other based on the requirements and provisions of the components.</p><p>This example represents just one configuration sequence. However, the database contains 500 components and numerous chains of compatibility. If all configuration solutions are calculated and materialised into the database, there will be various pathways to a configuration solution, for example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/1*jiSYIW9XweQzFZt31MC4BQ.png" /></figure><p>Web applications can be built and attached to the RDFox console, allowing users to interact with the knowledge graph without having to write SPARQL queries. This has significant benefits for businesses which require individuals throughout the company to access information, correctly and quickly. By typing the search constraints into the ‘Search Parameters’ box on the left, a SPARQL query is triggered, requesting information from the knowledge graph.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*_JxA0V9feibr6hH9sHGHRA.png" /><figcaption>Configuration Management Application</figcaption></figure><p>Alternatively, rather than using a web application, you can interact with the knowledge graph directly using RDFox’s console. RDFox uses the RDF standard query language SPARQL, which send requests for information to the knowledge graph.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*uYYqagy6FpPr6_h7vqyf-Q.png" /><figcaption>RDFox console with compatibility query</figcaption></figure><p>The console above contains the query for a configuration solution using our example database. The query indicates that specific torque and speed requirements were selected. The query fetched 47 answers and executed in 0.702 seconds — blink and it is there!</p><p>By using rules, RDFox can compute all compatibilities for configuration solutions ahead of query time. This advanced capability means that queries occur even faster than alternative knowledge graph solutions, resulting in increased efficiency within businesses, as solutions are provided quicker. This has knock on effects for user experience and client satisfaction. Systems which do not use rules would have to determine compatibilities during the query process, resulting in significantly slower results.</p><h3>What happens when new items are added or removed?</h3><p>In real-world applications, components will be added and removed from the database. This poses a significant constraint on companies who use databases with long iteration periods.</p><p>New component data can be imported into RDFox, along with the rules for its compatibility, at any point. As RDFox processes updates incrementally, this can be added without needing a whole system update.</p><p>Similarly, to remove a component, one would need to tell RDFox to delete it. Once the component is deleted from the data, all relationships (edges) from the component to other components (nodes), will also be deleted, incrementally.</p><h3>What if the constraints change?</h3><p>Similarly to the process of adding component data, the rules can be updated. This is important for companies and clients who are having to meet constantly changing constraints, such as budget, environment, demand, and so on.</p><p>This incremental feature is unique to RDFox, and provides huge benefits, as it allows real time addition or removal of rules and data from applications; for example, when components are no longer manufactured, come in or out of stock or if items are recalled. The ability of RDFox to provide flexibility without compromising the performance, is significant in comparison to alternative compatibility solutions.</p><h3>The overall picture:</h3><p>1. Data and rules go in</p><p>2. RDFox evaluates the rules</p><p>3. Rotation solutions are accessed via SPARQL queries, using the RDFox console or web applications built on top of the console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0v0atXciIHTKyqO8MYrCtA.png" /></figure><p>Knowledge graphs allow absolute flexibility for data modelling, as rules can encode domain expertise, and are bespoke to suit each company’s needs. For more information on this particular use case, watch the webinar.</p><p>To learn more about RDFox go to our <a href="http://www.oxfordsemantic.tech/">website</a> or <a href="https://medium.com/oxford-semantic-technologies">medium publication</a>. To request an evaluation license click <a href="https://oxfordsemantictech.typeform.com/to/p0WKTn?typeform-embed=embed-widget&amp;typeform-embed-id=vylbd">here</a>.</p><h3>Team and Resources</h3><p>The team behind Oxford Semantic Technologies started working on RDFox in 2011 at the Computer Science Department of the University of Oxford with the conviction that flexible and high-performance reasoning was a possibility for data intensive applications without jeopardising the correctness of the results. RDFox is the first market-ready knowledge graph designed from the ground up with reasoning in mind. Oxford Semantic Technologies is a spin out of the University of Oxford and is backed by leading investors including Samsung Venture Investment Corporation (SVIC), Oxford Sciences Innovation (OSI) and Oxford University’s investment arm (OUI). The author is proud to be a member of this team.</p><p><em>Cover photo by the author with the permission of his children to use the subject.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b952d941c22a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/determining-compatibility-b952d941c22a">Determining compatibility</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The impact of rules on queries]]></title>
            <link>https://medium.com/data-science/the-impact-of-rules-on-queries-e69468dadf98?source=rss-2ef284cfaf5b------2</link>
            <guid isPermaLink="false">https://medium.com/p/e69468dadf98</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[knowledge-graph]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Peter Crocker]]></dc:creator>
            <pubDate>Wed, 27 May 2020 21:08:42 GMT</pubDate>
            <atom:updated>2020-07-17T16:17:28.250Z</atom:updated>
            <content:encoded><![CDATA[<h4>Realising the knowledge in your data</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HCoxvBFahOivW7vJsZSdVg.jpeg" /></figure><p>An application’s logic for processing and manipulating data is typically controlled by an application or logic layer which sits between the database and the presentation. This formulates the requests which must then comply with the database’s structure. The following diagram represents the classic three tier architecture on which much of the world’s IT systems are built.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*bG_IaMrIwOvbGoEkV6_pug.png" /><figcaption><a href="https://en.wikipedia.org/wiki/Multitier_architecture#Three-tier_architecture">https://en.wikipedia.org/wiki/Multitier_architecture#Three-tier_architecture</a></figcaption></figure><p>However, knowledge graphs propose a paradigm shift to this design blurring the barrier between logic and data. By bringing some of the knowledge of the domain into a graph through rules a knowledge graph captures more than just the data in the system. As a result, rules can make the queries and requests much simpler to write and manage which in turn allows applications to be more flexible, less error prone and faster.</p><p>This article will introduce a simple example to showcase the impact of rules on query design. The example will be illustrated on RDFox, a high-performance knowledge graph and semantic reasoning engine developed by Oxford Semantic Technologies.</p><h3>Introducing rules</h3><p>A rule is a logical statement which scans the graph for data patterns which match the rule.</p><p>Consider the following graph rendered in RDFox’s console:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/304/1*hHwj6WEPJgABL_cyWE-b-g.png" /><figcaption>A fragment of the original data imported for this example.</figcaption></figure><p>It is easy to determine from the graph that Douglas Adams and Charlie Chaplin were born in the UK and that they are therefore UK comics. In a classical tiered approach, one might write logic in a middle tier to query the base graph directly in its original form. This query is by definition going to be more complicated than if we could query a knowledge graph directly for all UK comics.</p><p>The first rule works on the subClassOf relationship and for our data this makes the direct type relationship between Douglas Adams and Charlie Chaplin to Comic.</p><p>[?x, a, ?z] :- [?x, a, ?y], [?y, :subClassOf, ?z] .</p><p>Next we introduce the UK comic concept to the graph. To add this concept, we can use a simple rule in Datalog to materialise the UK Comic relationships:</p><p>[?x, a, :UKComic] :- [?x, a, :Comic] , [?x, :born_in, :uk] .</p><p>Which translates to:</p><p>If ?x is a :Comic and ?x is born_in :uk then ?x is a :UKComic.</p><h3>Materialising rules</h3><p>RDFox will scan the datastore for triples which satisfy the body of the rule. RDFox will add ?x a :UKComic triples to the graph whenever the pattern following the “:-” symbol is satisfied and will stop when all the UK comics have been found.</p><p>The result is the following graph:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*ZztKJGydXkxsgnmHyjZkeg.png" /><figcaption>The same fragment as shown earlier here showing the additions made by the rules. In particular direct connections to the new UKComic concept.</figcaption></figure><p>Using RDFox the materialisation of these triples by the rules happens as soon as the rules are imported into the datastore or incrementally whenever new data points are added to the datastore. For example, a new comic born in the UK would automatically be tagged a :UKComic when added to the graph.</p><h3>How do rules help queries?</h3><p>In the first graph, to fetch the UK Comics, a query would first have to identify the entities born in the UK and then identify the Comic entities and then return the entities present in both answers. The query can be expressed the following way in SPARQL:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*8xd6Ii8r8bCIeLPi6mFgvQ.png" /><figcaption>The original query run against the source data.</figcaption></figure><p>With the UK comic rule, the query to answer the same question is much simpler because it is only searching for the :UKComic entities:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/1*_xBIEjCyaPrbocK8rCLKCg.png" /><figcaption>A simplified query that uses the new :UKComic concept.</figcaption></figure><p>We can also notice that the simplified query was faster to execute. This becomes more noticeable on larger datasets and more complex queries.</p><p>Rules help by expanding the original data in a consistent and managed way: as new data is added the same rules fire. Importantly if data is removed the reverse is also true and the consequences of previously fired rules are undone.</p><p>Modelling commonly searched concepts with rules can, therefore, help answer the questions faster but they also make the middle tiers easier to maintain thanks to simpler queries. Simpler queries allow applications to be more flexible.</p><p>Most queries can be modelled by the IF part of a rule which means that many existing applications could become faster and more flexible with a knowledge graph. If you have a situation today where your current architecture cannot supply the query performance required by your users why not use rules to push the logic about your data into a knowledge graph. Try writing queries in combination with rules using RDFox, you can sign up for a trial <a href="https://www.oxfordsemantic.tech/product">here</a>.</p><p>To learn more about knowledge graphs, read our introduction on TDS <a href="https://towardsdatascience.com/the-intuitions-behind-knowledge-graphs-and-reasoning-59df2f1ad054">here</a>.</p><h4>About Oxford Semantic Technologies</h4><p>The team behind <a href="https://www.oxfordsemantic.tech/team">Oxford Semantic Technologies</a> started working on RDFox in 2011 at the Computer Science Department of the University of Oxford with the conviction that flexible and high-performance reasoning was a possibility for data extensive applications without jeopardising the correctness of the results. RDFox is the first market-ready knowledge graph designed from ground up with reasoning in mind. Oxford Semantic Technologies is a spin out of the University of Oxford and is backed by leading investors including Samsung Venture Investment Corporation (<a href="https://www.samsungventure.co.kr/english_main.do"><strong>SVIC</strong></a>), Oxford Sciences Innovation (<a href="https://www.oxfordsciencesinnovation.com/"><strong>OSI</strong></a>) and Oxford University’s investment arm (<a href="https://innovation.ox.ac.uk/"><strong>OUI</strong></a>). The author is proud to be a member of this team and fan of the late great Douglas Adams.</p><p>Photo by <a href="https://unsplash.com/@pawel_czerwinski?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Paweł Czerwiński</a> on <a href="https://unsplash.com/@pawel_czerwinski?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e69468dadf98" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/the-impact-of-rules-on-queries-e69468dadf98">The impact of rules on queries</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Finding patterns with rules]]></title>
            <link>https://medium.com/data-science/finding-patterns-with-rules-4227ee4e8f58?source=rss-2ef284cfaf5b------2</link>
            <guid isPermaLink="false">https://medium.com/p/4227ee4e8f58</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[semanticweb]]></category>
            <category><![CDATA[rdfox]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[knowledge-graph]]></category>
            <dc:creator><![CDATA[Peter Crocker]]></dc:creator>
            <pubDate>Thu, 14 May 2020 14:29:44 GMT</pubDate>
            <atom:updated>2020-06-03T11:26:54.325Z</atom:updated>
            <content:encoded><![CDATA[<h3>Finding patterns with rules, using Knowledge Graphs and Semantic Reasoning</h3><h4>Concepts and examples</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*clh7D9W9nrpFnR0T" /></figure><p>Machine learning algorithms are now synonymous with finding patterns in data but not all patterns are suitable for statistics based data-driven techniques, for example when these patterns don’t have explicitly labelled targets to learn from.</p><p>In some cases, these patterns can be expressed precisely as a rule. Reasoning is the process of matching rule-based patterns or verifying that they don’t exist in a graph. Because these patterns are found with deductive logic they can be found more efficiently and interpreted more easily than Machine Learning patterns which are induced from the data.</p><p>This article will introduce some common patterns and how you can express them in the rule language, Datalog, using <a href="https://www.oxfordsemantic.tech/product">RDFox</a>, a knowledge graph and semantic reasoning engine developed by Oxford Semantic Technologies. RDFox is a standards based, <a href="https://www.w3.org/RDF/">RDF</a>-triple store which we will query with <a href="https://www.w3.org/TR/rdf-sparql-query/">SPARQL</a>. If you are not yet familiar with knowledge graphs and reasoning, you can read an introduction published on Towards Data Science <a href="https://towardsdatascience.com/the-intuitions-behind-knowledge-graphs-and-reasoning-59df2f1ad054">here</a>. If you don’t have RDF data, read our simple <a href="https://www.oxfordsemantic.tech/importing-data-into-rdfox">tutorial</a> for importing CSVs and SQL data into an RDF graph.</p><h3>The transitive relation pattern</h3><p>The “located in” relation is intuitively transitive but might not be completely expressed in the graph. For example, a graph might contain the following triples:</p><pre>@prefix : &lt;https://oxfordsemantic.tech/RDFox/tutorial/&gt; .</pre><pre>:oxford       :located_in :oxfordshire .<br>:oxfordshire  :located_in :england .<br>:england      :located_in :uk .</pre><p>A SPARQL query will not return that Oxford is located in England because it is missing the triple:</p><pre>:oxford       :located_in :england .</pre><p>This triple could be added on a one-off basis, but this would soon become impractical on larger graphs where other towns located in Oxfordshire might also be missing the located in England edge.</p><p>In this case, a transitive relation rule can effortlessly draw the relevant :located_in edges automatically:</p><pre>[?x, :located_in, ?z] :- <br>   [?x, :located_in, ?y], <br>   [?y, :located_in, ?z] .</pre><p>The first part is the head of the rule which will materialise ?x :located_in ?z triples if the pattern following the symbol :- is found in the graph.</p><p>In our example, the rule will bind the variable ?x to :oxford, variable ?y to :oxfordshire and variable ?z to :england, and then as a logical consequence of the rule being satisfied, create the :oxford :located_in :england triple by replacing ?x with :oxford and ?z with :england.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*nmyR7rd-FmsApDgbiaN9NA.png" /><figcaption>The original data is expanded by the rules with new relationships shown here in green.</figcaption></figure><p>RDFox will materialise the rule incrementally on the fly whenever new data points are added or removed from the graph which makes it an efficient solution for dynamic data sources.</p><h3>The transitive closure pattern</h3><p>Transitive closure patterns help materialise transitive relations which don’t yet exist in the graph but could potentially. For example, some Twitter followers can be represented in the following graph:</p><pre>:alice :follows :bob .<br>:bob   :follows :charlie .<br>:diana :follows :alice .</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/385/1*J4VDBqojf2oA_wqy6PWwzA.png" /><figcaption>Visualising the graph.</figcaption></figure><p>When recommending follow suggestions to the users we might wish to compute the missing connections as :follows_closure edges using the following rules:</p><pre>[?x, :follows_closure, ?y] :- <br>   [?x, :follows, ?y] .</pre><pre>[?x, :follows_closure, ?z] :-<br>   [?x, :follows, ?y], <br>   [?y, :follows_closure, ?z] .</pre><p>The first rule specifies that the new relation :follows_closure is an extension of the relation :follows. The second rule implements the closure by saying that if a person ?x directly follows ?y and ?y (directly or indirectly) follows person ?z, then ?x (indirectly) follows ?z.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/379/1*C8tRtqiDk_7SCmPJ2WaqWA.png" /><figcaption>Updated relationships showing the addition of the :follows_closure edges.</figcaption></figure><p>The new :follows_closure relations which were not originally a :follows relation are therefore:</p><pre>:diana :charlie .<br>:alice :charlie .<br>:diana :bob .</pre><p>These simple rules can be enhanced to include user interests, geography, language, common followers etc.</p><h3>Defining a relation as the composition of other relations</h3><p>An important practical use of knowledge graphs is to power Open Query Answering (Open QA) applications or chatbots, where the user asks a question in natural language, which is then automatically answered against the graph. Open QA systems often struggle to interpret questions that involve several “hops” in the graph. For instance, consider the graph consisting of the triples given next.</p><pre>:douglas_adams :born_in  :uk .<br>:uk            rdf:type  :country.</pre><p>A user may ask in which country Douglas Adams was born. To obtain this information, the system would need to construct a query involving two hops in the graph. In particular, the SPARQL query</p><pre>select ?c where {<br>   :douglas_adams :born_in ?c .<br>   ?c rdf:type :country .<br>}</pre><p>would return :uk as an answer.</p><p>The results of the open QA system would be greatly enhanced if the desired information had been available in just a single hop. RDFox rules can be used to provide a clean solution in this situation. In particular, we can use rules to define a new :country_of_birth relation that provides a “shortcut” for directly accessing the desired information.</p><pre>[?x, :country_of_birth, ?y] :- <br>   [?x, :born_in, ?y], <br>   [?y, rdf:type, :country] .</pre><p>The rule says that, if a person ?x is born in a place ?y, and that place ?y is a :country, then ?y is the country of birth of ?x.</p><p>As a result, RDFox would derive that Douglas Adams’ country of birth is the UK. The Open QA system would now only need to construct the following simpler query, which involves a single hop in the graph, to obtain the desired information.</p><pre>select ?x ?y where {?x :country_of_birth ?y}</pre><p>As we have already seen rules can build on the results of other rules so this pattern combined with the the first, transitive relation, can cater for data which includes more the full detail of where Douglas Adams was born. Such as:</p><pre>:douglasAdams   :born_in    :cambridge .<br>:cambridge      :located_in :cambridgeshire .<br>:cambridgeshire :located_in :england .<br>:england        :located_in :uk .<br>:uk             rdf:type    :country .</pre><p>When the rules are applied to this data they produce the graph visualised below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/593/1*TR-xUcRAvmiZLQll5cpgUw.png" /><figcaption>A graph of the input data along with the edges that have been derived by the rules.</figcaption></figure><h3>Cycle detection</h3><p>A common task in knowledge graphs is to identify cyclic relationships. For instance, partonomy relations are typically acyclic (e.g., if an engine is part of a car, we wouldn’t expect the car to be part of the engine as well!). In these cases, cycle detection may be needed to detect errors in the graph and thus provide data validation. Cycle detection is also useful for detecting fraud or insider trading by identifying for example communication relations in the network which shouldn’t exist.</p><p>Consider the following graph with “part of” relations:</p><pre>:piston :part_of :engine .<br>:engine :part_of :car .<br>:car    :part_of :piston .</pre><p>The graph contains a cyclic path :piston -&gt; :engine -&gt; :car -&gt; :piston. via the :part_of relation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/237/1*cpqA2A03iD8mhVvESYQkYQ.png" /><figcaption>By looking at this small graph clearly something is wrong. Imagine something much larger with many levels of nesting and branching in the structure.</figcaption></figure><p>The relationship is naturally transitive and can be define with the following rule:</p><pre>[?x, :part_of, ?z] :- <br>   [?x, :part_of, ?y], <br>   [?y, :part_of, ?z] .</pre><p>The following SPARQL query will return the elements which are part of others (directly or indirectly)</p><pre>select ?x ?y where {?x :part_of ?y}</pre><p>Which gives us the following results</p><pre>:piston :piston .<br>:car. :car .<br>:engine :engine .<br>:piston :car .<br>:car :piston .<br>:engine :car .<br>:piston :engine .</pre><p>A cycle manifests itself by the presence of self-loops (e.g. :piston is derived to be a part of itself).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/267/1*nH4-A5nLT61f3DgF5Bk7Zg.png" /></figure><p>Hence, it is possible to detect cyclic part of relations with the following SPARQL query.</p><pre>ask {?x :part_of ?x}</pre><p>Alternatively, we could define cyclic relations with the following rule:</p><pre>[:part_of, rdf:type, :cyclic_relation] :- <br>   [?x, :part_of, ?x] .</pre><p>Which tells us that if any object is determined to be a part of itself, then the partonomy relation is cyclic.</p><p>We can now easily retrieve the list of cyclic relations in the graph.</p><pre>select ?x where {?x rdf:type :cyclic_relation}</pre><p>To obtain :part_of as a result.</p><h3>Ordering pattern</h3><p>Many relations naturally imply some sort of order, and in such cases, we might be interested in finding the first and last elements of such orders.</p><p>For instance, consider the managerial structure of a company.</p><pre>:alice  :manages :bob .<br>:bob    :manages :jeremy .<br>:bob    :manages :emma .<br>:emma   :manages :david .<br>:jeremy :manages :monica .</pre><p>We would like to recognise which individuals in the company are “top-level managers”. We can use a rule to define a top-level manager as a person who manages someone and is not managed by anyone else.</p><pre>[?x, rdf:type, :top_level_manager] :-<br>   [?x, :manages, ?y], <br>   not exists ?z in ([?z, :manages, ?x]) .</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*ed5BKls_g4t0qcBseB1KLA.png" /><figcaption>As visualised here Alice matched the pattern of the rule and so marked as of type :top_level_manager.</figcaption></figure><p>The query</p><pre>select ?x where {?x rdf:type :top_level_manager}</pre><p>asking for the list of top level managers gives :alice as the answer.</p><p>We can now use a rule to define “junior employees” as those who have a manager but who themselves do not manage anyone else.</p><pre>[?x, rdf:type, :junior_employee] :- <br>   [?y, :manages, ?x], <br>   not exists ?z in ([?x, :manages, ?z]) .</pre><p>The query for junior employees is then</p><pre>select ?x where {?x rdf:type :junior_employee}</pre><p>This returns :monica and :david as answers.</p><h3>Finding patterns in practice</h3><p>This was a short introduction to a sample of rule-based patterns which will be expanded with more examples and applications in my next articles. Imagine what is possible with the combination of these with other rules and when run at scale over your data.</p><p>If you would like to search for rule-based patterns yourself visit <a href="https://www.oxfordsemantic.tech/product">RDFox’s</a> getting started guide.</p><h3>About Oxford Semantic Technologies</h3><p>The team behind <a href="https://www.oxfordsemantic.tech/team">Oxford Semantic Technologies</a> started working on RDFox in 2011 at the Computer Science Department of the University of Oxford with the conviction that flexible and high-performance reasoning was a possibility for data extensive applications without jeopardising the correctness of the results. RDFox is the first market-ready knowledge graph designed from ground up with reasoning in mind. Oxford Semantic Technologies is a spin out of the University of Oxford and is backed by leading investors including Samsung Venture Investment Corporation (<a href="https://www.samsungventure.co.kr/english_main.do"><strong>SVIC</strong></a>), Oxford Sciences Innovation (<a href="https://www.oxfordsciencesinnovation.com/"><strong>OSI</strong></a>) and Oxford University’s investment arm (<a href="https://innovation.ox.ac.uk/"><strong>OUI</strong></a>). The author is proud to be a member of this team.</p><p><em>Photo by </em><a href="https://unsplash.com/@pawel_czerwinski?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText"><em>Paweł Czerwiński</em></a><em> on </em><a href="https://unsplash.com/s/photos/fractal?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText"><em>Unsplash</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4227ee4e8f58" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/finding-patterns-with-rules-4227ee4e8f58">Finding patterns with rules</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The intuitions behind Knowledge Graphs and Reasoning]]></title>
            <link>https://medium.com/data-science/the-intuitions-behind-knowledge-graphs-and-reasoning-59df2f1ad054?source=rss-2ef284cfaf5b------2</link>
            <guid isPermaLink="false">https://medium.com/p/59df2f1ad054</guid>
            <category><![CDATA[semanticweb]]></category>
            <category><![CDATA[knowledge-graph]]></category>
            <category><![CDATA[rdfox]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[graph-database]]></category>
            <dc:creator><![CDATA[Peter Crocker]]></dc:creator>
            <pubDate>Tue, 05 May 2020 13:21:39 GMT</pubDate>
            <atom:updated>2020-05-06T15:43:42.205Z</atom:updated>
            <content:encoded><![CDATA[<h4>Concepts and examples</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*na2vSPnbL5ltPHmdE9eOyg.jpeg" /></figure><p>Relational databases despite their name are not very good at expressing relationships in data because they impose a storage structure which does not favour connections.</p><p>Graph databases despite their name look nothing like a graph but offer greater flexibility for expressing relationships between data points. These relationships can be of any type and are represented as edges between the data points.</p><p>Storing relationships in a graph is interesting but not very useful for extracting knowledge and insights. A knowledge graph is therefore composed of a graph database to store the data and a reasoning layer to search and materialise patterns in the data.</p><p>This article introduces the basic concepts and intuitions behind knowledge graphs and reasoning on <a href="https://en.wikipedia.org/wiki/Resource_Description_Framework">RDF</a> graphs with examples demonstrated on <a href="https://www.oxfordsemantic.tech/product">RDFox</a> a high-performance knowledge graph and semantic reasoning engine.</p><h3>Knowledge Graphs</h3><p>The RDF data model requires data points to be expressed in triples in the form: subject-predicate-object. The predominant query language for RDF graphs is <a href="https://en.wikipedia.org/wiki/SPARQL">SPARQL</a>.</p><p>Reasoning in RDF is the ability to calculate the set of triples that logically follow from an RDF graph and a set of rules. Such logical consequences are materialised in RDFox as new triples in the graph.</p><p>The use of rules can significantly simplify the management of RDF data as well as provide a more complete set of answers to user queries. Consider, for instance, a graph containing the following triples:</p><pre>:oxford       :located_in :oxfordshire .<br>:oxfordshire  :located_in :england .<br>:england      :located_in :uk .</pre><p>The relation :located_in is intuitively transitive: from the fact that Oxford is located in Oxfordshire and Oxfordshire is located in England, we can deduce that Oxford is located in England. However, the triple :oxford :located_in :england is missing from the graph, and a SPARQL query asking for all English cities will not return Oxford as an answer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/854/1*KQULKzg13k4NWRY1PQGAAA.png" /><figcaption>A visual representation of the graph.</figcaption></figure><p>We could, of course, add the missing triple by hand to the graph, thus making sure that Oxford is included in the list of English cities. Doing so, however, has a number of important disadvantages.</p><ul><li>There can be millions of missing triples involving the :located_in relation and each of them would need to be manually added, which is cumbersome and error-prone.</li><li>More importantly, by manually adding the missing triples we are not capturing the transitive nature of the relation, which applies universally to all objects connected by it in the graph.</li></ul><p>In particular, if we add to the graph the triple :england :located_in :uk we should derive the following triples as logical consequences of the transitivity of the :located_in relation:</p><pre>:oxford :located_in :uk .<br>:oxfordshire :located_in :uk .</pre><p>We can use a rule to faithfully represent the transitive nature of the relation.</p><p>Such a rule would state that,</p><p><strong>if</strong><br> (any) object <strong>?x</strong> in the graph is connected by :located_in to an object <strong>?y</strong>,<br><strong>and<br> ?y</strong> is in turn connected by :located_in to an object <strong>?z</strong>,<br><strong>then<br> ?x</strong> must also be connected by :located_in to <strong>?z</strong>.</p><p>Here, <strong>?x</strong>, <strong>?y</strong>, and <strong>?z</strong> are variables which can bind to any object in the graph.</p><p>In particular, such a rule can be written in RDFox’s rule language as follows:</p><pre>[?x, :located_in, ?z] :- <br>   [?x, :located_in, ?y], [?y, :located_in, ?z] .</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*mhkNgKznDofJu98cfjm9eA.png" /><figcaption>In this illustration the green line shows the link which is derived from the rule.</figcaption></figure><p>The rule establishes a causal relation between different data triples;</p><p>indeed,</p><p>triple :oxford, :located_in, :england holds because triples :oxford, :located_in, :oxfordshire and :oxfordshire, :located_in, :england also hold.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/854/1*Thw9kgD6Eu1LHjPt3A8J2w.png" /><figcaption>Green lines denote the relationships that are derived by the rule.</figcaption></figure><p>Assume that we later find out that :oxford is not located in :oxfordshire , but rather in the state of Mississippi in the US, and we delete from the graph the following triple as a result:</p><pre>:oxford :located_in :oxfordshire .</pre><p>Then, the triples :oxford, located_in, :england and :oxford, :located_in, :uk must also be retracted as they are no longer justified.</p><p>Such situations are very hard to handle by simply adding and/or deleting triples; in contrast, they can be automatically handled in an efficient and elegant way by using rules in RDFox.</p><h3>Rule Languages</h3><p>A rule language determines which syntactic expressions are valid rules, and also provides well-defined meaning to each rule. In particular, given an arbitrary set of syntactically valid rules and an arbitrary RDF graph, the set of new triples that follow from the application of the rules to the graph must be unambiguously defined.</p><h3>Datalog</h3><p>Rule languages have been in use since the 1980s in the fields of data management and artificial intelligence. The basic rule language is called <em>Datalog</em>. It is a very well understood language, which constitutes the core of a plethora of subsequent rule formalisms equipped with a wide range of extensions.</p><p>A Datalog rule can be seen as an IF ... THEN statement. In particular our example rule</p><pre>[?x, :located_in, ?z] :- <br>    [?x, :located_in, ?y], [?y, :located_in, ?z] .</pre><p>is a Datalog rule.</p><ul><li>The IF part of the rule is also called the <em>body</em> or <em>antecedent.</em></li><li>The THEN part of the rule is called the <em>head</em> or the <em>consequent</em>.</li><li>The head is written first, and is separated from the body by the symbol :-.</li></ul><p>Both the body and the head consist of a conjunction of conditions, where conjuncts are comma-separated and where each conjunct is a triple in which variables may occur.</p><p>In our example, the body is [?x, :located_in, ?y], [?y, :located_in, ?z] and the head is [?x, :located_in, ?z] .</p><p>Each Datalog rule conveys the idea that, from certain combinations of triples in the input RDF graph, we can logically deduce that some other triples must also be part of the graph.</p><p>In particular, variables in the rule range over all possible nodes in the RDF graph; whenever these variables are assigned values that make the rule body become a subset of the graph, then we see what the values of those variables are, propagate these values to the head of the rule, and deduce that the resulting triples must also be a part of the graph.</p><p>In our example, a particular rule application binds variable ?x to :oxford , variable ?y to :oxfordshire and variable ?z to :england, which then implies that that triple :oxford :located_in :england obtained by replacing ?x with :oxford and ?z with :england in the head of the rule holds as a logical consequence.</p><p>A different rule application would bind ?x to :oxfordshire, ?y to :england, and ?z to :uk; as a result, the triple :oxfordshire :located_in :uk can also be derived as a logical consequence.</p><p>An alternative way to understand the meaning of a single Datalog rule application to an RDF graph is to look at it as the execution of an INSERT statement in SPARQL, which adds a set of triples to the graph. In particular, the statement</p><pre>insert {?x :located_in ?z } where {<br>   ?x :located_in ?y. <br>   ?y :located_in ?z }</pre><p>corresponding to our example rule leads to the insertion of triples</p><pre>:oxford :located_in :england . <br>:oxfordshire :located_in :uk .</pre><p>There is, however, a fundamental difference that makes rules more powerful than simple INSERT statements in SPARQL, namely that rules are applied recursively.</p><p>Indeed, after we have derived that Oxford is located in England, we can apply the rule again by matching ?x to :oxford , ?y to :england , and ?z to :uk , to derive :oxford :located_in :uk --- a triple that is not obtained as a result of the INSERT statement above.</p><p>In this way, the logical consequences of a set of Datalog rules on a graph are captured by the iterative application of the rules until no new information can be added to the graph.</p><p>It is important to notice that the set of logical consequences obtained is completely independent from the order in which rule applications are performed as well as of the order in which different elements of rule bodies are given. In particular, the following two rules are completely equivalent:</p><pre>[?x, :located_in, ?z] :- <br>   [?x, :located_in, ?y], [?y, :located_in, ?z] .</pre><pre>[?x, :located_in, ?z] :- <br>   [?y, :located_in, ?z], [?x, :located_in, ?y] .</pre><h3>Knowledge Graphs in Practice</h3><p>Knowledge graphs offer a variety of applications which are not always appreciated or known.</p><p>Knowledge graphs built using RDFox are particularly efficient at finding complex rule-based patterns in data on the fly or verifying that they don’t occur.</p><p>Rule-based patterns offer an intuitive way to encode domain expertise. Patterns can for example model how components should be assembled into a functioning product or the requirements a user needs to satisfy in order to move through a process.</p><p>Most responsive applications need to evaluate these rules on the fly which is typically impractical to perform with legacy reasoning engines at scale and within the desired response times. You can read <a href="https://openreview.net/pdf?id=ByldIMlEDV">here</a> how RDFox helped Festo reduce the time to configure complex products from hours to seconds.</p><p>Knowledge graphs can also be used to turn chat bots into truly intelligent reasoning agents by providing a more flexible and coherent approach to storing knowledge. Rules can also help improve the interpretation of poorly formulated questions.</p><p>Another key use case for knowledge graphs is detecting cyclic relations in networks which represent undesirable behaviour such as fraud or insider trading. RDFox can seamlessly establish connections in networks by efficiently navigating transitive relationships. RDFox can automatically flag or prevent connections which shouldn’t exist regardless of the complexity of the network.</p><h3>Operationalising knowledge graphs with RDFox</h3><p>RDFox is a high-performance knowledge graph and semantic reasoning engine which can evaluate complex queries and rules at scale and on the fly.</p><p>RDFox overcomes the flexibility and performance limitations of classical databases and reasoning engines by being an in-memory RDF-triple store optimised for speed and parallel reasoning.</p><p>The novel design and concepts underpinning RDFox were developed and refined at the University of Oxford over the past decade and have been mathematically validated in peer-reviewed research.</p><p>RDFox guarantees the correctness of its rule materialisations and query results which can be delivered at scale and on the fly on both production grade servers and memory-constrained devices.</p><p>More information on RDFox can be found <a href="https://www.oxfordsemantic.tech/product">here</a>.</p><h3>Team and Resources</h3><p>The team behind <a href="https://www.oxfordsemantic.tech/team">Oxford Semantic Technologies</a> started working on RDFox in 2011 at the Computer Science Department of the University of Oxford with the conviction that flexible and high-performance reasoning was a possibility for data intensive applications without jeopardising the correctness of the results. RDFox is the first market-ready knowledge graph designed from the ground up with reasoning in mind. Oxford Semantic Technologies is a spin out of the University of Oxford and is backed by leading investors including Samsung Venture Investment Corporation (<a href="https://www.samsungventure.co.kr/english_main.do"><strong>SVIC</strong></a>), Oxford Sciences Innovation (<a href="https://www.oxfordsciencesinnovation.com/"><strong>OSI</strong></a>) and Oxford University’s investment arm (<a href="https://innovation.ox.ac.uk/"><strong>OUI</strong></a>). The author is proud to be a member of this team.</p><p>Cover photo by <a href="https://unsplash.com/@pawel_czerwinski?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Paweł Czerwiński</a> on <a href="https://unsplash.com/?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=59df2f1ad054" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/the-intuitions-behind-knowledge-graphs-and-reasoning-59df2f1ad054">The intuitions behind Knowledge Graphs and Reasoning</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>