incubator-triplesoup-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From leosim...@apache.org
Subject svn commit: r528394 [31/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...
Date Fri, 13 Apr 2007 08:56:16 GMT
Added: incubator/triplesoup/donations/TRIPLES-3-RDFStore/t/05_serializer.t
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-3-RDFStore/t/05_serializer.t?view=auto&rev=528394
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-3-RDFStore/t/05_serializer.t (added)
+++ incubator/triplesoup/donations/TRIPLES-3-RDFStore/t/05_serializer.t Fri Apr 13 01:56:01
2007
@@ -0,0 +1,96 @@
+BEGIN {print "1..6\n";}
+END { print "not ok 1\n" unless $::loaded; RDFStore::debug_malloc_dump(); };
+
+my $a = "";
+local $SIG{__WARN__} = sub {$a = $_[0]} ;
+
+sub ok
+{
+    my $no = shift ;
+    my $result = shift ;
+ 
+    print "not " unless $result ;
+    print "ok $no\n" ;
+}
+
+use RDFStore::Serializer::RDFXML;
+use RDFStore::Serializer::NTriples;
+
+#use RDFStore::Parser::NTriples;
+use RDFStore::Parser::SiRPAC;
+use RDFStore::NodeFactory;
+
+$loaded = 1;
+print "ok 1\n";
+
+my $tt=2;
+my $factory = new RDFStore::NodeFactory();
+#ok $tt++, my $parser1 = new RDFStore::Parser::NTriples(Style => 'RDFStore::Parser::Styles::RDFStore::Model',NodeFactory
=> $factory );
+ok $tt++, my $parser2 = new RDFStore::Parser::SiRPAC(Style => 'RDFStore::Parser::Styles::RDFStore::Model',
NodeFactory => $factory );
+
+my $rdfstring = qq|<rdf:RDF
+	xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
+	xmlns:a='http://description.org/schema/'>
+<rdf:Description rdf:about='http://www.w3.org'>
+	<a:Date>1998-10-03T02:27</a:Date>
+	<a:Publisher>World Wide Web Consortium</a:Publisher>
+	<a:Title>W3C Home Page</a:Title>
+	<a:memyI> </a:memyI>
+	<a:albe rdf:parseType='Literal'><this xmlns:is="http://iscool.org" xmlns="http://anduot.edu"
is:me="a test">
+Hei!!<me you="US"><you><a><b/></a></you>aaaa</me>
+
+ciao!!!
+<test2/>
+
+---lsls;s</this></a:albe>
+	<a:ee>EEEEE</a:ee>
+        <a:bb rdf:parseType="Literal"><a:raffa xmlns:a="http://description.org/schema/">Ella</a:raffa></a:bb>
+	<a:test2>aabbccdd</a:test2>
+	<a:test3>aabbccdd</a:test3>
+</rdf:Description>
+<rdf:Description rdf:about='http://www.w3.org/aaaa'>
+	<a:test1>CCCCCCC</a:test1>
+</rdf:Description>
+</rdf:RDF>|;
+
+#my $model1;
+#eval {
+#    $model1 = $parser1->parsestring($rdfstrawmanstring);
+#};
+#ok $tt++, !$@;
+
+#ok $tt++, ( $model1->serialize(undef, "Strawman") eq $model1->toStrawmanRDF );
+#ok $tt++, ( $model1->serialize(undef, "Strawman") eq $rdfstrawmanstring ); # pure conversion?
+
+my $model2;
+eval {
+    $model2 = $parser2->parsestring($rdfstring);
+};
+ok $tt++, !$@;
+
+ok $tt++,  $model2->serialize(undef,"N-Triples" );
+ok $tt++,  $model2->serialize(undef,undef,{ 'http://description.org/schema/' => 'a'
} );
+
+#not yet...
+#print $model2->serialize(undef,undef,{ 'http://description.org/schema/' => 'a' } );
+#open(A,">a.txt");
+#print A $model2->serialize(undef,undef,{ 'http://description.org/schema/' => 'a' }
);
+#close(A);
+#open(B,">b.txt");
+#print B $rdfstring;
+#close(B);
+#ok $tt++, ( $model2->serialize(undef,undef,{ 'http://description.org/schema/' => 'a'
} ) eq $rdfstring ); # pure conversion?
+
+my $statement = $factory->createStatement(	$factory->createResource('http://www.w3.org/Home/Lassila'),
+						$factory->createResource('http://description.org/schema/','Author'),
+						$factory->createLiteral('Ora Lissala') );
+#my $meta_statement = $factory->createStatement(	$statement,
+#						$factory->createResource('http://description.org/schema/','MetaAuthor'),
+#						$factory->createLiteral('meMyselI') );
+#my $meta_meta_statement = $factory->createStatement(	$meta_statement,
+#						$factory->createResource('http://description.org/schema/','MetaMetaAuthor'),
+#						$factory->createLiteral('You') );
+#$model2->add( $meta_statement );
+#$model2->add( $meta_meta_statement );
+ok $tt++,  $model2->serialize(undef,undef,{ 'http://description.org/schema/' => 'a'
} );
+#print $model2->serialize(undef,undef,{ 'http://description.org/schema/' => 'a' } );

Added: incubator/triplesoup/donations/TRIPLES-3-RDFStore/t/06_objects.t
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-3-RDFStore/t/06_objects.t?view=auto&rev=528394
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-3-RDFStore/t/06_objects.t (added)
+++ incubator/triplesoup/donations/TRIPLES-3-RDFStore/t/06_objects.t Fri Apr 13 01:56:01 2007
@@ -0,0 +1,74 @@
+use strict ;
+ 
+BEGIN { print "1..14\n"; };
+END { print "not ok 1\n" unless $::loaded; RDFStore::debug_malloc_dump(); eval{ rmtree('cooltest');
}; };
+
+my $a = "";
+local $SIG{__WARN__} = sub {$a = $_[0]} ;
+ 
+sub ok
+{
+    my $no = shift ;
+    my $result = shift ;
+ 
+    print "not " unless $result ;
+    print "ok $no\n" ;
+}
+ 
+sub docat
+{
+    my $file = shift;
+    local $/ = undef;
+    open(CAT,$file) || die "Cannot open $file:$!";
+    my $result = <CAT>;
+    close(CAT);
+    return $result;
+};
+
+#$::debug=1;
+
+umask(0);
+
+use RDFStore::Object;
+
+$::loaded = 1;
+print "ok 1\n";
+
+my $tt=2;
+
+#simplest
+ok $tt++, my $rdf_obj = new RDFStore::Object;
+#ok $tt++, $rdf_obj->define( 'cip' => { 'namespace' => 'http://earth.esa.int/standards/cip/',
'URI' => 'file:///Users/reggiori/tmp/www-asemantics/demo/biz/infeo/cip.rdf', 'content_type'
=> 'RDF/XML' } );
+ok $tt++, $rdf_obj->define( 'cip' => { 'namespace' => 'http://earth.esa.int/standards/cip/'
} );
+ok $tt++, ! $rdf_obj->getNamespace;
+ok $tt++, ! $rdf_obj->getLocalName;
+
+#print $rdf_obj->load( 'file:///Users/reggiori/tmp/Ireland_ASA_WSM_Orbit_09567_20031229.rdf'
);
+#$rdf_obj->load( $rdf_obj->{'prefixes'}->{'cip'}->{'schema'} );
+
+$rdf_obj->export( 'foaf', 'dc');
+$rdf_obj->foaf::name( "BLAAAA" );
+
+$rdf_obj->set( 'cip:title' => 'foo bar' );
+$rdf_obj->set( 'dc:title' => 'foo bar' );
+$rdf_obj->set( 'dc:title' => [ 't1', 't2', 't3' , [ 't5' ], { 'foaf:Person' } ] );
+
+#print $rdf_obj->serialize."\n";
+
+my @vals = map { $_->toString } $rdf_obj->get( 'cip:title' );
+ok $tt++, @vals;
+ok $tt++, ($#vals==0);
+ok $tt++, ($vals[0] eq 'foo bar');
+eval { @vals = map { $_->toString } $rdf_obj->cip::title; };
+ok $tt++, $@;
+
+@vals = map { $_->toString } $rdf_obj->dc::title;
+ok $tt++, @vals;
+ok $tt++, $#vals==1;
+
+ok $tt++, my $rdf_obj1 = new RDFStore::Object('http://www.google.com/index.php');
+ok $tt++, $rdf_obj1->connect;
+
+my $connection;
+ok $tt++, $connection = $rdf_obj1->connection;
+#ok $tt++, $connection->fetch_object( $rdf_obj1 )->getResource( $rdf_obj1 )->equals(
$rdf_obj1 );

Added: incubator/triplesoup/donations/TRIPLES-3-RDFStore/t/rdf-syntax-ns-examples.xml
URL: http://svn.apache.org/viewvc/incubator/triplesoup/donations/TRIPLES-3-RDFStore/t/rdf-syntax-ns-examples.xml?view=auto&rev=528394
==============================================================================
--- incubator/triplesoup/donations/TRIPLES-3-RDFStore/t/rdf-syntax-ns-examples.xml (added)
+++ incubator/triplesoup/donations/TRIPLES-3-RDFStore/t/rdf-syntax-ns-examples.xml Fri Apr
13 01:56:01 2007
@@ -0,0 +1,180 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!-- RDF test suite coming from http://www.w3.org/1999/02/22-rdf-syntax-ns -->
+<RDF
+    xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+    xmlns:s="http://description.org/schema/"
+    xmlns:a="http://description.org/schema/"
+    xmlns:v="http://description.org/schema/">
+
+<!-- Basic Serialization Syntax -->
+
+<rdf:Description rdf:about="http://www.w3.org/Home/Lassila">
+      <s:Creator>Ora Lassila</s:Creator>
+    </rdf:Description>
+
+<Description rdf:about="http://www.w3.org/Home/Lassila">
+      <s:Creator>Ora Lassila</s:Creator>
+    </Description>
+
+<Description rdf:about="http://www.w3.org/Home/Lassila">
+      <s:Creator xmlns:s="http://description.org/schema/">Ora Lassila</s:Creator>
+    </Description>
+
+<Description rdf:about="http://www.w3.org/Home/Lassila">
+      <Creator xmlns="http://description.org/schema/">Ora Lassila</Creator>
+    </Description>
+
+<!-- Basic Abbreviated Syntax -->
+
+<rdf:Description rdf:about="http://www.w3.org/Home/Lassila"
+                     s:Creator="Ora Lassila" />
+
+<rdf:Description rdf:about="http://www.w3.org">
+      <s:Publisher>World Wide Web Consortium</s:Publisher>
+      <s:Title>W3C Home Page</s:Title>
+      <s:Date>1998-10-03T02:27</s:Date>
+    </rdf:Description>
+
+<rdf:Description rdf:about="http://www.w3.org"
+         s:Publisher="World Wide Web Consortium"
+         s:Title="W3C Home Page"
+         s:Date="1998-10-03T02:27"/>
+
+<rdf:Description rdf:about="http://www.w3.org/Home/Lassila">
+      <s:Creator rdf:resource="http://www.w3.org/staffId/85740"/>
+    </rdf:Description>
+
+    <rdf:Description rdf:about="http://www.w3.org/staffId/85740">
+      <v:Name>Ora Lassila</v:Name>
+      <v:Email>lassila@w3.org</v:Email>
+    </rdf:Description>
+
+<rdf:Description rdf:about="http://www.w3.org/Home/Lassila">
+      <s:Creator>
+        <rdf:Description rdf:about="http://www.w3.org/staffId/85740">
+          <v:Name>Ora Lassila</v:Name>
+          <v:Email>lassila@w3.org</v:Email>
+        </rdf:Description>
+      </s:Creator>
+    </rdf:Description>
+
+<!--
+<rdf:Description rdf:about="http://www.w3.org/Home/Lassila">
+      <s:Creator rdf:resource="http://www.w3.org/staffId/85740"
+         v:Name="Ora Lassila"
+         v:Email="lassila@w3.org" />
+    </rdf:Description>
+-->
+
+<rdf:Description rdf:about="http://www.w3.org/Home/Lassila">
+      <s:Creator>
+        <rdf:Description rdf:about="http://www.w3.org/staffId/85740">
+          <rdf:type rdf:resource="http://description.org/schema/Person"/>
+          <v:Name>Ora Lassila</v:Name>
+          <v:Email>lassila@w3.org</v:Email>
+        </rdf:Description>
+      </s:Creator>
+    </rdf:Description>
+
+<rdf:Description rdf:about="http://www.w3.org/Home/Lassila">
+      <s:Creator>
+        <s:Person rdf:about="http://www.w3.org/staffId/85740">
+          <v:Name>Ora Lassila</v:Name>
+          <v:Email>lassila@w3.org</v:Email>
+        </s:Person>
+      </s:Creator>
+    </rdf:Description>
+
+<!-- Containers -->
+
+<rdf:Description rdf:about="http://mycollege.edu/courses/6.001">
+      <s:students>
+        <rdf:Bag>
+          <rdf:li rdf:resource="http://mycollege.edu/students/Amy"/>
+          <rdf:li rdf:resource="http://mycollege.edu/students/Tim"/>
+          <rdf:li rdf:resource="http://mycollege.edu/students/John"/>
+          <rdf:li rdf:resource="http://mycollege.edu/students/Mary"/>
+          <rdf:li rdf:resource="http://mycollege.edu/students/Sue"/>
+        </rdf:Bag>
+      </s:students>
+    </rdf:Description>
+
+<rdf:Description rdf:about="http://x.org/packages/X11">
+      <s:DistributionSite>
+        <rdf:Alt>
+          <rdf:li rdf:resource="ftp://ftp.x.org"/>
+          <rdf:li rdf:resource="ftp://ftp.cs.purdue.edu"/>
+          <rdf:li rdf:resource="ftp://ftp.eu.net"/>
+        </rdf:Alt>
+      </s:DistributionSite>
+    </rdf:Description>
+
+<!-- Distributive Referents: Statements about Members of a Container -->
+
+<rdf:Bag ID="pages">
+    <rdf:li rdf:resource="http://foo.org/foo.html" />
+    <rdf:li rdf:resource="http://bar.org/bar.html" />
+  </rdf:Bag>
+
+  <rdf:Description rdf:about="#pages">
+    <s:Creator>Ora Lassila</s:Creator>
+  </rdf:Description>
+
+<!-- not supported by PenRDF -->
+<!--
+<rdf:Description aboutEach="#pages">
+    <s:Creator>Ora Lassila</s:Creator>
+  </rdf:Description>
+
+<rdf:Description rdf:about="http://foo.org/foo.html">
+    <s:Creator>Ora Lassila</s:Creator>
+  </rdf:Description>
+
+  <rdf:Description rdf:about="http://bar.org/bar.html">
+    <s:Creator>Ora Lassila</s:Creator>
+  </rdf:Description>
+
+<rdf:Description aboutEachPrefix="http://foo.org/doc">
+    <s:Copyright>© 1998, The Foo Organization</s:Copyright>
+  </rdf:Description>
+
+<rdf:Description rdf:about="http://foo.org/doc/page1">
+    <s:Copyright>© 1998, The Foo Organization</s:Copyright>
+  </rdf:Description>
+  <rdf:Description rdf:about="http://foo.org/doc/page2">
+    <s:Copyright>© 1998, The Foo Organization</s:Copyright>
+  </rdf:Description>
+
+<rdf:Description aboutEach="#docpages">
+    <s:Copyright>© 1998, The Foo Organization</s:Copyright>
+  </rdf:Description>
+  <rdf:Bag ID="docpages">
+    <rdf:li rdf:resource="http://foo.org/doc/page1"/>
+    <rdf:li rdf:resource="http://foo.org/doc/page2"/>
+  </rdf:Bag>
+-->
+
+<!-- Reification -->
+
+<rdf:Description>
+      <rdf:subject rdf:resource="http://www.w3.org/Home/Lassila" />
+      <rdf:predicate rdf:resource="http://description.org/schema/Creator" />
+      <rdf:object>Ora Lassila</rdf:object>
+      <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement" />
+      <a:attributedTo>Ralph Swick</a:attributedTo>
+    </rdf:Description>
+
+<rdf:Description rdf:about="http://www.w3.org/Home/Lassila" bagID="D_001">
+      <s:Creator>Ora Lassila</s:Creator>
+      <s:Title>Ora's Home Page</s:Title>
+    </rdf:Description>
+
+<!-- Syntactic Shorthand for Statements About Statements -->
+<!-- not suppoerted 
+<rdf:Description aboutEach="#D_001">
+    <a:attributedTo>Ralph Swick</a:attributedTo>
+  </rdf:Description>
+-->
+
+</RDF>



Mime
View raw message