Getting Started With ROS
This tutorial covers the basics of running a kDB Store as a ROS Node. The full documentation of the ROS Node is available here. The following command can be used to start a ROS node with a kDB Store:
Start server
# The following will create a PostgreSQL database in '$HOME/.ros_kdb/stores/default' using
# the default port 10141:
ros2 run ros_kdb kdb_server
When running multiple instance on the same computer, it is required to use namespaces and specify the port for the database:
# The following will create a PostgreSQL database in '$HOME/.ros_kdb/stores/default' using
# the default port 10142:
ros2 run ros_kdb kdb_server --ros-args -r __ns:=/ -p db_port:=10142
Query database
Then it is possible to query the database using the following service calls:
# The following executes an SQL query, listing the content of the triples_stores table.
ros2 service call /kdb_server/sql_query ros_kdb_interfaces/srv/QueryDatabase 'queries: [ { query: "SELECT * FROM triples_stores" } ]'
# The following creates an SPARQL query, listing the content of an RDF Graph.
ros2 service call /kdb_server/sparql_query ros_kdb_interfaces/srv/QueryDatabase 'queries: [ { graphnames: ["http://askco.re/graphs#info"], query: "SELECT * WHERE { ?x ?y ?z. }" } ]'
Loading RDF Data
The following commands can be used to load RDF data in a triple store.
In this example it will load the data in the http://askco.re/examples#map
triple store.
# Replace the ... with the ttl data:
ros2 service call /kdb_server/insert_triples ros_kdb_interfaces/srv/InsertTriples "
graphname: 'http://askco.re/examples#map'
format: 'ttl'
content: '...'"
# If the deta is in the file `data.ttl` it can be loaded with:
ros2 service call /kdb_server/insert_triples ros_kdb_interfaces/srv/InsertTriples "
graphname: 'http://askco.re/examples#map'
format: 'ttl'
content: '`cat data.ttl`'"
For more information on triple store, check the triple stores tutorial.
Next
The following tutorials expand on various aspect of the kDB ROS Node:
- Querying with ROS tutorial covers more information about how to query the database using ROS.
- RDF Graph Synchronisation covers how to synchronise RDF Graphs between agents.
- Record Sensor Data covers how to record sensor data, such as images and Lidar using the kDB Server.
- The Dataset Transfer tutorial presents how to exchange large dataset of sensory data between two platforms.