You are viewing a plain text version of this content. The canonical link for it is here.
Posted to triplesoup-commits@incubator.apache.org by le...@apache.org on 2007/04/13 08:56:16 UTC

svn commit: r528394 [35/35] - in /incubator/triplesoup/donations/TRIPLES-3-RDFStore: ./ dbms/ dbms/client/ dbms/client/t/ dbms/dbmsproxy/ dbms/deamon/ dbms/doc/ dbms/include/ dbms/libdbms/ dbms/utils/ doc/ include/ lib/ lib/DBD/ lib/RDFStore/ lib/RDFSt...

Added: incubator/triplesoup/donations/TRIPLES-3-RDFStore/utils/rdfdump.pl
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-3-RDFStore/utils/rdfdump.pl?view=auto&rev=528394
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-3-RDFStore/utils/rdfdump.pl (added)
+++ incubator/triplesoup/donations/TRIPLES-3-RDFStore/utils/rdfdump.pl Fri Apr 13 01:56:01 2007
@@ -0,0 +1,139 @@
+#!/usr/bin/perl
+##############################################################################
+# 	Copyright (c) 2000-2006 All rights reserved
+# 	Alberto Reggiori <ar...@webweaving.org>
+#	Dirk-Willem van Gulik <di...@webweaving.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer. 
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in
+#    the documentation and/or other materials provided with the
+#    distribution.
+#
+# 3. The end-user documentation included with the redistribution,
+#    if any, must include the following acknowledgment:
+#       "This product includes software developed by 
+#        Alberto Reggiori <ar...@webweaving.org> and
+#        Dirk-Willem van Gulik <di...@webweaving.org>."
+#    Alternately, this acknowledgment may appear in the software itself,
+#    if and wherever such third-party acknowledgments normally appear.
+#
+# 4. All advertising materials mentioning features or use of this software
+#    must display the following acknowledgement:
+#    This product includes software developed by the University of
+#    California, Berkeley and its contributors. 
+#
+# 5. Neither the name of the University nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+#
+# 6. Products derived from this software may not be called "RDFStore"
+#    nor may "RDFStore" appear in their names without prior written
+#    permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+# OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# ====================================================================
+#
+# This software consists of work developed by Alberto Reggiori and 
+# Dirk-Willem van Gulik. The RDF specific part is based on public 
+# domain software written at the Stanford University Database Group by 
+# Sergey Melnik. For more information on the RDF API Draft work, 
+# please see <http://www-db.stanford.edu/~melnik/rdf/api.html>
+# The DBMS TCP/IP server part is based on software originally written
+# by Dirk-Willem van Gulik for Web Weaving Internet Engineering m/v Enschede,
+# The Netherlands.
+#
+##############################################################################
+
+use Carp;
+use RDFStore::NodeFactory;
+use RDFStore::Model;
+use DBI;
+
+my $Usage =<<EOU;
+Usage is:
+    $0 [-h] [-v] -storename <IDENTIFIER> [-syntax <RDF/XML | NTriples> ]
+
+Query an existing RDFStore database.
+
+-h	Print this message
+
+-storename <IDENTIFIER>
+		RDFStore database name IDENTIFIER is like rdfstore://[HOSTNAME[:PORT]]/PATH/DBDIRNAME
+
+                        E.g. URLs
+                                        rdfstore://mysite.foo.com:1234/this/is/my/rd/store/database
+                                        rdfstore:///root/this/is/my/rd/store/database
+
+[-syntax <RDF/XML | NTriples> ]
+		By default is (normalized) RDF/XML - otherwise you can specify N-Triples
+
+[-v]	Be verbose
+
+EOU
+
+# Process options
+print $Usage and exit if ($#ARGV<0);
+
+my ($verbose,$syntax,$storename,$input_dir,$dbms_host,$dbms_port);
+$verbose=0;
+my @query;
+while (defined($ARGV[0]) and $ARGV[0] =~ /^[-+]/) {
+    my $opt = shift;
+
+    if ($opt eq '-storename') {
+        $storename = shift;
+    } elsif ($opt eq '-syntax') {
+	$syntax=shift;
+    } elsif ($opt eq '-h') {
+        print $Usage;
+        exit;
+    } elsif ($opt eq '-v') {
+	$verbose=1;
+    } elsif ($opt eq '-input_dir') {
+	$opt=shift;
+	$input_dir = $opt
+                if(-e $opt);
+        $input_dir .= '/'
+                unless( (not(defined $input_dir)) ||
+                        ($input_dir eq '') ||
+                        ($input_dir =~ /\s+/) ||
+                        ($input_dir =~ /\/$/) );
+    } elsif ($opt eq '-dbms_host') {
+        $dbms_host = shift;
+    } elsif ($opt eq '-dbms_port') {
+	$opt=shift;
+        $dbms_port = (int($opt)) ? $opt : undef;
+    } else {
+        die "Unknown option: $opt\n$Usage";
+    };
+};
+
+my $factory = new RDFStore::NodeFactory();
+my $model = new RDFStore::Model( Name => $storename, Host => $dbms_host, Port => $dbms_port, Mode => 'r' );
+
+$syntax = 'RDF/XML' unless($syntax);
+
+print "Total statements: ".$model->size."\n"
+	if($verbose);
+
+$model->serialize( *STDOUT, $syntax );
+

Propchange: incubator/triplesoup/donations/TRIPLES-3-RDFStore/utils/rdfdump.pl
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/triplesoup/donations/TRIPLES-3-RDFStore/utils/rdfingest.pl
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-3-RDFStore/utils/rdfingest.pl?view=auto&rev=528394
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-3-RDFStore/utils/rdfingest.pl (added)
+++ incubator/triplesoup/donations/TRIPLES-3-RDFStore/utils/rdfingest.pl Fri Apr 13 01:56:01 2007
@@ -0,0 +1,200 @@
+#!/usr/bin/perl
+##############################################################################
+# 	Copyright (c) 2000-2006 All rights reserved
+# 	Alberto Reggiori <ar...@webweaving.org>
+#	Dirk-Willem van Gulik <di...@webweaving.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer. 
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in
+#    the documentation and/or other materials provided with the
+#    distribution.
+#
+# 3. The end-user documentation included with the redistribution,
+#    if any, must include the following acknowledgment:
+#       "This product includes software developed by 
+#        Alberto Reggiori <ar...@webweaving.org> and
+#        Dirk-Willem van Gulik <di...@webweaving.org>."
+#    Alternately, this acknowledgment may appear in the software itself,
+#    if and wherever such third-party acknowledgments normally appear.
+#
+# 4. All advertising materials mentioning features or use of this software
+#    must display the following acknowledgement:
+#    This product includes software developed by the University of
+#    California, Berkeley and its contributors. 
+#
+# 5. Neither the name of the University nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+#
+# 6. Products derived from this software may not be called "RDFStore"
+#    nor may "RDFStore" appear in their names without prior written
+#    permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+# OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# ====================================================================
+#
+# This software consists of work developed by Alberto Reggiori and 
+# Dirk-Willem van Gulik. The RDF specific part is based on public 
+# domain software written at the Stanford University Database Group by 
+# Sergey Melnik. For more information on the RDF API Draft work, 
+# please see <http://www-db.stanford.edu/~melnik/rdf/api.html>
+# The DBMS TCP/IP server part is based on software originally written
+# by Dirk-Willem van Gulik for Web Weaving Internet Engineering m/v Enschede,
+# The Netherlands.
+#
+##############################################################################
+
+use Carp;
+use RDFStore::NodeFactory;
+use RDFStore::Model;
+
+my $Usage =<<EOU;
+Usage is:
+    $0 [-h] -storename <IDENTIFIER> [-freetext] [-serialise] [-v] [-Context <URL_or_filename>] <URL_or_filename>
+
+Query an existing RDFStore database.
+
+-h	Print this message
+
+[-v]	Be verbose
+
+-storename <IDENTIFIER>
+		RDFStore database name IDENTIFIER is like rdfstore://[HOSTNAME[:PORT]]/PATH/DBDIRNAME
+
+                        E.g. URLs
+                                        rdfstore://mysite.foo.com:1234/this/is/my/rd/store/database
+                                        rdfstore:///root/this/is/my/rd/store/database
+
+[-freetext]
+                Generates free-text searchable database
+
+[-serialise]
+                Generate strawman RDF output
+
+[-Context <URL_or_filename>]
+                Specify a resource to set a kind of context for the statements
+
+Main paramter is URL or filename to parser; '-' denotes STDIN.
+
+EOU
+
+# Process options
+print $Usage and exit if ($#ARGV<0);
+
+my $factory = new RDFStore::NodeFactory();
+
+my ($verbose,$Context,$freetext,$serialise,$stuff,$storename,$output_dir,$dbms_host,$dbms_port);
+my @query;
+while (defined($ARGV[0])) {
+    my $opt = shift;
+
+    if ($opt eq '-storename') {
+        $storename = shift;
+    } elsif ($opt eq '-Context') {
+	$Context=shift;
+    } elsif ($opt eq '-stuff') {
+	print STDERR "WARNING! -stuff option is deprecated - input source is defined to be last passed argument now\n";
+        $stuff = shift;
+    } elsif ($opt eq '-freetext') {
+        $freetext = 1;
+    } elsif ($opt eq '-serialise') {
+        $serialise = 1;
+    } elsif ($opt eq '-h') {
+        print $Usage;
+        exit;
+    } elsif ($opt eq '-v') {
+	$verbose=1;
+    } elsif ($opt eq '-output_dir') {
+	$opt=shift;
+	$output_dir = $opt
+                if(-e $opt);
+        $output_dir .= '/'
+                unless( (not(defined $output_dir)) ||
+                        ($output_dir eq '') ||
+                        ($output_dir =~ /\s+/) ||
+                        ($output_dir =~ /\/$/) );
+    } elsif ($opt eq '-dbms_host') {
+        $dbms_host = shift;
+    } elsif ($opt eq '-dbms_port') {
+	$opt=shift;
+        $dbms_port = (int($opt)) ? $opt : undef;
+    } else {
+        $stuff = $opt;
+    	};
+};
+
+my $model = new RDFStore::Model(
+					Name	=>	$output_dir.$storename,
+					Host =>    $dbms_host,
+                                        Port =>    $dbms_port,
+					FreeText	=>	$freetext,
+					Sync	=> 1,
+					Context => ( (defined $Context) ? $factory->createResource($Context): undef ) )
+	or croak "Oh dear, can not build my model :( $!";
+
+if($stuff eq '-') {
+	*STUFF=*STDIN;
+} else {
+	open(STUFF,$stuff);
+};
+
+my $stats=0;
+# input must look like ("S","P","O") or ("S","P",literal("O"))
+while(<STUFF>) {
+        if(     (m/\("([^,]*)", "([^,]+)", "(.*)"\)$/) ||
+                (m/\("([^,]*)", "([^,]+)", (literal\(".*"\))\)$/) ) {
+                my $s = trim($1);
+                my $p = trim($2);
+                my $o = trim($3);
+                $s =~ s/^(stdin|file:[^#]+)#?(\w+:)/$2/;
+                $p =~ s/^(stdin|file:[^#]+)#?(\w+:)/$2/;
+                $s = $factory->createResource($s);
+                $p = $factory->createResource($p);
+                if($o =~ m/literal\(\s*"([^"]+)"\s*\)/) {
+                        $o = $factory->createLiteral($1);
+                } else {
+                        $o =~ s/^(stdin|file:[^#]+)#?(\w+:)/$2/;
+                        $o = $factory->createResource($o);
+                };
+                my $stat = $factory->createStatement($s,$p,$o);
+                print STDERR "Ingesting: ",$stat->toString,"\n"
+                        if($verbose);
+                $model->add($stat);
+                $stats++;
+        };
+};
+print STDERR "Ingested '$stats' RDF statements in '$output_dir$storename' using '$style' style and split factor '$split'\n"
+	if($verbose);
+unless($stuff eq '-') {
+	close(STUFF);
+};
+
+if($serialise) {
+        print $model->toStrawmanRDF(),"\n";
+};
+
+sub trim {
+	my $t = shift;
+	$t =~ s/^\s+//g;
+	$t =~ s/\s+$//g;
+	return $t;
+};

Propchange: incubator/triplesoup/donations/TRIPLES-3-RDFStore/utils/rdfingest.pl
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/triplesoup/donations/TRIPLES-3-RDFStore/utils/rdfquery.pl
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-3-RDFStore/utils/rdfquery.pl?view=auto&rev=528394
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-3-RDFStore/utils/rdfquery.pl (added)
+++ incubator/triplesoup/donations/TRIPLES-3-RDFStore/utils/rdfquery.pl Fri Apr 13 01:56:01 2007
@@ -0,0 +1,214 @@
+#!/usr/bin/perl
+##############################################################################
+# 	Copyright (c) 2000-2006 All rights reserved
+# 	Alberto Reggiori <ar...@webweaving.org>
+#	Dirk-Willem van Gulik <di...@webweaving.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer. 
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in
+#    the documentation and/or other materials provided with the
+#    distribution.
+#
+# 3. The end-user documentation included with the redistribution,
+#    if any, must include the following acknowledgment:
+#       "This product includes software developed by 
+#        Alberto Reggiori <ar...@webweaving.org> and
+#        Dirk-Willem van Gulik <di...@webweaving.org>."
+#    Alternately, this acknowledgment may appear in the software itself,
+#    if and wherever such third-party acknowledgments normally appear.
+#
+# 4. All advertising materials mentioning features or use of this software
+#    must display the following acknowledgement:
+#    This product includes software developed by the University of
+#    California, Berkeley and its contributors. 
+#
+# 5. Neither the name of the University nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+#
+# 6. Products derived from this software may not be called "RDFStore"
+#    nor may "RDFStore" appear in their names without prior written
+#    permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+# OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# ====================================================================
+#
+# This software consists of work developed by Alberto Reggiori and 
+# Dirk-Willem van Gulik. The RDF specific part is based on public 
+# domain software written at the Stanford University Database Group by 
+# Sergey Melnik. For more information on the RDF API Draft work, 
+# please see <http://www-db.stanford.edu/~melnik/rdf/api.html>
+# The DBMS TCP/IP server part is based on software originally written
+# by Dirk-Willem van Gulik for Web Weaving Internet Engineering m/v Enschede,
+# The Netherlands.
+#
+##############################################################################
+
+use Carp;
+use RDFStore::Model;
+use RDFStore::NodeFactory;
+use DBI;
+
+my $Usage =<<EOU;
+Usage is:
+
+    $0 <querystring_or_filename> [-storename <IDENTIFIER>] [-serialize <syntax>] [-h]
+
+Query an existing RDFStore database.
+
+<querystring_or_filename>
+
+		A SPARQL query string (see syntax at http://www.w3.org/TR/rdf-sparql-query/) or a file containing the actual query
+
+		Example RSS-1.0 query
+
+		PREFIX   rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+		PREFIX   rss:   <http://purl.org/rss/1.0/>
+		SELECT
+			?title ?link
+		FROM
+			<http://xmlhack.com/rss10.php>
+		WHERE
+			( ?item rdf:type rss:item )
+			( ?item rss::title ?title )
+			( ?item rss::link ?link )
+
+[-storename <IDENTIFIER>]
+	If not specified into the FROM clause part of the query, this option allows to specify a 
+	database IDENTIFIER like rdfstore://[HOSTNAME[:PORT]]/PATH/DBDIRNAME to query
+
+        E.g. URLs
+        		rdfstore://mysite.foo.com:1234/this/is/my/rd/store/database
+                        rdfstore:///root/this/is/my/rd/store/database
+
+[-serialize rdf-for-xml | dawg-xml ]
+	Result Forms - by default SELECT generates RDF/XML tabular format (http://www.w3.org/2001/sw/DataAccess/tests/result-set#) while 
+	DESCRIBE or CONSTRUCT queries generate canonical RDF/XML output.
+	
+	Alternatively this option allows you to get two simple XML output formats
+		* dawg-xml (http://www.w3.org/2001/sw/DataAccess/rf1/) syntax
+		* rdf-for-xml (http://jena.hpl.hp.com/~afs/RDF-XML.html)
+
+[-smart]
+	Use simple rdfs:subClassOf rdfs:subPropertyOf and owl:sameAs inferencing
+
+[-comment <STRING>]
+	Comment to add to the XML output
+
+[-metadata <filename_or_URI>]
+	Additional metadata link for <head/> elemenet into DAWG-XML format
+
+[-h]
+	Print this message
+
+EOU
+
+# Process options
+print $Usage and exit if ($#ARGV<0);
+
+my ($verbose,$metadata, $comment,$query,$storename,$input_dir,$dbms_host,$dbms_port,$serialize,$smart);
+$smart=0;
+while (defined($ARGV[0])) {
+    my $opt = shift;
+
+    if ($opt eq '-storename') {
+        $storename = shift;
+    } elsif ($opt eq '-h') {
+        print $Usage;
+        exit;
+    } elsif ($opt eq '-smart') {
+	$smart=1;
+    } elsif ($opt eq '-v') {
+	$verbose=1;
+    } elsif ($opt eq '-input_dir') {
+	$opt=shift;
+	$input_dir = $opt
+                if(-e $opt);
+        $input_dir .= '/'
+                unless( (not(defined $input_dir)) ||
+                        ($input_dir eq '') ||
+                        ($input_dir =~ /\s+/) ||
+                        ($input_dir =~ /\/$/) );
+    } elsif ($opt eq '-dbms_host') {
+        $dbms_host = shift;
+    } elsif ($opt eq '-dbms_port') {
+	$opt=shift;
+        $dbms_port = (int($opt)) ? $opt : undef;
+    } elsif ($opt eq '-serialize') {
+        $serialize = shift;
+	$serialize = 'RDF/XML'
+		unless($serialize);
+    } elsif ($opt eq '-comment') {
+        $comment = shift;
+    } elsif ($opt eq '-metadata') {
+        $metadata = shift;
+    } else {
+	$query=$opt;
+    	};
+};
+
+my $factory = new RDFStore::NodeFactory();
+my %results_options = (
+	'syntax' => $serialize
+	);
+$results_options{'metadata'} = $metadata
+	if($metadata); #check if file or URI perhaps?
+
+$results_options{'comment'} = $comment
+	if($comment);
+
+my $dbh = DBI->connect("DBI:RDFStore:database=$input_dir$storename;host=$dbms_host;port=$dbms_port", "pincopallino", 0,
+						{	nodeFactory => $factory,
+							results => \%results_options,
+							smarter => $smart } )
+	or die "Oh dear, can not connect to rdfstore: $!";
+
+if( -e $query && -r _ ) {
+	open(QUERY, $query);
+	$query='';
+	while(<QUERY>) {
+		$query.=$_;
+		};
+	close(QUERY);
+	};
+
+my $sth;
+my $rdfresults;
+eval {
+        $sth=$dbh->prepare($query);
+	$sth->execute();
+	};
+my $err = $@;
+croak $err
+	if $err;
+
+if( $sth->func('getQueryStatement')->getQueryType eq 'SELECT' and $serialize !~ /n-triples/i ) {
+	while (my $xml = $sth->func( $serialize ? $serialize : 'dawg-results', 'fetchrow_XML' )) {
+		print $xml;
+       		};
+} else {
+	while (my $rdf = $sth->func( $serialize ? $serialize : 'RDF/XML', 'fetchsubgraph_serialize' )) {
+		print $rdf;
+       		};
+	};
+
+$sth->finish();

Propchange: incubator/triplesoup/donations/TRIPLES-3-RDFStore/utils/rdfquery.pl
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/triplesoup/donations/TRIPLES-3-RDFStore/utils/rdfs2html.pl
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-3-RDFStore/utils/rdfs2html.pl?view=auto&rev=528394
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-3-RDFStore/utils/rdfs2html.pl (added)
+++ incubator/triplesoup/donations/TRIPLES-3-RDFStore/utils/rdfs2html.pl Fri Apr 13 01:56:01 2007
@@ -0,0 +1,538 @@
+#!/usr/local/bin/perl
+
+eval 'exec /usr/local/bin/perl  -S $0 ${1+"$@"}'
+    if 0; # not running under some shell
+
+##############################################################################
+# 	Copyright (c) 2000-2006 All rights reserved
+# 	Alberto Reggiori <ar...@webweaving.org>
+#	Dirk-Willem van Gulik <di...@webweaving.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer. 
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in
+#    the documentation and/or other materials provided with the
+#    distribution.
+#
+# 3. The end-user documentation included with the redistribution,
+#    if any, must include the following acknowledgment:
+#       "This product includes software developed by 
+#        Alberto Reggiori <ar...@webweaving.org> and
+#        Dirk-Willem van Gulik <di...@webweaving.org>."
+#    Alternately, this acknowledgment may appear in the software itself,
+#    if and wherever such third-party acknowledgments normally appear.
+#
+# 4. All advertising materials mentioning features or use of this software
+#    must display the following acknowledgement:
+#    This product includes software developed by the University of
+#    California, Berkeley and its contributors. 
+#
+# 5. Neither the name of the University nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+#
+# 6. Products derived from this software may not be called "RDFStore"
+#    nor may "RDFStore" appear in their names without prior written
+#    permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+# OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# ====================================================================
+#
+# This software consists of work developed by Alberto Reggiori and 
+# Dirk-Willem van Gulik. The RDF specific part is based on public 
+# domain software written at the Stanford University Database Group by 
+# Sergey Melnik. For more information on the RDF API Draft work, 
+# please see <http://www-db.stanford.edu/~melnik/rdf/api.html>
+# The DBMS TCP/IP server part is based on software originally written
+# by Dirk-Willem van Gulik for Web Weaving Internet Engineering m/v Arnhem,
+# The Netherlands.
+#
+##############################################################################
+
+use Carp;
+use RDFStore::Model;
+use RDFStore::NodeFactory;
+use RDFStore::Parser::SiRPAC;
+use RDFStore::Vocabulary::RDF;
+use RDFStore::Vocabulary::RDFS;
+
+my $Usage =<<EOU;
+Usage is:
+    $0 [-h] [-outdir dir] schema_file
+
+Given an RDF Schema (RDFS) generates JavaDoc style HTML documentation for the schema itself.
+
+-h	Print this message
+
+[-v]	Be verbose
+
+[-name label]
+	A human readable label for the schema/project.
+
+[-outdir dir]
+	Target directory.
+
+[-examples file]
+	Example instances file.
+
+See http://wadi.asemantics.com/pieter/ for an example output.
+
+EOU
+
+my ($verbose,$name,$outdir,$schema_file,$examples);
+while (defined($ARGV[0])) {
+    my $opt = shift;
+
+    if ($opt eq '-outdir') {
+        $outdir = shift;
+    } elsif ($opt eq '-name') {
+        $name = shift;
+    } elsif ($opt eq '-examples') {
+        $examples = shift;
+    } elsif ($opt eq '-h') {
+        print $Usage;
+        exit;
+    } elsif ($opt eq '-v') {
+	$verbose=1;
+    } else {
+	$schema_file=$opt;
+    	};
+};
+
+unless($schema_file) {
+	print $Usage;
+	exit;
+	};
+
+$outdir = 'rdfdoc'
+	unless($outdir);
+
+mkdir $outdir
+	unless(-d $outdir);
+
+my $factory = new RDFStore::NodeFactory();
+
+# bear in mind that this is NOT fully RDF Schema aware ie. using RDFStore::SchemaModel yet!!
+my $p=new RDFStore::Parser::SiRPAC(
+                                ErrorContext =>         3, 
+                                Style =>                'RDFStore::Parser::Styles::RDFStore::Model',
+                                NodeFactory =>          $factory,
+                                store   =>      { seevalues =>    $verbose }
+                                );
+
+my $m;
+if($stuff =~ /^-/) {
+        # for STDIN use no-blocking
+        $m = $p->parsestream(*STDIN);
+} else {
+        $m = $p->parsefile($schema_file);
+};
+
+if($examples) {
+	my $p1=new RDFStore::Parser::SiRPAC(
+                                ErrorContext =>         3, 
+                                Style =>                'RDFStore::Parser::Styles::RDFStore::Model',
+                                NodeFactory =>          $factory,
+                                store   =>      { seevalues =>    $verbose }
+                                );
+
+	my $m_e = $p1->parsefile($examples);
+	my $exs = $m_e->elements;
+	while (my $e = $exs->each ) {
+		$m->add($e);
+		};	
+	};
+
+my @namespaces = $m->namespaces;
+
+$name = 'RDFDoc'
+	unless($name);
+
+my $date = `date`;
+chop($date);
+
+# toc.html
+&toc();
+
+sub toc {
+	open(TOC,">$outdir/toc.html");
+
+	print TOC <<EOFHTML;
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>$name - Class Hierarchy</title>
+</head>
+<body>
+<center><h1> Class Hierarchy for <i>$name</i> Project </h1></center><hr>
+<p>
+<p>
+<ul>
+EOFHTML
+
+	#take top classes
+	my $top_classes=$m->find(undef,$RDFStore::Vocabulary::RDF::type,$RDFStore::Vocabulary::RDFS::Class)->elements;
+	if($top_classes->size <= 0 ) {
+		die "No rdfs:Class(es) found in $schema_file!\n";
+		};
+
+	while ( my $top_class = $top_classes->each_subject ) {
+		my $sc = $m->find($top_class,$RDFStore::Vocabulary::RDFS::subClassOf)->elements;
+		my $ns = $sc->first_object;
+		$ns = $ns->getNamespace
+			if($ns);
+		next
+			unless(	$sc->size <=0 or 
+				$sc->size==1 and $sc->first_object->equals($RDFStore::Vocabulary::RDFS::Resource) or
+				$sc->size==1 and (! grep /^$ns$/,@namespaces ) );
+
+		&visit_class( $top_class, *TOC ) ;
+        	};
+
+	print TOC <<EOFHTML;
+</ul>
+<hr>Generated on $date</body></html>
+EOFHTML
+
+	close(TOC);
+	};
+
+# example
+sub example {
+	my ($example,$class_name) = @_;
+
+	my $example_name = ($example->isbNode) ? $example->toString : $example->getLocalName;
+
+	open(EXAMPLE,">$outdir/$example_name.html");
+
+	print EXAMPLE <<EOFHTML;
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Project: $name - Example of $class_name Class - $example_name</title>
+</head>
+<body>
+<H2><font size="-1"> Project: $name</font><BR>
+Example $example_name</H2>  
+<dl>
+<dt><b> Example of <A HREF="$class_name.html">$class_name</A> Class&nbsp;</b></dt>
+<dt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
+</dl>
+<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"> 
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TD COLSPAN=3 width="100%"><font size="+2"><b>Own Slots</b></font></TD>
+</TR> 
+<TR BGCOLOR="white" CLASS="TableRowColor"> 
+<TD ALIGN="right" VALIGN="top" WIDTH="20%"><b>Slot name</b></TD>
+<TD ALIGN="left" width="10%"><b>Value&nbsp;</b></TD> 
+<TD ALIGN="left" width="10%"><b>Type</b></TD>   
+</TR>
+
+EOFHTML
+
+	my $slots = $m->find($example)->elements;
+
+	while ( my $s = $slots->each) {
+		next
+			if( $s->predicate->equals( $RDFStore::Vocabulary::RDF::type ) );
+		my $slot_name = $s->predicate->getLocalName;
+		my $value = $s->object;
+		my $type;
+		my $tt;
+		if($value->isa("RDFStore::Resource")) {
+			$type = $m->find($value, $RDFStore::Vocabulary::RDF::type)->elements->first_object;
+
+			if( $value->isbNode ) {
+				my $ll = $m->find($value, $RDFStore::Vocabulary::RDFS::label)->elements->first_object; #pick up rdfs:label of it if there
+				$ll = ($ll) ? $ll->toString : 'bNode';
+				$value = "<A HREF='".$value->toString.".html'>$ll</A>";
+			} else {
+				my $ns = $value->getNamespace;
+				if( grep /^$ns$/, @namespaces ) {
+					$value = "<A HREF='".$value->getLocalName.".html'>".$value->getLocalName."</A>";
+				} else {
+					$tt = 'Resource<br>(controlled list)';
+					$value = $value->getLocalName;
+					};
+				};
+		} else {
+			$value = $value->toString;
+			};
+
+		unless($tt) {
+			if($type) {
+				$type = $type->getLocalName;
+				$type = " (of class <A HREF='".$type.".html'>".$type."</A>)";
+				$tt = 'Instance';
+			} else {
+				$tt = 'String';
+				};
+			};
+
+		print EXAMPLE <<EOFHTML;
+
+<TR>
+<TD ALIGN="left" VALIGN="top" WIDTH="15%"><i>$slot_name&nbsp;</i></TD>
+<TD ALIGN="left" width="70%">$value$type&nbsp;</b></TD> 
+<TD ALIGN="left" width="15%">$tt&nbsp;</b></TD>
+</TR> 
+
+EOFHTML
+        	};
+
+	print EXAMPLE <<EOFHTML;
+</table><P>
+<P><A HREF="toc.html"> Return to class hierarchy </A>
+<hr>Generated on $date</body></html>
+EOFHTML
+
+	close(EXAMPLE);
+	};
+
+sub visit_class {
+	my ($top_class, $fh, $parent_slots ) = @_;
+
+	my $class_name = $top_class->getLocalName;
+	print $fh <<EOFHTML;
+<li>
+<A HREF="$class_name.html">$class_name</A>
+</li>
+EOFHTML
+	my $examples = $m->find(undef,$RDFStore::Vocabulary::RDF::type, $top_class);
+
+	if($examples->size > 0 ) {
+
+		$examples = $examples->elements;
+
+		print $fh <<EOFHTML;
+<ul>
+<i>Examples :
+EOFHTML
+		my $max_examples=3; #avoid a complete messy HTML page...
+		my $ex_i=0;
+		while ( my $ex = $examples->each_subject ) {
+			last
+				if($ex_i == $max_examples);
+
+			my $ll = $m->find($ex, $RDFStore::Vocabulary::RDFS::label)->elements->first_object; #pick up rdfs:label of it if there
+
+			my $example_name;
+			if($ex->isbNode) {
+				$example_name = $ex->toString;
+				$ll = ($ll) ? $ll->toString : 'bNode';
+			} else {
+				$example_name = $ex->getLocalName;
+				$ll = ($ll) ? $ll->toString : $example_name;
+				};
+			print $fh "<A HREF='$example_name.html'>$ll</A>&nbsp;";
+
+			&example( $ex, $class_name );
+
+			$ex_i++;
+			};
+
+		print $fh <<EOFHTML;
+</i></ul>
+EOFHTML
+		};
+
+	my $slots = $m->find(undef,$RDFStore::Vocabulary::RDFS::domain, $top_class)->elements;
+	$slots = $slots->unite( $parent_slots )
+		if($parent_slots);
+
+	my $sc = $m->find(undef, $RDFStore::Vocabulary::RDFS::subClassOf, $top_class)->elements;
+
+	print $fh '<ul>'
+		if($sc->size>0);
+
+	while( my $es = $sc->each_subject) {
+		&visit_class( $es, $fh, $slots );
+		};
+
+	print $fh '</ul>'
+		if($sc->size>0);
+
+	&class($top_class, $slots);
+	};
+
+# class
+sub class {
+	my ($class,$slots) = @_;
+
+	my $class_name = ($class->isbNode) ? $class->toString : $class->getLocalName;
+
+	my $base_class = $m->find($class,$RDFStore::Vocabulary::RDFS::subClassOf)->elements;
+	if($base_class->size > 0 and ! $base_class->first_object->equals($RDFStore::Vocabulary::RDFS::Resource) ) {
+		$base_class = $base_class->first_object;
+		my $ns = $base_class->getNamespace;
+		if( ! grep /^$ns$/, @namespaces ) {
+			$base_class = $base_class->toString;
+		} else {
+			$base_class = ($base_class->isbNode) ? $base_class->toString : $base_class->getLocalName;
+			$base_class =  "<A HREF='$base_class.html'>$base_class</A>";
+			};
+	} else {
+		$base_class = ':THING';	
+		};	
+
+	open(CLASS,">$outdir/$class_name.html");
+
+	print CLASS <<EOFHTML;
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Project: $name - Example of $class_name Class - $class_name</title>
+</head>
+<body>
+<H2><font size="-1"> Project: $name</font><BR>
+Class $class_name</H2>  
+<dl>
+<dt><b>Concrete Class Extends&nbsp;</b></dt>
+<dt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
+$base_class</dt><dd>&nbsp;</dd>
+<dt><b>Direct Examples:</b> <dd>
+EOFHTML
+
+	my $examples = $m->find(undef,$RDFStore::Vocabulary::RDF::type, $class);
+
+	if($examples->size > 0 ) {
+
+		$examples = $examples->elements;
+
+		while ( my $ex = $examples->each_subject ) {
+			if($ex->isbNode) {
+				my $example_name = $ex->toString;
+				my $ll = $m->find($ex, $RDFStore::Vocabulary::RDFS::label)->elements->first_object; #pick up rdfs:label of it if there
+				$ll = ($ll) ? $ll->toString : 'bNode';
+				print CLASS "<A HREF='$example_name.html'>$ll</A>&nbsp;";
+			} else {
+				my $example_name = $ex->getLocalName;
+				print CLASS "<A HREF='$example_name.html'>$example_name</A>&nbsp;";
+				};
+			};
+	} else {
+		print CLASS "None";
+		};
+
+	print CLASS <<EOFHTML;
+</dt><dd>&nbsp;</dd>
+<DT><B>Direct Subclasses:</B> <DD>
+EOFHTML
+	my $sub_classes = $m->find(undef,$RDFStore::Vocabulary::RDFS::subClassOf, $class)->elements;
+	if($sub_classes->size > 0) {
+		print CLASS "<OL>";
+		while ( my $sc = $sub_classes->each_subject ) {
+			if($sc->isbNode) {
+				my $sc_name = $sc->toString;
+				my $ll = $m->find($sc, $RDFStore::Vocabulary::RDFS::label)->elements->first_object; #pick up rdfs:label of it if there
+				$ll = ($ll) ? $ll->toString : 'bNode';
+				print CLASS "<LI><A HREF='$sc_name.html'>$ll</A></LI>";
+			} else {
+				my $sc_name = $sc->getLocalName;
+				print CLASS "<LI><A HREF='$sc_name.html'>$sc_name</A></LI>";
+				};
+			};
+		print CLASS "</OL>";
+	} else {
+		print CLASS "None";
+		};
+	print CLASS <<EOFHTML;
+</dt><dd>&nbsp;</dd> </dl>
+<HR>
+<P>
+<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"> 
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TD COLSPAN=6 width="100%"><font size="+2"><b>Template Slots</b></font></TD>
+</TR> 
+<TR BGCOLOR="white" CLASS="TableRowColor"> 
+<TD ALIGN="right" WIDTH="10%"><b>Slot name</b></TD>
+<TD width="60%"><b>Documentation</b></TD>
+<TD width="10%"><b>Type</b></TD>   
+<TD width="10%"><b>Allowed Values/Classes</b></TD> 
+<TD width="5%"><b>Cardinality</b></TD> 
+<TD width="5%"><b>Default</b></TD>  
+</TR>  
+
+EOFHTML
+
+	while ( my $s = $slots->each_subject) {
+		my $slot_name = $s->getLocalName;
+		my $comment = $m->find($s,$RDFStore::Vocabulary::RDFS::comment)->elements;
+		if($comment->size>0) {
+			$comment=$comment->first_object->toString;
+		} else {
+			$comment='';
+			};
+		my $tt=$m->find($s,$RDFStore::Vocabulary::RDFS::range)->elements;
+		my $ranges;
+		if($tt->size > 0 and ! $tt->first_object->equals($RDFStore::Vocabulary::RDFS::Literal) ) {
+			while(my $rr=$tt->each_object) {
+				if($rr->isbNode) {
+					my $rr_name = $rr->toString;
+					my $ll = $m->find($rr, $RDFStore::Vocabulary::RDFS::label)->elements->first_object; #pick up rdfs:label of it if there
+					$ll = ($ll) ? $ll->toString : 'bNode';
+					$ranges .= "<A HREF='$rr_name.html'>$ll</A>&nbsp;";
+				} else {
+					my $rr_name = $rr->getLocalName;
+					if(	($rr->getNamespace eq 'http://www.w3.org/2000/10/XMLSchema#') ||
+						($rr->getNamespace eq 'http://www.w3.org/2001/XMLSchema#') ) {
+						$ranges .= "$rr_name&nbsp;";
+					} else {
+						$ranges .= "<A HREF='$rr_name.html'>$rr_name</A>&nbsp;";
+						};
+					};
+				};
+			$tt = 'Instance';
+		} else {
+			$tt = 'String';
+			};
+		my $max = $m->find($s,$factory->createResource('http://www.w3.org/2002/07/owl#maxCardinality'))->elements;
+		if($max->size > 0) {
+			$max = $max->first_object->toString;
+		} else {
+			$max = 'n';
+			};
+		my $min = $m->find($s,$factory->createResource('http://www.w3.org/2002/07/owl#minCardinality'))->elements;
+		if($min->size > 0) {
+			$min = $min->first_object->toString;
+		} else {
+			$min = '0';
+			};
+
+		print CLASS <<EOFHTML;
+
+<TR>
+<TD ALIGN="right"  WIDTH="10%"><i>$slot_name</i></TD>
+<TD ALIGN="left" width="60%">$comment&nbsp;</TD>
+<TD ALIGN="left" width="15%">$tt&nbsp;</TD>   
+<TD ALIGN="left" width="10%">$ranges&nbsp;</TD> 
+<TD width="5%">$min:$max&nbsp;</b></TD> 
+<TD ALIGN="left" width="5%">&nbsp;</TD>
+</TR>  
+
+EOFHTML
+        	};
+
+	print CLASS <<EOFHTML;
+</table><P>
+<P><A HREF="toc.html"> Return to class hierarchy </A>
+<hr>Generated on $date</body></html>
+EOFHTML
+
+	close(CLASS);
+	};

Propchange: incubator/triplesoup/donations/TRIPLES-3-RDFStore/utils/rdfs2html.pl
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/triplesoup/donations/TRIPLES-3-RDFStore/utils/rdfsh.pl
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-3-RDFStore/utils/rdfsh.pl?view=auto&rev=528394
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-3-RDFStore/utils/rdfsh.pl (added)
+++ incubator/triplesoup/donations/TRIPLES-3-RDFStore/utils/rdfsh.pl Fri Apr 13 01:56:01 2007
@@ -0,0 +1,155 @@
+#!/usr/bin/perl
+##############################################################################
+# 	Copyright (c) 2000-2006 All rights reserved
+# 	Alberto Reggiori <ar...@webweaving.org>
+#	Dirk-Willem van Gulik <di...@webweaving.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer. 
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in
+#    the documentation and/or other materials provided with the
+#    distribution.
+#
+# 3. The end-user documentation included with the redistribution,
+#    if any, must include the following acknowledgment:
+#       "This product includes software developed by 
+#        Alberto Reggiori <ar...@webweaving.org> and
+#        Dirk-Willem van Gulik <di...@webweaving.org>."
+#    Alternately, this acknowledgment may appear in the software itself,
+#    if and wherever such third-party acknowledgments normally appear.
+#
+# 4. All advertising materials mentioning features or use of this software
+#    must display the following acknowledgement:
+#    This product includes software developed by the University of
+#    California, Berkeley and its contributors. 
+#
+# 5. Neither the name of the University nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+#
+# 6. Products derived from this software may not be called "RDFStore"
+#    nor may "RDFStore" appear in their names without prior written
+#    permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+# OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# ====================================================================
+#
+# This software consists of work developed by Alberto Reggiori and 
+# Dirk-Willem van Gulik. The RDF specific part is based on public 
+# domain software written at the Stanford University Database Group by 
+# Sergey Melnik. For more information on the RDF API Draft work, 
+# please see <http://www-db.stanford.edu/~melnik/rdf/api.html>
+# The DBMS TCP/IP server part is based on software originally written
+# by Dirk-Willem van Gulik for Web Weaving Internet Engineering m/v Enschede,
+# The Netherlands.
+#
+##############################################################################
+
+# ok here is the a basic Unix like shell to manage RDF (RDFStore) databases
+#
+# Useful for inspiration are the following links:
+#
+#	XML Editing Shell: http://xsh.sourceforge.net/ and http://www.xml.com/lpt/a/2002/07/10/kip.html
+#	Guha rdfdb tcp/ip commands: http://www.guha.com/rdfdb/query.html
+#	Tucana RDF store Interactive Query Language: http://tks.pisoftware.com/user/itql.html
+#	Intellidimension RDF Gateway RDFQL: http://www.intellidimension.com/default.rsp?topic=/pages/rdfgateway/reference/db/default.rsp
+#
+
+use RDFStore::Parser::SiRPAC;
+use RDFStore::Parser::NTriples;
+use RDFStore::NodeFactory;
+use Carp;
+
+my $Usage =<<EOU;
+Usage is:
+    $0 [-h] [-f <command_file>] [-i]
+
+RDF shell
+
+-h	Print this message
+
+[-f <command_file>]
+	Command file containing the RDF shell commands
+
+EOU
+
+my ($command_file);
+$interactive=0;
+while (defined($ARGV[0]) and $ARGV[0] =~ /^[-+]/) {
+    my $opt = shift;
+
+    if ($opt eq '-f') {
+        $command_file = shift;
+	undef $command_file
+		unless(-e $command_file);
+    } elsif ($opt eq '-h') {
+        print $Usage;
+        exit;
+    } elsif ($opt eq '-v') {
+	$verbose=1;
+    } else {
+        die "Unknown option: $opt\n$Usage";
+    };
+};
+
+my $fh;
+if($command_file) {
+	open(FILE,$command_file);
+	$fh = *FILE;
+} else {
+	$fh = *STDIN;
+	};
+
+my %aliases = (
+	'http://www.w3.org/1999/02/22-rdf-syntax-ns#' => rdf,
+	'http://www.w3.org/2000/01/rdf-schema#' => rdfs,
+	'http://purl.org/rss/1.0/' => rss,
+	'http://www.daml.org/2001/03/daml+oil#' => 'daml+oil',
+	'http://purl.org/dc/elements/1.1/' => 'dc',
+	'http://purl.org/dc/terms/' => 'dcq',
+	'http://xmlns.com/foaf/0.1/' => 'foaf'
+	);
+
+print "\nWelcome to RDFStore shell!\n\nType help for a list of available commands\n\n" unless($command_file);
+
+for(;;) {
+	prompt();
+
+	$line = <$fh>;
+
+	last unless($line);
+
+	#print "OOOKKK!!!\n" if($line =~ m/^[[A/);
+
+	next
+		if( $line =~ m/^(\s|\n|#[^\n]*)*$/gm);
+
+	if($line =~ m/^(help)/i) {
+		print "help <command>\n";
+	} elsif($line =~ m/^(quit|exit)/i) {
+		exit;
+		};
+	};
+
+close(FILE)
+	if($command_file);
+
+sub prompt { print 'rdfsh> '; };

Propchange: incubator/triplesoup/donations/TRIPLES-3-RDFStore/utils/rdfsh.pl
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/triplesoup/donations/TRIPLES-3-RDFStore/utils/vocabulary-generator.pl
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-3-RDFStore/utils/vocabulary-generator.pl?view=auto&rev=528394
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-3-RDFStore/utils/vocabulary-generator.pl (added)
+++ incubator/triplesoup/donations/TRIPLES-3-RDFStore/utils/vocabulary-generator.pl Fri Apr 13 01:56:01 2007
@@ -0,0 +1,129 @@
+#!/usr/bin/perl
+##############################################################################
+# 	Copyright (c) 2000-2006 All rights reserved
+# 	Alberto Reggiori <ar...@webweaving.org>
+#	Dirk-Willem van Gulik <di...@webweaving.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer. 
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in
+#    the documentation and/or other materials provided with the
+#    distribution.
+#
+# 3. The end-user documentation included with the redistribution,
+#    if any, must include the following acknowledgment:
+#       "This product includes software developed by 
+#        Alberto Reggiori <ar...@webweaving.org> and
+#        Dirk-Willem van Gulik <di...@webweaving.org>."
+#    Alternately, this acknowledgment may appear in the software itself,
+#    if and wherever such third-party acknowledgments normally appear.
+#
+# 4. All advertising materials mentioning features or use of this software
+#    must display the following acknowledgement:
+#    This product includes software developed by the University of
+#    California, Berkeley and its contributors. 
+#
+# 5. Neither the name of the University nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+#
+# 6. Products derived from this software may not be called "RDFStore"
+#    nor may "RDFStore" appear in their names without prior written
+#    permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+# OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# ====================================================================
+#
+# This software consists of work developed by Alberto Reggiori and 
+# Dirk-Willem van Gulik. The RDF specific part is based on public 
+# domain software written at the Stanford University Database Group by 
+# Sergey Melnik. For more information on the RDF API Draft work, 
+# please see <http://www-db.stanford.edu/~melnik/rdf/api.html>
+# The DBMS TCP/IP server part is based on software originally written
+# by Dirk-Willem van Gulik for Web Weaving Internet Engineering m/v Enschede,
+# The Netherlands.
+#
+##############################################################################
+# this is the script to actually run the RDF Schema generator
+
+use Carp;
+use RDFStore::NodeFactory;
+use RDFStore::Parser::SiRPAC;
+use RDFStore::Vocabulary::Generator;
+    
+my $f = new RDFStore::NodeFactory();
+my @schemas = ();
+
+my ($outputDirectory, $packageClass, $namespace, $factoryStr);
+      
+# parse options
+while (my $opt = shift @ARGV) {
+	if($opt =~ /\-d/) {
+		$outputDirectory = shift @ARGV;
+	} elsif($opt =~ /\-o/) {
+		$packageClass = shift @ARGV;
+	} elsif($opt =~ /\-s/) {
+		push @schemas,shift @ARGV;
+	} elsif($opt =~ /\-n/) {
+		$namespace = shift @ARGV;
+	} elsif($opt =~ /\-f/) {
+		$factoryStr = shift @ARGV;
+	};
+};
+
+if(scalar(@schemas) == 0) {
+	print STDERR "Usage: Generator {-s <schema file or URL>}+ -o <output class name> -n <namespace> [-f <node factory class name>] [-d <output directory>]\n"." If -d is not specified, generated class will be printed to standard output.\n";
+	exit(1);
+};
+
+my $generator = new RDFStore::Vocabulary::Generator();
+$packageClass = $generator->{DEFAULT_PACKAGE_CLASS}
+	unless(defined $packageClass);
+
+my $all;
+foreach my $schemaURL (@schemas) {
+	$namespace = $schemaURL
+		unless(defined $namespace);
+
+	my $p=new RDFStore::Parser::SiRPAC( ErrorContext => 2, 
+				Style => 'RDFStore::Parser::Styles::RDFStore::Model',
+				NodeFactory	=> $f,
+				Source	=> $namespace );
+
+	my $m = $p->parsefile($schemaURL);
+	print STDERR "Reading schema from ".$schemaURL."\n";
+
+        if(!(defined $all)) {
+        	#$all = $m->find(); #tricky get a VirtualModel here :-) otherwise it would be a type-cast
+        	$all = $m;
+        } else {
+        	$all->unite($m);
+	};
+#print $all->toStrawmanRDF(),"\n";
+};
+
+print STDERR "Total statements: ".$all->size(),"\n";
+
+$outputDirectory .= '/'
+        unless( (not(defined $outputDirectory)) || ($outputDirectory eq '') || ($outputDirectory =~ /\s+/) || ($outputDirectory =~ /\/$/) );
+
+$generator->createVocabulary($packageClass, $all, $namespace, $outputDirectory, $factoryStr) or
+	die "Could not generate vocabulary";

Propchange: incubator/triplesoup/donations/TRIPLES-3-RDFStore/utils/vocabulary-generator.pl
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/triplesoup/donations/TRIPLES-3-RDFStore/vocabularies/contexts.rdf
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-3-RDFStore/vocabularies/contexts.rdf?view=auto&rev=528394
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-3-RDFStore/vocabularies/contexts.rdf (added)
+++ incubator/triplesoup/donations/TRIPLES-3-RDFStore/vocabularies/contexts.rdf Fri Apr 13 01:56:01 2007
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE rdf:RDF [
+	<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
+	<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
+	<!ENTITY dc "http://purl.org/dc/elements/1.1/" >
+	<!ENTITY dcq "http://purl.org/dc/terms/" > 
+	<!ENTITY dctypes "http://purl.org/dc/dcmitype/" > 
+  	<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
+  	<!ENTITY owl "http://www.w3.org/2002/07/owl#" >
+  	<!ENTITY foaf "http://xmlns.com/foaf/0.1/" >
+  	<!ENTITY abc "http://metadata.net/harmony#" >
+  	<!ENTITY rdfstore "http://rdfstore.sourceforge.net/contexts/">
+	]>
+	
+<!-- ISC RDF Schema configuration file -->
+	
+<rdf:RDF 
+	xml:lang="en" 
+	xmlns:rdf="&rdf;" 
+	xmlns:rdfs="&rdfs;" 
+	xmlns:dc="&dc;" 
+	xmlns:dcq="&dcq;" 
+	xmlns:dctypes="&dctypes;" 
+	xmlns:foaf="&foaf;"
+	xmlns:xsd="&xsd;"
+	xmlns:owl="&owl;"
+	xml:base="&rdfstore;"
+	>
+	
+	<!-- Description of this schema. -->
+	
+	<rdf:Description rdf:about="&rdfstore;">
+		<rdfs:comment xml:lang="en">RDF Schema for simple RDFStore context support</rdfs:comment>
+		<rdfs:label xml:lang="en">RDF Schema for simple RDFStore context support</rdfs:label>
+		<dc:title xml:lang="en">RDF Schema for simple RDFStore context support</dc:title>
+		<dc:publisher>
+			<foaf:Organisation foaf:homepage="http://www.asemantics.com" />
+		</dc:publisher>
+		<dc:description xml:lang="en">ISC RDF Schema configuration file</dc:description>
+		<dc:creator>
+			<foaf:Person foaf:homepage="http://reggiori.webweaving.org" />
+		</dc:creator>
+		<dcq:modified>2004-02-18</dcq:modified>
+	</rdf:Description>
+	
+	<rdfs:Class rdf:about="&rdfstore;Context">
+		<rdfs:comment xml:lang="en">Context</rdfs:comment>
+		<rdfs:label xml:lang="en">Context</rdfs:label>
+		<!-- perhaps add the ABC schema here as father... - also to look at GK context schema perhaps -->
+		<rdfs:subClassOf rdf:resource="&abc;Situation"/>
+		<rdfs:isDefinedBy rdf:resource="&rdfstore;"/>
+	</rdfs:Class>
+
+	<rdfs:Class rdf:about="&rdfstore;EmptyContext">
+		<rdfs:comment xml:lang="en">Empty (NULL) Context</rdfs:comment>
+		<rdfs:label xml:lang="en">Empty (NULL) Context</rdfs:label>
+		<!-- perhaps add the ABC schema here as father... - also to look at GK context schema perhaps -->
+		<rdfs:subClassOf rdf:resource="&abc;Situation"/>
+		<rdfs:isDefinedBy rdf:resource="&rdfstore;"/>
+	</rdfs:Class>
+
+</rdf:RDF>