Skip to content

TriplestarKB

TriplestarKB is a ROS 2 enabled knowledge base backed by Oxigraph, a high-performance SPARQL graph database. It provides a bridge between the ROS 2 message ecosystem and the RDF semantic web stack.

Why a knowledge base?

In robotics, knowledge is more than sensor readings — it's understanding rooms, objects, task hierarchies, and their relationships. A knowledge base stores this as a semantic graph (RDF triples) you can query with SPARQL, reason over, and integrate with your ROS 2 nodes.

Key features

  • SPARQL query engine — full SPARQL 1.2 support via Oxigraph, with SELECT, ASK, UPDATE, CONSTRUCT, and reasoning
  • Automatic ROS → RDF conversion — ROS messages (geometry_msgs/Point32, std_msgs/Float32, …) are seamlessly converted to typed RDF literals (WKT geometry, XSD types)
  • Insertion subscribers — subscribe to ROS topics and translate incoming messages into SPARQL INSERT queries via Jinja2 templates
  • Query-time subscribers — expose the latest value on a ROS topic as a SPARQL function (qt:batteryLevel()) callable directly from queries
  • TF integration - look up fresh frame positions directly from SPARQL (qt:tfPosition(?frame, "map"))
  • Custom SPARQL functions — register Python functions as fn: extension functions callable from SPARQL
  • Query services — expose SPARQL queries as typed ROS 2 services (SELECT → JSON, ASK → bool)
  • ROS 2 lifecycle — the KB node follows the lifecycle pattern (configure → activate → deactivate), with persistent storage to disk
  • Reasoning — OWL 2 RL reasoning via the reasonable library

Package overview

Package Role
triplestar_core The core KB node, SPARQL engine, ROS ↔ RDF conversions, subscriber management, query services, and custom functions
triplestar_bringup Shared launch file and template for custom bringup packages
triplestar_msgs ROS 2 message and service definitions for interacting with the KB

Next steps