[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 http://purl.org/dc/elements/1.1/;
> ALIAS rdf http://www.w3.org/1999/02/22-rdf-syntax-ns#;
>
> 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
> (http://www.w3.org/1999/02/22-rdf-syntax-ns#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 http://www.w3.org/2000/10/swap/pim/contact#
INSERT http://dotgnu.org/people/PeterMinten 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:
REMOVE http://dotgnu.org/people/PeterMinten
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 http://www.w3.org/2000/10/swap/pim/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:
ALTER http://dotgnu.org/people/PeterMinten
PROPERTIES (mailbox)
PROPERTYTYPES (*)
VALUES ("mailto:address@hidden");
Greetings,
Peter
Re: [DotGNU]RDF Query Language,
Peter Minten <=
[DotGNU]Implement RDF in a Universal Data Structure, Seth Johnson, 2003/03/26
- Re: [DotGNU]Implement RDF in a Universal Data Structure, Peter Minten, 2003/03/28
- Re: [DotGNU]Implement RDF in a Universal Data Structure, Seth Johnson, 2003/03/29
- Re: [DotGNU]Implement RDF in a Universal Data Structure, Norbert Bollow, 2003/03/29
- Re: [DotGNU]Implement RDF in a Universal Data Structure, Seth Johnson, 2003/03/29
- RE: [DotGNU]Implement RDF in a Universal Data Structure, Danny Ayers, 2003/03/29
- Re: [DotGNU]Implement RDF in a Universal Data Structure, Seth Johnson, 2003/03/29
- RE: [DotGNU]Implement RDF in a Universal Data Structure, Danny Ayers, 2003/03/30
- Re: [DotGNU]Implement RDF in a Universal Data Structure, Seth Johnson, 2003/03/30