# SdaiTerm, the Terminal Interface for J-SDAI

Lothar Klein, LKSoftWare GmbH, last updated 1999/04/29

## Purpose

SDAI defines an Application Programming Interface (API) on persistent data. But SDAI does not define a User Interface (UI). Therefore we create SdaiTerm which is a low level User Interface for J-SDAI.

The purpose of J-SDAI is:
- to analyse the state and version of a J-SDAI
- to check and modify the available Express-Schemas, SdaiRepositories, SdaiModels and Schema-Instances
- to play around with J-SDAI and learn in an interactive way how to operate on it without writing a Java program

SdaiTerm is not a Graphical User Interface. Instead it is a command line oriented User Interface. Because of this you can easily use it to maintain an J-SDAI installation on a remote computer via telnet.

You may also want to know how SdaiTerm is programmed. Have a look to SdaiTerm.java.

## General

There are not much words to say on SdaiTerm. All it does is a link between the SDAI operations and the standard IO channels.
For this we have commands consisting of 1 or 2 characters and parameters as needed. The first character specifies the kind of object on which to operate; e.g. 's' for SdaiSession, 'r' for SdaiRepository, 'm' for SdaiModel and so on. The second character specifies the operation; e.g. 'o' for open and 'c' for close. An overview of the commands is given with the single character command '?'. Detailed help about a particular object is available with '?' followed why the character for the object type.

SdaiTerm is included in the J-SDAI runtime environment. After installation of Java and J-SDAI you can start StaiTerm with:

> >java jsdai.util.SdaiTerm

## Course 1

We want to check whether or not JavaSdai is running at all and which repositories and Express-Schemas are available. While doing this we also check the correct installation of J-SDAI (file jsdai_s.jar or jsdai_m.jar or jsdai_m.jar).
Start SdaiTerm and enter the following command after the ":" prompt

- `:? List the available commands`
- `:?s List the available commands for SdaiSession`
- `:so open SdaiSession`
- `:si shows the implementation attributes`
- `:sl list the known repositories`
- `:cd assign the SchemaInstance variable to the data-dictionary of the session`
- `:cl list the available dictionary-models associated with the dictionary SchemaInstance`
- `:q quit the program`

You will see something like this

`D:\LKSOFT\EXAMPLES>java SdaiTerm`
`:?`
`Terminal Interface for J-SDAI(TM), Version 0.6, Copyright 1998-2003 LKSoftWare GmbH`
`-------------------------------------------------------------------------------`
`SdaiSession s: o(open) m(import-r) i(implementation) l(list)`
`c(close) r(create-r) f(find-r)`
`SdaiTransaction t: r(start read only) c(commit) e(end+commit) i(info)`
`w(start read write) a(abort) b(abort+commit)`
`SdaiRepository r: =(nr) o(open) d(delete) i(info) s(create-c)`
`: c(close) e(export) l(list) m(create-m)`
`SdaiModel m: d(delete) r(startReadOnly) e(endReadOnly) p(promote)`
`: n(rename) w(startReadWrite) f(endReadWrite) i(info)`
`: =(nr) c(create) g(get) l(list) q(query)`
`EntityExtent x: =(nr) i(info) l(list)`
`EntitDefinition e: =(nr)`
`EntityInstance i: =(nr) i(info) l(list)`
`Attribute u: =(nr) s(set) u(unset) c(create) i(info) l(list_aggr)`
`Aggregate a: =(nr) s(set) u(unset) c(create) l(list)`
`Member b: =(nr) s(set) u(unset) i(info) l(list)`
`schema_definition h: =(nr) i(info)`
`SchemaInstance c: =(nr) d(dictionary) i(info) l(list)`
`help ?: s, t, r, m, x, e, i, u, a, b, h, c`
`quit q:`
`-------------------------------------------------------------------------------`
`:?s`
`Terminal Interface for J-SDAI(TM), Version 0.6, Copyright 1998-2003 LKSoftWare GmbH`
`-------------------------------------------------------------------------------`
`Object Return value Method`
`-------------------------------------------------------------------------------`
`so : SdaiSession: SdaiSession openSession()`
`sc : SdaiSession: void closeSession()`
`si : SdaiSession: Implementation getSdai_implementation()`
`sl : SdaiSession: ASdaiRepository getKnown_servers()`
`sr : SdaiSession: SdaiRepository createRepository(s1,s2)`
`sm : SdaiSession: SdaiRepository importClearTextEncoding(s2,s1,s3)`
`sf : SdaiSession: SdaiRepository findRepository(s1)`
`-------------------------------------------------------------------------------`
`:so`
`:si`
`----------- Implementation -------------`
`name: J-SDAI MULTIPLE`
`level: lang=1.1 (Build 58, 990308)`
`sdai_version: { iso standard 10303 part(22) version(0) }`
`binding_version: Java-SDAI conformance level 3, ISO TC184/SC4/WG11/N0`
`60`
`implementation_class: 5`
`transaction_level: 3`
`expression_level: 1`
`recording_level: 1`
`scope_level: 1`
`domain_equivalence_level: 2`
`:sl`
`1+DICTIONARY_DATA : null`
`2:CONCEPTUAL PART EXAMPLE : SDAI.lang.A_string@849488b`
`3:53711_75757f91-2_na.224 : SDAI.lang.A_string@8a294884`
`:sc`
`:q`

## Course 2

Import a p21-file, see what it contains, select an instance,, change an attribute and export the reslt into a new p21 file.

- `:so // open SdaiSession`
- `:tw // start transaction read/write access`
- `:sm test.p21 // import the physical file "test.p21" into a new repository`
- `:ri // display some information of the repository`
- `:rl // show the contents of the repository`
- `:m=1 // select the first model`
- `:mi // display some information of the model`
- `:ml // list the entit_extents of the populated folders of the model`
- `:x=112 // select the 112th entit_extent`
- `:xi // disply the entity type of the selected entity extent`
- `:xl // list all application instances of this type`
- `:i=1101 // select instance #1101`
- `:ii // disply the selected instance`
- `:il // list the attributes of the selected instance`
- `:a=1 // select the first attribute of this instance`
- `:au @i0 // unset the attribute`
- `:as @i0 MyName // set a string for this attribute`
- `:ii // check the result`
- `:tc // commit the transaction to make the changes permanent in the repository`
- `:re xxx.p21 // export the repository into a new physical file "xxx.p21"`
- `:mf // end read-write access`
- `:te // end the transaction`
- `:q // quit SdaiTerm`

`d:\_STEP\util>java SdaiTerm`
`:so`
`:tw`
`:sm test.p21`
`:ri`
`--------------- Repository -------------`
`name: CONCEPTUAL PART EXAMPLE`
`description: THIS IS A SAMPLE AP203 STEP MODEL`
`time_stamp: 1994-07-10 T15:30:00`
`author: LORI BRINDLE`
`organization: PDES, Inc.`
`authorization: APPROVED BY LARRY MCKEE`
`preprocessor_version: NO VERSION`
`originating_system: HAND POPULATED`
`:rl`
`---models`
`1: model1`
`---schemas`
`2: schema1`
`:m=1`
`:mi`
`name: model1`
`underlying_schema: CONFIG_CONTROL_DESIGN`
`repository: CONCEPTUAL PART EXAMPLE`
`change_date: 1998-12-05 T12:30:07`
`mode: ---`
`:ml`
`...`
`105 folder: PRODUCT_DEFINITION_USAGE`
`106 folder: PRODUCT_DEFINITION_WITH_ASSOCIATED_DOCUMENTS`
`107 folder: PRODUCT_RELATED_PRODUCT_CATEGORY`
`108 folder: PROMISSORY_USAGE_OCCURRENCE`
`109 folder: PROPERTY_DEFINITION`
`110 folder: PROPERTY_DEFINITION_REPRESENTATION`
`111 folder: QUANTIFIED_ASSEMBLY_COMPONENT_USAGE`
`112 folder: REPRESENTATION`
`113 folder: REPRESENTATION_CONTEXT`
`114 folder: REPRESENTATION_ITEM`
`...`
`:x=112`
`:xi`
`name: REPRESENTATION`
`:xl`
`#1101=GEOMETRICALLY_BOUNDED_WIREFRAME_SHAPE_REPRESENTATION('gbwr1',(#1100,#1074),#1099);`
`#2101=GEOMETRICALLY_BOUNDED_WIREFRAME_SHAPE_REPRESENTATION('gbwr2',(#2100,#2051),#2099);`
`#3101=GEOMETRICALLY_BOUNDED_WIREFRAME_SHAPE_REPRESENTATION('gbwr3',(#3100,#3051),#3099);`
`#4101=GEOMETRICALLY_BOUNDED_WIREFRAME_SHAPE_REPRESENTATION('gbwr4',(#4100,#4051),#4099);`
`#5101=GEOMETRICALLY_BOUNDED_WIREFRAME_SHAPE_REPRESENTATION('gbwr5',(#5100,#5071),#5099);`
`#7101=GEOMETRICALLY_BOUNDED_WIREFRAME_SHAPE_REPRESENTATION('gbwr6',(#7006,#7012,#7018,#7024,#7030,#70`
`04,#7010,#7016,#7022,#7028,#7034),#7099);`
`#7401=SHAPE_REPRESENTATION('gbwr7',(#7037),#7099);`
`#7402=SHAPE_REPRESENTATION('gbwr8',(#7038),#7099);`
`#7403=SHAPE_REPRESENTATION('gbwr9',(#7039),#7099);`
`#7404=SHAPE_REPRESENTATION('gbwr10',(#7040),#7099);`
`#7405=SHAPE_REPRESENTATION('gbwr11',(#7041),#7099);`
`:i=1101`
`:ii`
`#1101=GEOMETRICALLY_BOUNDED_WIREFRAME_SHAPE_REPRESENTATION('gbwr1',(#1100,#1074),#1099);`
`:il`
`#1101=GEOMETRICALLY_BOUNDED_WIREFRAME_SHAPE_REPRESENTATION('gbwr1',(#1100,#1074),#1099);`
`REPRESENTATION`
`1 name= 'gbwr1'`
`2 items ( SET ) = ( #1100 #1074 )`
`3 context_of_items = #1099 GEOMETRIC_REPRESENTATION_CONTEXT$GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT$GLO`
`BAL_UNIT_ASSIGNED_CONTEXT`
`SHAPE_REPRESENTATION`
`GEOMETRICALLY_BOUNDED_WIREFRAME_SHAPE_REPRESENTATION`
`:a=1`
`:au @i0`
`SHAPE_REPRESENTATION`
`1 name UNSET`
`:as @i0 MyName`
`SHAPE_REPRESENTATION`
`1 name`
`:ii`
`#1101=GEOMETRICALLY_BOUNDED_WIREFRAME_SHAPE_REPRESENTATION('MyName',(#1100,#1074),#1099);`
`:tc`
`:re xxx.p21`
`:mf`
`:te`
`:q`

`d:\_STEP\util>`