W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > July to September 2004

Re: variables prefix - ?variable vs. $variable

From: Dirk-Willem van Gulik <dirkx@webweaving.org>
Date: Tue, 31 Aug 2004 07:03:48 -0700 (PDT)
To: Kendall Clark <kendall@monkeyfist.com>
cc: "Seaborne, Andy" <andy.seaborne@hp.com>, Alberto Reggiori <alberto@asemantics.com>, RDF Data Access Working Group <public-rdf-dawg@w3.org>
Message-ID: <20040831065347.U64496@skutsje.san.webweaving.org>


> 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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:15:20 GMT