Re: Using the catalogue

From: David Portas <REMOVE_BEFORE_REPLYING_dportas_at_acm.org>
Date: 16 Nov 2005 06:33:34 -0800
Message-ID: <1132151614.921439.320960_at_g14g2000cwa.googlegroups.com>


amado.alves_at_netcabo.pt wrote:

> Suppose a RDBMS has a catalogue with schema
>
> Relations (Name) with key (Name)
> Fields (RelationName,FieldName,FieldType) with key
> (RelationName,FieldName)
>
> The catalogue is reflexive i.e.
>
> relation Relations contains { (Relations), (Fields) }
>
> relation Fields contains
> { (Relations, Name, Symbol),
> (Fields, RelationName, Symbol),
> (Fields, FieldName, Symbol),
> (Fields, FieldType, Symbol) }
>
> Suppose a database instance, and a query like
>
> all triplets (field name, value, relation), from any relation, such
> that field name is in {Name, Designation}, field type is String, and
> field value = "King"
>
> Please confirm that this query is impossible to express in SQL, and
> suggest other relational languages where it is possible. Tutorial D,
> Alaphor, the original relational calculus or algebra?
>
> Note that what is at stake is the capability of the language to
> transfer from field values to relation and field names. RDF has the
> corresponding capability in its data model. XQuery?
>
> Thanks a lot,
> Marius A. Alves
> PhD student, University of Porto

It seems that two relational operators would be sufficient. One to return the catalogue and one to "evaluate" a union based on some restriction of a catalogue relvar. A D language assumes an open ended set of user-defined operators and types so I don't see why this should be forbidden in Tutorial D for example.

SQL has the catalogue but the "evaluation" part isn't in standard SQL AFAIK. However, all SQL products that I'm familiar with implement some form of dynamic SQL as an extension - that should be up to the task.

-- 
David Portas 
SQL Server MVP 
--
Received on Wed Nov 16 2005 - 15:33:34 CET

Original text of this message