Conreality Software Development Kit (SDK) for SQL

The Conreality SDK for SDK is currently under active development at: https://github.com/conreality/conreality.sql

Prerequisites

Examples

Registering a New Player

SELECT conreality.player_register()
  AS player_uuid;

Sending a Text Message

SELECT conreality.message_send("Hello, world!")
  AS message_id;

Sending an Audio Message

-- TODO

Recording a Game Event

SELECT conreality.event_send("met",
  (SELECT o1.uuid
     FROM conreality.object o1
     WHERE o1.label = 'Bob'),
  (SELECT o2.uuid
     FROM conreality.object o2
     WHERE o2.label = 'Alice'))
  AS event_id;

Retrieving a Camera Thumbnail

SELECT cf.data AS camera_thumbnail
  FROM conreality.camera_frame cf
  WHERE cf.uuid = ...;

Finding Players Near a GPS Point

-- TODO

Finding Assets Currently Immobile

SELECT a.uuid FROM conreality.asset a
  WHERE NOT conreality.object_is_moving(a.uuid::text);

Measuring the Distance Between Objects

SELECT conreality.distance_between(
  (SELECT o1.position
     FROM conreality.object o1
     WHERE o1.label = 'Alice'),
  (SELECT o2.position
     FROM conreality.object o2
     WHERE o2.label = 'Bob'))
  AS distance;

Plotting Current Target Positions

-- TODO

Tutorials

Installation

https://github.com/conreality/conreality.sql/blob/master/src/schema.sh

$ src/schema.sh | psql > /dev/null

Frequently Asked Questions (FAQ)

How can I help contribute to the development of the SQL SDK?

See https://github.com/conreality/conreality.sql

Does the SQL SDK also support other DBMSes than PostgreSQL?

No, the Conreality SDK for SQL targets exclusively PostgreSQL.

Reference

schema conreality
SET search_path TO "$user", conreality, public, topology;

Data Type Reference

type conreality.binary_type
type conreality.object_type

Table Schema

TODO: diagram

Table Reference

table conreality.asset
table conreality.binary
table conreality.camera
table conreality.camera_frame
table conreality.event
table conreality.group
table conreality.message
table conreality.object
table conreality.player
table conreality.target
table conreality.theater

View Reference

view conreality.message_with_avatar
view conreality.object_asset
view conreality.object_camera
view conreality.object_player
view conreality.object_target

Function Reference

function conreality.distance_between(p1 geometry, p2 geometry) → float
function conreality.distance_between(p1 geography, p2 geography) → float
function conreality.event_send(event_predicate text, event_subject text, event_object text) → bigint
function conreality.message_send(message_text text) → bigint
function conreality.message_send(message_sender text, message_text text) → bigint
function conreality.object_invert_mass(object_uuid text) → float

Computes the inverse mass of this object.

function conreality.object_is_accelerating(object_uuid text) → boolean

Determines whether this object has a nonzero linear acceleration.

function conreality.object_is_active(object_uuid text) → boolean

Determines whether this object is currently active.

function conreality.object_is_immovable(object_uuid text) → boolean

Determines whether this is an immovable physical object.

function conreality.object_is_inactive(object_uuid text) → boolean

Determines whether this object is currently inactive.

function conreality.object_is_located(object_uuid text) → boolean

Determines whether this object has a nonzero position.

function conreality.object_is_moving(object_uuid text) → boolean

Determines whether this object has a nonzero linear velocity.

function conreality.object_is_rotating(object_uuid text) → boolean

Determines whether this object has a nonzero angular velocity.

function conreality.player_deregister(player_uuid uuid) → void
function conreality.player_register() → uuid
function conreality.player_register(player_uuid uuid, player_nick text) → uuid
function conreality.point_2d(x float, y float) → geometry
function conreality.point_3d(x float, y float, z float) → geometry
function conreality.point_gps(lon float, lat float) → geography
function conreality.session_start() → void
function conreality.session_terminate() → void