company logo

OSI Query

Get queries will return all data for an instance. Instance attributes are shown using attribute names (using database terminology).

A GET query does not define field mappings, i.e. all attributes will be displayed by name. References and reference collection instances are provided as LOID-links. Each query creates a separate test mapping.


Children

The mapping for an OSI GET query would look like:


Class/type

Query/variable

Source

Comment

Person/OSI

Children

Persons(?id)

?id is a parameter passed with the HTTP request

    name

name

    firstname

first_name

All first names

    income

Source name is the same as target

    children

children()

collection

        name

name

Child name

firstname1

first_name(0)

First first name

        Income    

income

Childs income

The first line in the generated test script shows the URL for calling the query with GET method. Below, starting with the /osi line, the generated POST request follows as executed by the OHTTP server, because OSI has been defined as request type (method) for the query (mapping).

Test: http://localhost:2000/query/OSI/Person/Income?id="P124"

POST

user

pwd

/osi

Persons(?id) ==> {

  name : name,

  firstname1 : first_name(0),

  income : income,

  children_income : children_inc,

    children : children() ==> {

    name : name,

    firstname : first_name,

    income : income } }

Result

The result returned from this request looks as:

{ Persons: { name: "Miller", firstname: [ "Rznmgxpiwb", "", "" ],

  income: 0.00, children_income: 12643.00,

  children: [

  {name: "Ycngp", firstname1: "Dcwktgfuxj", income: 8261.00},

  {name: "Czjso", firstname1: "Ygkordeqhx", income: 4382.00} ]

} }

EmployeesCount

Instead of property paths, access paths may contain also function calls to system or application functions.


Class/type

Query/variable

Source

Comment

Company/OSI

EmployeesCount

Company(?id)

Calling a system function

count

employees.count

Number of employees

Here, instead of a company identifier (LOID), a collection position (2) has been passed in id.

Test: http://localhost:2000/query/OSI/Company/Employees?id=2

POST

user

pwd

/osi

Company(?id) ==> {

count : employees.count }

Result

The query returns the number of employees in the company passed in ?id. Because the query is hierarchical (2 levels), the result returnes also contains a hierarchical structure.

{ Company: { count: 104 } }