{"id":27767,"date":"2025-08-12T09:28:55","date_gmt":"2025-08-12T16:28:55","guid":{"rendered":"https:\/\/tdengine.com\/?p=27767"},"modified":"2025-08-12T18:27:00","modified_gmt":"2025-08-13T01:27:00","slug":"tdengine-introduces-integration-with-ontop","status":"publish","type":"post","link":"https:\/\/tdengine.com\/tdengine-introduces-integration-with-ontop\/","title":{"rendered":"TDengine Introduces Integration with Ontop"},"content":{"rendered":"\n<p>TDengine is excited to announce support for connecting TDengine TSDB with <a href=\"https:\/\/ontop-vkg.org\/\" rel=\"noopener\">Ontop<\/a> as well as a partnership with <a href=\"https:\/\/ontopic.ai\/en\/\" rel=\"noopener\">Ontopic<\/a>. Ontop is an open-source virtual knowledge graph system that dynamically transforms database content into knowledge graphs without requiring data migration from the original source.<\/p>\n\n\n\n<p>This integration combines the strong logical reasoning of knowledge graphs with the generalization capabilities of large language models, providing intelligent analysis solutions with cognitive capabilities for complex IoT scenarios such as device failure root cause analysis and energy efficiency optimization.<\/p>\n\n\n\n<figure class=\"gb-element-2394402b\">\n<img decoding=\"async\" width=\"1920\" height=\"418\" class=\"gb-media-447aedad\" alt=\"\" src=\"https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/ontop-soc.png?strip=all&sharp=1\" title=\"ontop-soc\" srcset=\"https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/ontop-soc.png?strip=all&amp;sharp=1 1920w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/ontop-soc-300x65.png?strip=all&amp;sharp=1 300w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/ontop-soc-1024x223.png?strip=all&amp;sharp=1 1024w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/ontop-soc-768x167.png?strip=all&amp;sharp=1 768w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/ontop-soc-1536x334.png?strip=all&amp;sharp=1 1536w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/ontop-soc.png?strip=all&amp;sharp=1&amp;w=384 384w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/ontop-soc.png?strip=all&amp;sharp=1&amp;w=1152 1152w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/ontop-soc.png?strip=all&amp;sharp=1&amp;w=450 450w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/>\n<\/figure>\n\n\n\n<p>The integration of TDengine TSDB and Ontop achieves the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Automatic conversion of time-series data to RDF, supporting SPARQL semantic queries.<\/li>\n\n\n\n<li>Unified data access interface compliant with W3C standards.<\/li>\n\n\n\n<li>Unlocking knowledge graph analysis and reasoning capabilities for industrial IoT.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"gb-text\">Prerequisites<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Install TDengine TSDB 3.3.6.0 or later. TDengine TSDB-OSS and TSDB-Enterprise are both supported. For installation instructions, visit our <a href=\"https:\/\/tdengine.com\/downloads\/?product=TDengine+TSDB-Enterprise\">Download Center<\/a>.<\/li>\n\n\n\n<li>Ensure that TDengine TSDB and taosAdapter are running.<\/li>\n\n\n\n<li>Download the <a href=\"https:\/\/central.sonatype.com\/artifact\/com.taosdata.jdbc\/taos-jdbcdriver\" rel=\"noopener\">TDengine JDBC Client Library<\/a> 3.6.0 or later. Select the file ending in <code class=\"\" data-line=\"\">dist.jar<\/code>.<\/li>\n\n\n\n<li>Download and build the <code class=\"\" data-line=\"\">version5<\/code> branch of the <a href=\"https:\/\/github.com\/ontop\/ontop\" rel=\"noopener\">Ontop source code<\/a> according to the readme file.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"configure-data-source\">Configure Data Source<\/h2>\n\n\n\n<ol>\n<li>\n<p>Copy the TDengine JDBC client library in the <code class=\"\" data-line=\"\">jdbc\/<\/code> directory within Ontop.<\/p>\n<\/li>\n\n\n\n<li>\n<p>In the Ontop <code class=\"\" data-line=\"\">.properties<\/code> file, configure the JDBC connection:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-java\" data-line=\"\">jdbc.url = jdbc:TAOS-WS:\/\/&lt;taosadapter-host&gt;:&lt;port&gt;\/&lt;database&gt;\njdbc.user = &lt;tdengine-username&gt;\njdbc.password = &lt;tdengine-password&gt;\njdbc.driver = com.taosdata.jdbc.ws.WebSocketDriver<\/code><\/pre>\n\n\n\n<p>For URL parameter details, see <a href=\"https:\/\/docs.tdengine.com\/tdengine-reference\/client-libraries\/java\/#url-specification\">TDengine URL Specification<\/a>.<\/p>\n<\/li>\n\n\n\n<li>\n<p>Define the mapping relationship between TDengine TSDB and Ontop in the <code class=\"\" data-line=\"\">.obda<\/code> file. A smart meter scenario is given as an example.<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-java\" data-line=\"\">[PrefixDeclaration]\n:   http:\/\/example.org\/tde\nns: http:\/\/example.org\/ns#\n\n[MappingDeclaration] @collection [[\n  mappingId meters-mapping\n  target ns:{ts} a ns:Meters ; ns:ts {ts} ; ns:voltage {voltage}; ns:phase {phase}; ns:groupid {groupid}; ns:location {location}^^xsd:string .\n  source SELECT ts, voltage, phase, groupid, location  from test.meters\n]]<\/code><\/pre>\n\n\n\n<p>Format Description:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Key Field<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>mappingId<\/td><td>Mapping ID, uniquely identifies the mapping relationship<\/td><\/tr><tr><td>source<\/td><td>TDengine TSDB SQL query statement (supports complex queries)<\/td><\/tr><tr><td>target<\/td><td>Field mapping relationship (uses default conversion rules when type not specified)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>You can specify mapping data types in the target. If not specified, the following conversion rules apply:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>TDengine JDBC Data Type<\/th><th>Ontop Data Type<\/th><\/tr><\/thead><tbody><tr><td>java.sql.Timestamp<\/td><td>xsd:datetime<\/td><\/tr><tr><td>java.lang.Boolean<\/td><td>xsd:boolean<\/td><\/tr><tr><td>java.lang.Byte<\/td><td>xsd:byte<\/td><\/tr><tr><td>java.lang.Short<\/td><td>xsd:short<\/td><\/tr><tr><td>java.lang.Integer<\/td><td>xsd:int<\/td><\/tr><tr><td>java.lang.Long<\/td><td>xsd:long<\/td><\/tr><tr><td>java.math.BigInteger<\/td><td>xsd:nonNegativeInteger<\/td><\/tr><tr><td>java.lang.Float<\/td><td>xsd:float<\/td><\/tr><tr><td>java.lang.Double<\/td><td>xsd:double<\/td><\/tr><tr><td>byte[]<\/td><td>xsd:base64Binary<\/td><\/tr><tr><td>java.lang.String<\/td><td>xsd:string<\/td><\/tr><tr><td>java.math.BigDecimal<\/td><td>xsd:decimal<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>For complete <code class=\"\" data-line=\"\">.obda<\/code> file format documentation, refer to <a href=\"https:\/\/ontop-vkg.org\/guide\/advanced\/mapping-language.html\" target=\"_blank\" rel=\"noreferrer noopener\">Ontop OBDA Documentation<\/a>.<\/p>\n<\/li>\n\n\n\n<li>\n<p>Start the Ontop endpoint service to verify configuration:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-bash\" data-line=\"\">ontop endpoint -p db.properties -m db.obda --port 8080<\/code><\/pre>\n<\/li>\n<\/ol>\n\n\n\n<p>In a web browser, access <code class=\"\" data-line=\"\">http:\/\/localhost:8080<\/code>. If the SPARQL query interface appears, the configuration is successful.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"data-analysis\">Sample Scenario<\/h2>\n\n\n\n<p>In this scenario, smart meter data from a residential community is stored in TDengine TSDB. Ontop is used to transform this data into a virtual knowledge graph and identify overloaded equipment with voltage exceeding 240V.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"data-preparation\">Data Preparation<\/h3>\n\n\n\n<ol>\n<li>\n<p>Generate simulated data using taosBenchmark:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-bash\" data-line=\"\">taosBenchmark -t 100 -n 1000 -y<\/code><\/pre>\n<\/li>\n\n\n\n<li>\n<p>Edit the Ontop .properties file and configure the connection:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-bash\" data-line=\"\">jdbc.url=jdbc:TAOS-WS:\/\/localhost:6041\/test\njdbc.user=root\njdbc.password=taosdata\njdbc.driver=com.taosdata.jdbc.ws.WebSocketDriver   <\/code><\/pre>\n<\/li>\n\n\n\n<li>\n<p>Edit the Ontop .odba file and configure the table mapping:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-java\" data-line=\"\">[PrefixDeclaration]\n:   http:\/\/example.org\/tde\nns: http:\/\/example.org\/ns#\n\n[MappingDeclaration] @collection [[\n  mappingId meters-mapping\n  target ns:{ts} a ns:Meters ; ns:ts {ts} ; ns:voltage {voltage}; ns:phase {phase}; ns:groupid {groupid}; ns:location {location}^^xsd:string .\n  source SELECT ts, voltage, phase, groupid, location  from test.meters\n]]<\/code><\/pre>\n<\/li>\n\n\n\n<li>\n<p>Create a SPARQL query statement to query smart meter devices with voltage exceeding 240V and display the top two results by voltage in descending order:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-sparql\" data-line=\"\"> PREFIX ns: &lt;http:\/\/example.org\/ns#&gt;\n\n SELECT ?ts ?voltage ?phase ?groupid ?location\n WHERE {\n     ?m a ns:Meters ;\n             ns:ts ?ts;\n             ns:voltage ?voltage;\n             ns:phase ?phase;         \n             ns:groupid ?groupid;\n             ns:location ?location.\n     FILTER(?voltage &gt; 240)\n }\n ORDER BY DESC(?voltage)\n LIMIT 2<\/code><\/pre>\n<\/li>\n\n\n\n<li>\n<p>In a web browser, open the Ontop SPARQL endpoint and run the SPARQL statement.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/docs.tdengine.com\/assets\/images\/ontop-query-6df65c3d7a76074d8fcc7a721998c158.webp\" alt=\"ontop-query\"\/><\/figure>\n<\/li>\n<\/ol>\n\n\n\n<p>Results are returned in SPARQL JSON format, containing meter collection timestamps, voltage readings, phase, group ID, and device location information.<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-json\" data-line=\"\">{\n &quot;head&quot; : {\n     &quot;vars&quot; : [\n     &quot;ts&quot;,\n     &quot;voltage&quot;,\n     &quot;phase&quot;,\n     &quot;groupid&quot;,\n     &quot;location&quot;\n     ]\n},\n &quot;results&quot; : {\n     &quot;bindings&quot; : [\n     {\n         &quot;ts&quot; : {\n         &quot;datatype&quot; : &quot;http:\/\/www.w3.org\/2001\/XMLSchema#dateTime&quot;,\n         &quot;type&quot; : &quot;literal&quot;,\n         &quot;value&quot; : &quot;2025-07-02T15:22:55.098&quot;\n         },\n         &quot;voltage&quot; : {\n         &quot;datatype&quot; : &quot;http:\/\/www.w3.org\/2001\/XMLSchema#integer&quot;,\n         &quot;type&quot; : &quot;literal&quot;,\n         &quot;value&quot; : &quot;263&quot;\n         },\n         &quot;phase&quot; : {\n         &quot;datatype&quot; : &quot;http:\/\/www.w3.org\/2001\/XMLSchema#double&quot;,\n         &quot;type&quot; : &quot;literal&quot;,\n         &quot;value&quot; : &quot;143.2&quot;\n         },\n         &quot;groupid&quot; : {\n         &quot;datatype&quot; : &quot;http:\/\/www.w3.org\/2001\/XMLSchema#integer&quot;,\n         &quot;type&quot; : &quot;literal&quot;,\n         &quot;value&quot; : &quot;2&quot;\n         },\n         &quot;location&quot; : {\n         &quot;type&quot; : &quot;literal&quot;,\n         &quot;value&quot; : &quot;California.PaloAlto&quot;\n         }\n     },\n     {\n         &quot;ts&quot; : {\n         &quot;datatype&quot; : &quot;http:\/\/www.w3.org\/2001\/XMLSchema#dateTime&quot;,\n         &quot;type&quot; : &quot;literal&quot;,\n         &quot;value&quot; : &quot;2025-07-02T15:23:30.186&quot;\n         },\n         &quot;voltage&quot; : {\n         &quot;datatype&quot; : &quot;http:\/\/www.w3.org\/2001\/XMLSchema#integer&quot;,\n         &quot;type&quot; : &quot;literal&quot;,\n         &quot;value&quot; : &quot;259&quot;\n         },\n         &quot;phase&quot; : {\n         &quot;datatype&quot; : &quot;http:\/\/www.w3.org\/2001\/XMLSchema#double&quot;,\n         &quot;type&quot; : &quot;literal&quot;,\n         &quot;value&quot; : &quot;132.1&quot;\n         },\n         &quot;groupid&quot; : {\n         &quot;datatype&quot; : &quot;http:\/\/www.w3.org\/2001\/XMLSchema#integer&quot;,\n         &quot;type&quot; : &quot;literal&quot;,\n         &quot;value&quot; : &quot;2&quot;\n         },\n         &quot;location&quot; : {\n         &quot;type&quot; : &quot;literal&quot;,\n         &quot;value&quot; : &quot;California.PaloAlto&quot;\n         }\n     }\n     ]\n   }\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>TDengine is excited to announce support for connecting TDengine TSDB with Ontop as well as a partnership with Ontopic.<\/p>\n","protected":false},"author":127,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"content-type":"","footnotes":""},"categories":[21],"tags":[],"ppma_author":[261],"class_list":["post-27767","post","type-post","status-publish","format-standard","hentry","category-engineering"],"authors":[{"term_id":261,"user_id":127,"is_guest":0,"slug":"jfan","display_name":"Jim Fan","avatar_url":"https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/jfan-profile-new.jpg?strip=all&#038;sharp=1&#038;resize=96%2C96","1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":""}],"_links":{"self":[{"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/posts\/27767","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/users\/127"}],"replies":[{"embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/comments?post=27767"}],"version-history":[{"count":4,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/posts\/27767\/revisions"}],"predecessor-version":[{"id":27795,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/posts\/27767\/revisions\/27795"}],"wp:attachment":[{"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/media?parent=27767"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/categories?post=27767"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/tags?post=27767"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/ppma_author?post=27767"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}