Provides sample persistent classes for use with InterSystems IRIS, as well as code to generate tables/data for those classes.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
buildsample
cls/Sample
gbl
LICENSE
README.md

README.md

Samples-Data

This is the README file for SAMPLES-DATA. The end of the file has setup instructions.


Use or operation of this code is subject to acceptance of the license available in the code repository for this code.


SAMPLES-DATA is meant for use with the InterSystems IRIS. There are three purposes for these classes:

  • To provide sample data that you can query via InterSystems IRIS SQL, for any basic proof-of-concept testing. You can query this data via the SQL shell, via the Management Portal, via JDBC or ODBC, or via server-side code.

  • To give you a way to explore some of the basic concepts of InterSystems IRIS object classes. Features include serial objects, relationships, indexes, calculated properties, and a class query.

    Because InterSystems IRIS persistent classes let you access data either via SQL or via the object methods, this simple set of classes lets you become familiar with creating, retrieving, updating, and deleting data, via either mechanism. You can also use the classes to become familiar with the SQL projections of persistent classes.

  • To provide a simple demonstration of the built-in data population utility (%Library.Populate), which you can use to generate data for other proof-of-concept scenarios.

The InterSystems ObjectScript documentation and the InterSystems SQL documentation use these tables and classes extensively.

Contents of the Sample package

  • Sample.Person represents a person. This class is projected to SQL as the table Sample.Person. Of note:
    • The properties Home and Office are references to the serial object class Sample.Address.
    • Age is a calculated property.
    • ByName is a class query.
  • Sample.Address is a serial object class, representing a street address. Sample.Person uses this class as the type of the Home and Office properties.
  • Sample.Employee is a subclass of Sample.Person. This class is projected to SQL as the table Sample.Employee. The records for Sample.Employee are also included in the table Sample.Person.
  • Sample.Company represents a company. This class is projected to SQL as the table Sample.Company. Each company has a relationship properties that connects to the Sample.Employee class.
  • Sample.Customer is another sample serial object class.
  • Sample.Vendor demonstrates how to use the %Library.CacheSQLStorage storage class to provide custom storage for a persistent class.

Setup instructions

  1. Clone or download the repository.
  2. If you have not yet created a namespace in InterSystems IRIS, follow the detailed instructions to do so.
  3. Open the InterSystems IRIS Terminal.
  4. Enter the following command (replacing mynamespace with the namespace where you want to load the sample):
   ZN "mynamespace"
  1. Enter the following commands (replacing with the full path of the buildsample/Build.DataSample.cls file):
   do $system.OBJ.Load("full-path-to-Build.DataSample.cls","ck")

   do ##class(Build.DataSample).Build()
   ```

6. When prompted, enter the full path of the directory to which you downloaded this sample. The method then loads and compiles the code and performs other needed setup steps.