[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [DotGNU]RDF Query Language

From: Peter Minten
Subject: Re: [DotGNU]RDF Query Language
Date: Wed, 26 Mar 2003 16:47:53 +0100

Peter Minten wrote:

> Now to some syntax. The first difference from SQL is ALIAS, which is a
> pre-processor directive that works just like in C, it allows using simple 
> names
> instead of uri's, note that ALIAS does not bluntly replace every occurence of 
> a
> string, it only replaces if the string completely matches. Before sending the
> RQL to the server the client pre-processes.
> The basic SELECT operation goes like this:
> SELECT propertynames
> FROM resourceclassnames

Correction: idividual resources can also be named. To signal that a name is
meant as a class the word CLASS should be put in front of it.

> WHERE condition
> GROUP BY propertynames
> HAVING condition
> An example:
> ALIAS dc;
> ALIAS rdf;
> SELECT dc:creator
> FROM rdf:Description

According to the new rules this should be:
FROM CLASS rdf:Description

> WHERE dc:language = "english";
> This query returns all the resources from class rdf:Description
> ( that have as language
> English and it returns the creator of those descriptions.

The conditions are basically the same as in SQL.

It's possible to get a property of the object of a triple without using
subqueries. This is done using the dot operator (.), the dot operator simply
interprets the value of left hand argument as a resource and it's right hand
argument as a property.

It's possible in RQL to use a SELECT query wherever you would type a non-keyword
string, thus you can put subqueries in the FROM clause. It's possible to assign
the value of a SELECT query to a variable using the pascal style assignment
(:=). Variables have unlimited scope in RQL.

It's possible to use a variable wherever you would type a non-keyword string.
RQL first checks for every string if there is a variable with the right name and
if not interprets the string directly (like a bareword literal in Perl).

It's possible to insert triples into the web by using the INSERT operation. A
small example:

ALIAS contact

INSERT as contact:person 
PROPERTIES (contact:fullName, contact:mailbox)
PROPERTYTYPES (*, xsd:string)
VALUES ("Peter Minten", "mailto:address@hidden";);

The PROPERTYTYPES clause can usually be left, it's only needed for non-standard
types. When it is needed an asterisk can be used to signal that the type of a
property is to be determined by the RQL interpreter (standard).

It's possible to delete triples from the web by using the REMOVE operation. A
small example:

PROPERTIES (contact:mailbox);

Without properties every triple that has the given resource as it's subject is
removed. It's also possible to remove properties from every resource of a class
simply by writing REMOVE FROM CLASS instead of REMOVE.
An optional WHERE clause can be used to make this more flexible. An example:

ALIAS contact

REMOVE FROM CLASS contact:person
PROPERTIES (contact:mailbox)
WHERE contact:fullName =~ /Minten$/;

Note the possibility of regular expressions.

It's possible to alter triples by using the ALTER operation. A small example:

PROPERTIES (mailbox)
VALUES ("mailto:address@hidden";);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]