Discussion:
[Wsf-general] Data service handling of references
James Clark
2007-02-27 07:31:02 UTC
Permalink
I've been using a database with the following structure as an example to
think about the data service.

A customers table with the following columns:

- id (primary-key, numeric, auto-generated)
- name
- date of birth
- phone number
- country

A products table with the following columns:

- code (primary-key, alphanumeric, human-specified)
- description

An orders table with the following columns:

- id (primary-key, numeric, auto-generated)
- customer_id (references customers.id)
- status (enumeration)

An order_items table with the following columns:

- order_id (references orders.id)
- product_code (references products.code)
- quantity

Imagine I want an operation that gives me information about a particular
order based on its id. I would like to get back XML something like this.

<order>
<id>12345</id>
<customerId>678</customerId>
<items>
<item>
<productCode>AA-123</productCode>
<quantity>1</quantity>
</item>
<item>
<productCode>BB-456</productCode>
<quantity>1000</quantity>
</item>
</items>
</order>

In other words, I need to turn the references from the
order_items.order_id column to the orders.id column that are present in
the database into hierarchical relationships in the XML.

Most non-toy databases will have this sort of thing. Microsoft have
done a lot of stuff in this area. See, e.g.

http://msdn.microsoft.com/SQLXML

I think we've got to be able to handle this sort of thing.

James
Chamil Thanthrimudalige
2007-03-03 16:21:38 UTC
Permalink
Post by James Clark
I've been using a database with the following structure as an
example to
think about the data service.
- id (primary-key, numeric, auto-generated)
- name
- date of birth
- phone number
- country
- code (primary-key, alphanumeric, human-specified)
- description
- id (primary-key, numeric, auto-generated)
- customer_id (references customers.id)
- status (enumeration)
- order_id (references orders.id)
- product_code (references products.code)
- quantity
Imagine I want an operation that gives me information about a
particular
order based on its id. I would like to get back XML something like this.
<order>
<id>12345</id>
<customerId>678</customerId>
<items>
<item>
<productCode>AA-123</productCode>
<quantity>1</quantity>
</item>
<item>
<productCode>BB-456</productCode>
<quantity>1000</quantity>
</item>
</items>
</order>
In other words, I need to turn the references from the
order_items.order_id column to the orders.id column that are
present in
the database into hierarchical relationships in the XML.
Most non-toy databases will have this sort of thing. Microsoft have
done a lot of stuff in this area. See, e.g.
http://msdn.microsoft.com/SQLXML
I think we've got to be able to handle this sort of thing.
If we are to do some thing like this we will have to do some
integration deep into the database and this I think will need the
WSAS user to be a user who can query system tables about db structure.

Also we will have to extend the query writing language to accommodate
this.

Best Regards,
Chamil Thanthrimudalige
Post by James Clark
James
_______________________________________________
Wsf-general mailing list
http://wso2.org/cgi-bin/mailman/listinfo/wsf-general
Loading...