196 Appendix D. PDL Syntax
object type screenName {
BigDecimal id = screen_names.name_id INTEGER;
String screenName = screen_names.screen_name VARCHAR(700);
Blob screenIcon = screen_names.screen_icon BLOB;
object key (id);
}
object type Author {
BigInteger[1..1] id = authors.author_id INTEGER;
String[1..1] firstName = author.first_name VARCHAR(700);
String[1..1] lastName = author.last_name VARCHAR(700);
Blob[0..1] portrait = authors.portrait BLOB;
// notice the use of a join path to allow the events for the
// Role Reference to be automatically created.
ScreenName[0..1] screenName =
join authors.screen_name_id to screen_names.name_id;
object key (id);
}
query paragraphMagazines {
BigDecimal magazineID;
BigDecimal paragraphID;
Integer issueNumber;
String text;
do {
select m.magazine_id, p.paragraph_id, issue_number, text
from magazines m, a, magazine_article_map ma, paragraphs p
where ma.magazine_id = m.magazine_id
and p.article_id = ma.article_id
} map {
magazineID = m.magazine_id;
paragraphID = p.paragraph_id;
issueNumber = m.issue_number;
text = p.text;
}
}
query MagazineToAuthorMapping {
// the next two lines are declaring that objects will be returned
Magazine magazine;
Author author;
options {
WRAP_QUERIES = false;
}
do {
select publications.name, issue_number, publication_id,
authors.first_name, authors.last_name, author_id
from magazines, publications, articles, authors,
magazine_article_map, article_author_map
where publications.publication_id =
magazines.magazine_id
and magazine_article_map.magazine_id =
magazines.magazine_id