Skip to main content

Object Service

The object service allows you to manage, browse, search for and use stored objects

Creating Objects

All objects have a type - this is a structure that defines the properties that you would expect on an object. Individual objects can also have dynamic properties that are not included in the type structure. If you create an object without specifying a type, ODSL will add a #Object type to it.

Creating a basic object

You can create a simple object using the basic Object constructor, e.g.

myobject = Object()

This creates a dynamic object of type #Object which has the following standard properties:

  • name
  • description
  • classification
  • geolocation

Creating a typed object

You can create an object from a type in 2 different ways:

Using a constructor

london = Object("#Location")

Using an object structure

london = object as #Location
name = "London"

The only difference between the 2 methods is that with the object structure you can directly set some properties.

Saving Objects

To save an object, you use the save command as shown in the code snippet below:

myobject = Object() = "My Test"

save ${object:myobject}

This will save a private object called myobject of type #Object to the database.

Reading Objects

You can find objects using the find command and searching for objects is covered in this article. If you know the id of the object you want, you can directly read the object using the active variable, e.g.

myobject = ${object:"myobject"}

Deleting Objects

To delete an object from the database, you use the delete command.

delete ${object:"myobject"}

If versioning is enabled on the object type you are deleting, then the delete command performs a roll back. To completely delete a versioned object, add a * version modifier to the delete command, e.g.

delete ${object:"myobject":*}