Re: variables prefix - ?variable vs. $variable

> it's safe to say that the WG has been assuming (?) that we'd use
> HTTP.

I am sure that HTTP will play an increasingly large role. But at the same
time I fully expect the existing legacy to be with us for quite a while;
and us to have a hybrid where we talk some SWQL which depending on the
configs goes out over the wire as HTTP -or- hooks into some "shared memory
fancy whatever dirty trick those SQL people have had 15 years to refine".

> If it's really that easy

If you want to give it a spin; take postgress; hook in one of the flavours
of RDQL and then go into your favourite editor/IDE from your favourite
language and give it a go. Or alternatively take just the protocol decoder
(some 350 lines of Java or around 50 lines of perl and hook it up).

Dw.


# perl -- asemantics.com -- against news.asemantics.com
use DBI;

$dbh = DBI->connect("dbi:Pg:dbname=test;host=burly;port=5555","meagain","")
        or die $!;

$sth=$dbh->prepare("select ?x,?y,?z from dbms://localhost/test where (?x,?y,?z)")
        or die $!;

$sth->execute()
        or die $!;

while ( $row = $sth->fetchrow_hashref) {
        foreach $k (keys %{ $row }) {
                print "$k:      $row->{$k}\n";
        };
        print "====\n\n";
}



import java.sql.*;

/* License:
 *
 * Copyright abandoned 2001 by Marc Liyanage
 * Do with this whatever you want.
 *
 * Original at http://www.entropy.ch/software/macosx/postgresql/TestPostgreSQL.java
 */

public class TestPostgreSQL {


        public static void main(String argv[]) throws Exception {


                Class.forName("org.postgresql.Driver");

                // 5555 is the non default port for our perl
                // deamon. we must use 'localhost' to make sure
                // that the unix domain socket is NOT used.
                //
                Connection conn = DriverManager.getConnection(
                        "jdbc:postgresql://localhost:5555/test",
                        "anything-anyusername",
                        ""
                );

                Statement stmt = conn.createStatement();

                // ResultSet rset = stmt.executeQuery("SELECT * FROM foo;");
                ResultSet rset = stmt.executeQuery(
                        "SELECT "+
                        "       ?title, ?link "+
                        "FROM "+
                        "       <http://xmlhack.com/rss10.php> "+
                        "WHERE "+
                        "       (?item, <rdf:type>, <rss:item>), "+
                        "       (?item, <rss::title>, ?title), "+
                        "       (?item, <rss::link>, ?link) "+
                        "USING "+
                        "       rdf for <http://www.w3.org/1999/02/22-rdf-syntax-ns#>, "+
                        "       rss for <http://purl.org/rss/1.0/> "
                        );
                ResultSetMetaData rsm = rset.getMetaData();
                int numCols = rsm.getColumnCount();

                // Print out all rows.
                //
                while (rset.next()) {
                        // and in each row print the collumn names too.
                        //
                        for(int i=1; i <= numCols; i++)
                                System.out.println(
                                        rsm.getColumnLabel(i)+":\t"+rset.getString(i)
                                );
                         System.out.println("===\n");
                }

                // Close result set, statement and DB connection
                //
                rset.close();
                stmt.close();
                conn.close();

        }


}

Received on Tuesday, 31 August 2004 14:15:58 UTC