You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(19) |
Jul
(6) |
Aug
(65) |
Sep
(4) |
Oct
(5) |
Nov
(8) |
Dec
(2) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(1) |
Feb
(9) |
Mar
(1) |
Apr
|
May
(8) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <cw...@us...> - 2008-06-20 12:20:13
|
Revision: 575 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=575&view=rev Author: cweiske Date: 2008-06-20 05:20:12 -0700 (Fri, 20 Jun 2008) Log Message: ----------- no need to use infModelP.php Modified Paths: -------------- trunk/rdfapi-php/api/infModel/InfModelB.php trunk/rdfapi-php/api/infModel/InfModelF.php Modified: trunk/rdfapi-php/api/infModel/InfModelB.php =================================================================== --- trunk/rdfapi-php/api/infModel/InfModelB.php 2008-05-26 18:18:16 UTC (rev 574) +++ trunk/rdfapi-php/api/infModel/InfModelB.php 2008-06-20 12:20:12 UTC (rev 575) @@ -2,6 +2,7 @@ // ---------------------------------------------------------------------------------- // Class: InfModelB // ---------------------------------------------------------------------------------- +require_once RDFAPI_INCLUDE_DIR . 'infModel/InfModel.php'; /** * A InfModelB extends the InfModel Class, with a backward chaining algorithm. Modified: trunk/rdfapi-php/api/infModel/InfModelF.php =================================================================== --- trunk/rdfapi-php/api/infModel/InfModelF.php 2008-05-26 18:18:16 UTC (rev 574) +++ trunk/rdfapi-php/api/infModel/InfModelF.php 2008-06-20 12:20:12 UTC (rev 575) @@ -2,6 +2,7 @@ // ---------------------------------------------------------------------------------- // Class: InfModelF // ---------------------------------------------------------------------------------- +require_once RDFAPI_INCLUDE_DIR . 'infModel/InfModel.php'; /** * A InfModelF extends the InfModel Class, with a forward chaining algorithm. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tg...@us...> - 2008-05-26 18:18:21
|
Revision: 574 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=574&view=rev Author: tgauss Date: 2008-05-26 11:18:16 -0700 (Mon, 26 May 2008) Log Message: ----------- Subject label is now CDATA Modified Paths: -------------- trunk/bookmashup/ApiQueryService.php Modified: trunk/bookmashup/ApiQueryService.php =================================================================== --- trunk/bookmashup/ApiQueryService.php 2008-05-26 09:04:29 UTC (rev 573) +++ trunk/bookmashup/ApiQueryService.php 2008-05-26 18:18:16 UTC (rev 574) @@ -303,7 +303,7 @@ foreach($subjects as $kk => $subject){ $subjectUri = new Resource(substr($newuri,0,$pos+1).urlencode($subject)); $model->add(new Statement($itemresource, $skosSubject, $subjectUri)); - $model->add(new Statement($subjectUri, new Resource("http://www.w3.org/2000/01/rdf-schema#label"), new Literal($subject))); + $model->add(new Statement($subjectUri, new Resource("http://www.w3.org/2000/01/rdf-schema#label"), new Literal((string)$subject))); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cyg...@us...> - 2008-05-26 09:04:33
|
Revision: 573 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=573&view=rev Author: cyganiak Date: 2008-05-26 02:04:29 -0700 (Mon, 26 May 2008) Log Message: ----------- Bugfix: There were always two extra newlines before the content due to poor HTTP implementation. Found by Venkat Yaday Modified Paths: -------------- trunk/rdfapi-php/api/sparql/SparqlClient.php Modified: trunk/rdfapi-php/api/sparql/SparqlClient.php =================================================================== --- trunk/rdfapi-php/api/sparql/SparqlClient.php 2008-05-23 18:59:23 UTC (rev 572) +++ trunk/rdfapi-php/api/sparql/SparqlClient.php 2008-05-26 09:04:29 UTC (rev 573) @@ -131,10 +131,10 @@ $replace = $url['path']; - fputs($fp, "GET ".$replace."?".$url['query']." HTTP/1.0\n"); - fputs($fp, "Host:". $url['host']." \r\n"); + fputs($fp, "GET ".$replace."?".$url['query']." HTTP/1.0\r\n"); + fputs($fp, "Host: ". $url['host']."\r\n"); fputs($fp, "Accept: application/sparql-results+xml, application/rdf+xml\r\n"); - fputs($fp, "Connection: close\n\n"); + fputs($fp, "Connection: close\r\n\r\n"); $buffer = ""; while ($tmp = fread($fp, 1024)) @@ -142,19 +142,10 @@ $buffer .= $tmp; } - $pos1 = strpos($buffer,"\r\n\r\n"); - $pos2 = strpos($buffer,"\n\n"); - if ($pos1 === false) { - $pos = $pos2; - } else { - $pos = $pos1; - } - - return substr($buffer,$pos); - + return preg_replace("/^.*?(\r\n\r\n|\n\n)/s", "", $buffer); } } -?> \ No newline at end of file +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tg...@us...> - 2008-05-23 18:59:25
|
Revision: 572 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=572&view=rev Author: tgauss Date: 2008-05-23 11:59:23 -0700 (Fri, 23 May 2008) Log Message: ----------- Redirects for dereferencing subjects added Modified Paths: -------------- trunk/bookmashup/.htaccess Modified: trunk/bookmashup/.htaccess =================================================================== --- trunk/bookmashup/.htaccess 2008-05-20 17:55:10 UTC (rev 571) +++ trunk/bookmashup/.htaccess 2008-05-23 18:59:23 UTC (rev 572) @@ -4,7 +4,7 @@ RewriteRule ^$ http://sites.wiwiss.fu-berlin.de/suhl/bizer/bookmashup/ [R,L] # Implement 303 redirects for URIs that identify books, reviews etc -RewriteRule ^(books|reviews|persons|offers|shops)/(.*) /bookmashup/doc/$1/$2 [R=303,L] +RewriteRule ^(books|reviews|persons|subject|offers|shops)/(.*) /bookmashup/doc/$1/$2 [R=303,L] # Call bookmashup.php for document URIs -RewriteRule ^doc/(books|reviews|persons|offers|shops)/(.*) /bookmashup/bookmashup.php?type=$1&item=$2 [L] +RewriteRule ^doc/(books|reviews|persons|subject|offers|shops)/(.*) /bookmashup/bookmashup.php?type=$1&item=$2 [L] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tg...@us...> - 2008-05-20 17:55:14
|
Revision: 571 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=571&view=rev Author: tgauss Date: 2008-05-20 10:55:10 -0700 (Tue, 20 May 2008) Log Message: ----------- search for dereferencing subjects added. skos namespace added Modified Paths: -------------- trunk/bookmashup/bookmashup.php Modified: trunk/bookmashup/bookmashup.php =================================================================== --- trunk/bookmashup/bookmashup.php 2008-05-20 17:54:16 UTC (rev 570) +++ trunk/bookmashup/bookmashup.php 2008-05-20 17:55:10 UTC (rev 571) @@ -11,6 +11,8 @@ // Create an RDF model and fill with information about the resource $type = @$_GET["type"]; $item = @$_GET["item"]; + + $documentURI = BOOKMASHUP_BASE . "doc/" . urlencode($type) . "/" . urlencode($item); $resourceID = BOOKMASHUP_BASE . urlencode($type) . "/" . urlencode($item); $service = new ApiQueryService($resourceID, $documentURI); @@ -25,6 +27,8 @@ $service->findOffer($model, urlencode($item)); } else if ($type == "shops") { $service->findShop($model, $item); +} else if ($type == "subject") { + $service->findSubject($model, $item); } else { header("HTTP/1.1 404 Not Found"); header("Content-Type: text/plain"); @@ -61,6 +65,7 @@ $s->addNamespacePrefix('scom', 'http://sites.wiwiss.fu-berlin.de/suhl/bizer/bookmashup/simpleCommerceVocab01.rdf#'); $s->addNamespacePrefix('bookRdf', 'http://www.hackcraft.net/bookrdf/vocab/0_1/'); $s->addNamespacePrefix('owl', 'http://www.w3.org/2002/07/owl#'); +$s->addNamespacePrefix('skos','http://www.w3.org/2004/02/skos/core#'); echo $s->serialize($model); ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tg...@us...> - 2008-05-20 17:54:18
|
Revision: 570 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=570&view=rev Author: tgauss Date: 2008-05-20 10:54:16 -0700 (Tue, 20 May 2008) Log Message: ----------- search for dereferencing subjects added Modified Paths: -------------- trunk/bookmashup/ApiQueryService.php Modified: trunk/bookmashup/ApiQueryService.php =================================================================== --- trunk/bookmashup/ApiQueryService.php 2008-05-19 05:24:39 UTC (rev 569) +++ trunk/bookmashup/ApiQueryService.php 2008-05-20 17:54:16 UTC (rev 570) @@ -71,6 +71,12 @@ return $result; } + public function findSubject(MemModel $model, $subject){ + $name = urldecode($subject); + $result = false; + $result = $this->addSubjectToModel($model,$name); + } + private function addGoogleOffersToModel(MemModel $model){ $isbn = substr($this->uri,strrpos($this->uri,"/")+1,strlen($this->uri)); $itemresource = new Resource($this->uri); @@ -106,6 +112,19 @@ $this->dblpLookup($name,$model); return true; } + + + private function addSubjectToModel(MemModel $model,$name){ + $itemresource = new Resource($this->uri); + // rdf:type + $model->add(new Statement($itemresource, new Resource(RDF_NAMESPACE_URI.RDF_TYPE), new Resource("http://www.w3.org/2004/02/skos/core#Concept"))); + // rdfs:label + $model->add(new Statement($itemresource, new Resource("http://www.w3.org/2000/01/rdf-schema#label"), new Literal($name))); + // + $this->findBooksSubjectOf($model,$name); + $model->add(new Statement(new Resource($this->document),new Resource("http://www.w3.org/2000/01/rdf-schema#label"),new Literal("RDF document describing: ".$name))); + return true; + } private function findBooksFromAuthor($model,$name){ $xml = $this->queryAmazon($name); @@ -121,6 +140,29 @@ } } + private function findBooksSubjectOf($model,$name){ + $xml = $this->amazonPowerSearchSubject($name); + foreach($xml->Items->Item as $index =>$item){ + if(isset($item->ItemAttributes->ISBN)){ + //add book to model + $book = str_replace("/subject/","/books/",$this->uri); + $book = substr($book,0,strrpos($book,"/")+1).$item->ItemAttributes->ISBN; + $model->add(new Statement(new Resource($book) ,new Resource("http://www.w3.org/2000/01/rdf-schema#label"),new Literal($item->ItemAttributes->Title))); + $model->add(new Statement(new Resource($book) ,new Resource("http://purl.org/dc/elements/1.1/title"),new Literal($item->ItemAttributes->Title))); + // add at least the dereferenced model + $model->add(new Statement(new Resource($book) ,new Resource("http://www.w3.org/2004/02/skos/core#subject"),new Resource($this->uri))); + foreach($item->Subjects->Subject as $k => $subject){ + // generate URI for new subject + $pos = strrpos($this->uri,"/"); + $subjectUri = new Resource(substr($this->uri,0,$pos+1).urlencode($subject)); + // add to model if not the dereferenced subject (because it is already added + if($this->uri != $subjectUri) + $model->add(new Statement(new Resource($book) ,new Resource("http://www.w3.org/2004/02/skos/core#subject"),$subjectUri)); + } + } + } + } + private function findAmazonOffer($model,$offer,$isbn){ @@ -192,12 +234,20 @@ public function queryAmazon($query){ $searchIndex = "Books"; - $request="http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=".KEYID."&AssociateTag=".AssocTag."&Version=2006-09-11&Operation=ItemSearch&ResponseGroup=Medium"; + $request="http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=".KEYID."&AssociateTag=".AssocTag."&Version=2006-09-11&Operation=ItemSearch&ResponseGroup=Medium,Subjects"; $request.="&SearchIndex=$searchIndex&Keywords=".urlencode($query); $response = file_get_contents($request); return simplexml_load_string($response); } +public function amazonPowerSearchSubject($subject){ + $searchIndex = "Books"; + $request="http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=".KEYID."&AssociateTag=".AssocTag."&Version=2006-09-11&Operation=ItemSearch&ResponseGroup=Medium,Subjects"; + $request.="&SearchIndex=$searchIndex&Power=".urlencode('subject:"'.$subject.'"'); + $response = file_get_contents($request); + return simplexml_load_string($response); + } + private function addBookToModel(SimpleXMLElement $item,MemModel $model){ $itemresource = new Resource($this->uri); @@ -244,6 +294,20 @@ $model->add(new Statement($authorUri,new Resource("http://www.w3.org/2000/01/rdf-schema#label"),new Literal((string)$author))); } } + // subject(s) + $newuri = str_replace("/books/","/subject/",$this->uri); + $skosSubject = new Resource("http://www.w3.org/2004/02/skos/core#subject"); + $pos = strrpos($newuri,"/"); + if(isset($item->Subjects)){ + foreach($item->Subjects as $k => $subjects){ + foreach($subjects as $kk => $subject){ + $subjectUri = new Resource(substr($newuri,0,$pos+1).urlencode($subject)); + $model->add(new Statement($itemresource, $skosSubject, $subjectUri)); + $model->add(new Statement($subjectUri, new Resource("http://www.w3.org/2000/01/rdf-schema#label"), new Literal($subject))); + } + } + } + if(isset($item->ItemAttributes->Creator)){ foreach($item->ItemAttributes->Creator as $key => $creator){ $creatorUri = new Resource(substr($newuri,0,$pos+1).urlencode($creator)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <p_f...@us...> - 2008-05-19 05:24:42
|
Revision: 569 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=569&view=rev Author: p_frischmuth Date: 2008-05-18 22:24:39 -0700 (Sun, 18 May 2008) Log Message: ----------- [fixed] loadModelFromString for N3 Modified Paths: -------------- trunk/rdfapi-php/api/model/Model.php trunk/rdfapi-php/api/syntax/N3Parser.php trunk/rdfapi-php/test/unit/Model/Model_tests.php Modified: trunk/rdfapi-php/api/model/Model.php =================================================================== --- trunk/rdfapi-php/api/model/Model.php 2008-05-14 15:08:04 UTC (rev 568) +++ trunk/rdfapi-php/api/model/Model.php 2008-05-19 05:24:39 UTC (rev 569) @@ -170,10 +170,10 @@ E_USER_ERROR); } - if ($parser instanceof JsonParser) { + if (($parser instanceof JsonParser) || ($parser instanceof N3Parser)) { $parser->generateModelFromString($str, $this); } else { - $parser->generateModel($str, false, $this); + $temp = $parser->generateModel($str, false, $this); $this->addModel($temp); if($this->getBaseURI() == null) { Modified: trunk/rdfapi-php/api/syntax/N3Parser.php =================================================================== --- trunk/rdfapi-php/api/syntax/N3Parser.php 2008-05-14 15:08:04 UTC (rev 568) +++ trunk/rdfapi-php/api/syntax/N3Parser.php 2008-05-19 05:24:39 UTC (rev 569) @@ -247,6 +247,12 @@ $m = $this->parse2model($input,$model); return $m; } + + function generateModelFromString($n3String, $model) { + + $m = $this->parse2model($n3String, $model); + $m->addModel($m); + } /* ==================== Private Methods from here ==================== */ Modified: trunk/rdfapi-php/test/unit/Model/Model_tests.php =================================================================== --- trunk/rdfapi-php/test/unit/Model/Model_tests.php 2008-05-14 15:08:04 UTC (rev 568) +++ trunk/rdfapi-php/test/unit/Model/Model_tests.php 2008-05-19 05:24:39 UTC (rev 569) @@ -49,6 +49,18 @@ new Literal('Fred'))); $this->assertIdentical(1, $ont->size()); } + + function testLoadFromStringN3() { + $mem = &ModelFactory::getDefaultModel(); + + $n3String = '<http://example.com/res1> <http://example.com/label> "ttt" .'; + + $mem->loadFromString($n3String, 'n3'); + + $this->assertTrue($mem->contains(new Statement(new Resource('http://example.com/res1'), + new Resource('http://example.com/label'), + new Literal('ttt')))); + } } ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <p_f...@us...> - 2008-05-14 15:08:38
|
Revision: 568 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=568&view=rev Author: p_frischmuth Date: 2008-05-14 08:08:04 -0700 (Wed, 14 May 2008) Log Message: ----------- [fixed] loadFromString method for types other than json Modified Paths: -------------- trunk/rdfapi-php/api/model/Model.php Modified: trunk/rdfapi-php/api/model/Model.php =================================================================== --- trunk/rdfapi-php/api/model/Model.php 2008-05-06 19:51:51 UTC (rev 567) +++ trunk/rdfapi-php/api/model/Model.php 2008-05-14 15:08:04 UTC (rev 568) @@ -174,6 +174,11 @@ $parser->generateModelFromString($str, $this); } else { $parser->generateModel($str, false, $this); + + $this->addModel($temp); + if($this->getBaseURI() == null) { + $this->setBaseURI($temp->getBaseURI()); + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tg...@us...> - 2008-05-06 19:52:01
|
Revision: 567 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=567&view=rev Author: tgauss Date: 2008-05-06 12:51:51 -0700 (Tue, 06 May 2008) Log Message: ----------- 'Subjects' added to the queries response group parameter Modified Paths: -------------- trunk/bookmashup/search.php Modified: trunk/bookmashup/search.php =================================================================== --- trunk/bookmashup/search.php 2008-03-03 14:56:08 UTC (rev 566) +++ trunk/bookmashup/search.php 2008-05-06 19:51:51 UTC (rev 567) @@ -20,7 +20,7 @@ . "&AssociateTag=" . AssocTag . "&Version=2006-09-11" . "&Operation=ItemSearch" - . "&ResponseGroup=Medium" + . "&ResponseGroup=Medium,Subjects" . "&SearchIndex=" . $this->search_index . "&Keywords=" . urlencode($this->search_term) . "&ItemPage=" . $this->page; @@ -35,6 +35,7 @@ 'isbn' => (string) @$item->ItemAttributes->ISBN, 'title' => (string) @$item->ItemAttributes->Title, 'authors' => array(), + 'subjects' => array(), 'uri' => BOOKMASHUP_BASE . "books/" . @$item->ItemAttributes->ISBN, 'image' => (string) @$item->SmallImage->URL, ); @@ -45,6 +46,10 @@ foreach($item->ItemAttributes->Creator as $creator){ $book['authors'][] = (string) $creator; } + foreach ($item->Subjects->Subject as $subject){ + $book['subjects'][] = (string) $subject; + } + $this->results[] = $book; } $this->total_pages = (int) $xml->Items->TotalPages; @@ -72,6 +77,7 @@ $rdf_type = new Resource(RDF_NAMESPACE_URI . "type"); $rdfs_label = new Resource(RDF_SCHEMA_URI . "label"); $dc_creator = new Resource(DC_NS . "creator"); + $dc_subject = new Resource(DC_NS . "subject"); $foaf_name = new Resource(FOAF_NS . "name"); $foaf_depiction = new Resource(FOAF_NS . "depiction"); $SearchResultPage = new Resource(SEARCH_NS . "SearchResultPage"); @@ -118,6 +124,11 @@ $model->add(new Statement($this_result, $dc_creator, $this_author)); $model->add(new Statement($this_author, $foaf_name, new Literal($author))); } + foreach ($book['subjects'] as $key => $subject) { + $this_subject = new BlankNode("result{$i}_subject" . ($key + 1)); + $model->add(new Statement($this_result, $dc_subject, $this_subject)); + $model->add(new Statement($this_subject, $foaf_name, new Literal($subject))); + } } header('Content-Type: application/rdf+xml; charset=utf-8'); include(RDFAPI_INCLUDE_DIR . PACKAGE_SYNTAX_RDF); @@ -236,4 +247,4 @@ <small><a href="<?php echo BOOKMASHUP_BASE; ?>">Back to RDF Book Mashup</a></small> </div> </body> -</html> +</html> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2008-03-03 14:56:16
|
Revision: 566 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=566&view=rev Author: cax Date: 2008-03-03 06:56:08 -0800 (Mon, 03 Mar 2008) Log Message: ----------- Link to the online demo of rap_pubby added Modified Paths: -------------- trunk/rdfapi-php/doc/tutorial/RAP_Pubby.htm Modified: trunk/rdfapi-php/doc/tutorial/RAP_Pubby.htm =================================================================== --- trunk/rdfapi-php/doc/tutorial/RAP_Pubby.htm 2008-02-29 17:30:48 UTC (rev 565) +++ trunk/rdfapi-php/doc/tutorial/RAP_Pubby.htm 2008-03-03 14:56:08 UTC (rev 566) @@ -281,10 +281,12 @@ <p>Will be replaced with table rows containing 'property - property value' pairs of the resource beeing described. The styling of odd and even table rows can be altered in your css file by defining 'odd' and 'even' classes respectively. </p> <p> </p> <h2>Use Case Example</h2> -<p>RAP_Pubby distribution contains a small use case example showing information about the Web-based Systems Group @ Freie Universit\xE4t Berlin. To run this example: -<li>install RAP_Pubby (see installation section)</li> -<li>open config.php and modify the paramters RDFAPI_INCLUDE_DIR and PUBBY_WEBBASE</li> -<li>type the PUBBY_WEBBASE-URL into the address bar of your web browser</li> -</p> +<p>RAP_Pubby distribution contains a small use case example showing information about the Web-based Systems Group @ Freie Universit\xE4t Berlin. To run this example: </p> +<ul> + <li>install RAP_Pubby (see installation section)</li> + <li>open config.php and modify the paramters RDFAPI_INCLUDE_DIR and PUBBY_WEBBASE</li> + <li>type the PUBBY_WEBBASE-URL into the address bar of your web browser</li> +</ul> +<p>You can also view this example online at: <a href="http://www4.wiwiss.fu-berlin.de/rap-pubby/">http://www4.wiwiss.fu-berlin.de/rap-pubby/</a> </p> <br> </body></html> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2008-02-29 17:30:55
|
Revision: 565 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=565&view=rev Author: cax Date: 2008-02-29 09:30:48 -0800 (Fri, 29 Feb 2008) Log Message: ----------- false title fixed Modified Paths: -------------- trunk/rdfapi-php/doc/tutorial/RAP_Pubby.htm Modified: trunk/rdfapi-php/doc/tutorial/RAP_Pubby.htm =================================================================== --- trunk/rdfapi-php/doc/tutorial/RAP_Pubby.htm 2008-02-29 17:16:48 UTC (rev 564) +++ trunk/rdfapi-php/doc/tutorial/RAP_Pubby.htm 2008-02-29 17:30:48 UTC (rev 565) @@ -1,5 +1,5 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> -<html><head><title>RDF Net API</title> +<html><head><title>RAP_Pubby - A Linked Data Frontend for RAP</title> <meta content="text/html; charset=windows-1252" http-equiv="Content-Type"> <link href="../phpdoc.css" rel="stylesheet" type="text/css"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2008-02-29 17:16:56
|
Revision: 564 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=564&view=rev Author: cax Date: 2008-02-29 09:16:48 -0800 (Fri, 29 Feb 2008) Log Message: ----------- RAP_Pubby.htm moved to rap tutorials directory Modified Paths: -------------- trunk/rdfapi-php/doc/index.html trunk/rdfapi-php/doc/tests.html Added Paths: ----------- trunk/rdfapi-php/doc/tutorial/RAP_Pubby.htm Removed Paths: ------------- trunk/rdfapi-php/rap-pubby/doc/ Modified: trunk/rdfapi-php/doc/index.html =================================================================== --- trunk/rdfapi-php/doc/index.html 2008-02-29 16:02:33 UTC (rev 563) +++ trunk/rdfapi-php/doc/index.html 2008-02-29 17:16:48 UTC (rev 564) @@ -61,7 +61,7 @@ </LI> <LI>integrated <a href="tutorial/netapi.html">RDF server</a> providing similar functionality as the <a href="http://www.joseki.org/" target="_blank">Joseki RDF server</a></LI> - <LI>integrated <a href="../rap-pubby/doc/RAP_Pubby.htm">linked data frontend</a> </LI> + <LI>integrated <a href="tutorial/RAP_Pubby.htm">linked data frontend</a> </LI> <LI><a href="tutorial/db_utils.htm">graphical user-interface</a> for managing database-backed RDF models </LI> <LI>support for common <a href="tutorial/vocabularies.htm">vocabularies</a></LI> @@ -115,7 +115,7 @@ </TR> <TR> <TD align=middle valign="top">V0.9.6</TD> - <TD align=left><a href="../rap-pubby/doc/RAP_Pubby.htm">RAP_Pubby</a> - a linked data frontend for RAP added.<br /> + <TD align=left><a href="tutorial/RAP_Pubby.htm">RAP_Pubby</a> - a linked data frontend for RAP added.<br /> Multiple bugs fixed. </TD> <TD align=middle valign="top">2008-02-29</TD> </TR> Modified: trunk/rdfapi-php/doc/tests.html =================================================================== --- trunk/rdfapi-php/doc/tests.html 2008-02-29 16:02:33 UTC (rev 563) +++ trunk/rdfapi-php/doc/tests.html 2008-02-29 17:16:48 UTC (rev 564) @@ -81,7 +81,7 @@ </li> <li><a href="tutorial/usingtheSparqlClient.htm">SPARQL client</a><br><p> </li> - <li><a href="../rap-pubby/doc/RAP_Pubby.htm">RAP_Pubby</a></li> + <li><a href="tutorial/RAP_Pubby.htm">RAP_Pubby</a></li> </ol> <p> </p> <br> </td> Added: trunk/rdfapi-php/doc/tutorial/RAP_Pubby.htm =================================================================== --- trunk/rdfapi-php/doc/tutorial/RAP_Pubby.htm (rev 0) +++ trunk/rdfapi-php/doc/tutorial/RAP_Pubby.htm 2008-02-29 17:16:48 UTC (rev 564) @@ -0,0 +1,290 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html><head><title>RDF Net API</title> + +<meta content="text/html; charset=windows-1252" http-equiv="Content-Type"> +<link href="../phpdoc.css" rel="stylesheet" type="text/css"> +</head> +<body bgcolor="#ffffff"> + +<h3>RDF API for PHP </h3> +<h1>RAP_Pubby - + + + A Linked Data Frontend for RAP </h1> +<p>This document is part of the <a href="http://sites.wiwiss.fu-berlin.de/suhl/bizer/rdfapi/tests.html">RAP - Rdf API for PHP</a> documentation.</p> +<p>Radoslaw Oldakowski <<a href="mailto:ra...@gm...">ra...@gm...</a>><br> +Jan 2008</p> +<br> + +<h2>About</h2> +<p><strong>RAP_Pubby</strong> can be used to add <strong>Linked Data interfaces</strong> to RAP models.</p> +<p> <a href="http://linkeddata.org/">Linked Data </a> is a style of publishing data on the Semantic Web that makes it easy to interlink, discover and consume data on the Semantic Web. It allows a wide variety of existing RDF browsers (e.g. <a href="http://sites.wiwiss.fu-berlin.de/suhl/bizer/ng4j/disco/">Disco </a>, <a href="http://www.w3.org/2005/ajar/tab">Tabulator </a>, <a href="http://demo.openlinksw.com/DAV/JS/rdfbrowser/index.html">OpenLink Browser </a>), RDF crawlers (e.g. <a href="http://www.swse.org/">SWSE </a>, <a href="http://swoogle.umbc.edu/">Swoogle </a>), and query agents (e.g. <a href="http://sites.wiwiss.fu-berlin.de/suhl/bizer/ng4j/semwebclient/">SemWeb Client Library </a>, <a href="http://moustaki.org/swic/">SWIC </a>) to access the data. </p> +<p>RAP_Pubby was orignially inspired by <a href="http://www4.wiwiss.fu-berlin.de/pubby/">Pubby - A Linked Data Frontend for SPARQL Endpoints</a>. </p> +<h3> Features:</h3> +<ul> + <li> Provides a <strong>linked data interface</strong> to RAP RDF models (file or database backed) </li> + <li> Provides <strong>dereferenceable URIs</strong> by rewriting URIs found in the exposed dataset into the RAP_Pubby server's namespace </li> + <li> Provides a simple template-based <strong>HTML interface</strong> showing the data available about each resource </li> + <li> Takes care of handling <strong>303 redirects and content negotiation</strong> </li> +</ul> +<p> </p> +<h2>How It Works </h2> +<p>In RDF, resources are identified by URIs. The URIs used in most RDF datasets are not dereferenceable , meaning they cannot be accessed in a Semantic Web browser, but return 404 Not Found errors instead, or use non-dereferenceable URI schemes, as in the fictional URI tag:dbpedia.org,2007:Berlin . </p> +<p>When setting up a RAP_Pubby server for your RDF data, you will configure a mapping that translates those URIs to dereferenceable URIs handled by RAP_Pubby. If your server is running at http://myserver.org:8080/rap-pubby/ , then the Berlin URI above might be mapped to http://myserver.org:8080/rap-pubby/Berlin . </p> +<p>RAP_Pubby will handle requests to the mapped URIs by asking the underlying RAP model for information about the original URI, and passing back the results to the client. It also handles various details of the HTTP interaction , such as the 303 redirect required by Web Architecture, and content negotiation between HTML, RDF/XML and N3 descriptions of the same resource. </p> +<p> </p> +<h2>Installation</h2> + +<p> +</p><ol><li>The first thing you need to do is to get mod-rewrite to redirect requests + to the rap_pubby.php handler script. To do this you need to make sure that the + rewrite module is enabled in the Apache configuration file "httpd.conf":<br> + <br> + <table border="1" cellpadding="3" cellspacing="0" width="60%"> + <tbody> + <tr valign="top"> + <td bgcolor="#e7e7ef"> <p><code>LoadModule rewrite_module modules/mod_rewrite.so</code></p></td> + </tr> + </tbody> + </table> + <br> + And to make sure that output buffering is turned on in the PHP configuration + file "php.ini":<br> + <br> + <table border="1" cellpadding="3" cellspacing="0" width="60%"> + <tbody> + <tr valign="top"> + <td bgcolor="#e7e7ef"> <p><code>output_buffering = on</code></p></td> + </tr> + </tbody> + </table> + <br> + </li> + <li>You need to edit the ".htaccess" file in the rap-pubby directory. Change the + 'RewriteBase' bit to reflect the URI base of the rap-pubbyi directory relative to the htdocs directory of your Apache server. E.g.<br> + <br> + <table border="1" cellpadding="3" cellspacing="0" width="60%"> + <tbody> + <tr valign="top"> + <td bgcolor="#e7e7ef"> <p> <code>RewriteEngine on<br> + RewriteBase /rdfapi-php/rap-pubby/ #<---- Edit this <br> + RewriteRule ^[^\.]*$ rap_pubby.php</code></p></td> + </tr> + </tbody> + </table> + <br> + <b>Note:</b> the AllowOverride parameter in "httpd.conf" must be set to allow the use of an .htaccess file in the rap-pubby directory. + <br> + <br> + </li> + <li> Modify the "config.php" file in rap-pubby directory according to your needs (see next section).<br><br> + </li> + </ol> +<h2>Configuration</h2> +<h3>Include RAP Classes</h3> +<ul> + <li> + <h6><strong> RDFAPI_INCLUDE_DIR</strong></h6> + </li> +</ul> +<p> <strong>!!! Required !!!</strong> Modify this if your rap-pubby is not installed in RAP subdirectory.</p> +<br> +<h3>RAP_Pubby Server Configuration</h3> +<ul> + <li> + <h6><strong> PUBBY_WEBBASE</strong></h6> + </li> +</ul> +<p> <strong>!!! Required !!!</strong> The root URL where the RAP_Pubby web application is installed, e.g. http://myserver/mydataset/.</p> +<ul> + <li> + <h6><strong> PUBBY_INDEX_RESOURCE</strong></h6> + </li> +</ul> +<p> The URI of a resource which description will be displayed as the home page of the RAP_Pubby installation. <br> +NOTE: you have to specify a dataset URI, not a mapped web URI.</p> +<p> </p> +<h3>RAP_Pubby Database Configuration</h3> +<p>Note: in order to serve a DbModel the $_PUBBY_DATASET['loadRDF'] parameter must be set to "". </p> +<ul> + <li> + <h6>PUBBY_DB_DRIVER, PUBBY_DB_HOST, PUBBY_DB_DB, PUBBY_DB_USER, PUBBY_DB_PASS</h6> + </li> +</ul> +<p>Database connection setting </p> +<ul> + <li> + <h6>PUBBY_DBMODEL</h6> + </li> +</ul> +<p>Name of the RAP DbModel to be served by RAP_Pubby </p> +<h3>RAP_Pubby Dataset Configuration</h3> +<ul> + <li> + <h6>$_PUBBY_DATASET[''loadRDF'']</h6> + </li> +</ul> +<p>Load an RDF document from the Web or the file system and use it as the data source. If specified, the database connection configured above will be ignored.</p> +<ul> + <li> + <h6>$_PUBBY_DATASET['datasetBase']</h6> + </li> +</ul> +<p><strong>!!! Required !!!</strong> The common URI prefix of the resource identifiers in the served dataset. <br> +NOTE: Only resources with this prefix will be mapped and made available by RAP_Pubby</p> +<ul> + <li> + <h6>$_PUBBY_DATASET['datasetURIPattern']</h6> + </li> +</ul> +<p>If present, only dateset URIs matching this regular expression will be mapped and made available by RAP_Pubby. The regular expression must match everything after the $_PUBBY_DATASET['datasetBase'] part of the URI. For example: datasetBase = 'http://example.org/' and datasetURIPattern = '/(users|documents)\/.*/' This will publish the dataset URI http://example.org/users/alice, but not http://example.org/invoices/5395842 because the URI part invoices/5395842 does not match the regular expression. default value = ''.</p> +<ul> + <li> + <h6>$_PUBBY_DATASET['webResourcePrefix']</h6> + </li> +</ul> +<p>If present, this string will be prefixed to the mapped web URIs. This is useful if you have to avoid potential name clashes with URIs already used by the server itself. For example, if the dataset includes a URI http://mydataset/page, and the dataset prefix is http://mydataset/, then there would be a clash after mapping because RAP_Pubby reserves the mapped URI http://myserver/mydataset/page for its own use. In this case, you may specify a prefix like "resource/", which will result in a mapped URI of http://myserver/mydataset/resource/page.<br> +NOTE: the prefix must end with "/"</p> +<ul> + <li> + <h6>$_PUBBY_DATASET['usePrefixesFrom']</h6> + </li> +</ul> +<p>Links to an RDF document whose prefix declarations will be used in output. You can use the file prefixes.n3 in rap-pubby directory as template. If not specified the prefixes from the input RAP model will be used.</p> +<ul> + <li> + <h6>$_PUBBY_DATASET['rdfDocumentMetadata']</h6> + </li> +</ul> +<p>All statements inside the metadata file will be added as metadata to the RDF documents published for this dataset. This feature can be used for instance to add licensing information to your published documents. You can use the file metadata.n3 in rap-pubby directory as template. </p> +<ul> + <li> + <h6>$_PUBBY_DATASET['addSameAsStatements']</h6> + </li> +</ul> +<p>If set to true, an owl:sameAs statement of the form <web_uri> owl:sameAs <dataset_uri> will be present in Linked Data output.</p> +<p> </p> +<h3>Pubby HTML Output Setting</h3> +<ul> + <li> + <h6>PUBBY_HTML_SER__TEMPLATE</h6> + </li> +</ul> +<p>URL of the template file used in HTML output</p> +<ul> + <li> + <h6>PUBBY_HTML_SER__TEMPLATE_404</h6> + </li> +</ul> +<p>URL of the template file rendering '404 - Not Found' information used in HTML output</p> +<ul> + <li> + <h6>PUBBY_HTML_SER__TEMPL_INCL_DIR</h6> + </li> +</ul> +<p>Link to directory where template includes (css-files, scripts, images) are located</p> +<ul> + <li> + <h6>PUBBY_HTML_SER__PROJECT_NAME</h6> + </li> +</ul> +<p>The name of the project, for display in page titles</p> +<ul> + <li> + <h6>PUBBY_HTML_SER__PROJECT_HOMEPAGE</h6> + </li> +</ul> +<p>A project homepage or similar URL, for linking in page titles</p> +<ul> + <li> + <h6>PUBBY_HTML_SER__DEFAULT_LANG</h6> + </li> +</ul> +<p>Default language for resource label and short description </p> +<ul> + <li> + <h6>$_PUBBY_HTML_SER['labelProperty']</h6> + </li> +</ul> +<p>The value of these RDF properties, if present in the dataset, will be used as labels and page titles for resources. <br> + NOTE: If multiple properties are present only the first one found (in default language, if specified) will be showed.</p> +<ul> + <li> + <h6>$_PUBBY_HTML_SER['commentProperty']</h6> + </li> +</ul> +<p>The value of these RDF properties, if present in the dataset, will be used as short textual description for resources. <br> +NOTE: If multiple properties are present only the first one found (in default language, if specified) will be showed.</p> +<ul> + <li> + <h6>$_PUBBY_HTML_SER['imageProperty']</h6> + </li> +</ul> +<p>The value of these RDF properties, if present in the dataset, will be used as an image URL to show a depiction of the item.<br> +NOTE: If multiple properties are present only the first one found will be showed.<br></p><br> +<h2>Using Your Own HTML Templates </h2> +<p>In RAP_Pubby you can use your own HTML templates. RAPpubbyHTMLserializer loads an html template file specified in the config.php and replaces the placeholders inside a template with dynamically generated content. Following placeholders are allowed:</p> +<ul> + <li> + <h6>##_templInclDirURL_##</h6> + </li> +</ul> +Will be replaced with PUBBY_HTML_SER__TEMPL_INCL_DIR constant from config.php +<ul> + <li> + <h6>##_projetName_##</h6> + </li> +</ul> +Will be replaced with PUBBY_HTML_SER__PROJECT_NAME constant from config.php +<ul> + <li> + <h6>##_projectHomepage_##</h6> + </li> +</ul> +<p>Will be replaced with PUBBY_HTML_SER__PROJECT_HOMEPAGE constant from config.php </p> +<ul> + <li> + <h6>##_resURI_##</h6> + </li> +</ul> +<p>Will be replaced with the URI of the resource beeing described </p> +<ul> + <li> + <h6>##_repURIdata_##</h6> + </li> +</ul> +<p>Will be replaced with the URI of the resource representation in RDF/XML format. (For URIs of the resource representation in n3 place ##_repURIdata_##?output=n3)</p> +<ul> + <li> + <h6>##_resourceLabel_##</h6> + </li> +</ul> +<p>Will be replaced with the value of the label property of the URI beeing described, according to $_PUBBY_HTML_SER['labelProperty'] in config.php +</p> +<ul> + <li> + <h6>##_shortDescription_##</h6> + </li> +</ul> +<p>Will be replaced with the value of the comment property of the URI beeing described, according to $_PUBBY_HTML_SER['commentProperty'] in config.php</p> +<ul> + <li> + <h6>##_imgLink_##</h6> + </li> +</ul> +<p>Will be replaced with the value of the image property of the URI beeing described, according to $_PUBBY_HTML_SER['imageProperty'] in config.php</p> +<ul> + <li> + <h6>##_prop_tableRows_## </h6> + </li> +</ul> +<p>Will be replaced with table rows containing 'property - property value' pairs of the resource beeing described. The styling of odd and even table rows can be altered in your css file by defining 'odd' and 'even' classes respectively. </p> +<p> </p> +<h2>Use Case Example</h2> +<p>RAP_Pubby distribution contains a small use case example showing information about the Web-based Systems Group @ Freie Universit\xE4t Berlin. To run this example: +<li>install RAP_Pubby (see installation section)</li> +<li>open config.php and modify the paramters RDFAPI_INCLUDE_DIR and PUBBY_WEBBASE</li> +<li>type the PUBBY_WEBBASE-URL into the address bar of your web browser</li> +</p> +<br> +</body></html> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2008-02-29 16:03:01
|
Revision: 563 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=563&view=rev Author: cax Date: 2008-02-29 08:02:33 -0800 (Fri, 29 Feb 2008) Log Message: ----------- Version update -> V0.9.6 Modified Paths: -------------- trunk/rdfapi-php/doc/index.html trunk/rdfapi-php/doc/tests.html Modified: trunk/rdfapi-php/doc/index.html =================================================================== --- trunk/rdfapi-php/doc/index.html 2008-02-29 15:30:18 UTC (rev 562) +++ trunk/rdfapi-php/doc/index.html 2008-02-29 16:02:33 UTC (rev 563) @@ -2,7 +2,7 @@ <!-- Generated with PHPDoc, http://www.phpdoc.de --> <html> <head> - <title>RAP - Rdf API for PHP V0.9.4 - Home</title> + <title>RAP - Rdf API for PHP V0.9.6 - Home</title> <link rel="stylesheet" href="phpdoc.css" type="text/css"> <link rel="alternate" type="application/rdf+xml" title="rap" href="../../ueber_uns/team/rap.rdf"> <style type="text/css"> @@ -39,7 +39,7 @@ <p> </p> <p> </p> <p></p> <br> - <H1>RAP - RDF API for PHP V0.9.5</H1> + <H1>RAP - RDF API for PHP V0.9.6</H1> <p>RAP is a software package for parsing, querying, manipulating, serializing and serving RDF models. <BR> <br> @@ -61,6 +61,7 @@ </LI> <LI>integrated <a href="tutorial/netapi.html">RDF server</a> providing similar functionality as the <a href="http://www.joseki.org/" target="_blank">Joseki RDF server</a></LI> + <LI>integrated <a href="../rap-pubby/doc/RAP_Pubby.htm">linked data frontend</a> </LI> <LI><a href="tutorial/db_utils.htm">graphical user-interface</a> for managing database-backed RDF models </LI> <LI>support for common <a href="tutorial/vocabularies.htm">vocabularies</a></LI> @@ -113,6 +114,12 @@ <TH>Release Date</TH> </TR> <TR> + <TD align=middle valign="top">V0.9.6</TD> + <TD align=left><a href="../rap-pubby/doc/RAP_Pubby.htm">RAP_Pubby</a> - a linked data frontend for RAP added.<br /> + Multiple bugs fixed. </TD> + <TD align=middle valign="top">2008-02-29</TD> + </TR> + <TR> <TD align=middle valign="top">V0.9.5</TD> <TD align=left><p>New SPARQL query engine added. The new engine is much faster and supports <br> all features @@ -246,8 +253,7 @@ <li>Christian Weiske for reimplementing the RAP SPARQL engine and extending it with support for all features from the W3C SPARQL Recommendation</li> <li>Daniel Westphal for the ResModel- and OntModel-APIs, RDF dataset and the RDF-S/OWL reasoning support. </li> - <li>Radoslaw Oldakowski for the database backend and the RDQL query engine - and to</li> + <li>Radoslaw Oldakowski for the database backend, the RDQL query engine, improving the RDF/XML-parser, and for the RAP_Pubby</li> <li> Gunnar AA. Grimnes for the N3 support and the RDF DB Utils package</li> <li>Phil Dawes for the NetAPI implementation</li> <li>Tobias Gauß for the MemModel indexing, the unit test suite and the SPARQL engine and client library.</li> Modified: trunk/rdfapi-php/doc/tests.html =================================================================== --- trunk/rdfapi-php/doc/tests.html 2008-02-29 15:30:18 UTC (rev 562) +++ trunk/rdfapi-php/doc/tests.html 2008-02-29 16:02:33 UTC (rev 563) @@ -80,6 +80,8 @@ <li><a href="tutorial/usingtheSparqlEngine.htm"> Using the SPARQL Engine </a><br><p> </li> <li><a href="tutorial/usingtheSparqlClient.htm">SPARQL client</a><br><p> + </li> + <li><a href="../rap-pubby/doc/RAP_Pubby.htm">RAP_Pubby</a></li> </ol> <p> </p> <br> </td> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2008-02-29 15:30:25
|
Revision: 562 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=562&view=rev Author: cax Date: 2008-02-29 07:30:18 -0800 (Fri, 29 Feb 2008) Log Message: ----------- Fixing pass-by-reference notice Modified Paths: -------------- trunk/rdfapi-php/api/resModel/ResModel.php Modified: trunk/rdfapi-php/api/resModel/ResModel.php =================================================================== --- trunk/rdfapi-php/api/resModel/ResModel.php 2008-02-29 15:27:00 UTC (rev 561) +++ trunk/rdfapi-php/api/resModel/ResModel.php 2008-02-29 15:30:18 UTC (rev 562) @@ -794,7 +794,8 @@ */ function & rdqlQuery($queryString, $returnNodes = TRUE) { - return $this->model->rdqlQuery($queryString, $returnNodes); + $ret = $this->model->rdqlQuery($queryString, $returnNodes); + return $ret; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2008-02-29 15:27:03
|
Revision: 561 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=561&view=rev Author: cax Date: 2008-02-29 07:27:00 -0800 (Fri, 29 Feb 2008) Log Message: ----------- bug in the load method fixed Modified Paths: -------------- trunk/rdfapi-php/api/resModel/ResModel.php Modified: trunk/rdfapi-php/api/resModel/ResModel.php =================================================================== --- trunk/rdfapi-php/api/resModel/ResModel.php 2008-02-29 15:24:20 UTC (rev 560) +++ trunk/rdfapi-php/api/resModel/ResModel.php 2008-02-29 15:27:00 UTC (rev 561) @@ -632,7 +632,7 @@ */ function load($filename, $type = NULL, $stream=false) { - $this->model->load($filename, $type = NULL, $stream=false); + $this->model->load($filename, $type, $stream); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2008-02-29 15:24:24
|
Revision: 560 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=560&view=rev Author: cax Date: 2008-02-29 07:24:20 -0800 (Fri, 29 Feb 2008) Log Message: ----------- dbConn->connect --> dbConn->NConnect Modified Paths: -------------- trunk/rdfapi-php/api/model/DbStore.php Modified: trunk/rdfapi-php/api/model/DbStore.php =================================================================== --- trunk/rdfapi-php/api/model/DbStore.php 2008-02-29 15:21:35 UTC (rev 559) +++ trunk/rdfapi-php/api/model/DbStore.php 2008-02-29 15:24:20 UTC (rev 560) @@ -88,7 +88,7 @@ $this->dbConn->debug = true; // connect to database - $r = $this->dbConn->connect($host, $user, $password, $dbName); + $r = $this->dbConn->NConnect($host, $user, $password, $dbName); if ($r !== true) { throw new Exception('Could not connect to database'); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2008-02-29 15:21:37
|
Revision: 559 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=559&view=rev Author: cax Date: 2008-02-29 07:21:35 -0800 (Fri, 29 Feb 2008) Log Message: ----------- Fixing pass-by-reference notice Modified Paths: -------------- trunk/rdfapi-php/api/rdql/RdqlDbEngine.php Modified: trunk/rdfapi-php/api/rdql/RdqlDbEngine.php =================================================================== --- trunk/rdfapi-php/api/rdql/RdqlDbEngine.php 2008-02-29 15:14:04 UTC (rev 558) +++ trunk/rdfapi-php/api/rdql/RdqlDbEngine.php 2008-02-29 15:21:35 UTC (rev 559) @@ -86,9 +86,10 @@ $queryResult = $this->filterQueryResult($recordSet); if ($returnNodes) - return $this->toNodes($queryResult); + $ret = $this->toNodes($queryResult); else - return $this->toString($queryResult); + $ret = $this->toString($queryResult); + return $ret; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2008-02-29 15:14:08
|
Revision: 558 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=558&view=rev Author: cax Date: 2008-02-29 07:14:04 -0800 (Fri, 29 Feb 2008) Log Message: ----------- $default_prefixes defined as global Modified Paths: -------------- trunk/rdfapi-php/api/constants.php Modified: trunk/rdfapi-php/api/constants.php =================================================================== --- trunk/rdfapi-php/api/constants.php 2008-02-29 15:03:46 UTC (rev 557) +++ trunk/rdfapi-php/api/constants.php 2008-02-29 15:14:04 UTC (rev 558) @@ -328,6 +328,7 @@ // RDQL, SPARQL and parser default namespace prefixes // ---------------------------------------------------------------------------------- +global $default_prefixes; $default_prefixes = array( RDF_NAMESPACE_PREFIX => RDF_NAMESPACE_URI, RDF_SCHEMA_PREFIX => RDF_SCHEMA_URI, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2008-02-29 15:03:47
|
Revision: 557 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=557&view=rev Author: cax Date: 2008-02-29 07:03:46 -0800 (Fri, 29 Feb 2008) Log Message: ----------- initial version Added Paths: ----------- trunk/rdfapi-php/rap-pubby/ trunk/rdfapi-php/rap-pubby/.htaccess trunk/rdfapi-php/rap-pubby/RAPpubbyDataset.php trunk/rdfapi-php/rap-pubby/RAPpubbyHTMLSer.php trunk/rdfapi-php/rap-pubby/RAPpubbyResDescr.php trunk/rdfapi-php/rap-pubby/RAPpubbyURIrewriter.php trunk/rdfapi-php/rap-pubby/config.php trunk/rdfapi-php/rap-pubby/doc/ trunk/rdfapi-php/rap-pubby/doc/RAP_Pubby.htm trunk/rdfapi-php/rap-pubby/doc/phpdoc.css trunk/rdfapi-php/rap-pubby/example/ trunk/rdfapi-php/rap-pubby/example/group.rdf trunk/rdfapi-php/rap-pubby/metadata.n3 trunk/rdfapi-php/rap-pubby/prefixes.n3 trunk/rdfapi-php/rap-pubby/rap_pubby.php trunk/rdfapi-php/rap-pubby/templ/ trunk/rdfapi-php/rap-pubby/templ/404_notFound.html trunk/rdfapi-php/rap-pubby/templ/rdf-icon.gif trunk/rdfapi-php/rap-pubby/templ/script.js trunk/rdfapi-php/rap-pubby/templ/style.css trunk/rdfapi-php/rap-pubby/templ/template.html Added: trunk/rdfapi-php/rap-pubby/.htaccess =================================================================== --- trunk/rdfapi-php/rap-pubby/.htaccess (rev 0) +++ trunk/rdfapi-php/rap-pubby/.htaccess 2008-02-29 15:03:46 UTC (rev 557) @@ -0,0 +1,3 @@ +RewriteEngine on +RewriteBase /rdfapi-php/rap-pubby/ +RewriteRule ^[^\.]*$ rap_pubby.php Added: trunk/rdfapi-php/rap-pubby/RAPpubbyDataset.php =================================================================== --- trunk/rdfapi-php/rap-pubby/RAPpubbyDataset.php (rev 0) +++ trunk/rdfapi-php/rap-pubby/RAPpubbyDataset.php 2008-02-29 15:03:46 UTC (rev 557) @@ -0,0 +1,143 @@ +<?PHP + +// ---------------------------------------------------------------------------------- +// RAP_Pubby - A Linked Data Frontend for RAP +// ---------------------------------------------------------------------------------- + +/** + * Installation information is found in the RAP_Pubby documentation. + * + * @author Radoslaw Oldakowski <ra...@gm...> + * @version 1.0, 19.12.2007 + * @package rap-pubby + */ + + +// toDo: delete this +include_once('RAPpubbyURIrewriter.php'); + +Class RAPpubbyDataset extends Object { + + var $m; + var $ns = array(); + var $metadata; + + + function RAPpubbyDataset() { + + global $_PUBBY_DATASET; + + $this->loadModel($_PUBBY_DATASET['loadRDF']); + $this->loadNamespaces($_PUBBY_DATASET['usePrefixesFrom']); + $this->loadMetadata($_PUBBY_DATASET['rdfDocumentMetadata']); + + } + + + /** + * + */ + function & getResDescr ($resURI, $attach_metadata = false) { + + global $_PUBBY_DATASET; + + $r = new Resource(RAPpubbyURIrewriter::pubbyURItoDatasetURI($resURI)); + $rd_m = new MemModel(); + + $rd_m = $this->m->find($r, NULL, NULL); + $backlinks = $this->m->find(NULL, NULL, $r); + $rd_m->addModel($backlinks); + + $rew_rd_m = & RAPpubbyURIrewriter::rewriteURIsInResDescrModel($rd_m); + + if (!$rew_rd_m->isEmpty() && $_PUBBY_DATASET['addSameAsStatements']) { + + $rew_rd_m->add(new Statement(new Resource($resURI), new Resource(OWL_NS. "sameAs"), $r)); + } + $rew_rd_m->addParsedNamespaces($this->ns); + + $rd = new RAPpubbyResDescr($resURI, $rew_rd_m); + + if ($attach_metadata && !$rd->isEmpty()) { + $rd->attachMetadata($this->getMetadata($resURI)); + } + return $rd; + } + + + // private ----------------------------------------------------- + + + /** + * @return RAP model with metadata, blank node replaced with resource URI + */ + function & getMetadata ($resURI) { + + $dataURI = RAPpubbyURIrewriter::resURItoDataURI($resURI); + + $metaData = $this->metadata; + $metaData->replace(new BlankNode(BNODE_PREFIX .'1'), NULL, NULL, new Resource($dataURI)); + + return $metaData; + } + + + /** + * + */ + function loadModel($url) { + + // load model from file + if ($url) { + $this->m = new MemModel(); + $this->m->load($url); + } + else { + $db = new DbStore(PUBBY_DB_DRIVER, PUBBY_DB_HOST, PUBBY_DB_DB, PUBBY_DB_USER, PUBBY_DB_PASS); + $this->m = $db->getModel(PUBBY_DBMODEL); + } + } + + + /** + * loads namespaces from file or rewrites from configuration model + */ + function loadNamespaces($url) { + + if ($url) { + + $nmsp_m = new MemModel(); + $nmsp_m->load($url); + $this->ns = $nmsp_m->getParsedNamespaces(); + if (!$this->ns) { + trigger_error("The file:" .$url ."does not contain any namespace declarations." + ."The prefixes from the configuration model will be used instead"); + } + } + else { + + $nmsp = $this->m->getParsedNamespaces(); + if ($nmsp) { + $this->ns = RAPpubbyURIrewriter::rewrNamespaces($nmsp); + } + } + } + + + /** + * + */ + function loadMetadata($url) { + + if ($url) { + $this->metadata = new MemModel(); + $this->metadata->load($url); + } + } + + + + +} + +?> \ No newline at end of file Added: trunk/rdfapi-php/rap-pubby/RAPpubbyHTMLSer.php =================================================================== --- trunk/rdfapi-php/rap-pubby/RAPpubbyHTMLSer.php (rev 0) +++ trunk/rdfapi-php/rap-pubby/RAPpubbyHTMLSer.php 2008-02-29 15:03:46 UTC (rev 557) @@ -0,0 +1,361 @@ +<?PHP + +// ---------------------------------------------------------------------------------- +// RAP_Pubby - A Linked Data Frontend for RAP +// ---------------------------------------------------------------------------------- + +/** + * Installation information is found in the RAP_Pubby documentation. + * + * @author Radoslaw Oldakowski <ra...@gm...> + * @version 1.0, 19.12.2007 + * @package rap-pubby + */ + + +include_once(RDFAPI_INCLUDE_DIR.PACKAGE_UTILITY); + + +Class RAPpubbyHTMLSer extends Object { + + var $htmlTemplate; + var $htmlTemplate_404; + var $placeholders = array( + '##_templInclDirURL_##' => '', + '##_projetName_##' => '', + '##_projectHomepage_##' => '', + '##_resURI_##' => '', + '##_repURIdata_##' => '', + '##_resourceLabel_##' => '', + '##_shortDescription_##' => '', + '##_imgLink_##' => '', + '##_prop_tableRows_##' => '', + ); + + + /** + * + */ + function RAPpubbyHTMLSer ($template = PUBBY_HTML_SER__TEMPLATE, $template_404 = PUBBY_HTML_SER__TEMPLATE_404) { + + $this->loadTemplates($template, $template_404); + + $this->placeholders['##_templInclDirURL_##'] = PUBBY_WEBBASE .PUBBY_HTML_SER__TEMPL_INCL_DIR; + $this->placeholders['##_projectName_##'] = PUBBY_HTML_SER__PROJECT_NAME; + $this->placeholders['##_projectHomepage_##'] = PUBBY_HTML_SER__PROJECT_HOMEPAGE; + + } + + + /** + * + */ + function serialize (&$rd) { + + + if ($rd->isEmpty()) { + $html = $this->htmlTemplate_404; + } + else { + $html = $this->htmlTemplate; + } + $ph = $this->generatePlaceholderValues($rd); + $html = str_ireplace(array_keys($ph), $ph, $html); + + return $html; + } + + + /** + * + */ + function loadTemplates($t, $t_404) { + + if (file_exists($t)) { + $file = fopen($t, "r"); + if ($file) { + $this->htmlTemplate = fread($file,filesize($t)); + fclose($file); + } + } + else { + trigger_error("Could not find template file: $t, "); + $this->htmlTemplate = $this->getBasicTemplate(); + } + + if (file_exists($t_404)) { + $file = fopen($t_404, "r"); + if ($file) { + $this->htmlTemplate_404 = fread($file,filesize($t_404)); + fclose($file); + } + } + else { + trigger_error("Could not find template file: $t_404, "); + $this->htmlTemplate_404 = $this->getBasicTemplate_404(); + } + + } + + + /** + * + */ + function getBasicTemplate() { + + return '<h1>##_resURI_##</h1> + <table> + <tr><td><h3>Property</h3></td> <td><h3>Value</h3></td></tr> + ##_prop_tableRows_## + </table>'; + } + + function getBasicTemplate_404() { + + return '<h1>##_resURI_##</h1> + <p>The requested resource does not exist at this server, or no information about it is available.</p>'; + } + + + /** + * + */ + function generatePlaceholderValues (&$rd) { + + $res = & $rd->getResource(); + $m = & $rd->getModel(); + + $ph = $this->placeholders; + $ph['##_resURI_##'] = $res->getURI(); + $ph['##_repURIdata_##'] = $rd->getDataURI(); + $ph['##_resourceLabel_##'] = $this->findLabel($m, $res); + $ph['##_shortDescription_##'] = $this->findComment($m, $res); + $ph['##_imgLink_##'] = $this->findImgLink($m, $res); + $ph['##_prop_tableRows_##'] = $this->renderResourceProperties($m, $res); + + return $ph; + } + + + /** + * find only the first occurance of the label + */ + function findLabel(&$m, &$res) { + + global $_PUBBY_HTML_SER; + return $this->findLiteralValueLang($m, $res, $_PUBBY_HTML_SER['labelProperty']); + } + + + /** + * find only the first occurance of the comment + */ + function findComment(&$m, &$res) { + + global $_PUBBY_HTML_SER; + return $this->findLiteralValueLang($m, $res, $_PUBBY_HTML_SER['commentProperty']); + } + + + /** + * + */ + function findImgLink (&$m, &$res) { + + global $_PUBBY_HTML_SER; + + foreach ($_PUBBY_HTML_SER['imageProperty'] as $prop) { + + $triple = $m->findFirstMatchingStatement($res, $prop, NULL); + if ($triple) { + return $triple->getObject()->getURI(); + } + } + return ''; + } + + + /** + * find only the first occurance of the Literal from an array of properties + */ + function findLiteralValueLang(&$m, &$res, &$prop_array) { + + $tmp = ''; + + // if no default lang is specified find any literal value + if (PUBBY_HTML_SER__DEFAULT_LANG == '') { + + foreach ($prop_array as $prop) { + + $triple = $m->findFirstMatchingStatement($res, $prop, NULL); + if ($triple) { + return $triple->getObject()->getLabel(); + } + } + } + else { + foreach ($prop_array as $prop) { + + $result = $m->find($res, $prop, NULL); + + $iter = $result->getStatementIterator(); + while ($iter->hasNext()) { + + $triple = $iter->next(); + if ($triple->getObject()->getLanguage() == PUBBY_HTML_SER__DEFAULT_LANG) { + return $triple->getObject()->getLabel(); + } + } + // if no label with default lang was found take the first one + // and store it in $tmp because another property could contain the default lang + if (!$result->isEmpty()) { + $triple = $result->findFirstMatchingStatement($res, $prop, NULL); + if ($triple) { + $tmp = $triple->getObject()->getLabel(); + } + } + } + } + return $tmp; + } + + + /** + * + */ + function renderResourceProperties (&$m, &$res) { + + $prop = array(); + + // find properties + $result = $m->find($res, NULL, NULL); + + $iter = $result->getStatementIterator(); + while ($iter->hasNext()) { + $triple = $iter->next(); + $propURI = $triple->getPredicate()->getURI(); + $prop[$propURI][false][] = $triple->getObject(); + } + + // find inverse properteis (backlinks) + $result = $m->find(NULL, NULL, $res); + + $iter = $result->getStatementIterator(); + while ($iter->hasNext()) { + $triple = $iter->next(); + $propURI = $triple->getPredicate()->getURI(); + // inverse the property --> get subject instead of object + $prop[$propURI][true][] = $triple->getSubject(); + + } + + // sort properties + uksort($prop, array($this, '_sortURIbyQName')); + + // render table rows with resource properties + $nsPrefix = $m->getParsedNamespaces(); if (!$nsPrefix) $nsPrefix = array(); + $html_tableRows = ''; + $tr_class = array(true => 'odd', false => 'even'); + $odd = true; + + foreach ($prop as $propURI => $propType) { + foreach ($propType as $inverseProp => $valArray) { + + $tr=' + <tr class="' .$tr_class[$odd] .'"> + <td class="property">' + .$this->renderPropURI($propURI, $nsPrefix, $inverseProp) + .'</td> + <td> + <ul>'; + foreach ($valArray as $propValue) { + + if (is_a($propValue, "Literal")) { + $tr .=' + <li>' + .$this->renderLiteral($propValue) + .'</li>'; + } + else { + $tr .=' + <li>' + .$this->renderURI($propValue->getURI(), $nsPrefix) + .'</li>'; + } + } + $tr .=' + </ul> + </td> + </tr>'; + $odd = !$odd; + $html_tableRows .= $tr; + } + } + + return $html_tableRows; + } + + + /** + * + */ + function renderLiteral ($literal) { + + $html = '<span class="literal">' .$literal->getLabel(); + if ($literal->getLanguage()) { + $html .= '<small> (' .$literal->getLanguage() .')</small>'; + } + return $html .= '</span>'; + + } + + + /** + * + */ + function renderPropURI ($URI, &$nsPrefix, $inverseProp=false) { + + if ($inverseProp) { + return '<small>is </small>' .$this->renderURI($URI, $nsPrefix) .'<small> of</small>'; + } + else { + return $this->renderURI($URI, $nsPrefix); + } + + } + + + /** + * + */ + function renderURI($URI, &$nsPrefix) { + + $ns = RDFUtil::guessNamespace($URI); + $qName = RDFUtil::guessName($URI); + + $html = '<a class="uri" href="' .$URI .'" title="' .$URI .'">'; + + if (array_key_exists($ns, $nsPrefix)) { + $html .= '<small>' .$nsPrefix[$ns] .':</small>' .$qName; + } + else { + $html .= $URI; + } + $html .= '</a>'; + + return $html; + + } + + + /** + * Call-back function for uksort() + */ + function _sortURIbyQName ($a, $b) { + + return strcasecmp(RDFUtil::guessName($a), RDFUtil::guessName($b)); + } + +} + +?> \ No newline at end of file Added: trunk/rdfapi-php/rap-pubby/RAPpubbyResDescr.php =================================================================== --- trunk/rdfapi-php/rap-pubby/RAPpubbyResDescr.php (rev 0) +++ trunk/rdfapi-php/rap-pubby/RAPpubbyResDescr.php 2008-02-29 15:03:46 UTC (rev 557) @@ -0,0 +1,127 @@ +<?PHP + +// ---------------------------------------------------------------------------------- +// RAP_Pubby - A Linked Data Frontend for RAP +// ---------------------------------------------------------------------------------- + +/** + * Installation information is found in the RAP_Pubby documentation. + * + * @author Radoslaw Oldakowski <ra...@gm...> + * @version 1.0, 19.12.2007 + * @package rap-pubby + */ + + +Class RAPpubbyResDescr extends Object { + + var $res; + var $m_rd; + var $m_metadata; + + + /** + * + */ + function RAPpubbyResDescr ($resURI, &$m) { + + $this->res = new Resource($resURI); + $this->m_rd = &$m; + $this->m_metadata = new MemModel(); + } + + + /** + * + */ + function isEmpty() { + + return $this->m_rd->isEmpty(); + } + + + /** + * + */ + function & getResource() { + + return $this->res; + } + + + /** + * + */ + function getResURI() { + + return $this->res->getURI(); + } + + + /** + * + */ + function getDataURI() { + + return RAPpubbyURIrewriter::resURItoDataURI($this->res->getURI()); + } + + + /** + * + */ + function getPageURI() { + + return RAPpubbyURIrewriter::resURItoPageURI($this->res->getURI()); + } + + + /** + * + */ + function & getModel() { + + return $this->m_rd; + } + + + /** + * + */ + function attachMetadata(&$m) { + + $this->m_rd->addModel($m); + $this->m_metadata = &$m; + } + + + /** + * + */ + function & getMetadataModel() { + + return $this->m_metadata; + } + + + function serialize ($format) { + + switch ($format) { + case "html": + $s = new RAPpubbyHTMLSer(); + return $s->serialize($this); + case "n3": + include_once(RDFAPI_INCLUDE_DIR.PACKAGE_SYNTAX_N3); + $s = new N3Serializer(); + return $s->serialize($this->m_rd); + case "rdf/xml": + default: + include_once(RDFAPI_INCLUDE_DIR.PACKAGE_SYNTAX_RDF); + $s = new RdfSerializer(); + return $s->serialize($this->m_rd); + } + } + +} + +?> \ No newline at end of file Added: trunk/rdfapi-php/rap-pubby/RAPpubbyURIrewriter.php =================================================================== --- trunk/rdfapi-php/rap-pubby/RAPpubbyURIrewriter.php (rev 0) +++ trunk/rdfapi-php/rap-pubby/RAPpubbyURIrewriter.php 2008-02-29 15:03:46 UTC (rev 557) @@ -0,0 +1,181 @@ +<?PHP + +// ---------------------------------------------------------------------------------- +// RAP_Pubby - A Linked Data Frontend for RAP +// ---------------------------------------------------------------------------------- + +/** + * Installation information is found in the RAP_Pubby documentation. + * + * @author Radoslaw Oldakowski <ra...@gm...> + * @version 1.0, 19.12.2007 + * @package rap-pubby + */ + + +Class RAPpubbyURIrewriter extends Object { + + + /** + * + */ + function datasetURItoPubbyURI($uri) { + + global $_PUBBY_DATASET; + + return str_ireplace($_PUBBY_DATASET['datasetBase'], PUBBY_WEBBASE .$_PUBBY_DATASET['webResourcePrefix'], $uri); + } + + + /** + * + */ + function pubbyURItoDatasetURI($uri) { + + global $_PUBBY_DATASET; + + return str_ireplace(PUBBY_WEBBASE .$_PUBBY_DATASET['webResourcePrefix'], $_PUBBY_DATASET['datasetBase'], $uri); + } + + + /** + * + */ + function resURItoDataURI($resURI, $output='') { + + $dataURI = PUBBY_WEBBASE ."data/" .substr($resURI, strlen(PUBBY_WEBBASE)); + + if ($output) { + return $dataURI ."?output=$output"; + } + return $dataURI; + } + + + /** + * + */ + function resURItoPageURI($resURI) { + + return PUBBY_WEBBASE ."page/" .substr($resURI, strlen(PUBBY_WEBBASE)); + } + + + /** + * + */ + function dataURItoResURI($dataURI, $outputParam='') { + + $resURI = PUBBY_WEBBASE .substr($dataURI, strlen(PUBBY_WEBBASE. 'data/')); + + if ($outputParam) { + return substr($resURI, 0, stripos($resURI, "?$outputParam")); + } + return $resURI; + } + + + /** + * + */ + function pageURItoResURI($pageURI) { + + return PUBBY_WEBBASE .substr($pageURI, strlen(PUBBY_WEBBASE. 'page/')); + } + + + /** + * + */ + function rewrNamespaces($ns) { + + global $_PUBBY_DATASET; + + foreach ($ns as $n => $prefix) { + if (stripos($n, $_PUBBY_DATASET['datasetBase']) !== false) { + unset($ns[$n]); + $ns[RAPpubbyURIrewriter::datasetURItoPubbyURI($n)] = $prefix; + } + } + asort($ns); + return $ns; + } + + + /** + * + */ + function & rewriteURIsInResDescrModel(&$rd_m) { + + global $_PUBBY_DATASET; + global $namespaces; + + $rew_rd_m = new MemModel(); + + // uri rewriting + regex filtering + if ($_PUBBY_DATASET['datasetURIPattern'] != '') { + + $l = strlen($_PUBBY_DATASET['datasetBase']); + + $iter = $rd_m->getStatementIterator(); + while ($iter->hasNext()) { + + $triple = $iter->next(); + $subj = $triple->getSubject(); + + // if subjURI is a datasetURI & does not match the pattern + if (stripos($subj->getURI(), $_PUBBY_DATASET['datasetBase']) === 0 && + !preg_match($_PUBBY_DATASET['datasetURIPattern'], substr($subj->getURI(), $l))) { + continue; + } + else { + // if predURI is a datasetURI & does not match the pattern + $pred = $triple->getPredicate(); + if (stripos($pred->getURI(), $_PUBBY_DATASET['datasetBase']) === 0 && + !preg_match($_PUBBY_DATASET['datasetURIPattern'], substr($pred->getURI(), $l))) { + continue; + } + else { + // if obj is a Literal & objeURI is a datasetURI & does not match the pattern + $obj = $triple->getObject(); + if (!is_a($obj, "Literal")) { + if (stripos($obj->getURI(), $_PUBBY_DATASET['datasetBase']) === 0 && + !preg_match($_PUBBY_DATASET['datasetURIPattern'], substr($obj->getURI(), $l))) { + continue; + } + else { + $obj = new Resource(RAPpubbyURIrewriter::datasetURItoPubbyURI($obj->getURI())); + } + } + $subj = new Resource(RAPpubbyURIrewriter::datasetURItoPubbyURI($subj->getURI())); + $pred = new Resource(RAPpubbyURIrewriter::datasetURItoPubbyURI($pred->getURI())); + + $rew_rd_m->add(new Statement($subj, $pred, $obj)); + } + } + } + } + else { + + $iter = $rd_m->getStatementIterator(); + while ($iter->hasNext()) { + + $triple = $iter->next(); + + $subj = new Resource(RAPpubbyURIrewriter::datasetURItoPubbyURI($triple->getSubject()->getURI())); + $pred = new Resource(RAPpubbyURIrewriter::datasetURItoPubbyURI($triple->getPredicate()->getURI())); + $obj = $triple->getObject(); + + if (!is_a($obj, "Literal")) { + $obj = new Resource(RAPpubbyURIrewriter::datasetURItoPubbyURI($obj->getURI())); + } + $rew_rd_m->add(new Statement($subj, $pred, $obj)); + } + } + + return $rew_rd_m; + } + +} + +?> \ No newline at end of file Added: trunk/rdfapi-php/rap-pubby/config.php =================================================================== --- trunk/rdfapi-php/rap-pubby/config.php (rev 0) +++ trunk/rdfapi-php/rap-pubby/config.php 2008-02-29 15:03:46 UTC (rev 557) @@ -0,0 +1,146 @@ +<?PHP + +// ---------------------------------------------------------------------------------- +// RAP_Pubby - A Linked Data Frontend for RAP +// ---------------------------------------------------------------------------------- + +/** + * Installation information is found in the RAP_Pubby documentation. + * + * @author Radoslaw Oldakowski <ra...@gm...> + * @version 1.0, 29.02.2008 + * @package rap-pubby + */ + +// ---------------------------------------------------------------------------------- +// Include RAP Classes +// ---------------------------------------------------------------------------------- + +// Defines RAP include directories +// NOTE: Modify this if your rap-pubby is not installed in RAP subdirectory +define("RDFAPI_INCLUDE_DIR", "../api/"); +include(RDFAPI_INCLUDE_DIR . "RdfAPI.php"); + + +// include RAPpubby classes +include_once('RAPpubbyURIrewriter.php'); +include_once('RAPpubbyDataSet.php'); +include_once('RAPpubbyResDescr.php'); +include_once('RAPpubbyHTMLSer.php'); + +// ---------------------------------------------------------------------------------- +// RAP_Pubby Server Configuration Section +// ---------------------------------------------------------------------------------- + + +// The root URL where the RAP_Pubby web application is installed, e.g. http://myserver/mydataset/. +define('PUBBY_WEBBASE', 'http://localhost/rdfapi-php/rap-pubby/'); + +// The URI of a resource which description will be displayed as the home page of the RAP_Pubby installation. +// Note that you have to specify a dataset URI, not a mapped web URI. +define('PUBBY_INDEX_RESOURCE', 'http://www4.wiwiss.fu-berlin.de/is-group/projects/RAP'); + +// ---------------------------------------------------------------------------------- +// RAP_Pubby Database Configuration +// ---------------------------------------------------------------------------------- + +// Note: in order to serve a DbModel the $_PUBBY_DATASET['loadRDF'] parameter must be set to ''; +define('PUBBY_DB_DRIVER', ''); +define('PUBBY_DB_HOST', ''); +define('PUBBY_DB_DB', ''); +define('PUBBY_DB_USER', ''); +define('PUBBY_DB_PASS', ''); + +define('PUBBY_DBMODEL', ''); + + +// ---------------------------------------------------------------------------------- +// RAP_Pubby Dataset Configuration Section +// ---------------------------------------------------------------------------------- + +$_PUBBY_DATASET = array( + + // Load an RDF document from the Web or the file system and use it as the data source. + // If specified, the database connection configured above will be ignored. + 'loadRDF' => 'example/group.rdf', + + // The common URI prefix of the resource identifiers in the served dataset. + // Note: Only resources with this prefix will be mapped and made available by RAP_Pubby + 'datasetBase' => 'http://www4.wiwiss.fu-berlin.de/is-group/', + + // If present, only dateset URIs matching this regular expression will be mapped and made available by RAP_Pubby. + // The regular expression must match everything after the $_PUBBY_DATASET['datasetBase'] part of the URI. + // For example: datasetBase = 'http://example.org/' and datasetURIPattern = '/(users|documents)\/.*/' + // This will publish the dataset URI http://example.org/users/alice, + // but not http://example.org/invoices/5395842 because the URI part invoices/5395842 does not match the regular expression. + // default value = ''; + 'datasetURIPattern' => '', + + // If present, this string will be prefixed to the mapped web URIs. This is useful if you have to avoid potential name clashes + // with URIs already used by the server itself. For example, if the dataset includes a URI http://mydataset/page, + // and the dataset prefix is http://mydataset/, then there would be a clash after mapping because RAP_Pubby reserves + // the mapped URI http://myserver/mydataset/page for its own use. In this case, you may specify a prefix like "resource/", + // which will result in a mapped URI of http://myserver/mydataset/resource/page. + // NOTE: the prefix must end with "/" + 'webResourcePrefix' => '', + + // Links to an RDF document whose prefix declarations will be used in output. + // e.g. 'usePrefixesFrom' => 'prefixes.n3', You can use the file prefixes.n3 in rap-pubby directory as template. + // Defaults to the empty URL, which means the prefixes from the input RAP model will be used. + 'usePrefixesFrom' => 'prefixes.n3', + + // All statements inside the metadata file will be added as metadata to the RDF documents published + // for this dataset. This feature can be used for instance to add licensing information to your published documents. + // You can use the file metadata.n3 in rap-pubby directory as template. + 'rdfDocumentMetadata' => 'metadata.n3', + + + // If set to true, an owl:sameAs statement of the form <web_uri> owl:sameAs <dataset_uri> will be present in Linked Data output. + 'addSameAsStatements' => false, +); + + +// ---------------------------------------------------------------------------------- +// Pubby HTML Output Setting +// ---------------------------------------------------------------------------------- + +// URL of the template file used in HTML output +define ('PUBBY_HTML_SER__TEMPLATE', 'templ/template.html'); + +// URL of the template file rendering '404 - Not Found' information used in HTML output +define ('PUBBY_HTML_SER__TEMPLATE_404', 'templ/404_notFound.html'); + +// Link to directory where template includes (css-files, scripts, images) are located +define ('PUBBY_HTML_SER__TEMPL_INCL_DIR' , 'templ/'); + +// The name of the project, for display in page titles +define ('PUBBY_HTML_SER__PROJECT_NAME', 'PubbyExample@Localhost'); + +// A project homepage or similar URL, for linking in page titles +define ('PUBBY_HTML_SER__PROJECT_HOMEPAGE', 'http://localhost/rap-pubby/doc/RAP_Pubby.htm'); + +// For resource label and short description +define ('PUBBY_HTML_SER__DEFAULT_LANG', 'en'); + +// The value of these RDF properties, if present in the dataset, will be used as labels and page titles for resources. +// Note: If multiple properties are present only the first one found (in default language, if specified) will be showed. +$_PUBBY_HTML_SER['labelProperty'] = array ( + new Resource(RDF_SCHEMA_URI ."label"), + new Resource(DC_NS ."title"), + new Resource(FOAF_NS ."name"), +); + +// The value of these RDF properties, if present in the dataset, will be used as short textual description for resources. +// Note: If multiple properties are present only the first one found (in default language, if specified) will be showed. +$_PUBBY_HTML_SER['commentProperty'] = array ( + new Resource(RDF_SCHEMA_URI ."comment"), + new Resource(DC_NS ."description"), +); + +// The value of these RDF properties, if present in the dataset, will be used as an image URL to show a depiction of the item. +// Note: If multiple properties are present only the first one found will be showed. +$_PUBBY_HTML_SER['imageProperty'] = array ( + new Resource(FOAF_NS ."depiction"), +); + +?> \ No newline at end of file Added: trunk/rdfapi-php/rap-pubby/doc/RAP_Pubby.htm =================================================================== --- trunk/rdfapi-php/rap-pubby/doc/RAP_Pubby.htm (rev 0) +++ trunk/rdfapi-php/rap-pubby/doc/RAP_Pubby.htm 2008-02-29 15:03:46 UTC (rev 557) @@ -0,0 +1,290 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html><head><title>RDF Net API</title> + +<meta content="text/html; charset=windows-1252" http-equiv="Content-Type"> +<link href="phpdoc.css" rel="stylesheet" type="text/css"> +</head> +<body bgcolor="#ffffff"> + +<h3>RDF API for PHP </h3> +<h1>RAP_Pubby - + + + A Linked Data Frontend for RAP </h1> +<p>This document is part of the <a href="http://sites.wiwiss.fu-berlin.de/suhl/bizer/rdfapi/tests.html">RAP - Rdf API for PHP</a> documentation.</p> +<p>Radoslaw Oldakowski <<a href="mailto:ra...@gm...">ra...@gm...</a>><br> +Jan 2008</p> +<br> + +<h2>About</h2> +<p><strong>RAP_Pubby</strong> can be used to add <strong>Linked Data interfaces</strong> to RAP models.</p> +<p> <a href="http://linkeddata.org/">Linked Data </a> is a style of publishing data on the Semantic Web that makes it easy to interlink, discover and consume data on the Semantic Web. It allows a wide variety of existing RDF browsers (e.g. <a href="http://sites.wiwiss.fu-berlin.de/suhl/bizer/ng4j/disco/">Disco </a>, <a href="http://www.w3.org/2005/ajar/tab">Tabulator </a>, <a href="http://demo.openlinksw.com/DAV/JS/rdfbrowser/index.html">OpenLink Browser </a>), RDF crawlers (e.g. <a href="http://www.swse.org/">SWSE </a>, <a href="http://swoogle.umbc.edu/">Swoogle </a>), and query agents (e.g. <a href="http://sites.wiwiss.fu-berlin.de/suhl/bizer/ng4j/semwebclient/">SemWeb Client Library </a>, <a href="http://moustaki.org/swic/">SWIC </a>) to access the data. </p> +<p>RAP_Pubby was orignially inspired by <a href="http://www4.wiwiss.fu-berlin.de/pubby/">Pubby - A Linked Data Frontend for SPARQL Endpoints</a>. </p> +<h3> Features:</h3> +<ul> + <li> Provides a <strong>linked data interface</strong> to RAP RDF models (file or database backed) </li> + <li> Provides <strong>dereferenceable URIs</strong> by rewriting URIs found in the exposed dataset into the RAP_Pubby server's namespace </li> + <li> Provides a simple template-based <strong>HTML interface</strong> showing the data available about each resource </li> + <li> Takes care of handling <strong>303 redirects and content negotiation</strong> </li> +</ul> +<p> </p> +<h2>How It Works </h2> +<p>In RDF, resources are identified by URIs. The URIs used in most RDF datasets are not dereferenceable , meaning they cannot be accessed in a Semantic Web browser, but return 404 Not Found errors instead, or use non-dereferenceable URI schemes, as in the fictional URI tag:dbpedia.org,2007:Berlin . </p> +<p>When setting up a RAP_Pubby server for your RDF data, you will configure a mapping that translates those URIs to dereferenceable URIs handled by RAP_Pubby. If your server is running at http://myserver.org:8080/rap-pubby/ , then the Berlin URI above might be mapped to http://myserver.org:8080/rap-pubby/Berlin . </p> +<p>RAP_Pubby will handle requests to the mapped URIs by asking the underlying RAP model for information about the original URI, and passing back the results to the client. It also handles various details of the HTTP interaction , such as the 303 redirect required by Web Architecture, and content negotiation between HTML, RDF/XML and N3 descriptions of the same resource. </p> +<p> </p> +<h2>Installation</h2> + +<p> +</p><ol><li>The first thing you need to do is to get mod-rewrite to redirect requests + to the rap_pubby.php handler script. To do this you need to make sure that the + rewrite module is enabled in the Apache configuration file "httpd.conf":<br> + <br> + <table border="1" cellpadding="3" cellspacing="0" width="60%"> + <tbody> + <tr valign="top"> + <td bgcolor="#e7e7ef"> <p><code>LoadModule rewrite_module modules/mod_rewrite.so</code></p></td> + </tr> + </tbody> + </table> + <br> + And to make sure that output buffering is turned on in the PHP configuration + file "php.ini":<br> + <br> + <table border="1" cellpadding="3" cellspacing="0" width="60%"> + <tbody> + <tr valign="top"> + <td bgcolor="#e7e7ef"> <p><code>output_buffering = on</code></p></td> + </tr> + </tbody> + </table> + <br> + </li> + <li>You need to edit the ".htaccess" file in the rap-pubby directory. Change the + 'RewriteBase' bit to reflect the URI base of the rap-pubbyi directory relative to the htdocs directory of your Apache server. E.g.<br> + <br> + <table border="1" cellpadding="3" cellspacing="0" width="60%"> + <tbody> + <tr valign="top"> + <td bgcolor="#e7e7ef"> <p> <code>RewriteEngine on<br> + RewriteBase /rdfapi-php/rap-pubby/ #<---- Edit this <br> + RewriteRule ^[^\.]*$ rap_pubby.php</code></p></td> + </tr> + </tbody> + </table> + <br> + <b>Note:</b> the AllowOverride parameter in "httpd.conf" must be set to allow the use of an .htaccess file in the rap-pubby directory. + <br> + <br> + </li> + <li> Modify the "config.php" file in rap-pubby directory according to your needs (see next section).<br><br> + </li> + </ol> +<h2>Configuration</h2> +<h3>Include RAP Classes</h3> +<ul> + <li> + <h6><strong> RDFAPI_INCLUDE_DIR</strong></h6> + </li> +</ul> +<p> <strong>!!! Required !!!</strong> Modify this if your rap-pubby is not installed in RAP subdirectory.</p> +<br> +<h3>RAP_Pubby Server Configuration</h3> +<ul> + <li> + <h6><strong> PUBBY_WEBBASE</strong></h6> + </li> +</ul> +<p> <strong>!!! Required !!!</strong> The root URL where the RAP_Pubby web application is installed, e.g. http://myserver/mydataset/.</p> +<ul> + <li> + <h6><strong> PUBBY_INDEX_RESOURCE</strong></h6> + </li> +</ul> +<p> The URI of a resource which description will be displayed as the home page of the RAP_Pubby installation. <br> +NOTE: you have to specify a dataset URI, not a mapped web URI.</p> +<p> </p> +<h3>RAP_Pubby Database Configuration</h3> +<p>Note: in order to serve a DbModel the $_PUBBY_DATASET['loadRDF'] parameter must be set to "". </p> +<ul> + <li> + <h6>PUBBY_DB_DRIVER, PUBBY_DB_HOST, PUBBY_DB_DB, PUBBY_DB_USER, PUBBY_DB_PASS</h6> + </li> +</ul> +<p>Database connection setting </p> +<ul> + <li> + <h6>PUBBY_DBMODEL</h6> + </li> +</ul> +<p>Name of the RAP DbModel to be served by RAP_Pubby </p> +<h3>RAP_Pubby Dataset Configuration</h3> +<ul> + <li> + <h6>$_PUBBY_DATASET[''loadRDF'']</h6> + </li> +</ul> +<p>Load an RDF document from the Web or the file system and use it as the data source. If specified, the database connection configured above will be ignored.</p> +<ul> + <li> + <h6>$_PUBBY_DATASET['datasetBase']</h6> + </li> +</ul> +<p><strong>!!! Required !!!</strong> The common URI prefix of the resource identifiers in the served dataset. <br> +NOTE: Only resources with this prefix will be mapped and made available by RAP_Pubby</p> +<ul> + <li> + <h6>$_PUBBY_DATASET['datasetURIPattern']</h6> + </li> +</ul> +<p>If present, only dateset URIs matching this regular expression will be mapped and made available by RAP_Pubby. The regular expression must match everything after the $_PUBBY_DATASET['datasetBase'] part of the URI. For example: datasetBase = 'http://example.org/' and datasetURIPattern = '/(users|documents)\/.*/' This will publish the dataset URI http://example.org/users/alice, but not http://example.org/invoices/5395842 because the URI part invoices/5395842 does not match the regular expression. default value = ''.</p> +<ul> + <li> + <h6>$_PUBBY_DATASET['webResourcePrefix']</h6> + </li> +</ul> +<p>If present, this string will be prefixed to the mapped web URIs. This is useful if you have to avoid potential name clashes with URIs already used by the server itself. For example, if the dataset includes a URI http://mydataset/page, and the dataset prefix is http://mydataset/, then there would be a clash after mapping because RAP_Pubby reserves the mapped URI http://myserver/mydataset/page for its own use. In this case, you may specify a prefix like "resource/", which will result in a mapped URI of http://myserver/mydataset/resource/page.<br> +NOTE: the prefix must end with "/"</p> +<ul> + <li> + <h6>$_PUBBY_DATASET['usePrefixesFrom']</h6> + </li> +</ul> +<p>Links to an RDF document whose prefix declarations will be used in output. You can use the file prefixes.n3 in rap-pubby directory as template. If not specified the prefixes from the input RAP model will be used.</p> +<ul> + <li> + <h6>$_PUBBY_DATASET['rdfDocumentMetadata']</h6> + </li> +</ul> +<p>All statements inside the metadata file will be added as metadata to the RDF documents published for this dataset. This feature can be used for instance to add licensing information to your published documents. You can use the file metadata.n3 in rap-pubby directory as template. </p> +<ul> + <li> + <h6>$_PUBBY_DATASET['addSameAsStatements']</h6> + </li> +</ul> +<p>If set to true, an owl:sameAs statement of the form <web_uri> owl:sameAs <dataset_uri> will be present in Linked Data output.</p> +<p> </p> +<h3>Pubby HTML Output Setting</h3> +<ul> + <li> + <h6>PUBBY_HTML_SER__TEMPLATE</h6> + </li> +</ul> +<p>URL of the template file used in HTML output</p> +<ul> + <li> + <h6>PUBBY_HTML_SER__TEMPLATE_404</h6> + </li> +</ul> +<p>URL of the template file rendering '404 - Not Found' information used in HTML output</p> +<ul> + <li> + <h6>PUBBY_HTML_SER__TEMPL_INCL_DIR</h6> + </li> +</ul> +<p>Link to directory where template includes (css-files, scripts, images) are located</p> +<ul> + <li> + <h6>PUBBY_HTML_SER__PROJECT_NAME</h6> + </li> +</ul> +<p>The name of the project, for display in page titles</p> +<ul> + <li> + <h6>PUBBY_HTML_SER__PROJECT_HOMEPAGE</h6> + </li> +</ul> +<p>A project homepage or similar URL, for linking in page titles</p> +<ul> + <li> + <h6>PUBBY_HTML_SER__DEFAULT_LANG</h6> + </li> +</ul> +<p>Default language for resource label and short description </p> +<ul> + <li> + <h6>$_PUBBY_HTML_SER['labelProperty']</h6> + </li> +</ul> +<p>The value of these RDF properties, if present in the dataset, will be used as labels and page titles for resources. <br> + NOTE: If multiple properties are present only the first one found (in default language, if specified) will be showed.</p> +<ul> + <li> + <h6>$_PUBBY_HTML_SER['commentProperty']</h6> + </li> +</ul> +<p>The value of these RDF properties, if present in the dataset, will be used as short textual description for resources. <br> +NOTE: If multiple properties are present only the first one found (in default language, if specified) will be showed.</p> +<ul> + <li> + <h6>$_PUBBY_HTML_SER['imageProperty']</h6> + </li> +</ul> +<p>The value of these RDF properties, if present in the dataset, will be used as an image URL to show a depiction of the item.<br> +NOTE: If multiple properties are present only the first one found will be showed.<br></p><br> +<h2>Using Your Own HTML Templates </h2> +<p>In RAP_Pubby you can use your own HTML templates. RAPpubbyHTMLserializer loads an html template file specified in the config.php and replaces the placeholders inside a template with dynamically generated content. Following placeholders are allowed:</p> +<ul> + <li> + <h6>##_templInclDirURL_##</h6> + </li> +</ul> +Will be replaced with PUBBY_HTML_SER__TEMPL_INCL_DIR constant from config.php +<ul> + <li> + <h6>##_projetName_##</h6> + </li> +</ul> +Will be replaced with PUBBY_HTML_SER__PROJECT_NAME constant from config.php +<ul> + <li> + <h6>##_projectHomepage_##</h6> + </li> +</ul> +<p>Will be replaced with PUBBY_HTML_SER__PROJECT_HOMEPAGE constant from config.php </p> +<ul> + <li> + <h6>##_resURI_##</h6> + </li> +</ul> +<p>Will be replaced with the URI of the resource beeing described </p> +<ul> + <li> + <h6>##_repURIdata_##</h6> + </li> +</ul> +<p>Will be replaced with the URI of the resource representation in RDF/XML format. (For URIs of the resource representation in n3 place ##_repURIdata_##?output=n3)</p> +<ul> + <li> + <h6>##_resourceLabel_##</h6> + </li> +</ul> +<p>Will be replaced with the value of the label property of the URI beeing described, according to $_PUBBY_HTML_SER['labelProperty'] in config.php +</p> +<ul> + <li> + <h6>##_shortDescription_##</h6> + </li> +</ul> +<p>Will be replaced with the value of the comment property of the URI beeing described, according to $_PUBBY_HTML_SER['commentProperty'] in config.php</p> +<ul> + <li> + <h6>##_imgLink_##</h6> + </li> +</ul> +<p>Will be replaced with the value of the image property of the URI beeing described, according to $_PUBBY_HTML_SER['imageProperty'] in config.php</p> +<ul> + <li> + <h6>##_prop_tableRows_## </h6> + </li> +</ul> +<p>Will be replaced with table rows containing 'property - property value' pairs of the resource beeing described. The styling of odd and even table rows can be altered in your css file by defining 'odd' and 'even' classes respectively. </p> +<p> </p> +<h2>Use Case Example</h2> +<p>RAP_Pubby distribution contains a small use case example showing information about the Web-based Systems Group @ Freie Universit\xE4t Berlin. To run this example: +<li>install RAP_Pubby (see installation section)</li> +<li>open config.php and modify the paramters RDFAPI_INCLUDE_DIR and PUBBY_WEBBASE</li> +<li>type the PUBBY_WEBBASE-URL into the address bar of your web browser</li> +</p> +<br> +</body></html> \ No newline at end of file Added: trunk/rdfapi-php/rap-pubby/doc/phpdoc.css =================================================================== --- trunk/rdfapi-php/rap-pubby/doc/phpdoc.css (rev 0) +++ trunk/rdfapi-php/rap-pubby/doc/phpdoc.css 2008-02-29 15:03:46 UTC (rev 557) @@ -0,0 +1,288 @@ +BODY { + background-color : #FFFFFF; + color : #000000; + font-family : Verdana, Arial, sans-serif; + font-size : smaller; + margin-left : 1em; + margin-right : 1em; +} + +td { + font-size: smaller +} + +A { + +} + +A:LINK, A:VISITED { + color : #000099; + text-decoration : none; +} + +A:HOVER { + background-color : #FFFFFF; + color : #00009F; + text-decoration : underline; +} + +H2 { + color : Black; + font-size : 13pt; + font-weight: 400; + letter-spacing: .2em; + background-color: #CCCCCC; + padding: .4em; +} + +H3 { + color : Navy; + font-size : 12pt; + margin-top :1em; +} + +H4 { + color : Navy; + font-size : 10pt; + background-color : #E6E6FA; + padding-bottom : .5em; + padding-top : .5em; + padding-left : .5em; + +} + +H5 { + color : Navy; + font-size : 10pt; + font-weight : 900; + margin-bottom : -1em; +} + +BLOCKQUOTE { + margin-left : 0; +} + +CAPTION { + font-weight : 800; +} + +TH { + background-color : #CCCCCC; +} + +CODE { + font-size: 9pt; +} + +.MODULE_NAME { + color : Black; + background-color: #D9ECFF; + font-size : 16pt; + margin-bottom : .1em; + padding-top : 5px; + padding-left : 5px; +} + + .PACKAGE_NAME { + padding: .2em; + padding-left: .2em; + color : #000000; + background-color: #D9FBFF; + font-size : 9pt; + font-weight : 800; + margin-bottom : -2em; +} + + .PACKAGE_IN_NAV { + color : #000000; + font-size : 9pt; +<!-- font-weight : 800; --> +} + + + +.COPYRIGHT { + font-size: 8pt; +} + +.COPYRIGHT, .CLASS_FIELD_CONTENT { + margin-right: 1.5in; + margin-left: 1em; +} + +.FIELD_LABEL { + background-color: #FFCCCC; + padding: .15em; + +} + +.public_CLASS_FUNCTION_TABLE .public_METHOD_FUNCTION_TABLE { + background-color: #DABD89; +} + +<!-- +.private_CLASS_FUNCTION_TABLE, .private_METHOD_FUNCTION_TABLE { + background-color: #CBCEA6; +} --> + +.private_CLASS_FUNCTION_TABLE, .private_METHOD_FUNCTION_TABLE { + background-color: #FFFFFF; +} + + +.public_FUNCTION_DETAIL_NAME { + font-weight: bold; + font-size: 11pt; + color: black; + background-color: #9999FF; + padding: .2em; +} + +.private_FUNCTION_DETAIL_NAME { + font-weight: bold; + font-size: 11pt; + color: black; + background-color: #CCCCCC; + padding: .2em; +} + +.public_FUNCTION_DETAIL_SPAN, .private_FUNCTION_DETAIL_SPAN { + color: #333333; + margin-left: .5em; + margin-right: .75em; + font-style: bold; +} + +.FUNCTION_DIVIDER, .ELEMENT_LIST_DIVIDER { + width: 20em; + height: .2em; + color: black; +} + +.VARIABLE_DIVIDER { + width: 20em; + height: .2em; + color: red; +} + +.CONSTANTS_DIVIDER { + width: 20em; + height: .2em; + color: blue; +} + +.FUNCTION_DETAILS_LABEL { + Abackground-color: #AACCFF; +} + +.FUNCTION_DETAILS_CONTENT { + Abackground-color: #CCFF99; +} + +.FUNCTION_DETAILS_AUTHOR { + font-size: 11 pt; +} + +.FUNCTION_DETAILS_NAME_CELL { + Abackground-color: green; +} + +.FUNCTION_DETAILS_PARAMETER_CELL { + background-color: #FFFFCC; + padding-left: .5em; + padding-right: .5em; + padding-top: 0em; + padding-bottom: 0em; +} + +.FUNCTION_DETAILS_PARAMETER_TOP_CELL { + background-color: #DDDDDD; + padding-left: .5em; + padding-right: .5em; + padding-top: 0em; + padding-bottom: 0em; +} + +.FUNCTION_DETAILS_NAME_CELL { + background-color: purple; + +} + +.TOP_NAV_LINK { + text-align: left; +} + +.TOP_NAV_LINK A:LINK { + color: black; +} + +.TOP_NAV_LINK A:VISTED { + color: black; + background-color: white; +} + +.TOP_NAV_LINK A:HOVER { + color: black; + background-color: orange; + text-decoration: underline; +} + +.TOP_NAV_BAR { + background-color: #99CCFF; + padding: .2em; +} + +.MAIN_TITLE { + font-size: 13pt; + font-weight: bold; + margin-bottom: -1.5em; + margin-top: 0em; +} + +.SUB_TITLE { + font-size: 11pt; + font-weight: bold; + background-color: #E7E8E3; + padding-left: .3em; + margin-bottom: -1em; + margin-top: 2em; +} + +.SECTION_TITLE, .SECTION_TITLE_SPAN { + font-size: 10pt; + margin-left: 0em; + margin-bottom: -1.4em; +} + +.SECTION_TITLE_SPAN { + text-decoration: underline; + background-color: #CFDDEB; + padding-right: 5em; +} +.ELEMENT_NAME { + font-size: 8pt; + margin-bottom: -1.6em; + margin-left: 1.5em; +} + +.APP_NAME { + font-size: 20pt; + font-weight: 600; +} + +.CLASSES_DIV, .MODULES_DIV { + background-color: #CFDDEB; + margin-left: 1em; + padding-left: 1em; +} + +.PACKAGE_DIV { + background-color: BLACK; + margin-left: -.5em; + padding-left: .5em; +} + +.MAJOR_SECTION { + background-color: #FFFFCC; + padding: 1em; +} \ No newline at end of file Added: trunk/rdfapi-php/rap-pubby/example/group.rdf =================================================================== --- trunk/rdfapi-php/rap-pubby/example/group.rdf (rev 0) +++ trunk/rdfapi-php/rap-pubby/example/group.rdf 2008-02-29 15:03:46 UTC (rev 557) @@ -0,0 +1,834 @@ +<rdf:RDF + xmlns:admin="http://webns.net/mvcb/" + xmlns:dctype="http://purl.org/dc/dcmitype/" + xmlns:foaf="http://xmlns.com/foaf/0.1/" + xmlns:iswc="http://annotation.semanticweb.org/iswc/iswc.daml#" + xmlns:d2r="http://sites.wiwiss.fu-berlin.de/suhl/bizer/d2r-server/config.rdf#" + xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" + xmlns:owl="http://www.w3.org/2002/07/owl#" + xmlns:db1="http://www.example.org/dbserver01/db01#" + xmlns:doap="http://usefulinc.com/ns/doap#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:xsd="http://www.w3.org/2001/XMLSchema#" + xmlns:vcard="http://www.w3.org/2001/vcard-rdf/3.0#" + xmlns:swrc="http://swrc.ontoware.org/ontology#" + xmlns:dc="http://purl.org/dc/elements/1.1/" > + + <rdf:Description rdf:about="http://www4.wiwiss.fu-berlin.de/is-group/persons/Daniel__Westphal"> + <iswc:research_topic rdf:resource="http://www4.wiwiss.fu-berlin.de/is-group/topics/Semantic_Web"/> + <foaf:mbox rdf:resource="mailto:ma...@d-..."/> + <foaf:firstname rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Daniel</foaf:firstname> + <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Daniel Westphal</rdfs:label> + <foaf:surname rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Westphal</foaf:surname> + <rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person"/> + <foaf:homepage rdf:resource="http://www.d-westphal.de/"/> + <foaf:workplaceHomepage rdf:resource="http://www.webahp.info/"/> + </rdf:Description> + <rdf:Description rdf:about="http://www4.wiwiss.fu-berlin.de/is-group/projects/Disco"> + <doap:maintainer rdf:resource="http://www4.wiwiss.fu-berlin.de/is-group/persons/Chris__Bizer"/> + <doap:developer rdf:resource="http://www4.wiwiss.fu-berlin.de/is-group/persons/Tobias__Gau%C3%9F"/> + <doap:name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Disco - Hyperdata Browser</doap:name> + <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Disco - Hyperdata Browser</rdfs:label> + <doap:programming-language rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Java</doap:programming-language> + <doap:description rdf:datatype="http://www.w3.org/2001/XMLSchema#string">The Disco - Hyperdata Browser is a simple browser for navigating the Semantic Web as an unbound set of data sources. The browser renders all information, that it can find on the Semantic Web about a specific resource, as an HTML page. This resource description contains hyperlinks that allow you to navigate between resources. While you move from resource to resource, the browser dynamically retrieves information by dereferencing HTTP URIs and by following rdfs:seeAlso links. + +</doap:description> + <doap:os rdf:datatype="http://www.w3.org/2001/XMLSchema#string">platform independent</doap:os> + <doap:shortname rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Disco</doap:shortname> + <rdf:type rdf:resource="http://usefulinc.com/ns/doap#Project"/> + <doap:homepage rdf:resource="http://sites.wiwiss.fu-berlin.de/suhl/bizer/ng4j/disco/"/> + <doap:license rdf:resource="http://usefulinc.com/doap/licenses/gpl"/> + </rdf:Description> + <rdf:Description rdf:about="http://www4.wiwiss.fu-berlin.de/is-group/persons/Libby__Miller"> + <foaf:mbox rdf:resource="mailto:mailto:lib...@br..."/> + <foaf:nickname rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Libby</foaf:nickname> + <foaf:firstname rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Libby</foaf:firstname> + <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Libby Miller</rdfs:label> + <foaf:surname rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Miller</foaf:surname> + <rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person"/> + <foaf:depiction rdf:resource="http://swordfish.rdfweb.org/people/libby/libby.jpg"/> + <rdfs:seeAlso rdf:resource="http://swordfish.rdfweb.org/people/libby/rdfweb/webwho.xrdf"/> + <foaf:homepage rdf:resource="http://mail.ilrt.bris.ac.uk/~ecemm/"/> + <foaf:workplaceHomepage rdf:resource="http://www.asemantics.com"/> + </rdf:Description> + <rdf:Description rdf:about="http://www4.wiwiss.fu-berlin.de/is-group/events/Event5"> + <vcard:ADR rdf:resource="http://www4.wiwiss.fu-berlin.de/is-group/addresses/Address6"/> + <swrc:participant rdf:resource="http://www4.wiwiss.fu-berlin.de/is-group/persons/Chris__Bizer"/> + <swrc:participant rdf:resource="http://www4.wiwiss.fu-berlin.de/is-group/persons/Radoslaw__Oldakowski"/> + <dc:title rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Workshop on Scripting for the Semantic Web</dc:title> + <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Workshop on Scripting for the Semantic Web</rdfs:label> + <dc:date rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2005-05-30</dc:date> + <rdfs:seeAlso rdf:resource="http://www.semanticscripting.org/SFSW2005/"/> + <rdf:type rdf:resource="http://swrc.ontoware.org/ontology#Workshop"/> + </rdf:Description> + <rdf:Description rdf:about="http://www4.wiwiss.fu-berlin.de/is-group/addresses/Address7"> + <vcard:Country rdf:resource="http://www4.wiwiss.fu-berlin.de/is-group/countries/Japan"/> + <vcard:Locality rdf:resource="http://www4.wiwiss.fu-berlin.de/is-group/cities/Chiba"/> + </rdf:Description> + <rdf:Description rdf:about="http://www4.wiwiss.fu-berlin.de/is-group/cities/Freie_und_Hansestadt_Hamburg"> + <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Freie und Hansestadt Hamburg</rdfs:label> + <owl:sameAs rdf:resource="http://ws.geonames.org/rdf?geonameId=2911297"/> + </rdf:Description> + <rdf:Description rdf:about="http://www4.wiwiss.fu-berlin.de/is-group/topics/Knowledge_Representation_Languages"> + <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Knowledge Representation Languages</rdfs:label> + <owl:sameAs rdf:resource="http://annotation.semanticweb.org/iswc/iswc.daml#Knowledge_Representation_Languages"/> + </rdf:Description> + <rdf:Description rdf:about="http://www4.wiwiss.fu-berlin.de/is-group/cities/Chiba"> + <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Chiba</rdfs:label> + <owl:sameAs rdf:resource="http://ws.geonames.org/rdf?geonameId=2113015"/> + </rdf:Description> + <rdf:Description rdf:about="http://www4.wiwiss.fu-berlin.de/is-group/cities/Heraklion"> + <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Heraklion</rdfs:label> + <owl:sameAs rdf:resource="http://ws.geonames.org/rdf?geonameId=261741"/> + </rdf:Description> + <rdf:Description rdf:about="http://www4.wiwiss.fu-berlin.de/is-group/groups/Group3"> + <vcard:ADR rdf:resource="http://www4.wiwiss.fu-berlin.de/is-group/addresses/Address1"/> + <foaf:name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Department of Business and Economics</foaf:name> + <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Department of Business and Economics</rdfs:label> + <foaf:homepage rdf:resource="http://www.wiwiss.fu-berlin.de/wiwiss/main/index.html" /> + <rdf:type rdf:resource="http://swrc.ontoware.org/ontology#Department"/> + </rdf:Description> + <rdf:Description rdf:about="http://www4.wiwiss.fu-berlin.de/is-group/persons/Emmanuel__Pietriga"> + <foaf:mbox rdf:resource="mailto:emm...@in..."/> + <foaf:firstname rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Emmanuel</foaf:firstname> + <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Emmanuel Pietriga</rdfs:label> + <foaf:surname rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Pietriga</foaf:surname> + <rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person"/> + <foaf:depiction rdf:resource="http://www.lri.fr/~pietriga/id.jpg"/> + <owl:sameAs rdf:resource="http://www.lri.fr/~pietriga/foaf.rdf"/> + <foaf:homepage rdf:resource="http://www.lri.fr/~pietriga/"/> + <foaf:workplaceHomepage rdf:resource="http://www.inria.fr"/> + </rdf:Description> + <rdf:Description rdf:about="http://www4.wiwiss.fu-berlin.de/is-group/persons/Rowland__Watkins"> + <foaf:firstname rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Rowland</foaf:firstname> + <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Rowland Watkins</rdfs:label> + <foaf:surname rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Watkins</foaf:surname> + <rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person"/> + </rdf:Description> + <rdf:Description rdf:about="http://www4.wiwiss.fu-berlin.de/is-group/topics/World_Wide_Web"> + <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">World Wide Web</rdfs:label> + <owl:sameAs rdf:resource="http://annotation.semanticweb.org/iswc/iswc.daml#World_Wide_Web"/> + </rdf:Description> + <rdf:Description rdf:about="http://www4.wiwiss.fu-berlin.de/is-group/events/Event3"> + <vcard:ADR rdf:resource="http://www4.wiwiss.fu-berlin.de/is-group/addresses/Address4"/> + <swrc:participant rdf:resource="http://www4.wiwiss.fu-berlin.de/is-group/persons/Chris__Bizer"/> + <dc:title rdf:datatype="http://www.w3.org/2001/XMLSchema#string">ISWC 2005 - 4th International Semantic Web Conference</dc:title> + <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">ISWC 2005 - 4th International Semantic Web Conference</rdfs:label> + <rdfs:seeAlso rdf:resource="http://iswc2005.semanticweb.org/"/> + <rdf:type rdf:resource="http://swrc.ontoware.org/ontology#Conference"/> + </rdf:Description> + <rdf:Description rdf:about="http://www4.wiwiss.fu-berlin.de/is-group/countries/Greece"> + <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Greece</rdfs:label> + <owl:sameAs rdf:resource="http://ws.geonames.org/rdf?geonameId=390903"/> + </rdf:Description> + <rdf:Description rdf:about="http://www4.wiwiss.fu-berlin.de/is-group/events/Event1"> + <vcard:ADR rdf:resource="http://www4.wiwiss.fu-berlin.de/is-group/addresses/Address3"/> + <swrc:participant rdf:resource="http://www4.wiwiss.fu-berlin.de/is-group/persons/Chris__Bizer"/> + <dc:title rdf:datatype="http://www.w3.org/2001/XMLSchema#string">ISWC 2006 5th International Semantic Web Conference</dc:title> + <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">ISWC 2006 5th International Semantic Web Conference</rdfs:label> + <rdfs:seeAlso rdf:resource="http://iswc2006.semanticweb.org/"/> + <rdf:type rdf:resource="http://swrc.ontoware.org/ontology#Conference"/> + </rdf:Description> + <rdf:Description rdf:about="http://www4.wiwiss.fu-berlin.de/is-group/countries/Germany"> + <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Germany</rdfs:label> + <owl:sameAs rdf:resource="http://ws.geonames.org/rdf?geonameId=2921044"/> + </rdf:Description> + <rdf:Description rdf:about="http://www4.wiwiss.fu-berlin.de/is-group/persons/S%C3%B6ren__Auer"> + <vcard:ROLE rdf:resource="http://www4.wiwiss.fu-berlin.de/is-group/positions/Academic_Staff"/> + <foaf:mbox rdf:resource="mailto:au...@se..."/> + <foaf:firstname rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Sören</foaf:firstname> + <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Sören Auer</rdfs:label> + <foaf:surname rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Auer</foaf:surname> + <rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person"/> + <rdfs:seeAlso rdf:resource="http://www.informatik.uni-leipzig.de/~auer/foaf.rdf"/> + <owl:sameAs rdf:resource="http://www.auer.cx/soeren"/> + <foaf:homepage rdf:resource="http://www.informatik.uni-leipzig.de/~auer"/> + <foaf:workplaceHomepage rdf:resource="http://bis.informatik.uni-leipzig.de/"/> + </rdf:Description> + <rdf:Description rdf:about="http://www4.wiwiss.fu-berlin.de/is-group/topics/Query_Languages"> + <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Query Languages</rdfs:label> + <owl:sameAs rdf:resource="http://annotation.semanticweb.org/iswc/iswc.daml#Query_Languages"/> + </rdf:Description> + <rdf:Description rdf:about="http://www4.wiwiss.fu-berlin.de/is-group/persons/Veronika__Waue"> + <foaf:based_near rdf:resource="http://www4.wiwiss.fu-berlin.de/is-group/cities/Berlin"/> + <foaf:knows rdf:resource="http://www4.wiwiss.fu-berlin.de/is-group/persons/Chris__Bizer"/> + <foaf:knows rdf:resource="http://www4.wiwiss.fu-berlin.de/is-group/persons/Richard__Cyganiak"/> + <foaf:knows rdf:resource="http://www4.wiwiss.fu-berlin.de/is-group/persons/Tobias__Gau%C3%9F"/> + <foaf:knows rdf:resource="http://www4.wiwiss.fu-berlin.de/is-group/persons/Radoslaw__Oldakowski"/> + <foaf:knows rdf:resource="http://www4.wiwiss.fu-berlin.de/is-group/persons/Swantje__Friedrich"/> + <foaf:knows rdf:resource="http://www4.wiwiss.fu-berlin.de/is-group/persons/Sebastian__Thimm"/> + <foaf:knows rdf:resource="http://www4.wiwiss.fu-berlin.de/is-group/persons/Uwe__Suhl"/> + <vcard:ROLE rdf:resource="http://www4.wiwiss.fu-berlin.de/is-group/positions/Academic_Staff"/> + <vcard:ADR rdf:resource="http://www4.wiwiss.fu-berlin.de/is-group/addresse... [truncated message content] |
From: <fu...@us...> - 2008-01-22 10:52:51
|
Revision: 556 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=556&view=rev Author: fusel2k Date: 2008-01-22 02:52:48 -0800 (Tue, 22 Jan 2008) Log Message: ----------- [fix] bug where message 'Nesting level too deep - recursive dependency?' occurs if trying to export MemModels Modified Paths: -------------- trunk/rdfapi-php/api/syntax/N3Serializer.php Modified: trunk/rdfapi-php/api/syntax/N3Serializer.php =================================================================== --- trunk/rdfapi-php/api/syntax/N3Serializer.php 2007-12-11 20:27:34 UTC (rev 555) +++ trunk/rdfapi-php/api/syntax/N3Serializer.php 2008-01-22 10:52:48 UTC (rev 556) @@ -402,7 +402,7 @@ foreach ($ts->triples as $t) { $p = $t->getPredicate(); - if ($p == $lastp) { + if ($p === $lastp) { $out .= ' , '; } else { if ($lastp!='') { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <p_f...@us...> - 2007-12-11 20:27:38
|
Revision: 555 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=555&view=rev Author: p_frischmuth Date: 2007-12-11 12:27:34 -0800 (Tue, 11 Dec 2007) Log Message: ----------- [fixed] removed all newlines and whitespaces in order to follow the json spec; escaped all forbidden chars (see json spec for details) [modified] test cases updated in order to test special char cases Modified Paths: -------------- trunk/rdfapi-php/api/syntax/JsonParser.php trunk/rdfapi-php/api/syntax/JsonSerializer.php trunk/rdfapi-php/test/unit/Syntax/jsonParser_test.php trunk/rdfapi-php/test/unit/Syntax/jsonSerializer_test.php Modified: trunk/rdfapi-php/api/syntax/JsonParser.php =================================================================== --- trunk/rdfapi-php/api/syntax/JsonParser.php 2007-12-05 08:18:50 UTC (rev 554) +++ trunk/rdfapi-php/api/syntax/JsonParser.php 2007-12-11 20:27:34 UTC (rev 555) @@ -19,7 +19,7 @@ $jsonModel = array(); $jsonModel = json_decode($jsonString, true); - + // throws an excpetion if json model was corrupt if (!is_array($jsonModel)) { throw new Exception('error in json string'); @@ -39,7 +39,9 @@ $dtype = (isset($obj['datatype'])) ? $obj['datatype'] : ''; $lang = (isset($obj['lang'])) ? $obj['lang'] : ''; - $o = new Literal($obj['value'], $lang); + $oVal = $obj['value']; + + $o = new Literal($oVal, $lang); $o->setDatatype($dtype); } Modified: trunk/rdfapi-php/api/syntax/JsonSerializer.php =================================================================== --- trunk/rdfapi-php/api/syntax/JsonSerializer.php 2007-12-05 08:18:50 UTC (rev 554) +++ trunk/rdfapi-php/api/syntax/JsonSerializer.php 2007-12-11 20:27:34 UTC (rev 555) @@ -4,7 +4,7 @@ * * @package syntax * @author Philipp Frischmuth <ph...@fr...> - * @version $Id:$ + * @version $Id$ */ class JsonSerializer extends Object { @@ -28,11 +28,7 @@ // sort alphabetically ksort($subjects); - - // echo '<pre>'; - // print_r($subjects); - // echo '</pre>'; - + // triples are sorted by subject now, each key is a subject uri, containing all triples with this subject uri $i = 0; foreach ($subjects as $predicatesArray) { @@ -47,9 +43,9 @@ // add special _: sequence for blank node only if ($subj instanceof BlankNode) { - $jsonString .= PHP_EOL . ' "_:' . $subj->getLabel() . '" : '; + $jsonString .= '"_:' . $this->_escapeValue($subj->getLabel()) . '":'; } else { - $jsonString .= PHP_EOL . ' "' . $subj->getLabel() . '" : '; + $jsonString .= '"' . $this->_escapeValue($subj->getLabel()) . '":'; } @@ -73,7 +69,7 @@ } $j++; - $jsonString .= PHP_EOL . ' "' . $valueArray[0]->getLabelPredicate() . '" : '; + $jsonString .= '"' . $this->_escapeValue($valueArray[0]->getLabelPredicate()) . '":'; // create a json array (value array) $jsonString .= '['; @@ -86,52 +82,82 @@ $k++; // create json value object (value object) - $jsonString .= PHP_EOL . ' {'; + $jsonString .= '{'; $obj = $triple->getObject(); // add special _: sequence for blank nodes only if ($obj instanceof BlankNode) { - $jsonString .= PHP_EOL . ' "value" : "_:' . $obj->getLabel() . '",'; + $jsonString .= '"value":"_:' . $this->_escapeValue($obj->getLabel()) . '",'; + } else if ($obj instanceof Literal) { + $jsonString .= '"value":"' . $this->_escapeValue($obj->getLabel()) . '",'; } else { - $jsonString .= PHP_EOL . ' "value" : "' . $obj->getLabel() . '",'; + $jsonString .= '"value":"' . $this->_escapeValue($obj->getLabel()) . '",'; } // add type of object if ($obj instanceof Literal) { - $jsonString .= PHP_EOL . ' "type" : "literal"'; + $jsonString .= '"type":"literal"'; } else if ($obj instanceof BlankNode) { - $jsonString .= PHP_EOL . ' "type" : "bnode"'; + $jsonString .= '"type":"bnode"'; } else { - $jsonString .= PHP_EOL . ' "type" : "uri"'; + $jsonString .= '"type":"uri"'; } if ($obj instanceof Literal) { if ($obj->getLanguage() != '') { - $jsonString .= ',' . PHP_EOL . ' "lang" : "' . $obj->getLanguage() . '"'; + $jsonString .= ',"lang":"' . $this->_escapeValue($obj->getLanguage()) . '"'; } if ($obj->getDatatype() != '') { - $jsonString .= ',' . PHP_EOL . ' "datatype" : "' . $obj->getDatatype() . '"'; + $jsonString .= ',"datatype":"' . $this->_escapeValue($obj->getDatatype()) . '"'; } } // close value object - $jsonString .= PHP_EOL . ' }'; + $jsonString .= '}'; } // close the value array - $jsonString .= PHP_EOL . ' ]'; + $jsonString .= ']'; } // close the json object (for the subject) (subject object) - $jsonString .= PHP_EOL . ' }'; + $jsonString .= '}'; } // close root json object (root object) - $jsonString .= PHP_EOL . '}'; + $jsonString .= '}'; return $jsonString; } + + /* + * Escapes the following chars as specified at json.org: + * + * " -> \" + * \ -> \\ + * / -> \/ + * \b -> \\b + * \f -> \\f + * \n -> \\n + * \r -> \\r + * \t -> \\t + * \uXXXX -> \\uXXXX + */ + protected function _escapeValue($value) { + + + $value = str_replace("\\", '\\\\', $value); + #$value = str_replace("/", '\/', $value); + $value = str_replace("\n", '\\n', $value); + $value = str_replace("\t", '\\t', $value); + $value = str_replace("\r", '\\r', $value); + $value = str_replace("\b", '\\b', $value); + $value = str_replace("\f", '\\f', $value); + $value = str_replace('"', '\"', $value); + + return $value; + } } ?> Modified: trunk/rdfapi-php/test/unit/Syntax/jsonParser_test.php =================================================================== --- trunk/rdfapi-php/test/unit/Syntax/jsonParser_test.php 2007-12-05 08:18:50 UTC (rev 554) +++ trunk/rdfapi-php/test/unit/Syntax/jsonParser_test.php 2007-12-11 20:27:34 UTC (rev 555) @@ -19,43 +19,7 @@ GLOBAL $short_datatype; - $this->modelString = '{ "http://example.org/about" : { - "http://purl.org/dc/elements/1.1/creator" : [ - { - "value" : "Anna Wilder", - "type" : "literal" - } - ], - "http://purl.org/dc/elements/1.1/title" : [ - { - "value" : "Annas Homepage", - "type" : "literal", - "lang" : "en" - } - ], - "http://xmlns.com/foaf/0.1/maker" : [ - { - "value" : "_:person", - "type" : "bnode" - } - ], - "http://purl.org/dc/elements/1.1/title2" : [ - { - "value" : "Anns HP", - "type" : "literal", - "lang" : "en", - "datatype" : "' . $short_datatype['STRING'] . '" - } - ] - }, - "_:person" : { - "http://xmlns.com/foaf/0.1/homepage" : [ - { - "value" : "http://example.org/about", - "type" : "uri" - } - ] - }}'; + $this->modelString = '{"http://example.org/about":{"http://purl.org/dc/elements/1.1/creator":[{"value":"Anna Wilder","type":"literal"}],"http://purl.org/dc/elements/1.1/title":[{"value":"Annas Homepage","type":"literal","lang":"en"}],"http://xmlns.com/foaf/0.1/maker":[{"value":"_:person","type":"bnode"}],"http://purl.org/dc/elements/1.1/title2":[{"value":"Anns HP","type":"literal","lang":"en","datatype":"' . $short_datatype['STRING'] . '"}]},"_:person":{"http://xmlns.com/foaf/0.1/homepage":[{"value":"http://example.org/about","type":"uri"}],"http://example.com/testProp1":[{"value":"\\"double quote\\nnewline\\ttab\\rcarriage return\\\\reverse solidus"}]}}'; } function testGenerateModelFromString() { @@ -69,6 +33,9 @@ $this->fail($e->getMessage()); } + #echo "<pre>"; + #print_r($model); + GLOBAL $short_datatype; $model2 = new MemModel('http://example.com/'); @@ -96,6 +63,10 @@ $statement6 = new Statement(new Resource('http://example.org/about'), new Resource("http://purl.org/dc/elements/1.1/title2"), new Literal('Anns HP', 'en', $short_datatype['INTEGER'])); + + $statement7= new Statement(new BlankNode('person'), + new Resource("http://example.com/testProp1"), + new Literal("\"double quote\nnewline\ttab\rcarriage return\\reverse solidus")); $model2->add($statement1); @@ -103,6 +74,7 @@ $model2->add($statement3); $model2->add($statement4); $model2->add($statement5); + $model2->add($statement7); $this->assertTrue($model->containsAll($model2)); Modified: trunk/rdfapi-php/test/unit/Syntax/jsonSerializer_test.php =================================================================== --- trunk/rdfapi-php/test/unit/Syntax/jsonSerializer_test.php 2007-12-05 08:18:50 UTC (rev 554) +++ trunk/rdfapi-php/test/unit/Syntax/jsonSerializer_test.php 2007-12-11 20:27:34 UTC (rev 555) @@ -26,14 +26,18 @@ $literal1 = new Literal('test literal'); $literal2 = new Literal('test literal', 'en'); - $literal3 = new Literal('test literal', 'de', 'http://www.w3.org/2001/XMLSchema#string'); + $literal3 = new Literal('test literal', null, 'http://www.w3.org/2001/XMLSchema#string'); + // test literals with tabs and newlines and double quotes + $literal4 = new Literal("test literal\ttab\nnewline\"double quote\rcarriage return\fformfeed\bbackspace\\reverse solidus", null, 'http://www.w3.org/2001/XMLSchema#string'); + $stm1 = new Statement($res1, $res2, $res3); $stm2 = new Statement($res1, $res2, $bn1); $stm3 = new Statement($res1, $res2, $literal1); $stm4 = new Statement($res1, $res2, $literal2); $stm5 = new Statement($res1, $res2, $literal3); $stm6 = new Statement($bn1, $res2, $bn2); + $stm7 = new Statement($res2, $res1, $literal4); $this->model->add($stm1); $this->model->add($stm2); @@ -41,6 +45,7 @@ $this->model->add($stm4); $this->model->add($stm5); $this->model->add($stm6); + $this->model->add($stm7); } function testSerialize() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fu...@us...> - 2007-12-05 08:18:51
|
Revision: 554 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=554&view=rev Author: fusel2k Date: 2007-12-05 00:18:50 -0800 (Wed, 05 Dec 2007) Log Message: ----------- [fix] variables added correctly in <head></head> Modified Paths: -------------- trunk/rdfapi-php/api/sparql/SparqlEngineDb/ResultRenderer/XML.php Modified: trunk/rdfapi-php/api/sparql/SparqlEngineDb/ResultRenderer/XML.php =================================================================== --- trunk/rdfapi-php/api/sparql/SparqlEngineDb/ResultRenderer/XML.php 2007-11-27 13:06:14 UTC (rev 553) +++ trunk/rdfapi-php/api/sparql/SparqlEngineDb/ResultRenderer/XML.php 2007-12-05 08:18:50 UTC (rev 554) @@ -127,8 +127,9 @@ $arResultVars = array_keys($this->sg->arVarAssignments); } + $strVarXML = ''; foreach ($arResultVars as $var) { - $strVarXML = " <variable name=\"" . substr((string)$var,1) . "\"/>\n"; + $strVarXML .= " <variable name=\"" . substr((string)$var,1) . "\"/>\n"; } $strHeadXml = $this->getHead($strVarXML); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fu...@us...> - 2007-11-27 13:06:17
|
Revision: 553 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=553&view=rev Author: fusel2k Date: 2007-11-27 05:06:14 -0800 (Tue, 27 Nov 2007) Log Message: ----------- [fix] bnode output works correctly now Modified Paths: -------------- trunk/rdfapi-php/api/sparql/SparqlEngineDb/ResultRenderer/JSON.php Modified: trunk/rdfapi-php/api/sparql/SparqlEngineDb/ResultRenderer/JSON.php =================================================================== --- trunk/rdfapi-php/api/sparql/SparqlEngineDb/ResultRenderer/JSON.php 2007-11-23 09:12:11 UTC (rev 552) +++ trunk/rdfapi-php/api/sparql/SparqlEngineDb/ResultRenderer/JSON.php 2007-11-27 13:06:14 UTC (rev 553) @@ -33,7 +33,10 @@ case 'select': case 'select distinct': $results = $this->createFromRecords($arRecordSets, $strResultForm); - $strCode = json_encode(array('head' => array('vars'=>$ResultVarsTemp),'results'=>array('bindings'=>$results))); + $strCode = json_encode(array( + 'head' => array('vars'=>$ResultVarsTemp), + 'results'=>array('bindings'=>$results)) + ); //$strCode = str_replace(',{',','.PHP_EOL.'{',$strCode); break; case 'construct': @@ -90,17 +93,25 @@ $node = array(); foreach ($arResultVars as $ResultVar) { $nodeType = $value[$arVarAssignments[$ResultVar][0].'.'.$arVarAssignments[$ResultVar]['sql_is']]; - if ($type == 'r' || $type === null ) { + if ($nodeType == 'r') { $node[substr($ResultVar,1)] = array('type'=> 'uri','value'=>$value[$arVarAssignments[$ResultVar][0].'.'.$arVarAssignments[$ResultVar]['sql_value']]); } if ($value[$arVarAssignments[$ResultVar][0].'.'.$arVarAssignments[$ResultVar]['sql_is']] == 'l') { - $literalType = $value[$arVarAssignments[$ResultVar][0].'.'.$arVarAssignments[$ResultVar]['sql_type']]; - $literalLang = $value[$arVarAssignments[$ResultVar][0].'.'.$arVarAssignments[$ResultVar]['sql_lang']]; - $literalValue = $value[$arVarAssignments[$ResultVar][0].'.'.$arVarAssignments[$ResultVar]['sql_value']]; + $literalType = $value[$arVarAssignments[$ResultVar][0] . + '.' . $arVarAssignments[$ResultVar]['sql_type']]; + $literalLang = $value[$arVarAssignments[$ResultVar][0] . + '.' . $arVarAssignments[$ResultVar]['sql_lang']]; + $literalValue = $value[$arVarAssignments[$ResultVar][0] . + '.' . $arVarAssignments[$ResultVar]['sql_value']]; $node[substr($ResultVar,1)] = $this->getLiteral($literalValue,$literalLang,$literalType); } + + if ($nodeType === 'b') { + $literalValue = $value[$arVarAssignments[$ResultVar][0].'.'.$arVarAssignments[$ResultVar]['sql_value']]; + $node[substr($ResultVar,1)] = array ('type'=>'bnode' ,'value'=>$value[$arVarAssignments[$ResultVar][0].'.'.$arVarAssignments[$ResultVar]['sql_value']]); + } } $results[]=$node; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <p_f...@us...> - 2007-11-23 09:12:14
|
Revision: 552 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=552&view=rev Author: p_frischmuth Date: 2007-11-23 01:12:11 -0800 (Fri, 23 Nov 2007) Log Message: ----------- [added] a serializer class for rdf/json format [added] a unit test class for the json serializer in order to test the serialize method [propset] set svn:keyword Id on new files [modified] added the new test classes to the allTest environment Modified Paths: -------------- trunk/rdfapi-php/api/syntax/SyntaxJSON.php trunk/rdfapi-php/test/unit/allTests.php Added Paths: ----------- trunk/rdfapi-php/api/syntax/JsonSerializer.php trunk/rdfapi-php/test/unit/Syntax/jsonSerializer_test.php Added: trunk/rdfapi-php/api/syntax/JsonSerializer.php =================================================================== --- trunk/rdfapi-php/api/syntax/JsonSerializer.php (rev 0) +++ trunk/rdfapi-php/api/syntax/JsonSerializer.php 2007-11-23 09:12:11 UTC (rev 552) @@ -0,0 +1,137 @@ +<?php +/** + * This class provides capabilities to serialize MemModels to json strings. + * + * @package syntax + * @author Philipp Frischmuth <ph...@fr...> + * @version $Id:$ + */ +class JsonSerializer extends Object { + + /** + * This method takes a MemModel object ad parameter and serializes all contained triples to rdf/json format. + * + * @see http://n2.talis.com/wiki/RDF_JSON_Specification#rdf.2Fjson + * @param MemModel $model + * @return string Returns a string containing the serialized model. + */ + public function serialize(MemModel $model) { + + // create the root json object (root object) + $jsonString = '{'; + $subjects = array(); + + // sort triples by subject + foreach ($model->triples as $triple) { + $subjects[$triple->toStringSubject()][] = $triple; + } + + // sort alphabetically + ksort($subjects); + + // echo '<pre>'; + // print_r($subjects); + // echo '</pre>'; + + // triples are sorted by subject now, each key is a subject uri, containing all triples with this subject uri + $i = 0; + foreach ($subjects as $predicatesArray) { + $predicates = array(); + + if ($i > 0) { + $jsonString .= ','; + } + $i++; + + $subj = $predicatesArray[0]->getSubject(); + + // add special _: sequence for blank node only + if ($subj instanceof BlankNode) { + $jsonString .= PHP_EOL . ' "_:' . $subj->getLabel() . '" : '; + } else { + $jsonString .= PHP_EOL . ' "' . $subj->getLabel() . '" : '; + } + + + + // create a json object for each subject (subject object) + $jsonString .= '{'; + + // sort triples with current subject by predicate + foreach ($predicatesArray as $triple) { + $predicates[$triple->toStringPredicate()][] = $triple; + } + + // sort alphabetically + ksort($predicates); + + $j = 0; + foreach ($predicates as $valueArray) { + + if ($j > 0) { + $jsonString .= ','; + } + $j++; + + $jsonString .= PHP_EOL . ' "' . $valueArray[0]->getLabelPredicate() . '" : '; + + // create a json array (value array) + $jsonString .= '['; + + $k = 0; + foreach ($valueArray as $triple) { + if ($k > 0) { + $jsonString .= ','; + } + $k++; + + // create json value object (value object) + $jsonString .= PHP_EOL . ' {'; + + $obj = $triple->getObject(); + + // add special _: sequence for blank nodes only + if ($obj instanceof BlankNode) { + $jsonString .= PHP_EOL . ' "value" : "_:' . $obj->getLabel() . '",'; + } else { + $jsonString .= PHP_EOL . ' "value" : "' . $obj->getLabel() . '",'; + } + + // add type of object + if ($obj instanceof Literal) { + $jsonString .= PHP_EOL . ' "type" : "literal"'; + } else if ($obj instanceof BlankNode) { + $jsonString .= PHP_EOL . ' "type" : "bnode"'; + } else { + $jsonString .= PHP_EOL . ' "type" : "uri"'; + } + + if ($obj instanceof Literal) { + if ($obj->getLanguage() != '') { + $jsonString .= ',' . PHP_EOL . ' "lang" : "' . $obj->getLanguage() . '"'; + } + if ($obj->getDatatype() != '') { + $jsonString .= ',' . PHP_EOL . ' "datatype" : "' . $obj->getDatatype() . '"'; + } + + } + + // close value object + $jsonString .= PHP_EOL . ' }'; + } + + // close the value array + $jsonString .= PHP_EOL . ' ]'; + } + + // close the json object (for the subject) (subject object) + $jsonString .= PHP_EOL . ' }'; + } + + // close root json object (root object) + $jsonString .= PHP_EOL . '}'; + + return $jsonString; + } +} +?> Property changes on: trunk/rdfapi-php/api/syntax/JsonSerializer.php ___________________________________________________________________ Name: svn:keywords + Id Modified: trunk/rdfapi-php/api/syntax/SyntaxJSON.php =================================================================== --- trunk/rdfapi-php/api/syntax/SyntaxJSON.php 2007-11-22 19:58:35 UTC (rev 551) +++ trunk/rdfapi-php/api/syntax/SyntaxJSON.php 2007-11-23 09:12:11 UTC (rev 552) @@ -2,4 +2,5 @@ // Include Syntax classes // $Id$ require_once( RDFAPI_INCLUDE_DIR . 'syntax/JsonParser.php' ); +require_once( RDFAPI_INCLUDE_DIR . 'syntax/JsonSerializer.php' ); ?> \ No newline at end of file Added: trunk/rdfapi-php/test/unit/Syntax/jsonSerializer_test.php =================================================================== --- trunk/rdfapi-php/test/unit/Syntax/jsonSerializer_test.php (rev 0) +++ trunk/rdfapi-php/test/unit/Syntax/jsonSerializer_test.php 2007-11-23 09:12:11 UTC (rev 552) @@ -0,0 +1,57 @@ +<?php +require_once RDFAPI_INCLUDE_DIR.PACKAGE_SYNTAX_JSON; +/** + * Tests the JsonSerializer + * + * @version $Id $ + * @author Philipp Frischmuth <ph...@fr...> + * + * @package unittests + * @access public + */ +class testJsonSerializer extends UnitTestCase { + + var $model; + + function testJsonSerializer() { + + $this->model = new MemModel(); + + $res1 = new Resource('http://example.com/res1'); + $res2 = new Resource('http://example.com/res2'); + $res3 = new Resource('http://example.com/res3'); + + $bn1 = new BlankNode('test1'); + $bn2 = new BlankNode('test2'); + + $literal1 = new Literal('test literal'); + $literal2 = new Literal('test literal', 'en'); + $literal3 = new Literal('test literal', 'de', 'http://www.w3.org/2001/XMLSchema#string'); + + $stm1 = new Statement($res1, $res2, $res3); + $stm2 = new Statement($res1, $res2, $bn1); + $stm3 = new Statement($res1, $res2, $literal1); + $stm4 = new Statement($res1, $res2, $literal2); + $stm5 = new Statement($res1, $res2, $literal3); + $stm6 = new Statement($bn1, $res2, $bn2); + + $this->model->add($stm1); + $this->model->add($stm2); + $this->model->add($stm3); + $this->model->add($stm4); + $this->model->add($stm5); + $this->model->add($stm6); + } + + function testSerialize() { + + $ser = new JsonSerializer(); + + $jsonString = $ser->serialize($this->model); + $memModel = new MemModel(); + $memModel->loadFromString($jsonString, 'json'); + + $this->assertTrue($this->model->equals($memModel)); + } +} +?> Property changes on: trunk/rdfapi-php/test/unit/Syntax/jsonSerializer_test.php ___________________________________________________________________ Name: svn:keywords + Id Modified: trunk/rdfapi-php/test/unit/allTests.php =================================================================== --- trunk/rdfapi-php/test/unit/allTests.php 2007-11-22 19:58:35 UTC (rev 551) +++ trunk/rdfapi-php/test/unit/allTests.php 2007-11-23 09:12:11 UTC (rev 552) @@ -119,6 +119,8 @@ $test_syntax->addTestFile(RDFAPI_TEST_INCLUDE_DIR. 'test/unit/Syntax/n3Serializer_test.php'); $test_syntax->addTestFile(RDFAPI_TEST_INCLUDE_DIR. 'test/unit/Syntax/rdf_Parser_tests.php'); $test_syntax->addTestFile(RDFAPI_TEST_INCLUDE_DIR. 'test/unit/Syntax/rdf_Serializer_tests.php'); +$test_syntax->addTestFile(RDFAPI_TEST_INCLUDE_DIR. 'test/unit/Syntax/jsonParser_test.php'); +$test_syntax->addTestFile(RDFAPI_TEST_INCLUDE_DIR. 'test/unit/Syntax/jsonSerializer_test.php'); //$test_syntax->addTestFile(RDFAPI_TEST_INCLUDE_DIR. 'test/unit/rdf/rdf_test_cases.php'); $test_syntax->run(new $runnerClass()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <p_f...@us...> - 2007-11-22 19:58:46
|
Revision: 551 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=551&view=rev Author: p_frischmuth Date: 2007-11-22 11:58:35 -0800 (Thu, 22 Nov 2007) Log Message: ----------- [modified] updated loadFromString method in order to support parsers already supported by load (load can do the same, but method is more easy to use with strings) Modified Paths: -------------- trunk/rdfapi-php/api/model/Model.php Modified: trunk/rdfapi-php/api/model/Model.php =================================================================== --- trunk/rdfapi-php/api/model/Model.php 2007-11-15 13:45:22 UTC (rev 550) +++ trunk/rdfapi-php/api/model/Model.php 2007-11-22 19:58:35 UTC (rev 551) @@ -146,12 +146,35 @@ include_once(RDFAPI_INCLUDE_DIR.PACKAGE_SYNTAX_JSON); $parser = new JsonParser(); break; + case 'n3': + case 'nt': + include_once(RDFAPI_INCLUDE_DIR.PACKAGE_SYNTAX_N3); + $parser = new N3Parser(); + break; + case 'rdf': + case 'rdfxml': + case 'xml': + include_once(RDFAPI_INCLUDE_DIR.PACKAGE_SYNTAX_RDF); + $parser = new RdfParser(); + break; + case 'grddl': + include_once(RDFAPI_INCLUDE_DIR.PACKAGE_SYNTAX_GRDDL); + $parser = new GRDDLParser(); + break; + case 'rss': + include_once(RDFAPI_INCLUDE_DIR.PACKAGE_SYNTAX_RSS); + $parser = new RssParser(); + break; default: trigger_error('(class: Model; method: loadFromString): type ' . $type . 'is currently not supported', E_USER_ERROR); } - $parser->generateModelFromString($str, $this); + if ($parser instanceof JsonParser) { + $parser->generateModelFromString($str, $this); + } else { + $parser->generateModel($str, false, $this); + } } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |