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: <cyg...@us...> - 2007-08-14 16:46:31
|
Revision: 525 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=525&view=rev Author: cyganiak Date: 2007-08-14 09:46:23 -0700 (Tue, 14 Aug 2007) Log Message: ----------- Re-architected the book mashup and made new search interface Added Paths: ----------- trunk/bookmashup/.htaccess trunk/bookmashup/ApiQueryService.php trunk/bookmashup/bookmashup.php trunk/bookmashup/config.inc.php trunk/bookmashup/no-image.gif trunk/bookmashup/rdf_icon.16.gif trunk/bookmashup/search.php Removed Paths: ------------- trunk/bookmashup/documentation/ trunk/bookmashup/inc/ trunk/bookmashup/index.php Added: trunk/bookmashup/.htaccess =================================================================== --- trunk/bookmashup/.htaccess (rev 0) +++ trunk/bookmashup/.htaccess 2007-08-14 16:46:23 UTC (rev 525) @@ -0,0 +1,10 @@ +RewriteEngine on + +# Redirect homepage to Chris' web space +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] + +# Call bookmashup.php for document URIs +RewriteRule ^doc/(books|reviews|persons|offers|shops)/(.*) /bookmashup/bookmashup.php?type=$1&item=$2 [L] Copied: trunk/bookmashup/ApiQueryService.php (from rev 524, trunk/bookmashup/inc/ApiQueryService.php) =================================================================== --- trunk/bookmashup/ApiQueryService.php (rev 0) +++ trunk/bookmashup/ApiQueryService.php 2007-08-14 16:46:23 UTC (rev 525) @@ -0,0 +1,280 @@ +<?php + +class ApiQueryService { + + private $uri; + private $document; + + public function ApiQueryService($uri, $document){ + $this->uri = $uri; + $this->document = $document; + } + + public function findInformationAboutBook(MemModel $model,$isbn){ + $result = false; + $parsed_xml = $this->queryAmazon($isbn); + foreach($parsed_xml->Items->Item as $itemIndex => $item){ + if($item->ItemAttributes->ISBN == strval($isbn)){ + $this->addBookToModel($item,$model); + $result = true; + } + } + return $result; + } + + public function findReview(MemModel $model,$review){ + $isbn = substr($review,0,strpos($review,"_")); + // query Amazon: + $result = false; + $parsed_xml = $this->queryAmazon($isbn); + //var_dump($parsed_xml); + foreach($parsed_xml->Items->Item as $itemIndex => $item){ + //only if right isbn + if($item->ItemAttributes->ISBN == strval($isbn)){ + $result = $this->addReviewToModel($review,$item,$model); + } + } + return $result; + } + + public function findOffer(MemModel $model,$offer){ + $model->add(new Statement(new Resource($this->document),new Resource("http://www.w3.org/2000/01/rdf-schema#label"),new Literal("RDF document describing an Offer"))); + $result = false; + if(($pos = strpos($offer,"amazon"))!= false){ + $isbn = substr($offer,0,strlen($offer)-($pos+1)); + $result = $this->findAmazonOffer($model,$offer,$isbn); + }else{ + $pos = $pos = strpos($offer,"google"); + $isbn = substr($offer,0,strlen($offer)-($pos+1)); + $result = $this->findGoogleOffer($model,$offer,$isbn); + } + return $result; + } + + public function findShop(MemModel $model,$shop){ + $itemresource = new Resource($this->uri); + $string = base64_decode($shop); + $shopAr = split("\|\|",$string); + + $model->add(new Statement(new Resource($this->document),new Resource("http://www.w3.org/2000/01/rdf-schema#label"),new Literal("RDF document describing the shop: ".$shopAr[1]))); + $model->add(new Statement($itemresource ,new Resource(RDF_NAMESPACE_URI.RDF_TYPE),new Resource("http://sites.wiwiss.fu-berlin.de/suhl/bizer/bookmashup/simpleCommerceVocab01.rdf#Store"))); + $model->add(new Statement($itemresource ,new Resource("http://xmlns.com/foaf/0.1/name"),new Literal($shopAr[1]))); + $model->add(new Statement($itemresource ,new Resource("http://xmlns.com/foaf/0.1/page"),new Resource($shopAr[0]))); + $model->add(new Statement($itemresource ,new Resource("http://www.w3.org/2000/01/rdf-schema#label"),new Literal($shopAr[1]))); + return true; + } + + public function findInformationAboutPerson(MemModel $model,$person){ + $name = urldecode($person); + $result = false; + $result = $this->addPersonToModel(null,$model,$name); + return $result; + } + + private function addGoogleOffersToModel(MemModel $model){ + $isbn = substr($this->uri,strrpos($this->uri,"/")+1,strlen($this->uri)); + $itemresource = new Resource($this->uri); + //echo $isbn; + // build Query + $query = '[isbn:"'.$isbn.'"]'; + $q_uri = "http://www.google.com/base/feeds/snippets?bq=".urlencode($query)."&max-results=250"; + $con = file_get_contents($q_uri); + // hack: simple_xml ignores <g:.... + $content = str_replace("<g:","<",$con); + $content = str_replace("</g:","</",$content); + $xml = simplexml_load_string($content); + $newuri = str_replace("/books/","/offers/",$this->uri); + $pos = strrpos($newuri,"/"); + foreach($xml->entry as $key => $entry){ + $id = substr($entry->id,strrpos($entry->id,"/")+1,strlen($entry->id)); + $offer = new Resource($newuri."googleOffer".$id); + $model->add(new Statement($itemresource ,new Resource("http://sites.wiwiss.fu-berlin.de/suhl/bizer/bookmashup/simpleCommerceVocab01.rdf#hasOffer"),$offer)); + $model->add(new Statement($offer ,new Resource("http://www.w3.org/2000/01/rdf-schema#label"),new Literal("Offer for the book with the ISBN: ".$isbn))); + } + } + + private function addPersonToModel(SimpleXMLElement $item = null,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://xmlns.com/foaf/0.1/Person"))); + // rdf:name + $model->add(new Statement($itemresource ,new Resource("http://xmlns.com/foaf/0.1/name"),new Literal($name))); + // + $this->findBooksFromAuthor($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))); + $this->dblpLookup($name,$model); + return true; + } + + private function findBooksFromAuthor($model,$name){ + $xml = $this->queryAmazon($name); + foreach($xml->Items->Item as $index =>$item){ + if(isset($item->ItemAttributes->ISBN)){ + if($item->ItemAttributes->Author == $name){ + $book = str_replace("/persons/","/books/",$this->uri); + $book = substr($book,0,strrpos($book,"/")+1).$item->ItemAttributes->ISBN; + $model->add(new Statement(new Resource($book),new Resource("http://purl.org/dc/elements/1.1/creator"),new Resource($this->uri))); + $model->add(new Statement(new Resource($book) ,new Resource("http://www.w3.org/2000/01/rdf-schema#label"),new Literal($item->ItemAttributes->Title))); + } + } + } + } + + + + private function findAmazonOffer($model,$offer,$isbn){ + // query Amazon: + $itemresource = new Resource($this->uri); + $parsed_xml = $this->queryAmazon($isbn); + $result = false; + foreach($parsed_xml->Items->Item as $itemIndex => $item){ + //only if right isbn + if($item->ItemAttributes->ISBN == strval($isbn)){ + $shopUri = substr($item->DetailPageURL,0,strpos($item->DetailPageURL,"/",8))."||Amazon"; + $newuri = str_replace("/offers/","/shops/",$this->uri); + $newuri = substr($newuri,0,strrpos($newuri,"/")+1).base64_encode(trim($shopUri)); + $model->add(new Statement($itemresource ,new Resource(RDF_NAMESPACE_URI.RDF_TYPE),new Resource("http://sites.wiwiss.fu-berlin.de/suhl/bizer/bookmashup/simpleCommerceVocab01.rdf#Offer"))); + $model->add(new Statement($itemresource ,new Resource("http://sites.wiwiss.fu-berlin.de/suhl/bizer/bookmashup/simpleCommerceVocab01.rdf#offeredBy"),new Resource($newuri))); + $model->add(new Statement($itemresource ,new Resource("http://sites.wiwiss.fu-berlin.de/suhl/bizer/bookmashup/simpleCommerceVocab01.rdf#hasPrice"),new Literal((string)$item->OfferSummary->LowestNewPrice->FormattedPrice))); + $model->add(new Statement($itemresource ,new Resource("http://www.hackcraft.net/bookrdf/vocab/0_1/soldAt"),new Resource($item->DetailPageURL))); + $model->add(new Statement(new Resource($newuri) ,new Resource("http://www.w3.org/2000/01/rdf-schema#label"),new Literal("Amazon"))); + $result = true; + break; + } + } + return $result; + } + + + private function findGoogleOffer($model,$offer,$isbn){ + $result = false; + $itemresource = new Resource($this->uri); + $id = substr($offer,(strpos($offer,"google")+11)); + // hack: don't query google. Get xml result from snippets id + $con = file_get_contents("http://www.google.com/base/feeds/snippets/".$id); + // hack: simple_xml ignores <g:.... + $content = str_replace("<g:","<",$con); + $content = str_replace("</g:","</",$content); + $xml = simplexml_load_string($content); + $model->add(new Statement($itemresource ,new Resource(RDF_NAMESPACE_URI.RDF_TYPE),new Resource("http://sites.wiwiss.fu-berlin.de/suhl/bizer/bookmashup/simpleCommerceVocab01.rdf#Offer"))); + foreach($xml->link as $key => $link){ + if(($link['rel']=="alternate")&& ($link['type'] == "text/html") ){ + $model->add(new Statement($itemresource ,new Resource("http://xmlns.com/foaf/0.1/page"),new Resource($link['href']))); + $shopUri = substr($link['href'],0,strpos($link['href'],"/",8))."||".trim($xml->author->name); + $newuri = str_replace("/offers/","/shops/",$this->uri); + $newuri = substr($newuri,0,strrpos($newuri,"/")+1).base64_encode($shopUri); + $model->add(new Statement($itemresource ,new Resource("http://sites.wiwiss.fu-berlin.de/suhl/bizer/bookmashup/simpleCommerceVocab01.rdf#offeredBy"),new Resource($newuri))); + $model->add(new Statement($itemresource ,new Resource("http://sites.wiwiss.fu-berlin.de/suhl/bizer/bookmashup/simpleCommerceVocab01.rdf#hasPrice"),new Literal($xml->price))); + $model->add(new Statement(new Resource($newuri) ,new Resource("http://www.w3.org/2000/01/rdf-schema#label"),new Literal($xml->author->name))); + $result = true; + } + } + return $result; + } + + private function addReviewToModel($review, $item, MemModel $model){ + $number = substr($review,strpos($review,"_")+16); + $i = 1; + $result = false; + foreach($item->EditorialReviews->EditorialReview as $index => $rev){ + if($i == $number){ + $model->add(new Statement(new Resource($this->uri) ,new Resource(RDF_NAMESPACE_URI.RDF_TYPE),new Resource("http://dannyayers.com/xmlns/rev/#Review"))); + $model->add(new Statement(new Resource($this->uri) ,new Resource("http://dannyayers.com/xmlns/rev/#text"),new Literal("'".$rev->Content."'"))); + $model->add(new Statement(new Resource($this->document),new Resource("http://www.w3.org/2000/01/rdf-schema#label"),new Literal("RDF document describing a review about: ".$item->ItemAttributes->Title))); + $result = true; + break; + } + $i++; + } + return $result; + } + + 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.="&SearchIndex=$searchIndex&Keywords=".urlencode($query); + $response = file_get_contents($request); + return simplexml_load_string($response); + } + + private function addBookToModel(SimpleXMLElement $item,MemModel $model){ + + $itemresource = new Resource($this->uri); + // rdf:type + $model->add(new Statement($itemresource ,new Resource(RDF_NAMESPACE_URI.RDF_TYPE),new Resource("http://sites.wiwiss.fu-berlin.de/suhl/bizer/bookmashup/simpleCommerceVocab01.rdf#Book"))); + // homepage (link to details page @ amazon) + //$model->add(new Statement($itemresource ,new Resource("http://xmlns.com/foaf/0.1/homepage"),new Resource($item->DetailPageURL))); + // label + $model->add(new Statement($itemresource ,new Resource("http://www.w3.org/2000/01/rdf-schema#label"),new Literal((string)$item->ItemAttributes->Title))); + // date + $model->add(new Statement($itemresource ,new Resource("http://purl.org/dc/elements/1.1/date"),new Literal((string)$item->ItemAttributes->PublicationDate))); + // title + $model->add(new Statement($itemresource ,new Resource("http://purl.org/dc/elements/1.1/title"),new Literal((string)$item->ItemAttributes->Title))); + //large image + $model->add(new Statement($itemresource ,new Resource("http://xmlns.com/foaf/0.1/depiction"),new Resource((string)$item->LargeImage->URL))); + // thumbnail + $model->add(new Statement($itemresource ,new Resource("http://xmlns.com/foaf/0.1/thumbnail"),new Resource((string)$item->SmallImage->URL))); + // isbn + $model->add(new Statement($itemresource ,new Resource("http://purl.org/dc/elements/1.1/identifier"),new Resource("urn:ISBN:".$item->ItemAttributes->ISBN))); + // publisher + $model->add(new Statement($itemresource ,new Resource("http://purl.org/dc/elements/1.1/publisher"),new Literal((string)$item->ItemAttributes->Label))); + // format + if(isset($item->ItemAttributes->format)) + $model->add(new Statement($itemresource ,new Resource("http://purl.org/dc/elements/1.1/format"),new Literal((string)$item->ItemAttributes->format))); + if(isset($item->ItemAttributes->Binding)) + $model->add(new Statement($itemresource ,new Resource("http://purl.org/dc/elements/1.1/format"),new Literal((string)$item->ItemAttributes->Binding))); + // reviews + $i = 1; + foreach($item->EditorialReviews->EditorialReview as $index => $review){ + $newuri = str_replace("/books/","/reviews/",$this->uri); + $pos = strrpos($newuri,"/"); + $review = new Resource($newuri."_".$index.$i); + $model->add(new Statement($itemresource ,new Resource("http://dannyayers.com/xmlns/rev/#hasReview"),$review)); + $model->add(new Statement($review,new Resource("http://www.w3.org/2000/01/rdf-schema#label"),new Literal("Review number ".$i." about: ".$item->ItemAttributes->Title))); + $i++; + } + // author + $newuri = str_replace("/books/","/persons/",$this->uri); + $pos = strrpos($newuri,"/"); + if(isset($item->ItemAttributes->Author)){ + foreach($item->ItemAttributes->Author as $k => $author){ + $authorUri = new Resource(substr($newuri,0,$pos+1).urlencode($author)); + $model->add(new Statement($itemresource ,new Resource("http://purl.org/dc/elements/1.1/creator"),$authorUri)); + $model->add(new Statement($authorUri,new Resource("http://www.w3.org/2000/01/rdf-schema#label"),new Literal((string)$author))); + } + } + if(isset($item->ItemAttributes->Creator)){ + foreach($item->ItemAttributes->Creator as $key => $creator){ + $creatorUri = new Resource(substr($newuri,0,$pos+1).urlencode($creator)); + $model->add(new Statement($itemresource ,new Resource("http://purl.org/dc/elements/1.1/creator"),$creatorUri)); + $model->add(new Statement($creatorUri,new Resource("http://www.w3.org/2000/01/rdf-schema#label"),new Literal((string)$creator))); + } + } + // amazon offer + $newuri = str_replace("/books/","/offers/",$this->uri); + $pos = strrpos($newuri,"/"); + $offer = new Resource($newuri."amazonOffer"); + $model->add(new Statement($itemresource ,new Resource("http://sites.wiwiss.fu-berlin.de/suhl/bizer/bookmashup/simpleCommerceVocab01.rdf#hasOffer"),$offer)); + $model->add(new Statement($offer ,new Resource("http://www.w3.org/2000/01/rdf-schema#label"),new Literal("Offer for the book with the ISBN: ".$item->ItemAttributes->ISBN))); + // create OFFER from google + $this->addGoogleOffersToModel($model,$this->uri); + + // + $model->add(new Statement(new Resource($this->document),new Resource("http://www.w3.org/2000/01/rdf-schema#label"),new Literal("RDF document about the book: ".$item->ItemAttributes->Title))); + + } + + private function dblpLookup($name,$model){ + //query dblp + $querystring = 'PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?author WHERE { ?author foaf:name "'.$name.'" .}'; + $request = "http://www4.wiwiss.fu-berlin.de/dblp/sparql?query=".urlencode($querystring); + $response = file_get_contents($request); + $parsed_xml = simplexml_load_string($response); + $itemresource = new Resource($this->uri); + if(isset($parsed_xml->results->result->binding->uri)) + $model->add(new Statement($itemresource,new Resource("http://www.w3.org/2002/07/owl#sameAs"),new Resource($parsed_xml->results->result->binding->uri))); + } + + } +?> Copied: trunk/bookmashup/bookmashup.php (from rev 524, trunk/bookmashup/index.php) =================================================================== --- trunk/bookmashup/bookmashup.php (rev 0) +++ trunk/bookmashup/bookmashup.php 2007-08-14 16:46:23 UTC (rev 525) @@ -0,0 +1,66 @@ +<?php + +// I think the latest RAP works with E_ALL, but we still run an older version +error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING); +//error_reporting(E_ALL); + +include("config.inc.php"); +include(RDFAPI_INCLUDE_DIR . "RdfAPI.php"); +include("ApiQueryService.php"); + +// 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); +$model = ModelFactory::getDefaultModel(); +if ($type == "books") { + $service->findInformationAboutBook($model, $item); +} else if ($type == "persons") { + $service->findInformationAboutPerson($model, urlencode($item)); +} else if ($type == "reviews") { + $service->findReview($model, $item); +} else if ($type == "offers") { + $service->findOffer($model, urlencode($item)); +} else if ($type == "shops") { + $service->findShop($model, $item); +} else { + header("HTTP/1.1 404 Not Found"); + header("Content-Type: text/plain"); + echo "Resource not found\n"; + exit(); +} + +// Add document metadata to model +$doc = new Resource($documentURI); +$resource = new Resource($resourceID); +$rdf_type = new Resource(RDF_NAMESPACE_URI . RDF_TYPE); +$foaf_Document = new Resource("http://xmlns.com/foaf/0.1/Document"); +$foaf_primaryTopic = new Resource("http://xmlns.com/foaf/0.1/primaryTopic"); +$foaf_maker = new Resource("http://xmlns.com/foaf/0.1/maker"); +$dc_license = new Resource("http://purl.org/dc/elements/1.1/license"); +$rdfs_label = new Resource("http://www.w3.org/2000/01/rdf-schema#label"); +$AWS_license = new Resource("http://www.amazon.com/AWS-License-home-page-Money/b/ref=sc_fe_c_0_12738641_12/102-8791790-9885755?ie=UTF8&node=3440661&no=12738641&me=A36L942TSJ2AJA"); +$Google_license = new Resource("http://www.google.com/terms_of_service.html"); +$bookmashup = new Resource("http://www4.wiwiss.fu-berlin.de/is-group/resource/projects/Project10"); + +$model->add(new Statement($doc, $rdf_type, $foaf_Document)); +$model->add(new Statement($doc, $foaf_primaryTopic, $resource)); +$model->add(new Statement($doc, $dc_license, $AWS_license)); +$model->add(new Statement($doc, $dc_license, $Google_license)); +$model->add(new Statement($doc, $foaf_maker, $bookmashup)); +$model->add(new Statement($bookmashup, $rdfs_label, new Literal("RDF Book Mashup"))); + +// Output model as RDF/XML +header('Content-Type: application/rdf+xml; charset=utf-8'); +include(RDFAPI_INCLUDE_DIR . PACKAGE_SYNTAX_RDF); +$s = new RdfSerializer(); +$s->addNamespacePrefix('foaf', 'http://xmlns.com/foaf/0.1/'); +$s->addNamespacePrefix('rev', 'http://dannyayers.com/xmlns/rev/#'); +$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#'); +echo $s->serialize($model); + +?> Copied: trunk/bookmashup/config.inc.php (from rev 524, trunk/bookmashup/inc/config.inc) =================================================================== --- trunk/bookmashup/config.inc.php (rev 0) +++ trunk/bookmashup/config.inc.php 2007-08-14 16:46:23 UTC (rev 525) @@ -0,0 +1,8 @@ +<?php + +define('BOOKMASHUP_BASE', 'http://www4.wiwiss.fu-berlin.de/bookmashup/'); +define('RDFAPI_INCLUDE_DIR','C:/!htdocs/rdfapi-php/api/'); +define('KEYID','1VM1PSHWXY16G9KM3F02'); +define('AssocTag','[YourAssocitaeTagHere]'); + +?> Deleted: trunk/bookmashup/index.php =================================================================== --- trunk/bookmashup/index.php 2007-08-14 11:12:45 UTC (rev 524) +++ trunk/bookmashup/index.php 2007-08-14 16:46:23 UTC (rev 525) @@ -1,97 +0,0 @@ -<?php -/* - * Created on 20.11.2006 - * - * To change the template for this generated file go to - * Window - Preferences - PHPeclipse - PHP - Code Templates - */ - -if(strpos($_SERVER['SCRIPT_URI'],"/doc/")){ - // cut /doc/ - $uri = str_replace("/doc/","/",$_SERVER['SCRIPT_URI']); - - include("inc/config.inc"); - - include(RDFAPI_INCLUDE_DIR."RdfAPI.php"); - // include query service - include(RDF_BOOK_DIR."ApiQueryService.php"); - - // initialize query service; - $aqs = new ApiQueryService($uri); - - // get empty model - $model = ModelFactory::getDefaultModel(); - - // disable notices - error_reporting(null); - - $res = false; - // check if person (creator), book, review -if(strpos($uri,"/books/")){ - $isbn = substr($_GET['var'],6); - $res = $aqs->findInformationAboutBook($model,$isbn); -} -if(strpos($uri,"/persons/")){ - $person = urlencode(substr($_GET['var'],8)); - $res = $aqs->findInformationAboutPerson($model,$person); -} - -if(strpos($uri,"/reviews/")){ - $review = substr($_GET['var'],8); - //echo $review; - $res = $aqs->findReview($model,$review); -} -if(strpos($uri,"/offers/")){ - $offer = urlencode(substr($_GET['var'],7)); - $res = $aqs->findOffer($model,$offer); -} -if(strpos($uri,"/shops/")){ - $shop = substr($_GET['var'],6); - $res = $aqs->findShop($model,$shop); -} -if(!$res){ - header("HTTP/1.1 404 Not Found"); - echo "URI not found"; -}else{ -// add type triple -$model->add(new Statement(new Resource($_SERVER['SCRIPT_URI']) ,new Resource(RDF_NAMESPACE_URI.RDF_TYPE),new Resource("http://xmlns.com/foaf/0.1/Document"))); -// add topic triple -$model->add(new Statement(new Resource($_SERVER['SCRIPT_URI']),new Resource("http://xmlns.com/foaf/0.1/primaryTopic"),new Resource($uri))); -// add license triple -$model->add(new Statement(new Resource($_SERVER['SCRIPT_URI']),new Resource("http://purl.org/dc/elements/1.1/license"),new Resource("http://www.amazon.com/AWS-License-home-page-Money/b/ref=sc_fe_c_0_12738641_12/102-8791790-9885755?ie=UTF8&node=3440661&no=12738641&me=A36L942TSJ2AJA"))); -$model->add(new Statement(new Resource($_SERVER['SCRIPT_URI']),new Resource("http://purl.org/dc/elements/1.1/license"),new Resource("http://www.google.com/terms_of_service.html"))); -$model->add(new Statement(new Resource($_SERVER['SCRIPT_URI']),new Resource("http://xmlns.com/foaf/0.1/maker"),new Resource("http://www4.wiwiss.fu-berlin.de/is-group/resource/projects/Project10"))); -$model->add(new Statement(new Resource("http://www4.wiwiss.fu-berlin.de/is-group/resource/projects/Project10"),new Resource("http://www.w3.org/2000/01/rdf-schema#label"),new Literal("Book Mashup"))); - - header('Content-type: application/rdf+xml; charset=utf-8'); - - include(RDFAPI_INCLUDE_DIR.PACKAGE_SYNTAX_RDF); - $s = new RdfSerializer(); - $s->addNamespacePrefix('foaf','http://xmlns.com/foaf/0.1/'); - $s->addNamespacePrefix('rev','http://dannyayers.com/xmlns/rev/#'); - $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#'); - echo $s->serialize($model); -} -}else{ - - $docUri = "http://sites.wiwiss.fu-berlin.de/suhl/bizer/bookmashup/index.html"; - if(strpos($_SERVER['SCRIPT_URI'],"/books/")) - $docUri = str_replace("/books/","/doc/books/",$_SERVER['SCRIPT_URI']); - if(strpos($_SERVER['SCRIPT_URI'],"/persons/")) - $docUri = str_replace("/persons/","/doc/persons/",$_SERVER['SCRIPT_URI']); - if(strpos($_SERVER['SCRIPT_URI'],"/reviews/")) - $docUri = str_replace("/reviews/","/doc/reviews/",$_SERVER['SCRIPT_URI']); - if(strpos($_SERVER['SCRIPT_URI'],"/offers/")) - $docUri = str_replace("/offers/","/doc/offers/",$_SERVER['SCRIPT_URI']); - if(strpos($_SERVER['SCRIPT_URI'],"/shops/")) - $docUri = str_replace("/shops/","/doc/shops/",$_SERVER['SCRIPT_URI']); - - - header('Location: '.$docUri,false,303); -} - - - -?> Added: trunk/bookmashup/no-image.gif =================================================================== (Binary files differ) Property changes on: trunk/bookmashup/no-image.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/bookmashup/rdf_icon.16.gif =================================================================== (Binary files differ) Property changes on: trunk/bookmashup/rdf_icon.16.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Copied: trunk/bookmashup/search.php (from rev 524, trunk/bookmashup/documentation/booksearch.php) =================================================================== --- trunk/bookmashup/search.php (rev 0) +++ trunk/bookmashup/search.php 2007-08-14 16:46:23 UTC (rev 525) @@ -0,0 +1,239 @@ +<?php + +class AmazonSearch { + var $search_index = "Books"; + var $search_term; + var $page; + var $results = array(); + var $total_pages = 0; + var $total_results = 0; + var $results_per_page = 10; + + function __construct($search_term, $page = 1) { + $this->search_term = $search_term; + $this->page = $page; + } + + function execute() { + $request = "http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService" + . "&AWSAccessKeyId=" . KEYID + . "&AssociateTag=" . AssocTag + . "&Version=2006-09-11" + . "&Operation=ItemSearch" + . "&ResponseGroup=Medium" + . "&SearchIndex=" . $this->search_index + . "&Keywords=" . urlencode($this->search_term) + . "&ItemPage=" . $this->page; + $response = file_get_contents($request); + $xml = simplexml_load_string($response); + if ($xml->Items->Request->IsValid == "False" || $xml->Items->TotalResults == "0") { + return false; + } + $this->results = array(); + foreach ($xml->Items->Item as $key =>$item) { + $book = array( + 'isbn' => (string) @$item->ItemAttributes->ISBN, + 'title' => (string) @$item->ItemAttributes->Title, + 'authors' => array(), + 'uri' => BOOKMASHUP_BASE . "books/" . @$item->ItemAttributes->ISBN, + 'image' => (string) @$item->SmallImage->URL, + ); + foreach($item->ItemAttributes->Author as $author) { + if (in_array($author, $book['authors'])) continue; + $book['authors'][] = (string) $author; + } + foreach($item->ItemAttributes->Creator as $creator){ + $book['authors'][] = (string) $creator; + } + $this->results[] = $book; + } + $this->total_pages = (int) $xml->Items->TotalPages; + $this->total_results = (int) $xml->Items->TotalResults; + return true; + } +} + +include("config.inc.php"); + +$query = @$_GET['keywords']; +$page = @$_GET['page']; +if (!$page) $page = 1; +$output = @$_GET['output']; +if ($output != 'rdf') $output = 'html'; + +$service = new AmazonSearch($query, $page); +$service->execute(); + +if ($output == 'rdf') { + include(RDFAPI_INCLUDE_DIR . "RdfAPI.php"); + $model = ModelFactory::getDefaultModel(); + + define("SEARCH_NS", "urn:x-search:"); + $rdf_type = new Resource(RDF_NAMESPACE_URI . "type"); + $rdfs_label = new Resource(RDF_SCHEMA_URI . "label"); + $dc_creator = new Resource(DC_NS . "creator"); + $foaf_name = new Resource(FOAF_NS . "name"); + $foaf_depiction = new Resource(FOAF_NS . "depiction"); + $SearchResultPage = new Resource(SEARCH_NS . "SearchResultPage"); + $searchTerm = new Resource(SEARCH_NS . "searchTerm"); + $page = new Resource(SEARCH_NS . "page"); + $totalPages = new Resource(SEARCH_NS . "totalPages"); + $totalResults = new Resource(SEARCH_NS . "totalResults"); + $nextPage = new Resource(SEARCH_NS . "nextPage"); + $searchResult = new Resource(SEARCH_NS . "result"); + $rank = new Resource(SEARCH_NS . "rank"); + $item = new Resource(SEARCH_NS . "item"); + $document = new Resource(BOOKMASHUP_BASE . "search.php?keywords=" . urlencode($query) . "&page=" . $service->page . "&output=rdf"); + $label = "Search results for: " . $query . (($service->total_pages > 1) ? " (page {$service->page} of {$service->total_pages})" : ""); + $page_number = new Literal($service->page); + $page_number->setDatatype(XML_SCHEMA . "int"); + $total_pages_number = new Literal($service->total_pages); + $total_pages_number->setDatatype(XML_SCHEMA . "int"); + $total_results_number = new Literal($service->total_results); + $total_results_number->setDatatype(XML_SCHEMA . "int"); + $next_page = new Resource(BOOKMASHUP_BASE . "search.php?keywords=" . urlencode($query) . "&page=" . ($service->page + 1) . "&output=rdf"); + + $model->add(new Statement($document, $rdf_type, $SearchResultPage)); + $model->add(new Statement($document, $rdfs_label, new Literal($label))); + $model->add(new Statement($document, $searchTerm, new Literal($query))); + $model->add(new Statement($document, $page, $page_number)); + $model->add(new Statement($document, $totalPages, $total_pages_number)); + $model->add(new Statement($document, $totalResults, $total_results_number)); + $model->add(new Statement($document, $nextPage, $next_page)); + $i = ($service->page - 1) * $service->results_per_page; + foreach ($service->results as $book) { + $i++; + $this_result = new BlankNode("result$i"); + $rank_number = new Literal($i); + $rank_number->setDatatype(XML_SCHEMA . "int"); + $model->add(new Statement($document, $searchResult, $this_result)); + $model->add(new Statement($this_result, $rank, $rank_number)); + $model->add(new Statement($this_result, $item, new Resource($book['uri']))); + $model->add(new Statement($this_result, $rdfs_label, new Literal($book['title']))); + if ($book['image']) { + $model->add(new Statement($this_result, $foaf_depiction, new Resource($book['image']))); + } + foreach ($book['authors'] as $key => $author) { + $this_author = new BlankNode("result{$i}_author" . ($key + 1)); + $model->add(new Statement($this_result, $dc_creator, $this_author)); + $model->add(new Statement($this_author, $foaf_name, new Literal($author))); + } + } + header('Content-Type: application/rdf+xml; charset=utf-8'); + include(RDFAPI_INCLUDE_DIR . PACKAGE_SYNTAX_RDF); + $s = new RdfSerializer(); + $s->addNamespacePrefix('rdf', RDF_NAMESPACE_URI); + $s->addNamespacePrefix('rdfs', RDF_SCHEMA_URI); + $s->addNamespacePrefix('dc', DC_NS); + $s->addNamespacePrefix('foaf', FOAF_NS); + $s->addNamespacePrefix('search', SEARCH_NS); + echo $s->serialize($model); + exit(); +} + +?><html lang="en"> + <head> + <title><?php if ($query) { ?>Search Results: “<?php echo htmlspecialchars($query); ?>”<?php } else { ?>Book Search<?php } ?> | RDF Book Mashup</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <link rel='alternate' type='application/rdf+xml' href='search.php?keywords=<?php echo htmlspecialchars(urlencode($query)); ?>&page=<?php echo $page; ?>&output=rdf' /> + <style type="text/css"> +body { background: white; color: black; font-family: sans-serif; line-height: 1.4em; padding: 2.5em 3em; margin: 0; } +:link { color: #00c; } +:visited { color: #609; } +a:link img { border: none; } +a:visited img { border: none; } +h1, h2, h3 { background: white; color: #800; } +h1 { font: 170% sans-serif; margin: 0; } +h2 { font: 140% sans-serif; margin: 1.5em 0 -0.5em 0; } +h3 { font: 120% sans-serif; margin: 1.5em 0 -0.5em 0; } +h4 { font: bold 100% sans-serif; } +h5 { font: italic 100% sans-serif; } +h6 { font: small-caps 100% sans-serif; } +.hide { display: none; } +pre { background: #fff6bb; font-family: monospace; line-height: 1.2em; padding: 1em 2em; } +dt { font-weight: bold; margin-top: 1.2em; margin-bottom: 0; } +dd { margin: 0; padding: 0; } +code, tt { font-family: monospace; } +ul.toc { list-style-type: none; } +ol.toc li a { text-decoration: none; } +.note { color: red; } +ul.results { list-style-type: none; padding-left: 0; } +ul.results li { clear: left; margin-bottom: 1.2em; } +.image { float: left; margin-bottom: 12px; padding-right: 1em; padding-top: 0.25em; text-align: right; width: 80px; } +.title { color: #800; font-weight: bold; } +.author { color: #888; font-size: 92%; } +a.rdfuri { background: url(rdf_icon.16.gif) center left no-repeat; font-size: 92%; padding-left: 20px; text-decoration: none; } +a.rdfuri:link { color: #66b; } +a.rdfuri:visited { color: #869; } +#header { border-bottom: 1px solid #ccc; } +#logo { float: right; } +#authors { clear: right; float: right; font-size: 80%; text-align: right; } +#content { clear: both; margin: 2em auto 0 0; text-align: justify } +#download { font-family: sans-serif; margin-bottom: 1em; text-align: center; } +#download h2 { font-size: 125%; margin: 1.5em 0 -0.2em 0; } +#download small { color: #888; font-size: 80%; } +#footer { border-top: 1px solid #ccc; color: #aaa; margin: 2em 0 0; } + +@media Print { +* { font-size: 92%; } +body { padding: 0; line-height: 1.2em; } +#content { margin: 0; width: 100%; } +} +@media Aural { +h1 { stress: 20; richness: 90; } +h2 { stress: 20; richness: 90; } +h3 { stress: 20; richness: 90; } +.hide { speak: none; } +dt { pause-before: 20%; } +pre { speak-punctuation: code; } +} + </style> + </head> + <body> + <div id="header"> + <h1><?php if ($query) { ?>Book Search Results for “<?php echo htmlspecialchars($query); ?>” <?php } else { ?>Book Search<?php } ?></h1> + </div> + <div id="content"> + <form name='SearchTerms' action='search.php' method='GET'> + <p>Search for books: + <input type='text' name='keywords' size='40' value='<?php echo htmlspecialchars($query); ?>' /> + <input type='submit' value='Go' /></p> + </form> +<?php if ($service->results) { ?> + <p><strong>Note:</strong> You will need an RDF-capable browser to display any of these items.</p> + <ul class='results'> +<?php foreach ($service->results as $book) { ?> +<?php if (!isset($book['isbn'])) continue; ?> + <li> +<?php if ($book['image']) { ?> + <div class='image'><img src='<?php echo htmlspecialchars($book['image']); ?>' alt='' /></div> +<?php } else { ?> + <div class='image'><img src='no-image.gif' alt='' /></div> +<?php } ?> + <div style='margin-left: 80px; padding-left: 1em'> + <span class='title'><?php echo htmlspecialchars($book['title']); ?></span><br /> +<?php if ($book['authors']) { ?> + <span class='author'><?php echo join(', ', $book['authors']); ?></span><br /> +<?php } ?> + <a class='rdfuri' href='<?php echo htmlspecialchars($book['uri']); ?>'><?php echo htmlspecialchars($book['uri']); ?></a></span></li> + </div> +<?php } ?> + </ul> +<?php } else { ?> + <p><strong>Your query returned no results.</strong></p> +<?php } ?> + <p> +<?php if ($page > 1) { ?> + « <a href='search.php?keywords=<?php echo htmlspecialchars(urlencode($query)); ?>&page=<?php echo $page - 1; ?>'>Previous</a> +<?php } ?> +<?php if ($page > 1 && $page < $service->total_pages) { ?> | <?php } ?> +<?php if ($page < $service->total_pages) { ?> + <a href='search.php?keywords=<?php echo htmlspecialchars(urlencode($query)); ?>&page=<?php echo $page + 1; ?>'>Next</a> » +<?php } ?> + </p> + </div> + <div id="footer"> + <small><a href="<?php echo BOOKMASHUP_BASE; ?>">Back to RDF Book Mashup</a></small> + </div> + </body> +</html> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kob...@us...> - 2007-08-14 11:12:48
|
Revision: 524 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=524&view=rev Author: kobasoft Date: 2007-08-14 04:12:45 -0700 (Tue, 14 Aug 2007) Log Message: ----------- Testing SVN write access. Removed a potentially dangerous trailing end-of-line character. Modified Paths: -------------- trunk/rdfapi-php/api/model/ModelFactory.php Modified: trunk/rdfapi-php/api/model/ModelFactory.php =================================================================== --- trunk/rdfapi-php/api/model/ModelFactory.php 2007-08-14 09:24:11 UTC (rev 523) +++ trunk/rdfapi-php/api/model/ModelFactory.php 2007-08-14 11:12:45 UTC (rev 524) @@ -285,4 +285,4 @@ return $cl; } } -?> +?> \ 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: <cw...@us...> - 2007-08-14 09:24:32
|
Revision: 523 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=523&view=rev Author: cweiske Date: 2007-08-14 02:24:11 -0700 (Tue, 14 Aug 2007) Log Message: ----------- PHP was not closed Modified Paths: -------------- trunk/rdfapi-php/tools/rdfdb-utils/n3.php trunk/rdfapi-php/tools/rdfdb-utils/rdf.php Modified: trunk/rdfapi-php/tools/rdfdb-utils/n3.php =================================================================== --- trunk/rdfapi-php/tools/rdfdb-utils/n3.php 2007-08-14 09:22:22 UTC (rev 522) +++ trunk/rdfapi-php/tools/rdfdb-utils/n3.php 2007-08-14 09:24:11 UTC (rev 523) @@ -36,4 +36,6 @@ header('Pragma: public'); print $s->serialize($m); -} \ No newline at end of file +} + +?> \ No newline at end of file Modified: trunk/rdfapi-php/tools/rdfdb-utils/rdf.php =================================================================== --- trunk/rdfapi-php/tools/rdfdb-utils/rdf.php 2007-08-14 09:22:22 UTC (rev 522) +++ trunk/rdfapi-php/tools/rdfdb-utils/rdf.php 2007-08-14 09:24:11 UTC (rev 523) @@ -37,4 +37,6 @@ header('Pragma: public'); print $s->serialize($m->getMemModel()); -} \ No newline at end of file +} + +?> \ 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: <cw...@us...> - 2007-08-14 09:22:38
|
Revision: 522 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=522&view=rev Author: cweiske Date: 2007-08-14 02:22:22 -0700 (Tue, 14 Aug 2007) Log Message: ----------- PHP file were not closed Modified Paths: -------------- trunk/rdfapi-php/api/resModel/ResIterator.php trunk/rdfapi-php/api/resModel/ResModel.php trunk/rdfapi-php/test/unit/Model/ModelFactory_tests.php trunk/rdfapi-php/test/unit/Model/Model_tests.php Modified: trunk/rdfapi-php/api/resModel/ResIterator.php =================================================================== --- trunk/rdfapi-php/api/resModel/ResIterator.php 2007-08-13 18:05:10 UTC (rev 521) +++ trunk/rdfapi-php/api/resModel/ResIterator.php 2007-08-14 09:22:22 UTC (rev 522) @@ -279,6 +279,7 @@ break; case 'OntProperty': + return $this->associatedModel->createOntProperty($resource->getLabel()); break; @@ -292,4 +293,6 @@ } return $resource; } -} \ No newline at end of file +} + +?> \ No newline at end of file Modified: trunk/rdfapi-php/api/resModel/ResModel.php =================================================================== --- trunk/rdfapi-php/api/resModel/ResModel.php 2007-08-13 18:05:10 UTC (rev 521) +++ trunk/rdfapi-php/api/resModel/ResModel.php 2007-08-14 09:22:22 UTC (rev 522) @@ -870,4 +870,6 @@ -} \ No newline at end of file +} + +?> \ No newline at end of file Modified: trunk/rdfapi-php/test/unit/Model/ModelFactory_tests.php =================================================================== --- trunk/rdfapi-php/test/unit/Model/ModelFactory_tests.php 2007-08-13 18:05:10 UTC (rev 521) +++ trunk/rdfapi-php/test/unit/Model/ModelFactory_tests.php 2007-08-14 09:22:22 UTC (rev 522) @@ -160,3 +160,5 @@ new Literal('Fred'))); } } + +?> \ No newline at end of file Modified: trunk/rdfapi-php/test/unit/Model/Model_tests.php =================================================================== --- trunk/rdfapi-php/test/unit/Model/Model_tests.php 2007-08-13 18:05:10 UTC (rev 521) +++ trunk/rdfapi-php/test/unit/Model/Model_tests.php 2007-08-14 09:22:22 UTC (rev 522) @@ -50,3 +50,5 @@ $this->assertIdentical(1, $ont->size()); } } + +?> \ 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: <cw...@us...> - 2007-08-13 18:05:11
|
Revision: 521 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=521&view=rev Author: cweiske Date: 2007-08-13 11:05:10 -0700 (Mon, 13 Aug 2007) Log Message: ----------- Squash final nesting bug Modified Paths: -------------- trunk/rdfapi-php/api/syntax/N3Serializer.php trunk/rdfapi-php/test/unit/Syntax/n3Serializer_test.php Modified: trunk/rdfapi-php/api/syntax/N3Serializer.php =================================================================== --- trunk/rdfapi-php/api/syntax/N3Serializer.php 2007-08-13 17:51:59 UTC (rev 520) +++ trunk/rdfapi-php/api/syntax/N3Serializer.php 2007-08-13 18:05:10 UTC (rev 521) @@ -181,20 +181,29 @@ arsort($count); - foreach ( $count as $k=>$v) { + foreach ( $count as $k => $v) { $this->doResource($resources[$k]); // $this->res.=" .\n"; } - $c = 0; - foreach ($this->resourcetext as $r => $t) { - if (preg_match_all('/'.MAGIC_STRING.'([^ ]+)'.MAGIC_STRING.'/', $t, $ms, PREG_SET_ORDER)) { - foreach ($ms as $mseach) { - $rp = $this->resourcetext[$mseach[1]]; - $t = preg_replace('/'.MAGIC_STRING.$mseach[1].MAGIC_STRING.'/', $rp, $t); + //make all replacements + do { + $bReplacements = false; + foreach ($this->resourcetext as $r => $t) { + if (preg_match_all('/'.MAGIC_STRING.'([^ ]+)'.MAGIC_STRING.'/', $t, $ms, PREG_SET_ORDER)) { + foreach ($ms as $mseach) { + $rp = $this->resourcetext[$mseach[1]]; + $this->resourcetext[$r] = preg_replace('/'.MAGIC_STRING.$mseach[1].MAGIC_STRING.'/', $rp, $t); + $bReplacements = true; + } } + } + } while ($bReplacements); + //after all replacements took place, put the lines out + $c = 0; + foreach ($this->resourcetext as $r => $t) { if ($this->debug) { $this->res .= $c . ': '; } Modified: trunk/rdfapi-php/test/unit/Syntax/n3Serializer_test.php =================================================================== --- trunk/rdfapi-php/test/unit/Syntax/n3Serializer_test.php 2007-08-13 17:51:59 UTC (rev 520) +++ trunk/rdfapi-php/test/unit/Syntax/n3Serializer_test.php 2007-08-13 18:05:10 UTC (rev 521) @@ -338,8 +338,8 @@ - function testNest() - {return; + function testNestDeeply() + { $mod = new MemModel(); $b100 = new BlankNode($mod); $b110 = new BlankNode($mod); @@ -374,11 +374,9 @@ //test if it can be loaded $par = new N3Parser(); $mod2 = $par->parse2model($str, false); - var_dump($str);//, $mod2->triples); + //var_dump($str, $mod2->triples); - $this->assertEqual($mod->size(), $mod2->size(), 'Original model size and loaded model size should equal'); - $this->assertTrue($mod->containsAll($mod2), 'Original model should contain all triples of loaded model'); - $this->assertTrue($mod2->containsAll($mod), 'Loaded model should contain all triples of original model'); + $this->compareModelsIgnoringBlankNodes($mod, $mod2); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cw...@us...> - 2007-08-13 17:52:01
|
Revision: 520 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=520&view=rev Author: cweiske Date: 2007-08-13 10:51:59 -0700 (Mon, 13 Aug 2007) Log Message: ----------- Squash another bug in nesting code Modified Paths: -------------- trunk/rdfapi-php/api/syntax/N3Serializer.php trunk/rdfapi-php/test/unit/Syntax/n3Serializer_test.php Modified: trunk/rdfapi-php/api/syntax/N3Serializer.php =================================================================== --- trunk/rdfapi-php/api/syntax/N3Serializer.php 2007-08-13 17:26:48 UTC (rev 519) +++ trunk/rdfapi-php/api/syntax/N3Serializer.php 2007-08-13 17:51:59 UTC (rev 520) @@ -369,7 +369,7 @@ if (is_a($r, 'Resource')) { if (is_a($r, 'BlankNode')) { - //test, if this blanknode is referenced somewhere + //test if this blanknode is referenced somewhere $rbn = $this->model->find(null, null, $r); $compress = (N3SER_BNODE_SHORT || $this->styleCompress) && ( @@ -449,7 +449,9 @@ print 'Doing object: '.$o->getURI().LINEFEED; } if (is_a($o, 'BlankNode')) { - if ($this->styleNest) { + if ($this->styleNest && $this->styleCompress + && !isset($this->done[$o->getURI()]) + ) { $this->doResource($o, true, $strIndent . ' '); $out .= MAGIC_STRING . $o->getURI() . MAGIC_STRING; //$out .= $this->resourcetext[$o->getURI()]; Modified: trunk/rdfapi-php/test/unit/Syntax/n3Serializer_test.php =================================================================== --- trunk/rdfapi-php/test/unit/Syntax/n3Serializer_test.php 2007-08-13 17:26:48 UTC (rev 519) +++ trunk/rdfapi-php/test/unit/Syntax/n3Serializer_test.php 2007-08-13 17:51:59 UTC (rev 520) @@ -277,6 +277,67 @@ + function testNestSimple() + { + $mod = new MemModel(); + $b3 = new BlankNode($mod); + $mod->add(new Statement( + new Resource('http://example.org/foo'), + new Resource("http://example.org/bar2"), + $b3 + )); + $mod->add(new Statement( + $b3, + new Resource("http://example.org/bar2"), + new Literal('hohoho') + )); + + $ser = new N3Serializer(); + $ser->setCompress(true); + $ser->setNest(true); + $str = $ser->serialize($mod); + + //test if it can be loaded + $par = new N3Parser(); + $mod2 = $par->parse2model($str, false); + //var_dump($str, $mod2->triples); + + $this->compareModelsIgnoringBlankNodes($mod, $mod2); + } + + + + function testNestSimpleBlankStart() + { + $mod = new MemModel(); + $b1 = new BlankNode($mod); + $b3 = new BlankNode($mod); + $mod->add(new Statement( + $b1, + new Resource("http://example.org/bar2"), + $b3 + )); + $mod->add(new Statement( + $b3, + new Resource("http://example.org/bar2"), + new Literal('hohoho') + )); + + $ser = new N3Serializer(); + $ser->setCompress(true); + $ser->setNest(true); + $str = $ser->serialize($mod); + + //test if it can be loaded + $par = new N3Parser(); + $mod2 = $par->parse2model($str, false); + //var_dump($str);//, $mod2->triples); + + $this->compareModelsIgnoringBlankNodes($mod, $mod2); + } + + + function testNest() {return; $mod = new MemModel(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cw...@us...> - 2007-08-13 17:26:51
|
Revision: 519 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=519&view=rev Author: cweiske Date: 2007-08-13 10:26:48 -0700 (Mon, 13 Aug 2007) Log Message: ----------- Fix bug when nesting blank node at the end Modified Paths: -------------- trunk/rdfapi-php/api/syntax/N3Serializer.php trunk/rdfapi-php/test/unit/Syntax/n3Serializer_test.php Modified: trunk/rdfapi-php/api/syntax/N3Serializer.php =================================================================== --- trunk/rdfapi-php/api/syntax/N3Serializer.php 2007-08-13 16:35:51 UTC (rev 518) +++ trunk/rdfapi-php/api/syntax/N3Serializer.php 2007-08-13 17:26:48 UTC (rev 519) @@ -342,6 +342,9 @@ $ts = $this->model->find($r, null, null); if (count($ts->triples) == 0) { + if ($bEmbedded) { + $this->resourcetext[$r->getURI()] = '_:' . $r->getLabel(); + } return; } Modified: trunk/rdfapi-php/test/unit/Syntax/n3Serializer_test.php =================================================================== --- trunk/rdfapi-php/test/unit/Syntax/n3Serializer_test.php 2007-08-13 16:35:51 UTC (rev 518) +++ trunk/rdfapi-php/test/unit/Syntax/n3Serializer_test.php 2007-08-13 17:26:48 UTC (rev 519) @@ -193,5 +193,200 @@ $this->assertTrue($mod2->containsAll($mod), 'Loaded model should contain all triples of original model'); } - } + + + function testCompressOneBlank() + { + $mod = new MemModel(); + $b1 = new BlankNode($mod); + $mod->add(new Statement( + $b1, + new Resource("http://example.org/bar1"), + new Literal('baz') + )); + + $ser = new N3Serializer(); + $ser->setCompress(true); + $ser->setNest(true); + $str = $ser->serialize($mod); + //var_dump($str);//, $mod2->triples); + + //test if it can be loaded + $par = new N3Parser(); + $mod2 = $par->parse2model($str, false); + + $this->assertEqual($mod->size(), $mod2->size(), 'Original model size and loaded model size should equal'); + $this->assertTrue($mod->containsAll($mod2), 'Original model should contain all triples of loaded model'); + $this->assertTrue($mod2->containsAll($mod), 'Loaded model should contain all triples of original model'); + } + + + + function testCompressTwoBlanks() + { + $mod = new MemModel(); + $b1 = new BlankNode($mod); + $b2 = new BlankNode($mod); + $mod->add(new Statement( + $b1, + new Resource("http://example.org/bar1"), + new Literal('baz1') + )); + $mod->add(new Statement( + $b2, + new Resource("http://example.org/bar2"), + new Literal('baz2') + )); + + $ser = new N3Serializer(); + $ser->setCompress(true); + $ser->setNest(true); + $str = $ser->serialize($mod); + + //test if it can be loaded + $par = new N3Parser(); + $mod2 = $par->parse2model($str, false); + //var_dump($str, $mod2->triples); + + $this->compareModelsIgnoringBlankNodes($mod, $mod2); + } + + + + function testCompressBlankAtEnd() + { + $mod = new MemModel(); + $b3 = new BlankNode($mod); + $mod->add(new Statement( + new Resource('http://example.org/foo'), + new Resource("http://example.org/bar2"), + $b3 + )); + + $ser = new N3Serializer(); + $ser->setCompress(true); + $str = $ser->serialize($mod); + + //test if it can be loaded + $par = new N3Parser(); + $mod2 = $par->parse2model($str, false); + //var_dump($str, $mod2->triples); + + $this->compareModelsIgnoringBlankNodes($mod, $mod2); + } + + + + function testNest() + {return; + $mod = new MemModel(); + $b100 = new BlankNode($mod); + $b110 = new BlankNode($mod); + $b120 = new BlankNode($mod); + $b111 = new BlankNode($mod); + $mod->add(new Statement( + new Resource("http://example.org/foo"), + new Resource("http://example.org/bar"), + $b100 + )); + $mod->add(new Statement( + $b100, + new Resource("http://example.org/bar2"), + $b110 + )); + $mod->add(new Statement( + $b110, + new Resource("http://example.org/bar4"), + $b111 + )); + $mod->add(new Statement( + $b100, + new Resource("http://example.org/bar3"), + $b120 + )); + + $ser = new N3Serializer(); + $ser->setCompress(true); + $ser->setNest(true); + $str = $ser->serialize($mod); + + //test if it can be loaded + $par = new N3Parser(); + $mod2 = $par->parse2model($str, false); + var_dump($str);//, $mod2->triples); + + $this->assertEqual($mod->size(), $mod2->size(), 'Original model size and loaded model size should equal'); + $this->assertTrue($mod->containsAll($mod2), 'Original model should contain all triples of loaded model'); + $this->assertTrue($mod2->containsAll($mod), 'Loaded model should contain all triples of original model'); + } + + + + function testNestBlankAtEnd() + { + $mod = new MemModel(); + $b3 = new BlankNode($mod); + $mod->add(new Statement( + new Resource('http://example.org/foo'), + new Resource("http://example.org/bar2"), + $b3 + )); + + $ser = new N3Serializer(); + $ser->setCompress(true); + $ser->setNest(true); + $str = $ser->serialize($mod); + + //test if it can be loaded + $par = new N3Parser(); + $mod2 = $par->parse2model($str, false); + //var_dump($str, $mod2->triples); + + $this->compareModelsIgnoringBlankNodes($mod, $mod2); + } + + + + + + + + + + function compareModelsIgnoringBlankNodes($mod1, $mod2) + { + $this->assertEqual($mod1->size(), $mod2->size(), 'Original model size and loaded model size should equal'); + + foreach ($mod1->triples as &$triple) { + $s = $p = $o = null; + if (!$triple->subj instanceof BlankNode) { + $s = $triple->subj; + } + if (!$triple->pred instanceof BlankNode) { + $p = $triple->pred; + } + if (!$triple->obj instanceof BlankNode) { + $o = $triple->obj; + } + $res = $mod2->find($s, $p, $o); + $this->assertTrue($res->size() > 0); + } + + foreach ($mod2->triples as &$triple) { + $s = $p = $o = null; + if (!$triple->subj instanceof BlankNode) { + $s = $triple->subj; + } + if (!$triple->pred instanceof BlankNode) { + $p = $triple->pred; + } + if (!$triple->obj instanceof BlankNode) { + $o = $triple->obj; + } + $res = $mod1->find($s, $p, $o); + $this->assertTrue($res->size() > 0); + } + }//function compareModelsIgnoringBlankNodes($mod1, $mod2) + +} ?> \ 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: <cw...@us...> - 2007-08-13 16:35:57
|
Revision: 518 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=518&view=rev Author: cweiske Date: 2007-08-13 09:35:51 -0700 (Mon, 13 Aug 2007) Log Message: ----------- test for NoNSPrefix add n3Serializer test to allTests Modified Paths: -------------- trunk/rdfapi-php/test/unit/Syntax/n3Serializer_test.php trunk/rdfapi-php/test/unit/allTests.php Modified: trunk/rdfapi-php/test/unit/Syntax/n3Serializer_test.php =================================================================== --- trunk/rdfapi-php/test/unit/Syntax/n3Serializer_test.php 2007-08-13 16:14:17 UTC (rev 517) +++ trunk/rdfapi-php/test/unit/Syntax/n3Serializer_test.php 2007-08-13 16:35:51 UTC (rev 518) @@ -130,5 +130,68 @@ $this->assertTrue($mod->containsAll($mod2), 'Original model should contain all triples of loaded model'); $this->assertTrue($mod2->containsAll($mod), 'Loaded model should contain all triples of original model'); } + + + + function testNoNSPrefix() + { + $mod = new MemModel(); + $mod->add(new Statement( + new Resource("http://example.org/foo"), + new Resource("http://example.org/bar"), + new Resource("mailto:fr...@ex...") + )); + + $ser = new N3Serializer(); + $ser->addNoNSPrefix('mailto:'); + $str = $ser->serialize($mod); + + $this->assertTrue(strpos($str, '<http://example.org/>') > 0); + $this->assertTrue(strpos($str, '@prefix') !== false); + $this->assertTrue(strpos($str, ':foo') > 0); + $this->assertTrue(strpos($str, ':bar') > 0); + $this->assertTrue(strpos($str, '<mailto:fr...@ex...>') > 0); + + //test if it can be loaded + $par = new N3Parser(); + $mod2 = $par->parse2model($str, false); + //var_dump($str, $mod2->triples); + + $this->assertEqual($mod->size(), $mod2->size(), 'Original model size and loaded model size should equal'); + $this->assertTrue($mod->containsAll($mod2), 'Original model should contain all triples of loaded model'); + $this->assertTrue($mod2->containsAll($mod), 'Loaded model should contain all triples of original model'); + } + + + + function testNoNSPrefix2() + { + $mod = new MemModel(); + $mod->add(new Statement( + new Resource("http://example.org/foo"), + new Resource("http://example.org/bar"), + new Resource("mailto:fr...@ex...") + )); + + $ser = new N3Serializer(); + $ser->addNoNSPrefix('http://example.org/'); + $ser->addNoNSPrefix('mailto:'); + $str = $ser->serialize($mod); + + $this->assertTrue(strpos($str, '@prefix') === false); + $this->assertTrue(strpos($str, '<http://example.org/foo>') > 0); + $this->assertTrue(strpos($str, '<http://example.org/bar>') > 0); + $this->assertTrue(strpos($str, '<mailto:fr...@ex...>') > 0); + + //test if it can be loaded + $par = new N3Parser(); + $mod2 = $par->parse2model($str, false); + //var_dump($str, $mod2->triples); + + $this->assertEqual($mod->size(), $mod2->size(), 'Original model size and loaded model size should equal'); + $this->assertTrue($mod->containsAll($mod2), 'Original model should contain all triples of loaded model'); + $this->assertTrue($mod2->containsAll($mod), 'Loaded model should contain all triples of original model'); + } + } ?> \ No newline at end of file Modified: trunk/rdfapi-php/test/unit/allTests.php =================================================================== --- trunk/rdfapi-php/test/unit/allTests.php 2007-08-13 16:14:17 UTC (rev 517) +++ trunk/rdfapi-php/test/unit/allTests.php 2007-08-13 16:35:51 UTC (rev 518) @@ -110,6 +110,7 @@ $test_syntax = &new GroupTest('Syntax tests'); $test_syntax->addTestFile(RDFAPI_TEST_INCLUDE_DIR. 'test/unit/Syntax/n3Parser_test.php'); +$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/rdf/rdf_test_cases.php'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cw...@us...> - 2007-08-13 16:14:22
|
Revision: 517 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=517&view=rev Author: cweiske Date: 2007-08-13 09:14:17 -0700 (Mon, 13 Aug 2007) Log Message: ----------- Fix N3Parser to unescape quotes More tests Modified Paths: -------------- trunk/rdfapi-php/api/syntax/N3Parser.php trunk/rdfapi-php/api/syntax/N3Serializer.php trunk/rdfapi-php/test/unit/Syntax/n3Serializer_test.php Modified: trunk/rdfapi-php/api/syntax/N3Parser.php =================================================================== --- trunk/rdfapi-php/api/syntax/N3Parser.php 2007-08-13 15:59:46 UTC (rev 516) +++ trunk/rdfapi-php/api/syntax/N3Parser.php 2007-08-13 16:14:17 UTC (rev 517) @@ -624,7 +624,8 @@ // print "++$lit++"; $lit=str_replace('\n', '\\n',$lit); - $lit=ereg_replace("[^\\]" . $chBase, "\\" . $chBase, $lit); + //$lit=ereg_replace("[^\\]" . $chBase, "\\" . $chBase, $lit); + $lit = stripslashes($lit); $list[$i] = $chBase . $lit . $chBase; } else { @@ -632,8 +633,9 @@ } } else { if (strstr($list[$i],"\n")) { - die('Newline in literal: '+$list[$i]); + die('Newline in literal: ' . $list[$i]); } + $list[$i] = stripslashes($list[$i]); } } } Modified: trunk/rdfapi-php/api/syntax/N3Serializer.php =================================================================== --- trunk/rdfapi-php/api/syntax/N3Serializer.php 2007-08-13 15:59:46 UTC (rev 516) +++ trunk/rdfapi-php/api/syntax/N3Serializer.php 2007-08-13 16:14:17 UTC (rev 517) @@ -423,10 +423,13 @@ $quoteChar = $long ? '"""' : '"'; } else if ($quoteDouble && !$quoteSingle) { $quoteChar = $long ? '\'\'\'' : '\''; - } else { + } else if ($quoteDouble && $quoteSingle) { //both quotation chars inside $quoteChar = $long ? '"""' : '"'; $l = addslashes($l); + } else { + //no quotation chars + $quoteChar = $long ? '"""' : '"'; } $out .= $quoteChar . $l . $quoteChar; Modified: trunk/rdfapi-php/test/unit/Syntax/n3Serializer_test.php =================================================================== --- trunk/rdfapi-php/test/unit/Syntax/n3Serializer_test.php 2007-08-13 15:59:46 UTC (rev 516) +++ trunk/rdfapi-php/test/unit/Syntax/n3Serializer_test.php 2007-08-13 16:14:17 UTC (rev 517) @@ -19,8 +19,8 @@ $mod->add(new Statement( new Resource("http://example.org/foo"), new Resource("http://example.org/bar"), - new Resource("mailto:fr...@ex...")) - ); + new Resource("mailto:fr...@ex...") + )); $ser = new N3Serializer(); $str = $ser->serialize($mod); @@ -43,6 +43,92 @@ + function testStringsSimple() + { + $mod = new MemModel(); + $mod->add(new Statement( + new Resource("http://example.org/foo"), + new Resource("http://example.org/bar"), + new Literal('testliteral') + )); + $mod->add(new Statement( + new Resource("http://example.org/foo"), + new Resource("http://example.org/bar"), + new Literal("test''literal") + )); + $mod->add(new Statement( + new Resource("http://example.org/foo"), + new Resource("http://example.org/bar"), + new Literal("test\"\"literal") + )); + $mod->add(new Statement( + new Resource("http://example.org/foo"), + new Resource("http://example.org/bar"), + new Literal("test\nliteral") + )); + $mod->add(new Statement( + new Resource("http://example.org/foo"), + new Resource("http://example.org/bar"), + new Literal("test\"\nliteral") + )); + $mod->add(new Statement( + new Resource("http://example.org/foo"), + new Resource("http://example.org/bar"), + new Literal("test'\nliteral") + )); + + $ser = new N3Serializer(); + $str = $ser->serialize($mod); + + $this->assertTrue(strpos($str, 'testliteral') > 0); + $this->assertTrue(strpos($str, "test''literal") > 0); + $this->assertTrue(strpos($str, 'test""literal') > 0); + $this->assertTrue(strpos($str, "test\nliteral") > 0); + $this->assertTrue(strpos($str, "'''test\"\nliteral'''") > 0); + $this->assertTrue(strpos($str, '"""test\'' . "\n" . 'literal"""') > 0); + + //test if it can be loaded + $par = new N3Parser(); + $mod2 = $par->parse2model($str, false); + //var_dump($str, $mod2->triples); + + $this->assertEqual($mod->size(), $mod2->size(), 'Original model size and loaded model size should equal'); + $this->assertTrue($mod->containsAll($mod2), 'Original model should contain all triples of loaded model'); + $this->assertTrue($mod2->containsAll($mod), 'Loaded model should contain all triples of original model'); + } + + + function testStringsAdvanced() + { + $mod = new MemModel(); + //up to now, we didn't trick the serializer + $mod->add(new Statement( + new Resource("http://example.org/foo"), + new Resource("http://example.org/bar"), + new Literal("test'\"literal") + )); + $mod->add(new Statement( + new Resource("http://example.org/foo"), + new Resource("http://example.org/bar"), + new Literal("test'\"\nliteral") + )); + + + $ser = new N3Serializer(); + $str = $ser->serialize($mod); + + $this->assertTrue(strpos($str, 'test\\\'\\"literal') > 0); + $this->assertTrue(strpos($str, 'test\\\'\\"' . "\n" . 'literal') > 0); + + //test if it can be loaded + $par = new N3Parser(); + $mod2 = $par->parse2model($str, false); + //var_dump($str, $mod2->triples); + + $this->assertEqual($mod->size(), $mod2->size(), 'Original model size and loaded model size should equal'); + $this->assertTrue($mod->containsAll($mod2), 'Original model should contain all triples of loaded model'); + $this->assertTrue($mod2->containsAll($mod), 'Loaded model should contain all triples of original model'); + } } ?> \ 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: <cw...@us...> - 2007-08-13 15:59:48
|
Revision: 516 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=516&view=rev Author: cweiske Date: 2007-08-13 08:59:46 -0700 (Mon, 13 Aug 2007) Log Message: ----------- Make serializing a bit more intelligent when quoting 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-08-13 15:43:35 UTC (rev 515) +++ trunk/rdfapi-php/api/syntax/N3Serializer.php 2007-08-13 15:59:46 UTC (rev 516) @@ -410,11 +410,26 @@ if (is_a($o, 'Literal')) { $l = $o->getLabel(); - if ( strpos($l, LINEFEED) === FALSE ) { - $out.="\"$l\""; + if (strpos($l, LINEFEED) === false) { + $long = false; } else { - $out.="\"\"\"$l\"\"\""; + $long = true; } + + //try to be intelligent + $quoteSingle = strpos($l, '\'') !== false; + $quoteDouble = strpos($l, '"') !== false; + if ($quoteSingle && !$quoteDouble) { + $quoteChar = $long ? '"""' : '"'; + } else if ($quoteDouble && !$quoteSingle) { + $quoteChar = $long ? '\'\'\'' : '\''; + } else { + //both quotation chars inside + $quoteChar = $long ? '"""' : '"'; + $l = addslashes($l); + } + $out .= $quoteChar . $l . $quoteChar; + if ( $o->getLanguage()!='' ) { $out.='@'.$o->getLanguage(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cw...@us...> - 2007-08-13 15:43:38
|
Revision: 515 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=515&view=rev Author: cweiske Date: 2007-08-13 08:43:35 -0700 (Mon, 13 Aug 2007) Log Message: ----------- This is why we need unit tests Modified Paths: -------------- trunk/rdfapi-php/api/syntax/N3Serializer.php Added Paths: ----------- trunk/rdfapi-php/test/unit/Syntax/n3Serializer_test.php Modified: trunk/rdfapi-php/api/syntax/N3Serializer.php =================================================================== --- trunk/rdfapi-php/api/syntax/N3Serializer.php 2007-08-13 15:17:42 UTC (rev 514) +++ trunk/rdfapi-php/api/syntax/N3Serializer.php 2007-08-13 15:43:35 UTC (rev 515) @@ -199,7 +199,7 @@ $this->res .= $c . ': '; } if (!(isset($this->resourcetext_taken[$r]) && $this->resourcetext_taken[$r]>0)) { - $this->res .= $t . '.' . LINEFEED; + $this->res .= $t . ' .' . LINEFEED; if ($this->stylePretty) { $this->res .= LINEFEED; } Added: trunk/rdfapi-php/test/unit/Syntax/n3Serializer_test.php =================================================================== --- trunk/rdfapi-php/test/unit/Syntax/n3Serializer_test.php (rev 0) +++ trunk/rdfapi-php/test/unit/Syntax/n3Serializer_test.php 2007-08-13 15:43:35 UTC (rev 515) @@ -0,0 +1,48 @@ +<?php +require_once RDFAPI_INCLUDE_DIR . 'model/MemModel.php'; +require_once RDFAPI_INCLUDE_DIR . 'syntax/N3Serializer.php'; +require_once RDFAPI_INCLUDE_DIR . 'syntax/N3Parser.php'; + +/** + * Unit tests for N3Serializer + * + * @version $Id$ + * @author Christian Weiske <cw...@cw...> + * + * @package unittests + */ +class testN3SerializerTests extends UnitTestCase +{ + function testSimple() + { + $mod = new MemModel(); + $mod->add(new Statement( + new Resource("http://example.org/foo"), + new Resource("http://example.org/bar"), + new Resource("mailto:fr...@ex...")) + ); + + $ser = new N3Serializer(); + $str = $ser->serialize($mod); + + $this->assertTrue(strpos($str, '<http://example.org/>') > 0); + $this->assertTrue(strpos($str, '@prefix') !== false); + $this->assertTrue(strpos($str, ':foo') > 0); + $this->assertTrue(strpos($str, ':bar') > 0); + $this->assertTrue(strpos($str, 'fr...@ex...') > 0); + + //test if it can be loaded + $par = new N3Parser(); + $mod2 = $par->parse2model($str, false); + //var_dump($str, $mod2->triples); + + $this->assertEqual($mod->size(), $mod2->size(), 'Original model size and loaded model size should equal'); + $this->assertTrue($mod->containsAll($mod2), 'Original model should contain all triples of loaded model'); + $this->assertTrue($mod2->containsAll($mod), 'Loaded model should contain all triples of original model'); + }//function testSimple() + + + + + } +?> \ 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: <cw...@us...> - 2007-08-13 15:43:15
|
Revision: 514 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=514&view=rev Author: cweiske Date: 2007-08-13 08:17:42 -0700 (Mon, 13 Aug 2007) Log Message: ----------- Updating dawg2 tests Earl reporting works now. Modified Paths: -------------- trunk/rdfapi-php/test/unit/EarlReporter.php trunk/rdfapi-php/test/unit/Sparql/Dawg2Helper.php trunk/rdfapi-php/test/unit/Sparql/SparqlDbTests_test.php trunk/rdfapi-php/test/unit/Sparql/SparqlParserTests_test.php trunk/rdfapi-php/test/unit/Sparql/cases_dawg2.php Modified: trunk/rdfapi-php/test/unit/EarlReporter.php =================================================================== --- trunk/rdfapi-php/test/unit/EarlReporter.php 2007-08-13 14:12:38 UTC (rev 513) +++ trunk/rdfapi-php/test/unit/EarlReporter.php 2007-08-13 15:17:42 UTC (rev 514) @@ -215,14 +215,6 @@ new Resource($this->currentTestName) )); -/* - [ a earl:Assertion; - earl:assertedBy _8:chime; - earl:result [ a earl:TestResult; - earl:outcome earl:pass]; - earl:subject <http://rdflib.net>; - earl:test _7:dawg-graph-02]. -*/ $this->currentTestName = null; }//function addTest($bPass) Modified: trunk/rdfapi-php/test/unit/Sparql/Dawg2Helper.php =================================================================== --- trunk/rdfapi-php/test/unit/Sparql/Dawg2Helper.php 2007-08-13 14:12:38 UTC (rev 513) +++ trunk/rdfapi-php/test/unit/Sparql/Dawg2Helper.php 2007-08-13 15:17:42 UTC (rev 514) @@ -115,7 +115,7 @@ 'PREFIX mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> PREFIX qt: <http://www.w3.org/2001/sw/DataAccess/tests/test-query#> PREFIX dawgt: <http://www.w3.org/2001/sw/DataAccess/tests/test-dawg#> - SELECT ?name ?queryFile ?dataFile ?resultFile WHERE { + SELECT ?test ?name ?queryFile ?dataFile ?resultFile WHERE { ?test rdf:type mf:QueryEvaluationTest. ?test mf:name ?name. ?test dawgt:approval dawgt:Approved. @@ -128,6 +128,7 @@ $dirname = dirname($strCollectionFile) . '/'; $arTests = array(); + $prefix = self::getPrefix($strCollectionFile); //this is a bug in SparqlEngine and should be fixed if ($res === false) { @@ -135,11 +136,16 @@ } foreach ($res as $test) { + $name = $test['?test']->uri; + if (substr($name, 0, 7) !== 'http://') { + $name = $prefix . $name; + } $arTests[] = array( - 'title' => $test['?name']->label, - 'data' => $dirname . $test['?dataFile']->uri, - 'query' => $dirname . $test['?queryFile']->uri, - 'result' => $dirname . $test['?resultFile']->uri, + 'earl:name' => $name, + 'title' => $test['?name']->label, + 'data' => $dirname . $test['?dataFile']->uri, + 'query' => $dirname . $test['?queryFile']->uri, + 'result' => $dirname . $test['?resultFile']->uri, ); } @@ -154,7 +160,7 @@ 'PREFIX mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> PREFIX qt: <http://www.w3.org/2001/sw/DataAccess/tests/test-query#> PREFIX dawgt: <http://www.w3.org/2001/sw/DataAccess/tests/test-dawg#> - SELECT ?name ?queryFile ?type WHERE { + SELECT ?test ?name ?queryFile ?type WHERE { ?test rdf:type ?type. ?test mf:name ?name. ?test dawgt:approval dawgt:Approved. @@ -165,6 +171,7 @@ $dirname = dirname($strCollectionFile) . '/'; $arTests = array(); + $prefix = self::getPrefix($strCollectionFile); //this is a bug in SparqlEngine and should be fixed if ($res === false) { @@ -176,10 +183,15 @@ } else { $type = 'syntax-negative'; } + $name = $test['?test']->uri; + if (substr($name, 0, 7) !== 'http://') { + $name = $prefix . $name; + } $arTests[] = array( - 'title' => $test['?name']->label, - 'query' => $dirname . $test['?queryFile']->uri, - 'type' => $type + 'earl:name' => $name, + 'title' => $test['?name']->label, + 'query' => $dirname . $test['?queryFile']->uri, + 'type' => $type ); } @@ -188,6 +200,17 @@ + protected static function getPrefix($strFile) + { + return 'http://www.w3.org/2001/sw/DataAccess/tests/' + . substr( + $strFile, + strpos($strFile, 'w3c-dawg2/') + 10 + ); + }//protected static function getPrefix($strFile) + + + /** * Executes a SPARQL query on the data written in an * file containing N3-formatted RDF data Modified: trunk/rdfapi-php/test/unit/Sparql/SparqlDbTests_test.php =================================================================== --- trunk/rdfapi-php/test/unit/Sparql/SparqlDbTests_test.php 2007-08-13 14:12:38 UTC (rev 513) +++ trunk/rdfapi-php/test/unit/Sparql/SparqlDbTests_test.php 2007-08-13 15:17:42 UTC (rev 514) @@ -97,6 +97,12 @@ $_SESSION['test'] = $title . ' test'; $e = null; + if (isset($name['earl:name'])) { + //fix some weird issue with simpletest + $earlname = $name['earl:name']; + $this->signal('earl:name', $earlname); + } + if ($fileData != null && $fileData != $strLastDataFile) { //re-use database if not changed list($database, $dbModel) = $this->prepareDatabase(); Modified: trunk/rdfapi-php/test/unit/Sparql/SparqlParserTests_test.php =================================================================== --- trunk/rdfapi-php/test/unit/Sparql/SparqlParserTests_test.php 2007-08-13 14:12:38 UTC (rev 513) +++ trunk/rdfapi-php/test/unit/Sparql/SparqlParserTests_test.php 2007-08-13 15:17:42 UTC (rev 514) @@ -162,7 +162,7 @@ } continue; } - $this->signal('earl:name', $test['title']); + $this->signal('earl:name', $test['earl:name']); $qs = file_get_contents(SPARQL_TESTFILES . $test['query']); Modified: trunk/rdfapi-php/test/unit/Sparql/cases_dawg2.php =================================================================== --- trunk/rdfapi-php/test/unit/Sparql/cases_dawg2.php 2007-08-13 14:12:38 UTC (rev 513) +++ trunk/rdfapi-php/test/unit/Sparql/cases_dawg2.php 2007-08-13 15:17:42 UTC (rev 514) @@ -1,2176 +1,2514 @@ <?php /** -* automatically created by create-dawg2.php on 2007-08-12 16:52 +* automatically created by create-dawg2.php on 2007-08-13 16:53 */ $_SESSION['sparql_dawg2_tests'] = array ( - 0 => + 0 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/basic/manifest.ttl#spoo-1', 'title' => 'Basic graph pattern - spoo', 'data' => 'w3c-dawg2/data-r2/basic/data-6.ttl', 'query' => 'w3c-dawg2/data-r2/basic/spoo-1.rq', 'result' => 'w3c-dawg2/data-r2/basic/spoo-1.srx', ), - 1 => + 1 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/basic/manifest.ttl#base-prefix-1', 'title' => 'Basic - Prefix/Base 1', 'data' => 'w3c-dawg2/data-r2/basic/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/basic/base-prefix-1.rq', 'result' => 'w3c-dawg2/data-r2/basic/base-prefix-1.srx', ), - 2 => + 2 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/basic/manifest.ttl#base-prefix-2', 'title' => 'Basic - Prefix/Base 2', 'data' => 'w3c-dawg2/data-r2/basic/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/basic/base-prefix-2.rq', 'result' => 'w3c-dawg2/data-r2/basic/base-prefix-2.srx', ), - 3 => + 3 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/basic/manifest.ttl#base-prefix-3', 'title' => 'Basic - Prefix/Base 3', 'data' => 'w3c-dawg2/data-r2/basic/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/basic/base-prefix-3.rq', 'result' => 'w3c-dawg2/data-r2/basic/base-prefix-3.srx', ), - 4 => + 4 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/basic/manifest.ttl#base-prefix-4', 'title' => 'Basic - Prefix/Base 4', 'data' => 'w3c-dawg2/data-r2/basic/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/basic/base-prefix-4.rq', 'result' => 'w3c-dawg2/data-r2/basic/base-prefix-4.srx', ), - 5 => + 5 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/basic/manifest.ttl#base-prefix-5', 'title' => 'Basic - Prefix/Base 5', 'data' => 'w3c-dawg2/data-r2/basic/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/basic/base-prefix-5.rq', 'result' => 'w3c-dawg2/data-r2/basic/base-prefix-5.srx', ), - 6 => + 6 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/basic/manifest.ttl#list-1', 'title' => 'Basic - List 1', 'data' => 'w3c-dawg2/data-r2/basic/data-2.ttl', 'query' => 'w3c-dawg2/data-r2/basic/list-1.rq', 'result' => 'w3c-dawg2/data-r2/basic/list-1.srx', ), - 7 => + 7 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/basic/manifest.ttl#list-2', 'title' => 'Basic - List 2', 'data' => 'w3c-dawg2/data-r2/basic/data-2.ttl', 'query' => 'w3c-dawg2/data-r2/basic/list-2.rq', 'result' => 'w3c-dawg2/data-r2/basic/list-2.srx', ), - 8 => + 8 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/basic/manifest.ttl#list-3', 'title' => 'Basic - List 3', 'data' => 'w3c-dawg2/data-r2/basic/data-2.ttl', 'query' => 'w3c-dawg2/data-r2/basic/list-3.rq', 'result' => 'w3c-dawg2/data-r2/basic/list-3.srx', ), - 9 => + 9 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/basic/manifest.ttl#list-4', 'title' => 'Basic - List 4', 'data' => 'w3c-dawg2/data-r2/basic/data-2.ttl', 'query' => 'w3c-dawg2/data-r2/basic/list-4.rq', 'result' => 'w3c-dawg2/data-r2/basic/list-4.srx', ), - 10 => + 10 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/basic/manifest.ttl#quotes-1', 'title' => 'Basic - Quotes 1', 'data' => 'w3c-dawg2/data-r2/basic/data-3.ttl', 'query' => 'w3c-dawg2/data-r2/basic/quotes-1.rq', 'result' => 'w3c-dawg2/data-r2/basic/quotes-1.srx', ), - 11 => + 11 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/basic/manifest.ttl#quotes-2', 'title' => 'Basic - Quotes 2', 'data' => 'w3c-dawg2/data-r2/basic/data-3.ttl', 'query' => 'w3c-dawg2/data-r2/basic/quotes-2.rq', 'result' => 'w3c-dawg2/data-r2/basic/quotes-2.srx', ), - 12 => + 12 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/basic/manifest.ttl#quotes-3', 'title' => 'Basic - Quotes 3', 'data' => 'w3c-dawg2/data-r2/basic/data-3.ttl', 'query' => 'w3c-dawg2/data-r2/basic/quotes-3.rq', 'result' => 'w3c-dawg2/data-r2/basic/quotes-3.srx', ), - 13 => + 13 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/basic/manifest.ttl#quotes-4', 'title' => 'Basic - Quotes 4', 'data' => 'w3c-dawg2/data-r2/basic/data-3.ttl', 'query' => 'w3c-dawg2/data-r2/basic/quotes-4.rq', 'result' => 'w3c-dawg2/data-r2/basic/quotes-4.srx', ), - 14 => + 14 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/basic/manifest.ttl#term-1', 'title' => 'Basic - Term 1', 'data' => 'w3c-dawg2/data-r2/basic/data-4.ttl', 'query' => 'w3c-dawg2/data-r2/basic/term-1.rq', 'result' => 'w3c-dawg2/data-r2/basic/term-1.srx', ), - 15 => + 15 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/basic/manifest.ttl#term-2', 'title' => 'Basic - Term 2', 'data' => 'w3c-dawg2/data-r2/basic/data-4.ttl', 'query' => 'w3c-dawg2/data-r2/basic/term-2.rq', 'result' => 'w3c-dawg2/data-r2/basic/term-2.srx', ), - 16 => + 16 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/basic/manifest.ttl#term-3', 'title' => 'Basic - Term 3', 'data' => 'w3c-dawg2/data-r2/basic/data-4.ttl', 'query' => 'w3c-dawg2/data-r2/basic/term-3.rq', 'result' => 'w3c-dawg2/data-r2/basic/term-3.srx', ), - 17 => + 17 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/basic/manifest.ttl#term-4', 'title' => 'Basic - Term 4', 'data' => 'w3c-dawg2/data-r2/basic/data-4.ttl', 'query' => 'w3c-dawg2/data-r2/basic/term-4.rq', 'result' => 'w3c-dawg2/data-r2/basic/term-4.srx', ), - 18 => + 18 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/basic/manifest.ttl#term-5', 'title' => 'Basic - Term 5', 'data' => 'w3c-dawg2/data-r2/basic/data-4.ttl', 'query' => 'w3c-dawg2/data-r2/basic/term-5.rq', 'result' => 'w3c-dawg2/data-r2/basic/term-5.srx', ), - 19 => + 19 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/basic/manifest.ttl#term-6', 'title' => 'Basic - Term 6', 'data' => 'w3c-dawg2/data-r2/basic/data-4.ttl', 'query' => 'w3c-dawg2/data-r2/basic/term-6.rq', 'result' => 'w3c-dawg2/data-r2/basic/term-6.srx', ), - 20 => + 20 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/basic/manifest.ttl#term-7', 'title' => 'Basic - Term 7', 'data' => 'w3c-dawg2/data-r2/basic/data-4.ttl', 'query' => 'w3c-dawg2/data-r2/basic/term-7.rq', 'result' => 'w3c-dawg2/data-r2/basic/term-7.srx', ), - 21 => + 21 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/basic/manifest.ttl#term-8', 'title' => 'Basic - Term 8', 'data' => 'w3c-dawg2/data-r2/basic/data-4.ttl', 'query' => 'w3c-dawg2/data-r2/basic/term-8.rq', 'result' => 'w3c-dawg2/data-r2/basic/term-8.srx', ), - 22 => + 22 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/basic/manifest.ttl#term-9', 'title' => 'Basic - Term 9', 'data' => 'w3c-dawg2/data-r2/basic/data-4.ttl', 'query' => 'w3c-dawg2/data-r2/basic/term-9.rq', 'result' => 'w3c-dawg2/data-r2/basic/term-9.srx', ), - 23 => + 23 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/basic/manifest.ttl#var-1', 'title' => 'Basic - Var 1', 'data' => 'w3c-dawg2/data-r2/basic/data-5.ttl', 'query' => 'w3c-dawg2/data-r2/basic/var-1.rq', 'result' => 'w3c-dawg2/data-r2/basic/var-1.srx', ), - 24 => + 24 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/basic/manifest.ttl#var-2', 'title' => 'Basic - Var 2', 'data' => 'w3c-dawg2/data-r2/basic/data-5.ttl', 'query' => 'w3c-dawg2/data-r2/basic/var-2.rq', 'result' => 'w3c-dawg2/data-r2/basic/var-2.srx', ), - 25 => + 25 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/triple-match/manifest#dawg-triple-pattern-001', 'title' => 'dawg-triple-pattern-001', 'data' => 'w3c-dawg2/data-r2/triple-match/data-01.ttl', 'query' => 'w3c-dawg2/data-r2/triple-match/dawg-tp-01.rq', 'result' => 'w3c-dawg2/data-r2/triple-match/result-tp-01.ttl', ), - 26 => + 26 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/triple-match/manifest#dawg-triple-pattern-002', 'title' => 'dawg-triple-pattern-002', 'data' => 'w3c-dawg2/data-r2/triple-match/data-01.ttl', 'query' => 'w3c-dawg2/data-r2/triple-match/dawg-tp-02.rq', 'result' => 'w3c-dawg2/data-r2/triple-match/result-tp-02.ttl', ), - 27 => + 27 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/triple-match/manifest#dawg-triple-pattern-003', 'title' => 'dawg-triple-pattern-003', 'data' => 'w3c-dawg2/data-r2/triple-match/data-02.ttl', 'query' => 'w3c-dawg2/data-r2/triple-match/dawg-tp-03.rq', 'result' => 'w3c-dawg2/data-r2/triple-match/result-tp-03.ttl', ), - 28 => + 28 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/triple-match/manifest#dawg-triple-pattern-004', 'title' => 'dawg-triple-pattern-004', 'data' => 'w3c-dawg2/data-r2/triple-match/dawg-data-01.ttl', 'query' => 'w3c-dawg2/data-r2/triple-match/dawg-tp-04.rq', 'result' => 'w3c-dawg2/data-r2/triple-match/result-tp-04.ttl', ), - 29 => + 29 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/open-world/manifest#open-eq-01', 'title' => 'open-eq-01', 'data' => 'w3c-dawg2/data-r2/open-world/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/open-world/open-eq-01.rq', 'result' => 'w3c-dawg2/data-r2/open-world/open-eq-01-result.srx', ), - 30 => + 30 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/open-world/manifest#open-eq-02', 'title' => 'open-eq-02', 'data' => 'w3c-dawg2/data-r2/open-world/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/open-world/open-eq-02.rq', 'result' => 'w3c-dawg2/data-r2/open-world/open-eq-02-result.srx', ), - 31 => + 31 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/open-world/manifest#open-eq-03', 'title' => 'open-eq-03', 'data' => 'w3c-dawg2/data-r2/open-world/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/open-world/open-eq-03.rq', 'result' => 'w3c-dawg2/data-r2/open-world/open-eq-03-result.srx', ), - 32 => + 32 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/open-world/manifest#open-eq-04', 'title' => 'open-eq-04', 'data' => 'w3c-dawg2/data-r2/open-world/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/open-world/open-eq-04.rq', 'result' => 'w3c-dawg2/data-r2/open-world/open-eq-04-result.srx', ), - 33 => + 33 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/open-world/manifest#open-eq-05', 'title' => 'open-eq-05', 'data' => 'w3c-dawg2/data-r2/open-world/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/open-world/open-eq-05.rq', 'result' => 'w3c-dawg2/data-r2/open-world/open-eq-05-result.srx', ), - 34 => + 34 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/open-world/manifest#open-eq-06', 'title' => 'open-eq-06', 'data' => 'w3c-dawg2/data-r2/open-world/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/open-world/open-eq-06.rq', 'result' => 'w3c-dawg2/data-r2/open-world/open-eq-06-result.srx', ), - 35 => + 35 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/open-world/manifest#open-eq-07', 'title' => 'open-eq-07', 'data' => 'w3c-dawg2/data-r2/open-world/data-2.ttl', 'query' => 'w3c-dawg2/data-r2/open-world/open-eq-07.rq', 'result' => 'w3c-dawg2/data-r2/open-world/open-eq-07-result.srx', ), - 36 => + 36 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/open-world/manifest#open-eq-08', 'title' => 'open-eq-08', 'data' => 'w3c-dawg2/data-r2/open-world/data-2.ttl', 'query' => 'w3c-dawg2/data-r2/open-world/open-eq-08.rq', 'result' => 'w3c-dawg2/data-r2/open-world/open-eq-08-result.srx', ), - 37 => + 37 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/open-world/manifest#open-eq-09', 'title' => 'open-eq-09', 'data' => 'w3c-dawg2/data-r2/open-world/data-2.ttl', 'query' => 'w3c-dawg2/data-r2/open-world/open-eq-09.rq', 'result' => 'w3c-dawg2/data-r2/open-world/open-eq-09-result.srx', ), - 38 => + 38 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/open-world/manifest#open-eq-10', 'title' => 'open-eq-10', 'data' => 'w3c-dawg2/data-r2/open-world/data-2.ttl', 'query' => 'w3c-dawg2/data-r2/open-world/open-eq-10.rq', 'result' => 'w3c-dawg2/data-r2/open-world/open-eq-10-result.srx', ), - 39 => + 39 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/open-world/manifest#open-eq-11', 'title' => 'open-eq-11', 'data' => 'w3c-dawg2/data-r2/open-world/data-2.ttl', 'query' => 'w3c-dawg2/data-r2/open-world/open-eq-11.rq', 'result' => 'w3c-dawg2/data-r2/open-world/open-eq-11-result.srx', ), - 40 => + 40 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/open-world/manifest#open-eq-12', 'title' => 'open-eq-12', 'data' => 'w3c-dawg2/data-r2/open-world/data-2.ttl', 'query' => 'w3c-dawg2/data-r2/open-world/open-eq-12.rq', 'result' => 'w3c-dawg2/data-r2/open-world/open-eq-12-result.srx', ), - 41 => + 41 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/open-world/manifest#date-1', 'title' => 'date-1', 'data' => 'w3c-dawg2/data-r2/open-world/data-3.ttl', 'query' => 'w3c-dawg2/data-r2/open-world/date-1.rq', 'result' => 'w3c-dawg2/data-r2/open-world/date-1-result.srx', ), - 42 => + 42 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/open-world/manifest#date-2', 'title' => 'date-2', 'data' => 'w3c-dawg2/data-r2/open-world/data-3.ttl', 'query' => 'w3c-dawg2/data-r2/open-world/date-2.rq', 'result' => 'w3c-dawg2/data-r2/open-world/date-2-result.srx', ), - 43 => + 43 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/open-world/manifest#date-3', 'title' => 'date-3', 'data' => 'w3c-dawg2/data-r2/open-world/data-3.ttl', 'query' => 'w3c-dawg2/data-r2/open-world/date-3.rq', 'result' => 'w3c-dawg2/data-r2/open-world/date-3-result.srx', ), - 44 => + 44 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/open-world/manifest#date-4', 'title' => 'date-4', 'data' => 'w3c-dawg2/data-r2/open-world/data-3.ttl', 'query' => 'w3c-dawg2/data-r2/open-world/date-4.rq', 'result' => 'w3c-dawg2/data-r2/open-world/date-4-result.srx', ), - 45 => + 45 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/open-world/manifest#open-cmp-01', 'title' => 'open-cmp-01', 'data' => 'w3c-dawg2/data-r2/open-world/data-4.ttl', 'query' => 'w3c-dawg2/data-r2/open-world/open-cmp-01.rq', 'result' => 'w3c-dawg2/data-r2/open-world/open-cmp-01-result.srx', ), - 46 => + 46 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/open-world/manifest#open-cmp-02', 'title' => 'open-cmp-02', 'data' => 'w3c-dawg2/data-r2/open-world/data-4.ttl', 'query' => 'w3c-dawg2/data-r2/open-world/open-cmp-02.rq', 'result' => 'w3c-dawg2/data-r2/open-world/open-cmp-02-result.srx', ), - 47 => + 47 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/algebra/manifest#nested-opt-1', 'title' => 'Nested Optionals - 1', 'data' => 'w3c-dawg2/data-r2/algebra/two-nested-opt.ttl', 'query' => 'w3c-dawg2/data-r2/algebra/two-nested-opt.rq', 'result' => 'w3c-dawg2/data-r2/algebra/two-nested-opt.srx', ), - 48 => + 48 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/algebra/manifest#nested-opt-2', 'title' => 'Nested Optionals - 2', 'data' => 'w3c-dawg2/data-r2/algebra/two-nested-opt.ttl', 'query' => 'w3c-dawg2/data-r2/algebra/two-nested-opt-alt.rq', 'result' => 'w3c-dawg2/data-r2/algebra/two-nested-opt-alt.srx', ), - 49 => + 49 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/algebra/manifest#opt-filter-1', 'title' => 'Optional-filter - 1', 'data' => 'w3c-dawg2/data-r2/algebra/opt-filter-1.ttl', 'query' => 'w3c-dawg2/data-r2/algebra/opt-filter-1.rq', 'result' => 'w3c-dawg2/data-r2/algebra/opt-filter-1.srx', ), - 50 => + 50 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/algebra/manifest#opt-filter-2', 'title' => 'Optional-filter - 2 filters', 'data' => 'w3c-dawg2/data-r2/algebra/opt-filter-2.ttl', 'query' => 'w3c-dawg2/data-r2/algebra/opt-filter-2.rq', 'result' => 'w3c-dawg2/data-r2/algebra/opt-filter-2.srx', ), - 51 => + 51 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/algebra/manifest#opt-filter-3', 'title' => 'Optional-filter - scope of variable', 'data' => 'w3c-dawg2/data-r2/algebra/opt-filter-3.ttl', 'query' => 'w3c-dawg2/data-r2/algebra/opt-filter-3.rq', 'result' => 'w3c-dawg2/data-r2/algebra/opt-filter-3.srx', ), - 52 => + 52 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/algebra/manifest#filter-place-1', 'title' => 'Filter-placement - 1', 'data' => 'w3c-dawg2/data-r2/algebra/data-2.ttl', 'query' => 'w3c-dawg2/data-r2/algebra/filter-placement-1.rq', 'result' => 'w3c-dawg2/data-r2/algebra/filter-placement-1.srx', ), - 53 => + 53 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/algebra/manifest#filter-place-2', 'title' => 'Filter-placement - 2', 'data' => 'w3c-dawg2/data-r2/algebra/data-2.ttl', 'query' => 'w3c-dawg2/data-r2/algebra/filter-placement-2.rq', 'result' => 'w3c-dawg2/data-r2/algebra/filter-placement-2.srx', ), - 54 => + 54 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/algebra/manifest#filter-place-3', 'title' => 'Filter-placement - 3', 'data' => 'w3c-dawg2/data-r2/algebra/data-2.ttl', 'query' => 'w3c-dawg2/data-r2/algebra/filter-placement-3.rq', 'result' => 'w3c-dawg2/data-r2/algebra/filter-placement-3.srx', ), - 55 => + 55 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/algebra/manifest#filter-nested-1', 'title' => 'Filter-nested - 1', 'data' => 'w3c-dawg2/data-r2/algebra/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/algebra/filter-nested-1.rq', 'result' => 'w3c-dawg2/data-r2/algebra/filter-nested-1.srx', ), - 56 => + 56 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/algebra/manifest#filter-nested-2', 'title' => 'Filter-nested - 2', 'data' => 'w3c-dawg2/data-r2/algebra/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/algebra/filter-nested-2.rq', 'result' => 'w3c-dawg2/data-r2/algebra/filter-nested-2.srx', ), - 57 => + 57 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/algebra/manifest#filter-scope-1', 'title' => 'Filter-scope - 1', 'data' => 'w3c-dawg2/data-r2/algebra/data-2.ttl', 'query' => 'w3c-dawg2/data-r2/algebra/filter-scope-1.rq', 'result' => 'w3c-dawg2/data-r2/algebra/filter-scope-1.srx', ), - 58 => + 58 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/algebra/manifest#join-scope-1', 'title' => 'Join scope - 1', 'data' => 'w3c-dawg2/data-r2/algebra/var-scope-join-1.ttl', 'query' => 'w3c-dawg2/data-r2/algebra/var-scope-join-1.rq', 'result' => 'w3c-dawg2/data-r2/algebra/var-scope-join-1.srx', ), - 59 => + 59 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/bnode-coreference/manifest.ttl#dawg-bnode-coref-001', 'title' => 'dawg-bnode-coreference', 'data' => 'w3c-dawg2/data-r2/bnode-coreference/data.ttl', 'query' => 'w3c-dawg2/data-r2/bnode-coreference/query.rq', 'result' => 'w3c-dawg2/data-r2/bnode-coreference/result.ttl', ), - 60 => + 60 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/optional/manifest#dawg-optional-001', 'title' => 'One optional clause', 'data' => 'w3c-dawg2/data-r2/optional/data.ttl', 'query' => 'w3c-dawg2/data-r2/optional/q-opt-1.rq', 'result' => 'w3c-dawg2/data-r2/optional/result-opt-1.ttl', ), - 61 => + 61 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/optional/manifest#dawg-optional-002', 'title' => 'Two optional clauses', 'data' => 'w3c-dawg2/data-r2/optional/data.ttl', 'query' => 'w3c-dawg2/data-r2/optional/q-opt-2.rq', 'result' => 'w3c-dawg2/data-r2/optional/result-opt-2.ttl', ), - 62 => + 62 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/optional/manifest#dawg-union-001', 'title' => 'Union is not optional', 'data' => 'w3c-dawg2/data-r2/optional/data.ttl', 'query' => 'w3c-dawg2/data-r2/optional/q-opt-3.rq', 'result' => 'w3c-dawg2/data-r2/optional/result-opt-3.ttl', ), - 63 => + 63 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/optional-filter/manifest#dawg-optional-filter-001', 'title' => 'OPTIONAL-FILTER', 'data' => 'w3c-dawg2/data-r2/optional-filter/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/optional-filter/expr-1.rq', 'result' => 'w3c-dawg2/data-r2/optional-filter/expr-1-result.ttl', ), - 64 => + 64 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/optional-filter/manifest#dawg-optional-filter-002', 'title' => 'OPTIONAL - Outer FILTER', 'data' => 'w3c-dawg2/data-r2/optional-filter/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/optional-filter/expr-2.rq', 'result' => 'w3c-dawg2/data-r2/optional-filter/expr-2-result.ttl', ), - 65 => + 65 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/optional-filter/manifest#dawg-optional-filter-003', 'title' => 'OPTIONAL - Outer FILTER with BOUND', 'data' => 'w3c-dawg2/data-r2/optional-filter/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/optional-filter/expr-3.rq', 'result' => 'w3c-dawg2/data-r2/optional-filter/expr-3-result.ttl', ), - 66 => + 66 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/graph/manifest#dawg-graph-01', 'title' => 'graph-01', 'data' => 'w3c-dawg2/data-r2/graph/data-g1.ttl', 'query' => 'w3c-dawg2/data-r2/graph/graph-01.rq', 'result' => 'w3c-dawg2/data-r2/graph/graph-01.ttl', ), - 67 => + 67 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/graph/manifest#dawg-graph-04', 'title' => 'graph-04', 'data' => 'w3c-dawg2/data-r2/graph/data-g1.ttl', 'query' => 'w3c-dawg2/data-r2/graph/graph-04.rq', 'result' => 'w3c-dawg2/data-r2/graph/graph-04.ttl', ), - 68 => + 68 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/graph/manifest#dawg-graph-05', 'title' => 'graph-05', 'data' => 'w3c-dawg2/data-r2/graph/data-g1.ttl', 'query' => 'w3c-dawg2/data-r2/graph/graph-05.rq', 'result' => 'w3c-dawg2/data-r2/graph/graph-05.ttl', ), - 69 => + 69 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/graph/manifest#dawg-graph-06', 'title' => 'graph-06', 'data' => 'w3c-dawg2/data-r2/graph/data-g1.ttl', 'query' => 'w3c-dawg2/data-r2/graph/graph-06.rq', 'result' => 'w3c-dawg2/data-r2/graph/graph-06.ttl', ), - 70 => + 70 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/graph/manifest#dawg-graph-07', 'title' => 'graph-07', 'data' => 'w3c-dawg2/data-r2/graph/data-g1.ttl', 'query' => 'w3c-dawg2/data-r2/graph/graph-07.rq', 'result' => 'w3c-dawg2/data-r2/graph/graph-07.ttl', ), - 71 => + 71 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/graph/manifest#dawg-graph-08', 'title' => 'graph-08', 'data' => 'w3c-dawg2/data-r2/graph/data-g1.ttl', 'query' => 'w3c-dawg2/data-r2/graph/graph-08.rq', 'result' => 'w3c-dawg2/data-r2/graph/graph-08.ttl', ), - 72 => + 72 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/graph/manifest#dawg-graph-09', 'title' => 'graph-09', 'data' => 'w3c-dawg2/data-r2/graph/data-g3.ttl', 'query' => 'w3c-dawg2/data-r2/graph/graph-09.rq', 'result' => 'w3c-dawg2/data-r2/graph/graph-09.ttl', ), - 73 => + 73 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/graph/manifest#dawg-graph-10', 'title' => 'graph-10', 'data' => 'w3c-dawg2/data-r2/graph/data-g3.ttl', 'query' => 'w3c-dawg2/data-r2/graph/graph-10.rq', 'result' => 'w3c-dawg2/data-r2/graph/graph-10.ttl', ), - 74 => + 74 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/graph/manifest#dawg-graph-11', 'title' => 'graph-11', 'data' => 'w3c-dawg2/data-r2/graph/data-g1.ttl', 'query' => 'w3c-dawg2/data-r2/graph/graph-11.rq', 'result' => 'w3c-dawg2/data-r2/graph/graph-11.ttl', ), - 75 => + 75 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/boolean-effective-value/manifest.ttl#dawg-bev-1', 'title' => 'Test \'boolean effective value\' - true', 'data' => 'w3c-dawg2/data-r2/boolean-effective-value/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/boolean-effective-value/query-bev-1.rq', 'result' => 'w3c-dawg2/data-r2/boolean-effective-value/result-bev-1.ttl', ), - 76 => + 76 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/boolean-effective-value/manifest.ttl#dawg-bev-2', 'title' => 'Test \'boolean effective value\' - false', 'data' => 'w3c-dawg2/data-r2/boolean-effective-value/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/boolean-effective-value/query-bev-2.rq', 'result' => 'w3c-dawg2/data-r2/boolean-effective-value/result-bev-2.ttl', ), - 77 => + 77 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/boolean-effective-value/manifest.ttl#dawg-bev-3', 'title' => 'Test \'boolean effective value\' - &&', 'data' => 'w3c-dawg2/data-r2/boolean-effective-value/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/boolean-effective-value/query-bev-3.rq', 'result' => 'w3c-dawg2/data-r2/boolean-effective-value/result-bev-3.ttl', ), - 78 => + 78 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/boolean-effective-value/manifest.ttl#dawg-bev-4', 'title' => 'Test \'boolean effective value\' - ||', 'data' => 'w3c-dawg2/data-r2/boolean-effective-value/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/boolean-effective-value/query-bev-4.rq', 'result' => 'w3c-dawg2/data-r2/boolean-effective-value/result-bev-4.ttl', ), - 79 => + 79 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/boolean-effective-value/manifest.ttl#dawg-bev-5', 'title' => 'Test \'boolean effective value\' - optional', 'data' => 'w3c-dawg2/data-r2/boolean-effective-value/data-2.ttl', 'query' => 'w3c-dawg2/data-r2/boolean-effective-value/query-bev-5.rq', 'result' => 'w3c-dawg2/data-r2/boolean-effective-value/result-bev-5.ttl', ), - 80 => + 80 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/boolean-effective-value/manifest.ttl#dawg-bev-6', 'title' => 'Test \'boolean effective value\' - unknown types', 'data' => 'w3c-dawg2/data-r2/boolean-effective-value/data-2.ttl', 'query' => 'w3c-dawg2/data-r2/boolean-effective-value/query-bev-6.rq', 'result' => 'w3c-dawg2/data-r2/boolean-effective-value/result-bev-6.ttl', ), - 81 => + 81 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/bound/manifest.ttl#dawg-bound-query-001', 'title' => 'dawg-bound-query-001', 'data' => 'w3c-dawg2/data-r2/bound/data.ttl', 'query' => 'w3c-dawg2/data-r2/bound/bound1.rq', 'result' => 'w3c-dawg2/data-r2/bound/bound1-result.ttl', ), - 82 => + 82 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/expr-builtin/manifest#dawg-str-1', 'title' => 'str-1', 'data' => 'w3c-dawg2/data-r2/expr-builtin/data-builtin-1.ttl', 'query' => 'w3c-dawg2/data-r2/expr-builtin/q-str-1.rq', 'result' => 'w3c-dawg2/data-r2/expr-builtin/result-str-1.ttl', ), - 83 => + 83 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/expr-builtin/manifest#dawg-str-2', 'title' => 'str-2', 'data' => 'w3c-dawg2/data-r2/expr-builtin/data-builtin-1.ttl', 'query' => 'w3c-dawg2/data-r2/expr-builtin/q-str-2.rq', 'result' => 'w3c-dawg2/data-r2/expr-builtin/result-str-2.ttl', ), - 84 => + 84 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/expr-builtin/manifest#dawg-str-3', 'title' => 'str-3', 'data' => 'w3c-dawg2/data-r2/expr-builtin/data-builtin-1.ttl', 'query' => 'w3c-dawg2/data-r2/expr-builtin/q-str-3.rq', 'result' => 'w3c-dawg2/data-r2/expr-builtin/result-str-3.ttl', ), - 85 => + 85 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/expr-builtin/manifest#dawg-str-4', 'title' => 'str-4', 'data' => 'w3c-dawg2/data-r2/expr-builtin/data-builtin-1.ttl', 'query' => 'w3c-dawg2/data-r2/expr-builtin/q-str-4.rq', 'result' => 'w3c-dawg2/data-r2/expr-builtin/result-str-4.ttl', ), - 86 => + 86 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/expr-builtin/manifest#dawg-isBlank-1', 'title' => 'isBlank-1', 'data' => 'w3c-dawg2/data-r2/expr-builtin/data-builtin-1.ttl', 'query' => 'w3c-dawg2/data-r2/expr-builtin/q-blank-1.rq', 'result' => 'w3c-dawg2/data-r2/expr-builtin/result-blank-1.ttl', ), - 87 => + 87 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/expr-builtin/manifest#dawg-datatype-1', 'title' => 'datatype-1', 'data' => 'w3c-dawg2/data-r2/expr-builtin/data-builtin-1.ttl', 'query' => 'w3c-dawg2/data-r2/expr-builtin/q-datatype-1.rq', 'result' => 'w3c-dawg2/data-r2/expr-builtin/result-datatype-1.ttl', ), - 88 => + 88 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/expr-builtin/manifest#dawg-datatype-2', 'title' => 'datatype-2 : Literals with a datatype', 'data' => 'w3c-dawg2/data-r2/expr-builtin/data-builtin-2.ttl', 'query' => 'w3c-dawg2/data-r2/expr-builtin/q-datatype-2.rq', 'result' => 'w3c-dawg2/data-r2/expr-builtin/result-datatype-2.srx', ), - 89 => + 89 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/expr-builtin/manifest#dawg-datatype-3', 'title' => 'datatype-3 : Literals with a datatype of xsd:string', 'data' => 'w3c-dawg2/data-r2/expr-builtin/data-builtin-2.ttl', 'query' => 'w3c-dawg2/data-r2/expr-builtin/q-datatype-3.rq', 'result' => 'w3c-dawg2/data-r2/expr-builtin/result-datatype-3.srx', ), - 90 => + 90 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/expr-builtin/manifest#dawg-lang-1', 'title' => 'lang-1 : Literals with a lang tag of some kind', 'data' => 'w3c-dawg2/data-r2/expr-builtin/data-builtin-2.ttl', 'query' => 'w3c-dawg2/data-r2/expr-builtin/q-lang-1.rq', 'result' => 'w3c-dawg2/data-r2/expr-builtin/result-lang-1.srx', ), - 91 => + 91 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/expr-builtin/manifest#dawg-lang-2', 'title' => 'lang-2 : Literals with a lang tag of \'\'', 'data' => 'w3c-dawg2/data-r2/expr-builtin/data-builtin-2.ttl', 'query' => 'w3c-dawg2/data-r2/expr-builtin/q-lang-2.rq', 'result' => 'w3c-dawg2/data-r2/expr-builtin/result-lang-2.srx', ), - 92 => + 92 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/expr-builtin/manifest#dawg-lang-3', 'title' => 'lang-3 : Graph matching with lang tag being a different case', 'data' => 'w3c-dawg2/data-r2/expr-builtin/data-builtin-2.ttl', 'query' => 'w3c-dawg2/data-r2/expr-builtin/q-lang-3.rq', 'result' => 'w3c-dawg2/data-r2/expr-builtin/result-lang-3.srx', ), - 93 => + 93 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/expr-builtin/manifest#dawg-isURI-1', 'title' => 'isURI-1', 'data' => 'w3c-dawg2/data-r2/expr-builtin/data-builtin-1.ttl', 'query' => 'w3c-dawg2/data-r2/expr-builtin/q-uri-1.rq', 'result' => 'w3c-dawg2/data-r2/expr-builtin/result-uri-1.ttl', ), - 94 => + 94 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/expr-builtin/manifest#dawg-langMatches-1', 'title' => 'LangMatches-1', 'data' => 'w3c-dawg2/data-r2/expr-builtin/data-langMatches.ttl', 'query' => 'w3c-dawg2/data-r2/expr-builtin/q-langMatches-1.rq', 'result' => 'w3c-dawg2/data-r2/expr-builtin/result-langMatches-1.ttl', ), - 95 => + 95 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/expr-builtin/manifest#dawg-langMatches-2', 'title' => 'LangMatches-2', 'data' => 'w3c-dawg2/data-r2/expr-builtin/data-langMatches.ttl', 'query' => 'w3c-dawg2/data-r2/expr-builtin/q-langMatches-2.rq', 'result' => 'w3c-dawg2/data-r2/expr-builtin/result-langMatches-2.ttl', ), - 96 => + 96 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/expr-builtin/manifest#dawg-langMatches-3', 'title' => 'LangMatches-3', 'data' => 'w3c-dawg2/data-r2/expr-builtin/data-langMatches.ttl', 'query' => 'w3c-dawg2/data-r2/expr-builtin/q-langMatches-3.rq', 'result' => 'w3c-dawg2/data-r2/expr-builtin/result-langMatches-3.ttl', ), - 97 => + 97 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/expr-builtin/manifest#dawg-langMatches-4', 'title' => 'LangMatches-4', 'data' => 'w3c-dawg2/data-r2/expr-builtin/data-langMatches.ttl', 'query' => 'w3c-dawg2/data-r2/expr-builtin/q-langMatches-4.rq', 'result' => 'w3c-dawg2/data-r2/expr-builtin/result-langMatches-4.ttl', ), - 98 => + 98 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/expr-builtin/manifest#lang-case-insensitive-eq', 'title' => 'lang-case-insensitive-eq', 'data' => 'w3c-dawg2/data-r2/expr-builtin/lang-case-sensitivity.ttl', 'query' => 'w3c-dawg2/data-r2/expr-builtin/lang-case-sensitivity-eq.rq', 'result' => 'w3c-dawg2/data-r2/expr-builtin/lang-case-insensitive-eq.srx', ), - 99 => + 99 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/expr-builtin/manifest#lang-case-insensitive-ne', 'title' => 'lang-case-insensitive-ne', 'data' => 'w3c-dawg2/data-r2/expr-builtin/lang-case-sensitivity.ttl', 'query' => 'w3c-dawg2/data-r2/expr-builtin/lang-case-sensitivity-ne.rq', 'result' => 'w3c-dawg2/data-r2/expr-builtin/lang-case-insensitive-ne.srx', ), - 100 => + 100 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/expr-equals/manifest#eq-1', 'title' => 'Equality 1-1', 'data' => 'w3c-dawg2/data-r2/expr-equals/data-eq.ttl', 'query' => 'w3c-dawg2/data-r2/expr-equals/query-eq-1.rq', 'result' => 'w3c-dawg2/data-r2/expr-equals/result-eq-1.ttl', ), - 101 => + 101 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/expr-equals/manifest#eq-2', 'title' => 'Equality 1-2', 'data' => 'w3c-dawg2/data-r2/expr-equals/data-eq.ttl', 'query' => 'w3c-dawg2/data-r2/expr-equals/query-eq-2.rq', 'result' => 'w3c-dawg2/data-r2/expr-equals/result-eq-2.ttl', ), - 102 => + 102 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/expr-equals/manifest#eq-3', 'title' => 'Equality 1-3', 'data' => 'w3c-dawg2/data-r2/expr-equals/data-eq.ttl', 'query' => 'w3c-dawg2/data-r2/expr-equals/query-eq-3.rq', 'result' => 'w3c-dawg2/data-r2/expr-equals/result-eq-3.ttl', ), - 103 => + 103 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/expr-equals/manifest#eq-4', 'title' => 'Equality 1-4', 'data' => 'w3c-dawg2/data-r2/expr-equals/data-eq.ttl', 'query' => 'w3c-dawg2/data-r2/expr-equals/query-eq-4.rq', 'result' => 'w3c-dawg2/data-r2/expr-equals/result-eq-4.ttl', ), - 104 => + 104 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/expr-equals/manifest#eq-5', 'title' => 'Equality 1-5', 'data' => 'w3c-dawg2/data-r2/expr-equals/data-eq.ttl', 'query' => 'w3c-dawg2/data-r2/expr-equals/query-eq-5.rq', 'result' => 'w3c-dawg2/data-r2/expr-equals/result-eq-5.ttl', ), - 105 => + 105 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/expr-equals/manifest#eq-2-1', 'title' => 'Equality - 2 var - test equals', 'data' => 'w3c-dawg2/data-r2/expr-equals/data-eq.ttl', 'query' => 'w3c-dawg2/data-r2/expr-equals/query-eq2-1.rq', 'result' => 'w3c-dawg2/data-r2/expr-equals/result-eq2-1.ttl', ), - 106 => + 106 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/expr-equals/manifest#eq-2-2', 'title' => 'Equality - 2 var - test not equals ', 'data' => 'w3c-dawg2/data-r2/expr-equals/data-eq.ttl', 'query' => 'w3c-dawg2/data-r2/expr-equals/query-eq2-1.rq', 'result' => 'w3c-dawg2/data-r2/expr-equals/result-eq2-1.ttl', ), - 107 => + 107 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/expr-equals/manifest#eq-graph-1', 'title' => 'Equality 1-1 -- graph', 'data' => 'w3c-dawg2/data-r2/expr-equals/data-eq.ttl', 'query' => 'w3c-dawg2/data-r2/expr-equals/query-eq-graph-1.rq', 'result' => 'w3c-dawg2/data-r2/expr-equals/result-eq-graph-1.ttl', ), - 108 => + 108 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/expr-equals/manifest#eq-graph-2', 'title' => 'Equality 1-2 -- graph', 'data' => 'w3c-dawg2/data-r2/expr-equals/data-eq.ttl', 'query' => 'w3c-dawg2/data-r2/expr-equals/query-eq-graph-2.rq', 'result' => 'w3c-dawg2/data-r2/expr-equals/result-eq-graph-2.ttl', ), - 109 => + 109 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/expr-equals/manifest#eq-graph-3', 'title' => 'Equality 1-3 -- graph', 'data' => 'w3c-dawg2/data-r2/expr-equals/data-eq.ttl', 'query' => 'w3c-dawg2/data-r2/expr-equals/query-eq-graph-3.rq', 'result' => 'w3c-dawg2/data-r2/expr-equals/result-eq-graph-3.ttl', ), - 110 => + 110 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/expr-equals/manifest#eq-graph-4', 'title' => 'Equality 1-4 -- graph', 'data' => 'w3c-dawg2/data-r2/expr-equals/data-eq.ttl', 'query' => 'w3c-dawg2/data-r2/expr-equals/query-eq-graph-4.rq', 'result' => 'w3c-dawg2/data-r2/expr-equals/result-eq-graph-4.ttl', ), - 111 => + 111 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/expr-equals/manifest#eq-graph-5', 'title' => 'Equality 1-5 -- graph', 'data' => 'w3c-dawg2/data-r2/expr-equals/data-eq.ttl', 'query' => 'w3c-dawg2/data-r2/expr-equals/query-eq-graph-5.rq', 'result' => 'w3c-dawg2/data-r2/expr-equals/result-eq-graph-5.ttl', ), - 112 => + 112 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/regex/manifest#dawg-regex-001', 'title' => 'regex-query-001', 'data' => 'w3c-dawg2/data-r2/regex/regex-data-01.ttl', 'query' => 'w3c-dawg2/data-r2/regex/regex-query-001.rq', 'result' => 'w3c-dawg2/data-r2/regex/regex-result-001.ttl', ), - 113 => + 113 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/regex/manifest#dawg-regex-002', 'title' => 'regex-query-002', 'data' => 'w3c-dawg2/data-r2/regex/regex-data-01.ttl', 'query' => 'w3c-dawg2/data-r2/regex/regex-query-002.rq', 'result' => 'w3c-dawg2/data-r2/regex/regex-result-002.ttl', ), - 114 => + 114 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/regex/manifest#dawg-regex-003', 'title' => 'regex-query-003', 'data' => 'w3c-dawg2/data-r2/regex/regex-data-01.ttl', 'query' => 'w3c-dawg2/data-r2/regex/regex-query-003.rq', 'result' => 'w3c-dawg2/data-r2/regex/regex-result-003.ttl', ), - 115 => + 115 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/regex/manifest#dawg-regex-004', 'title' => 'regex-query-004', 'data' => 'w3c-dawg2/data-r2/regex/regex-data-01.ttl', 'query' => 'w3c-dawg2/data-r2/regex/regex-query-004.rq', 'result' => 'w3c-dawg2/data-r2/regex/regex-result-004.ttl', ), - 116 => + 116 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/construct/manifest.ttl#construct-1', 'title' => 'dawg-construct-identity', 'data' => 'w3c-dawg2/data-r2/construct/data-ident.ttl', 'query' => 'w3c-dawg2/data-r2/construct/query-ident.rq', 'result' => 'w3c-dawg2/data-r2/construct/result-ident.ttl', ), - 117 => + 117 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/ask/manifest#ask-1', 'title' => 'ASK-1 (SPARQL XML results)', 'data' => 'w3c-dawg2/data-r2/ask/data.ttl', 'query' => 'w3c-dawg2/data-r2/ask/ask-1.rq', 'result' => 'w3c-dawg2/data-r2/ask/ask-1.srx', ), - 118 => + 118 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/ask/manifest#ask-4', 'title' => 'ASK-4 (SPARQL XML results)', 'data' => 'w3c-dawg2/data-r2/ask/data.ttl', 'query' => 'w3c-dawg2/data-r2/ask/ask-4.rq', 'result' => 'w3c-dawg2/data-r2/ask/ask-4.srx', ), - 119 => + 119 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/ask/manifest#ask-7', 'title' => 'ASK-7 (SPARQL XML results)', 'data' => 'w3c-dawg2/data-r2/ask/data.ttl', 'query' => 'w3c-dawg2/data-r2/ask/ask-7.rq', 'result' => 'w3c-dawg2/data-r2/ask/ask-7.srx', ), - 120 => + 120 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/distinct/manifest#distinct-star-1', 'title' => 'SELECT DISTINCT *', 'data' => 'w3c-dawg2/data-r2/distinct/data-star.ttl', 'query' => 'w3c-dawg2/data-r2/distinct/distinct-star-1.rq', 'result' => 'w3c-dawg2/data-r2/distinct/distinct-star-1.srx', ), - 121 => + 121 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/distinct/manifest#no-distinct-1', 'title' => 'Numbers: No distinct', 'data' => 'w3c-dawg2/data-r2/distinct/data-num.ttl', 'query' => 'w3c-dawg2/data-r2/distinct/no-distinct-1.rq', 'result' => 'w3c-dawg2/data-r2/distinct/no-distinct-num.srx', ), - 122 => + 122 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/distinct/manifest#distinct-1', 'title' => 'Numbers: Distinct', 'data' => 'w3c-dawg2/data-r2/distinct/data-num.ttl', 'query' => 'w3c-dawg2/data-r2/distinct/distinct-1.rq', 'result' => 'w3c-dawg2/data-r2/distinct/distinct-num.srx', ), - 123 => + 123 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/distinct/manifest#no-distinct-2', 'title' => 'Strings: No distinct', 'data' => 'w3c-dawg2/data-r2/distinct/data-str.ttl', 'query' => 'w3c-dawg2/data-r2/distinct/no-distinct-1.rq', 'result' => 'w3c-dawg2/data-r2/distinct/no-distinct-str.srx', ), - 124 => + 124 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/distinct/manifest#distinct-2', 'title' => 'Strings: Distinct', 'data' => 'w3c-dawg2/data-r2/distinct/data-str.ttl', 'query' => 'w3c-dawg2/data-r2/distinct/distinct-1.rq', 'result' => 'w3c-dawg2/data-r2/distinct/distinct-str.srx', ), - 125 => + 125 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/distinct/manifest#no-distinct-3', 'title' => 'Nodes: No distinct', 'data' => 'w3c-dawg2/data-r2/distinct/data-node.ttl', 'query' => 'w3c-dawg2/data-r2/distinct/no-distinct-1.rq', 'result' => 'w3c-dawg2/data-r2/distinct/no-distinct-node.srx', ), - 126 => + 126 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/distinct/manifest#distinct-3', 'title' => 'Nodes: Distinct', 'data' => 'w3c-dawg2/data-r2/distinct/data-node.ttl', 'query' => 'w3c-dawg2/data-r2/distinct/distinct-1.rq', 'result' => 'w3c-dawg2/data-r2/distinct/distinct-node.srx', ), - 127 => + 127 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/distinct/manifest#no-distinct-4', 'title' => 'Opt: No distinct', 'data' => 'w3c-dawg2/data-r2/distinct/data-opt.ttl', 'query' => 'w3c-dawg2/data-r2/distinct/no-distinct-2.rq', 'result' => 'w3c-dawg2/data-r2/distinct/no-distinct-opt.srx', ), - 128 => + 128 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/distinct/manifest#distinct-4', 'title' => 'Opt: Distinct', 'data' => 'w3c-dawg2/data-r2/distinct/data-opt.ttl', 'query' => 'w3c-dawg2/data-r2/distinct/distinct-2.rq', 'result' => 'w3c-dawg2/data-r2/distinct/distinct-opt.srx', ), - 129 => + 129 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/distinct/manifest#no-distinct-9', 'title' => 'All: No distinct', 'data' => 'w3c-dawg2/data-r2/distinct/data-all.ttl', 'query' => 'w3c-dawg2/data-r2/distinct/no-distinct-1.rq', 'result' => 'w3c-dawg2/data-r2/distinct/no-distinct-all.srx', ), - 130 => + 130 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/distinct/manifest#distinct-9', 'title' => 'All: Distinct', 'data' => 'w3c-dawg2/data-r2/distinct/data-all.ttl', 'query' => 'w3c-dawg2/data-r2/distinct/distinct-1.rq', 'result' => 'w3c-dawg2/data-r2/distinct/distinct-all.srx', ), - 131 => + 131 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/sort/manifest#dawg-sort-1', 'title' => 'sort-1', 'data' => 'w3c-dawg2/data-r2/sort/data-sort-1.ttl', 'query' => 'w3c-dawg2/data-r2/sort/query-sort-1.rq', 'result' => 'w3c-dawg2/data-r2/sort/result-sort-1.rdf', ), - 132 => + 132 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/sort/manifest#dawg-sort-2', 'title' => 'sort-2', 'data' => 'w3c-dawg2/data-r2/sort/data-sort-1.ttl', 'query' => 'w3c-dawg2/data-r2/sort/query-sort-2.rq', 'result' => 'w3c-dawg2/data-r2/sort/result-sort-2.rdf', ), - 133 => + 133 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/sort/manifest#dawg-sort-3', 'title' => 'sort-3', 'data' => 'w3c-dawg2/data-r2/sort/data-sort-3.ttl', 'query' => 'w3c-dawg2/data-r2/sort/query-sort-3.rq', 'result' => 'w3c-dawg2/data-r2/sort/result-sort-3.rdf', ), - 134 => + 134 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/sort/manifest#dawg-sort-4', 'title' => 'sort-4', 'data' => 'w3c-dawg2/data-r2/sort/data-sort-4.ttl', 'query' => 'w3c-dawg2/data-r2/sort/query-sort-4.rq', 'result' => 'w3c-dawg2/data-r2/sort/result-sort-4.rdf', ), - 135 => + 135 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/sort/manifest#dawg-sort-5', 'title' => 'sort-5', 'data' => 'w3c-dawg2/data-r2/sort/data-sort-4.ttl', 'query' => 'w3c-dawg2/data-r2/sort/query-sort-5.rq', 'result' => 'w3c-dawg2/data-r2/sort/result-sort-5.rdf', ), - 136 => + 136 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/sort/manifest#dawg-sort-6', 'title' => 'sort-6', 'data' => 'w3c-dawg2/data-r2/sort/data-sort-6.ttl', 'query' => 'w3c-dawg2/data-r2/sort/query-sort-6.rq', 'result' => 'w3c-dawg2/data-r2/sort/result-sort-6.rdf', ), - 137 => + 137 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/sort/manifest#dawg-sort-7', 'title' => 'sort-7', 'data' => 'w3c-dawg2/data-r2/sort/data-sort-7.ttl', 'query' => 'w3c-dawg2/data-r2/sort/query-sort-4.rq', 'result' => 'w3c-dawg2/data-r2/sort/result-sort-7.rdf', ), - 138 => + 138 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/sort/manifest#dawg-sort-8', 'title' => 'sort-8', 'data' => 'w3c-dawg2/data-r2/sort/data-sort-8.ttl', 'query' => 'w3c-dawg2/data-r2/sort/query-sort-4.rq', 'result' => 'w3c-dawg2/data-r2/sort/result-sort-8.rdf', ), - 139 => + 139 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/sort/manifest#dawg-sort-9', 'title' => 'sort-9', 'data' => 'w3c-dawg2/data-r2/sort/data-sort-9.ttl', 'query' => 'w3c-dawg2/data-r2/sort/query-sort-9.rq', 'result' => 'w3c-dawg2/data-r2/sort/result-sort-9.rdf', ), - 140 => + 140 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/sort/manifest#dawg-sort-10', 'title' => 'sort-10', 'data' => 'w3c-dawg2/data-r2/sort/data-sort-9.ttl', 'query' => 'w3c-dawg2/data-r2/sort/query-sort-10.rq', 'result' => 'w3c-dawg2/data-r2/sort/result-sort-10.rdf', ), - 141 => + 141 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/syntax-sparql1/manifest#syntax-basic-01', 'title' => 'syntax-basic-01.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-basic-01.rq', 'type' => 'syntax-positive', ), - 142 => + 142 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/syntax-sparql1/manifest#syntax-basic-02', 'title' => 'syntax-basic-02.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-basic-02.rq', 'type' => 'syntax-positive', ), - 143 => + 143 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/syntax-sparql1/manifest#syntax-basic-03', 'title' => 'syntax-basic-03.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-basic-03.rq', 'type' => 'syntax-positive', ), - 144 => + 144 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/syntax-sparql1/manifest#syntax-basic-04', 'title' => 'syntax-basic-04.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-basic-04.rq', 'type' => 'syntax-positive', ), - 145 => + 145 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/syntax-sparql1/manifest#syntax-basic-05', 'title' => 'syntax-basic-05.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-basic-05.rq', 'type' => 'syntax-positive', ), - 146 => + 146 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/syntax-sparql1/manifest#syntax-basic-06', 'title' => 'syntax-basic-06.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-basic-06.rq', 'type' => 'syntax-positive', ), - 147 => + 147 => array ( + 'earl:name' => 'http://www.w3.org/2001/sw/DataAccess/tests/data-r2/syntax-sparql1/manifest#syntax-qname-01', 'title' => 'syntax-qname-01.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-qname-01.rq', 'type' => 'syntax-positive', ), - 148 => + 148 => array ( + 'earl:name' => 'http://www.w3.org/... [truncated message content] |
From: <cw...@us...> - 2007-08-13 14:12:39
|
Revision: 513 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=513&view=rev Author: cweiske Date: 2007-08-13 07:12:38 -0700 (Mon, 13 Aug 2007) Log Message: ----------- Script to run any unit tests from cmdline. Ability to select different output renderer Modified Paths: -------------- trunk/rdfapi-php/test/unit/EarlReporter.php trunk/rdfapi-php/test/unit/sparqlParserTests.php Added Paths: ----------- trunk/rdfapi-php/test/unit/runAnyTest.php Modified: trunk/rdfapi-php/test/unit/EarlReporter.php =================================================================== --- trunk/rdfapi-php/test/unit/EarlReporter.php 2007-08-13 13:51:30 UTC (rev 512) +++ trunk/rdfapi-php/test/unit/EarlReporter.php 2007-08-13 14:12:38 UTC (rev 513) @@ -6,6 +6,7 @@ * @see http://www.w3.org/2001/sw/DataAccess/tests/earl */ require_once SIMPLETEST_INCLUDE_DIR . 'simpletest.php'; +require_once SIMPLETEST_INCLUDE_DIR . 'reporter.php'; require_once RDFAPI_INCLUDE_DIR . 'model/MemModel.php'; require_once RDFAPI_INCLUDE_DIR . 'syntax/N3Serializer.php'; Added: trunk/rdfapi-php/test/unit/runAnyTest.php =================================================================== --- trunk/rdfapi-php/test/unit/runAnyTest.php (rev 0) +++ trunk/rdfapi-php/test/unit/runAnyTest.php 2007-08-13 14:12:38 UTC (rev 513) @@ -0,0 +1,58 @@ +<?php +/** +* Executes any given simpletest case. +* Simply pass the filename +*/ +if (!@include_once(dirname(__FILE__) . '/../config.php')) { + die('Make a copy of test/config.php.dist, change it and save it as test/config.php'); +} + +if ($argc <= 1 || $argv[1] == '--help') { + echo <<<EOT +Run any simpletest files. + Usage: php runAnyTest.php [--earl] file(s) + + --earl Generate report in EARL format + --help Show this help screen + + +EOT; + exit(1); +} + +$files = array(); +$reportClass = 'TextReporter'; +array_shift($argv); + +foreach ($argv as $option) { + if ($option == '--earl') { + require_once dirname(__FILE__) . '/EarlReporter.php'; + $reportClass = 'EarlReporter'; + } else { + //file? + if (!file_exists($option)) { + echo "File $option does not exist\n"; + exit(2); + } + $files[] = $option; + } +} + +require_once SIMPLETEST_INCLUDE_DIR . 'unit_tester.php'; +require_once SIMPLETEST_INCLUDE_DIR . 'reporter.php'; +require_once 'show_passes.php'; +require_once RDFAPI_INCLUDE_DIR . 'RdfAPI.php'; + +$_SESSION['passes'] = 0; +$_SESSION['fails'] = 0; + +$test_sparql = new GroupTest('some RDF API for PHP tests'); +foreach ($files as $file) { + $test_sparql->addTestFile($file); +} + +//$test_sparql->run(new ShowPasses()); +$test_sparql->run(new $reportClass()); + + +?> \ No newline at end of file Modified: trunk/rdfapi-php/test/unit/sparqlParserTests.php =================================================================== --- trunk/rdfapi-php/test/unit/sparqlParserTests.php 2007-08-13 13:51:30 UTC (rev 512) +++ trunk/rdfapi-php/test/unit/sparqlParserTests.php 2007-08-13 14:12:38 UTC (rev 513) @@ -6,7 +6,6 @@ require_once SIMPLETEST_INCLUDE_DIR . 'unit_tester.php'; require_once SIMPLETEST_INCLUDE_DIR . 'reporter.php'; -require_once dirname(__FILE__) . '/EarlReporter.php'; require_once 'show_passes.php'; require(RDFAPI_INCLUDE_DIR . 'RdfAPI.php'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cw...@us...> - 2007-08-13 13:51:50
|
Revision: 512 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=512&view=rev Author: cweiske Date: 2007-08-13 06:51:30 -0700 (Mon, 13 Aug 2007) Log Message: ----------- - Add SimpleTest EARL [1] renderer - Add nesting option to N3Serializer so that we get [ x:a x:b [ x:c [x:d x:e]]] now [1] http://www.w3.org/2001/sw/DataAccess/tests/earl Modified Paths: -------------- trunk/rdfapi-php/api/syntax/N3Serializer.php trunk/rdfapi-php/test/config.php.dist trunk/rdfapi-php/test/unit/Sparql/SparqlParserTests_test.php trunk/rdfapi-php/test/unit/sparqlParserTests.php Added Paths: ----------- trunk/rdfapi-php/test/unit/EarlReporter.php Modified: trunk/rdfapi-php/api/syntax/N3Serializer.php =================================================================== --- trunk/rdfapi-php/api/syntax/N3Serializer.php 2007-08-13 11:58:24 UTC (rev 511) +++ trunk/rdfapi-php/api/syntax/N3Serializer.php 2007-08-13 13:51:30 UTC (rev 512) @@ -36,7 +36,8 @@ var $debug = false; - var $prefixes; + var $prefixes = array(); + var $noPrefixes = array(); var $done; // keeps track of already serialized resources var $resourcetext; @@ -47,6 +48,7 @@ var $styleCompress = false; var $stylePretty = false; + var $styleNest = false; /** * Constructor @@ -66,9 +68,9 @@ * @param string $s * @returns void **/ - function addNSPrefix( $ns, $prefix) + function addNSPrefix($ns, $prefix) { - $this->prefixes[$ns]=$prefix; + $this->prefixes[$ns] = $prefix; } @@ -81,14 +83,38 @@ $this->prefixes = array(); } + + /** + * Add a namespace that shall not get shortened by using a prefix. + * + * @param string $ns Namespace URI like "http://example.com/" + */ + function addNoNSPrefix($ns) + { + $this->noPrefixes[$ns] = true; + } + + + + /** + * Clears all previously set noNamespace prefixes + */ + function clearNoNSPrefixes() + { + $this->noPrefixes = array(); + } + + + + /** * Serializes a model to N3 syntax. * * @param object Model $model * @return string * @access public */ - function & serialize(&$m) + function &serialize(&$m) { if (is_a($m, 'DbModel')) { $m=$m->getMemModel(); @@ -111,9 +137,9 @@ } } - $namespaces =array(); - $count =array(); - $resources =array(); + $namespaces = array(); + $count = array(); + $resources = array(); foreach ($this->model->triples as $t) { $s = $t->getSubject(); if (is_a($s, 'Resource')) { @@ -127,14 +153,20 @@ if (is_a($o, 'Resource')) { $namespaces[$o->getNamespace()] = 1; } - $uri=$s->getURI(); + $uri = $s->getURI(); if (isset($count[$uri])) { $count[$uri]++; } else { - $count[$uri]=0; - $resources[$uri]=$s; + $count[$uri] = 0; + $resources[$uri] = $s; } + + if ($this->styleNest && is_a($s, 'BlankNode')) { + //make sure blank nodes are sorted *after* normal nodes + //so that they can be included + $count[$uri] -= 0.00001; + } } if (!HIDE_ADVERTISE) { @@ -155,11 +187,11 @@ } $c = 0; - foreach ( $this->resourcetext as $r=>$t) { - if ( preg_match_all('/'.MAGIC_STRING.'([^ ]+)'.MAGIC_STRING.'/', $t, $ms, PREG_SET_ORDER)) { - foreach($ms as $mseach) { - $rp=$this->resourcetext[$mseach[1]]; - $t=preg_replace('/'.MAGIC_STRING.$mseach[1].MAGIC_STRING.'/', $rp, $t); + foreach ($this->resourcetext as $r => $t) { + if (preg_match_all('/'.MAGIC_STRING.'([^ ]+)'.MAGIC_STRING.'/', $t, $ms, PREG_SET_ORDER)) { + foreach ($ms as $mseach) { + $rp = $this->resourcetext[$mseach[1]]; + $t = preg_replace('/'.MAGIC_STRING.$mseach[1].MAGIC_STRING.'/', $rp, $t); } } @@ -188,7 +220,7 @@ // } return $this->res; - } + }//function &serialize(&$m) @@ -201,7 +233,7 @@ * @return boolean * @access public */ - function saveAs(&$model, $filename) + function saveAs(&$model, $filename) { // serialize model $n3 = $this->serialize($model); @@ -217,6 +249,8 @@ }; } + + /** * Set to true, if the N3 serializer should try to compress the blank node * syntax using [] whereever possible. @@ -236,6 +270,17 @@ $this->stylePretty = $prettyPrint; } + + + /** + * Enables nesting of blank nodes with [] if + * compression is activated via @see setCompress + */ + function setNest($nest) + { + $this->styleNest = $nest; + } + /* ==================== Private Methods from here ==================== */ @@ -247,14 +292,16 @@ **/ function reset() { - $this->anon=0; - $this->done=array(); - $this->resourcetext_taken=array(); - $this->resourcetext=array(); - $this->res=''; - $this->model=NULL; + $this->anon = 0; + $this->done = array(); + $this->resourcetext_taken = array(); + $this->resourcetext = array(); + $this->res = ''; + $this->model = null; } + + /** * Makes ns0, ns1 etc. prefixes for unknown prefixes. * Outputs @prefix lines. @@ -266,11 +313,11 @@ { $c = 0; foreach ($n as $ns => $nonsense) { - if (!$ns) { + if (!$ns || isset($this->noPrefixes[$ns])) { continue; } if (isset($this->prefixes[$ns])) { - $p=$this->prefixes[$ns]; + $p = $this->prefixes[$ns]; } else { $p = 'ns' . $c; $this->prefixes[$ns] = $p; @@ -280,29 +327,31 @@ } } + + /** * Fill in $resourcetext for a single resource. * Will recurse into Objects of triples, but should never look ? (really?) - * @access private * @param object Resource $r * @returns boolean + * @access private **/ - function doResource(&$r) + function doResource(&$r, $bEmbedded = false, $strIndent = ' ') { - // print $r->getURI(); + //var_dump($r->getURI()); - $ts=$this->model->find($r, null, null); - if (count($ts->triples)==0) { + $ts = $this->model->find($r, null, null); + if (count($ts->triples) == 0) { return; } $out = ''; if (isset($this->done[$r->getURI()]) && $this->done[$r->getURI()]) { - if (is_a($r, 'BlankNode')) { + if (!$this->styleNest && is_a($r, 'BlankNode')) { if ($this->resourcetext_taken[$r->getURI()] == 1) { //Oh bother, we must use the _:blah construct. - $a=$this->resourcetext[$r->getURI()]; + $a = $this->resourcetext[$r->getURI()]; $this->resourcetext[$r->getURI()]='_:anon'.$this->anon; $this->resourcetext['_:anon'.$this->anon]=$this->fixAnon($a, '_:anon'.$this->anon); $this->resourcetext_taken[$r->getURI()]=2; @@ -319,7 +368,11 @@ if (is_a($r, 'BlankNode')) { //test, if this blanknode is referenced somewhere $rbn = $this->model->find(null, null, $r); - $compress = count($rbn->triples) == 0 && (N3SER_BNODE_SHORT || $this->styleCompress); + $compress = (N3SER_BNODE_SHORT || $this->styleCompress) + && ( + count($rbn->triples) == 0 + || (count($rbn->triples) == 1 && $bEmbedded) + ); if ($compress) { $out.='['; } else { @@ -335,14 +388,14 @@ $out .= ' '; foreach ($ts->triples as $t) { - $p=$t->getPredicate(); + $p = $t->getPredicate(); if ($p == $lastp) { - $out.=' , '; + $out .= ' , '; } else { if ($lastp!='') { if ($this->stylePretty) { - $out .= ";\n "; + $out .= ";\n" . $strIndent; } else { $out .= ' ; '; } @@ -374,11 +427,15 @@ if ($this->debug) { print 'Doing object: '.$o->getURI().LINEFEED; } - if (is_a($o,'BlankNode')) { - // $this->doResource($o); - // $out.=MAGIC_STRING.$o->getURI().MAGIC_STRING; #$this->resourcetext[$o->getURI()]; - // $this->resourcetext_taken[$o->getURI()]=1; - $out .= '_:'.$o->getLabel(); + if (is_a($o, 'BlankNode')) { + if ($this->styleNest) { + $this->doResource($o, true, $strIndent . ' '); + $out .= MAGIC_STRING . $o->getURI() . MAGIC_STRING; + //$out .= $this->resourcetext[$o->getURI()]; + $this->resourcetext_taken[$o->getURI()] = 1; + } else { + $out .= '_:'.$o->getLabel(); + } } else { $this->doURI($o, $out); } @@ -399,8 +456,8 @@ /** * Format a single URI * @param string $s + * @return void * @access private - * @return void **/ function doURI(&$r, &$out) { @@ -408,11 +465,12 @@ $out .= 'a'; return; } - if ($r->getNamespace()!='') { - $out .= $this->prefixes[$r->getNamespace()].':'.$r->getLocalName(); + $ns = $r->getNamespace(); + if ($ns != '' && !isset($this->noPrefixes[$ns])) { + $out .= $this->prefixes[$ns].':'.$r->getLocalName(); } else { - //Will this ever happen? - $out .= $r->getURI(); + //Will this ever happen? It does, now. + $out .= '<' . $r->getURI() . '>'; } } @@ -427,9 +485,8 @@ **/ function fixAnon($t,$a) { - $t=preg_replace("/( \] $|^\[ )/", '', $t); - - return $a.$t; + $t = preg_replace("/( \] $|^\[ )/", '', $t); + return $a . $t; } } Modified: trunk/rdfapi-php/test/config.php.dist =================================================================== --- trunk/rdfapi-php/test/config.php.dist 2007-08-13 11:58:24 UTC (rev 511) +++ trunk/rdfapi-php/test/config.php.dist 2007-08-13 13:51:30 UTC (rev 512) @@ -18,8 +18,17 @@ 'password' => '' ); -//enable this to get more informatin about failing unit tests +//enable this to get more information about failing unit tests //$GLOBALS['debugTests'] = true; +//used in W3C earl report serialization +$GLOBALS['earlReport'] = array( + 'reporter' => array( + 'name' => 'John Doe', + 'seeAlso' => 'http://example.org/john/johndoe.rdf', + 'homepage' => 'http://example.org/john/' + ) +); + define('LOG', false); ?> \ No newline at end of file Added: trunk/rdfapi-php/test/unit/EarlReporter.php =================================================================== --- trunk/rdfapi-php/test/unit/EarlReporter.php (rev 0) +++ trunk/rdfapi-php/test/unit/EarlReporter.php 2007-08-13 13:51:30 UTC (rev 512) @@ -0,0 +1,231 @@ +<?php +/** +* EARL reporter for SimpleTest +* +* @author Christian Weiske <cw...@cw...> +* @see http://www.w3.org/2001/sw/DataAccess/tests/earl +*/ +require_once SIMPLETEST_INCLUDE_DIR . 'simpletest.php'; +require_once RDFAPI_INCLUDE_DIR . 'model/MemModel.php'; +require_once RDFAPI_INCLUDE_DIR . 'syntax/N3Serializer.php'; + + +class EarlReporter extends SimpleReporter +{ + const EARL = 'http://www.w3.org/ns/earl#'; + const FOAF = 'http://xmlns.com/foaf/0.1/'; + const RDF = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'; + const RDFS = 'http://www.w3.org/2000/01/rdf-schema#'; + const DOAP = 'http://usefulinc.com/ns/doap#'; + + protected $model = null; + protected $serializer = null; + + /** + * Set via $testcase->signal('earl:test', 'mytestname') + */ + protected $currentTestName = null; + + + + public function __construct($serializer = null, $model = null) + { + if ($serializer !== null) { + $this->serializer = $serializer; + } else { + $this->serializer = new N3Serializer(); + } + + if ($model !== null) { + $this->model = model; + } else { + $this->model = new MemModel(); + } + + if (!isset($GLOBALS['earlReport'])) { + die('Please configure $GLOBALS[\'earlReport\'] as shown in config.php.dist' . "\n"); + } + }//public function __construct($serializer = null, $model = null) + + + + function paintHeader($test_name) + { + //add personal information about the asserter + $this->assertingPerson = new Resource($GLOBALS['earlReport']['reporter']['seeAlso'] . '#me'); + $this->model->add(new Statement( + $this->assertingPerson, + new Resource(self::RDF . 'type'), + new Resource(self::FOAF . 'Person') + )); + $this->model->add(new Statement( + $this->assertingPerson, + new Resource(self::RDFS . 'seeAlso'), + new Resource($GLOBALS['earlReport']['reporter']['seeAlso']) + )); + $this->model->add(new Statement( + $this->assertingPerson, + new Resource(self::FOAF . 'homepage'), + new Resource($GLOBALS['earlReport']['reporter']['homepage']) + )); + $this->model->add(new Statement( + $this->assertingPerson, + new Resource(self::FOAF . 'name'), + new Literal($GLOBALS['earlReport']['reporter']['name']) + )); + + + //project information + $this->project = new Resource('http://rdfapi-php.sf.net/'); + $this->model->add(new Statement( + $this->project, + new Resource(self::RDF . 'type'), + new Resource(self::DOAP . 'Project') + )); + $this->model->add(new Statement( + $this->project, + new Resource(self::DOAP . 'name'), + new Literal('RDF API for PHP') + )); + $version = new BlankNode($this->model); + $this->model->add(new Statement( + $this->project, + new Resource(self::DOAP . 'release'), + $version + )); + $this->model->add(new Statement( + $version, + new Resource(self::RDF . 'type'), + new Resource(self::DOAP . 'Version') + )); + $this->model->add(new Statement( + $version, + new Resource(self::DOAP . 'created'), + new Literal(date('Y-m-d H:i'), null, 'http://www.w3.org/2001/XMLSchema#date') + )); + $this->model->add(new Statement( + $version, + new Resource(self::DOAP . 'name'), + new Literal('RAP SVN-' . date('Y-m-d\\TH:i')) + )); + }//function paintHeader($test_name) + + + + function paintFooter($test_name) + { + $this->serializer->addNSPrefix(self::DOAP, 'doap'); + $this->serializer->addNSPrefix(self::EARL, 'earl'); + $this->serializer->addNSPrefix(self::FOAF, 'foaf'); + + $this->serializer->addNoNSPrefix('http://rdfapi-php.sf.net/'); + $this->serializer->addNoNSPrefix($GLOBALS['earlReport']['reporter']['homepage']); + + $this->serializer->setCompress(true); + $this->serializer->setPrettyPrint(true); + $this->serializer->setNest(true); + + echo $this->serializer->serialize( + $this->model + ); + } + + + + /** + * We use this to keep track of test titles + */ + function paintSignal($type, $payload) + { + switch ($type) { + case 'earl:name': + $this->currentTestName = $payload; + break; + default: + echo "Unknown signal type $type\n"; + break; + } + }//function paintSignal($type, $payload) + + + function paintStart($test_name, $size) { + parent::paintStart($test_name, $size); + } + + function paintEnd($test_name, $size) { + parent::paintEnd($test_name, $size); + } + + function paintPass($message) { + $this->addTest(true); +// echo 'pass: ' . $message . "\n"; + parent::paintPass($message); + } + + function paintFail($message) { + $this->addTest(false); +// echo 'fail: ' . $message . "\n"; + parent::paintFail($message); + } + + function addTest($bPass) + { + if ($this->currentTestName === null) { +// echo "No test name set! Ignoring test\n"; + return; + } + + $assertion = new BlankNode($this->model); + $this->model->add(new Statement( + $assertion, + new Resource(self::RDF . 'type'), + new Resource(self::EARL . 'Assertion') + )); + $this->model->add(new Statement( + $assertion, + new Resource(self::EARL . 'assertedBy'), + $this->assertingPerson + )); + + $result = new BlankNode($this->model); + $this->model->add(new Statement( + $assertion, + new Resource(self::EARL . 'result'), + $result + )); + $this->model->add(new Statement( + $result, + new Resource(self::RDF . 'type'), + new Resource(self::EARL . 'TestResult') + )); + $this->model->add(new Statement( + $result, + new Resource(self::EARL . 'outcome'), + new Resource(self::EARL . ($bPass ? 'pass' : 'fail')) + )); + $this->model->add(new Statement( + $assertion, + new Resource(self::EARL . 'subject'), + $this->project + )); + $this->model->add(new Statement( + $assertion, + new Resource(self::EARL . 'test'), + new Resource($this->currentTestName) + )); + +/* + [ a earl:Assertion; + earl:assertedBy _8:chime; + earl:result [ a earl:TestResult; + earl:outcome earl:pass]; + earl:subject <http://rdflib.net>; + earl:test _7:dawg-graph-02]. +*/ + + $this->currentTestName = null; + }//function addTest($bPass) + +}//class EarlReporter extends SimpleReporter + +?> \ No newline at end of file Modified: trunk/rdfapi-php/test/unit/Sparql/SparqlParserTests_test.php =================================================================== --- trunk/rdfapi-php/test/unit/Sparql/SparqlParserTests_test.php 2007-08-13 11:58:24 UTC (rev 511) +++ trunk/rdfapi-php/test/unit/Sparql/SparqlParserTests_test.php 2007-08-13 13:51:30 UTC (rev 512) @@ -97,7 +97,7 @@ function testParseFilter() { - echo "<b>FilterParser tests</b><br/>\n"; + //echo "<b>FilterParser tests</b><br/>\n"; foreach ($GLOBALS['testSparqlParserTestsFilter'] as $arFilterTest) { list($query, $result) = $arFilterTest; @@ -122,7 +122,7 @@ function testParseNested() { - echo "<b>Nested queries tests</b><br/>\n"; + //echo "<b>Nested queries tests</b><br/>\n"; foreach ($GLOBALS['testSparqlParserTestsNested'] as $arNestedTest) { list($query, $strExpected) = $arNestedTest; @@ -162,10 +162,13 @@ } continue; } + $this->signal('earl:name', $test['title']); $qs = file_get_contents(SPARQL_TESTFILES . $test['query']); $this->runQueryParseTest($qs, $parser, $test['type'], $test['title']); + + //++$nCount; if ($nCount > 2) break; } }//function testDawg2SyntaxTests() Modified: trunk/rdfapi-php/test/unit/sparqlParserTests.php =================================================================== --- trunk/rdfapi-php/test/unit/sparqlParserTests.php 2007-08-13 11:58:24 UTC (rev 511) +++ trunk/rdfapi-php/test/unit/sparqlParserTests.php 2007-08-13 13:51:30 UTC (rev 512) @@ -4,9 +4,10 @@ die('Make a copy of test/config.php.dist, change it and save it as test/config.php'); } -require_once( SIMPLETEST_INCLUDE_DIR . 'unit_tester.php'); -require_once( SIMPLETEST_INCLUDE_DIR . 'reporter.php'); -require_once('show_passes.php'); +require_once SIMPLETEST_INCLUDE_DIR . 'unit_tester.php'; +require_once SIMPLETEST_INCLUDE_DIR . 'reporter.php'; +require_once dirname(__FILE__) . '/EarlReporter.php'; +require_once 'show_passes.php'; require(RDFAPI_INCLUDE_DIR . 'RdfAPI.php'); $_SESSION['passes'] = 0; @@ -22,6 +23,7 @@ $test_sparql->addTestFile(RDFAPI_TEST_INCLUDE_DIR. 'test/unit/Sparql/SparqlParserTests_test.php'); //$test_sparql->run(new ShowPasses()); $test_sparql->run(new TextReporter()); +//$test_sparql->run(new EarlReporter()); if(LOG){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cw...@us...> - 2007-08-13 11:58:26
|
Revision: 511 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=511&view=rev Author: cweiske Date: 2007-08-13 04:58:24 -0700 (Mon, 13 Aug 2007) Log Message: ----------- Prettify all N3Serializer 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-08-13 11:45:13 UTC (rev 510) +++ trunk/rdfapi-php/api/syntax/N3Serializer.php 2007-08-13 11:58:24 UTC (rev 511) @@ -23,6 +23,7 @@ * * @author Gunnar AA. Grimnes <ggr...@cs...> * @author Daniel Westphal <ma...@d-...> + * @author Christian Weiske <cw...@cw...> * @version $Id$ * @package syntax * @access public @@ -30,53 +31,57 @@ define('MAGIC_STRING', '~~~'); -class N3Serializer extends Object { +class N3Serializer extends Object +{ - var $debug; + var $debug = false; - var $prefixes; + var $prefixes; - var $done; // keeps track of already serialized resources - var $resourcetext; - var $resourcetext_taken; - var $model; - var $res; - var $anon; + var $done; // keeps track of already serialized resources + var $resourcetext; + var $resourcetext_taken; + var $model; + var $res; + var $anon; - var $styleCompress = false; - var $stylePretty = false; + var $styleCompress = false; + var $stylePretty = false; - /** + /** * Constructor * * @access public */ - function N3Serializer() { - $this->debug=FALSE; - } + function N3Serializer() + { + $this->debug = false; + } - /** - * Adds a new namespace prefix to use. - * Unknown namespaces will become ns0, ns1 etc. - * @access public - * @param string $s - * @returns void - **/ + /** + * Adds a new namespace prefix to use. + * Unknown namespaces will become ns0, ns1 etc. + * @access public + * @param string $s + * @returns void + **/ + function addNSPrefix( $ns, $prefix) + { + $this->prefixes[$ns]=$prefix; + } - function addNSPrefix( $ns, $prefix) { - $this->prefixes[$ns]=$prefix; - } - /** - * Clears all previously set namespace prefixes - */ - function clearNSPrefixes() - { - $this->prefixes = array(); - } /** + * Clears all previously set namespace prefixes + */ + function clearNSPrefixes() + { + $this->prefixes = array(); + } + + /** * Serializes a model to N3 syntax. * * @param object Model $model @@ -185,31 +190,33 @@ return $this->res; } -/** - * Serializes a model and saves it into a file. - * Returns FALSE if the model couldn't be saved to the file. - * - * @param object MemModel $model - * @param string $filename - * @return boolean - * @access public - */ - function saveAs(&$model, $filename) { - // serialize model - $n3 = $this->serialize($model); - // write serialized model to file - $file_handle = @fopen($filename, 'w'); - if ($file_handle) { - fwrite($file_handle, $n3); - fclose($file_handle); - return TRUE; - }else{ - return FALSE; - }; - } + /** + * Serializes a model and saves it into a file. + * Returns FALSE if the model couldn't be saved to the file. + * + * @param object MemModel $model + * @param string $filename + * @return boolean + * @access public + */ + function saveAs(&$model, $filename) + { + // serialize model + $n3 = $this->serialize($model); + // write serialized model to file + $file_handle = @fopen($filename, 'w'); + if ($file_handle) { + fwrite($file_handle, $n3); + fclose($file_handle); + return true; + } else { + return false; + }; + } + /** * Set to true, if the N3 serializer should try to compress the blank node * syntax using [] whereever possible. @@ -232,42 +239,46 @@ /* ==================== Private Methods from here ==================== */ -/** - * Readies this object for serializing another model - * @access private - * @param void - * @returns void - **/ - function reset() { - $this->anon=0; - $this->done=array(); - $this->resourcetext_taken=array(); - $this->resourcetext=array(); - $this->res=''; - $this->model=NULL; - } + /** + * Readies this object for serializing another model + * @access private + * @param void + * @returns void + **/ + function reset() + { + $this->anon=0; + $this->done=array(); + $this->resourcetext_taken=array(); + $this->resourcetext=array(); + $this->res=''; + $this->model=NULL; + } -/** - * Makes ns0, ns1 etc. prefixes for unknown prefixes. - * Outputs @prefix lines. - * @access private - * @param array $n - * @returns void - **/ - function doNamespaces(&$n) { - $c=0; - foreach ($n as $ns => $nonsense) { - if ( !$ns ) continue; - if ( isset($this->prefixes[$ns]) ) { - $p=$this->prefixes[$ns]; - } else { - $p='ns'.$c; - $this->prefixes[$ns]=$p; - $c++; - } - $this->res.="@prefix $p: <".$ns.'> .'.LINEFEED; + /** + * Makes ns0, ns1 etc. prefixes for unknown prefixes. + * Outputs @prefix lines. + * @access private + * @param array $n + * @returns void + **/ + function doNamespaces(&$n) + { + $c = 0; + foreach ($n as $ns => $nonsense) { + if (!$ns) { + continue; + } + if (isset($this->prefixes[$ns])) { + $p=$this->prefixes[$ns]; + } else { + $p = 'ns' . $c; + $this->prefixes[$ns] = $p; + $c++; + } + $this->res .= "@prefix $p: <".$ns.'> .'.LINEFEED; + } } - } /** * Fill in $resourcetext for a single resource. @@ -381,41 +392,46 @@ $this->resourcetext[$r->getURI()]=$out; return true; - } + }//function doResource(&$r) - /** - * Format a single URI - * @param string $s - * @access private - * @return void - **/ - function doURI(&$r, &$out) { - if ( $r->getURI()=='http://www.w3.org/1999/02/22-rdf-syntax-ns#type') { - $out.='a'; - return; + + + /** + * Format a single URI + * @param string $s + * @access private + * @return void + **/ + function doURI(&$r, &$out) + { + if ($r->getURI() == 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type') { + $out .= 'a'; + return; + } + if ($r->getNamespace()!='') { + $out .= $this->prefixes[$r->getNamespace()].':'.$r->getLocalName(); + } else { + //Will this ever happen? + $out .= $r->getURI(); + } } - if ($r->getNamespace()!='') { - $out.=$this->prefixes[$r->getNamespace()].':'.$r->getLocalName(); - } else { - //Will this ever happen? - $out.=$r->getURI(); - } - } - /** - * Fix the resourcetext for a blanknode where the _: construct was used - * @param string $s - * @param string $a - * @access private - * @return void - **/ - function fixAnon($t,$a) { - $t=preg_replace("/( \] $|^\[ )/", '', $t); - return $a.$t; - } + /** + * Fix the resourcetext for a blanknode where the _: construct was used + * @param string $s + * @param string $a + * @access private + * @return void + **/ + function fixAnon($t,$a) + { + $t=preg_replace("/( \] $|^\[ )/", '', $t); + return $a.$t; + } + } ?> \ 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: <cw...@us...> - 2007-08-13 11:45:18
|
Revision: 510 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=510&view=rev Author: cweiske Date: 2007-08-13 04:45:13 -0700 (Mon, 13 Aug 2007) Log Message: ----------- Add prettyprinting option and reformat serialize() code 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-08-13 11:32:20 UTC (rev 509) +++ trunk/rdfapi-php/api/syntax/N3Serializer.php 2007-08-13 11:45:13 UTC (rev 510) @@ -76,108 +76,115 @@ $this->prefixes = array(); } - /** - * Serializes a model to N3 syntax. - * - * @param object Model $model - * @return string - * @access public - */ - function & serialize(&$m) { + /** + * Serializes a model to N3 syntax. + * + * @param object Model $model + * @return string + * @access public + */ + function & serialize(&$m) + { + if (is_a($m, 'DbModel')) { + $m=$m->getMemModel(); + } - if (is_a($m, 'DbModel')) - $m=$m->getMemModel(); + $this->reset(); + $this->model = $m; + $this->res = ""; - $this->reset(); - $this->model=$m; - $this->res=""; - - // copy default namespaces - global $default_prefixes; - foreach($default_prefixes as $prefix => $namespace) + // copy default namespaces + global $default_prefixes; + foreach($default_prefixes as $prefix => $namespace) { $this->addNSPrefix($namespace,$prefix); + } - $nps= $this->model->getParsedNamespaces(); - if($nps!=false){ - foreach($nps as $uri => $prefix){ - $this->addNSPrefix($uri,$prefix); - } - } + $nps= $this->model->getParsedNamespaces(); + if ($nps!=false) { + foreach ($nps as $uri => $prefix){ + $this->addNSPrefix($uri,$prefix); + } + } - $namespaces=array(); - $count=array(); - $resources=array(); - foreach ($this->model->triples as $t) { - $s=$t->getSubject(); - if ( is_a($s, 'Resource')) - $namespaces[$s->getNamespace()]=1; + $namespaces =array(); + $count =array(); + $resources =array(); + foreach ($this->model->triples as $t) { + $s = $t->getSubject(); + if (is_a($s, 'Resource')) { + $namespaces[$s->getNamespace()] = 1; + } + $p = $t->getPredicate(); + if (is_a($p, 'Resource')) { + $namespaces[$p->getNamespace()] = 1; + } + $o = $t->getObject(); + if (is_a($o, 'Resource')) { + $namespaces[$o->getNamespace()] = 1; + } + $uri=$s->getURI(); - $p=$t->getPredicate(); - if ( is_a($p, 'Resource')) - $namespaces[$p->getNamespace()]=1; + if (isset($count[$uri])) { + $count[$uri]++; + } else { + $count[$uri]=0; + $resources[$uri]=$s; + } + } - $o=$t->getObject(); - if ( is_a($o, 'Resource')) - $namespaces[$o->getNamespace()]=1; + if (!HIDE_ADVERTISE) { + $this->res .= '# Generated by N3Serializer.php from RDF RAP.'.LINEFEED + .'# http://www.wiwiss.fu-berlin.de/suhl/bizer/rdfapi/index.html' + .LINEFEED.LINEFEED; + } - $uri=$s->getURI(); + $this->doNamespaces($namespaces); - if (isset($count[$uri])) { - $count[$uri]++; - } else { - $count[$uri]=0; - $resources[$uri]=$s; - } - } + $this->res .= LINEFEED.LINEFEED; - if (!HIDE_ADVERTISE) - $this->res .= '# Generated by N3Serializer.php from RDF RAP.'.LINEFEED - .'# http://www.wiwiss.fu-berlin.de/suhl/bizer/rdfapi/index.html' - .LINEFEED.LINEFEED; + arsort($count); - $this->doNamespaces($namespaces); + foreach ( $count as $k=>$v) { + $this->doResource($resources[$k]); + // $this->res.=" .\n"; + } - $this->res.=LINEFEED.LINEFEED; + $c = 0; + foreach ( $this->resourcetext as $r=>$t) { + if ( preg_match_all('/'.MAGIC_STRING.'([^ ]+)'.MAGIC_STRING.'/', $t, $ms, PREG_SET_ORDER)) { + foreach($ms as $mseach) { + $rp=$this->resourcetext[$mseach[1]]; + $t=preg_replace('/'.MAGIC_STRING.$mseach[1].MAGIC_STRING.'/', $rp, $t); + } + } - arsort($count); + if ($this->debug) { + $this->res .= $c . ': '; + } + if (!(isset($this->resourcetext_taken[$r]) && $this->resourcetext_taken[$r]>0)) { + $this->res .= $t . '.' . LINEFEED; + if ($this->stylePretty) { + $this->res .= LINEFEED; + } + } else if ($this->debug ) { + $this->res.=' Skipping : '.$t.LINEFEED; + } + $c++; + } - foreach ( $count as $k=>$v) { - $this->doResource($resources[$k]); - // $this->res.=" .\n"; - } + // $max=-1111; + // $maxkey=""; + // foreach ($count as $k=>$c) { + // if ( $c>$max) { $maxkey=$k; $max=$c; } + // } - $c=0; - foreach ( $this->resourcetext as $r=>$t) { + // if ($this->debug) { + // print "$maxkey is subject of most triples! ($max) \n"; + // } - if ( preg_match_all('/'.MAGIC_STRING.'([^ ]+)'.MAGIC_STRING.'/', $t, $ms, PREG_SET_ORDER)) { - - foreach($ms as $mseach) { - $rp=$this->resourcetext[$mseach[1]]; - $t=preg_replace('/'.MAGIC_STRING.$mseach[1].MAGIC_STRING.'/', $rp, $t); - } - } - - if ($this->debug) $this->res.=$c.': '; - if ( !( isset($this->resourcetext_taken[$r]) && $this->resourcetext_taken[$r]>0) ) - $this->res.=$t.' .'.LINEFEED; - else if ( $this->debug ) - $this->res.=' Skipping : '.$t.LINEFEED; - $c++; + return $this->res; } -// $max=-1111; -// $maxkey=""; -// foreach ($count as $k=>$c) { -// if ( $c>$max) { $maxkey=$k; $max=$c; } -// } - -// if ($this->debug) { -// print "$maxkey is subject of most triples! ($max) \n"; -// } - - return $this->res; - } - /** * Serializes a model and saves it into a file. * Returns FALSE if the model couldn't be saved to the file. @@ -303,7 +310,7 @@ $rbn = $this->model->find(null, null, $r); $compress = count($rbn->triples) == 0 && (N3SER_BNODE_SHORT || $this->styleCompress); if ($compress) { - $out.='[ '; + $out.='['; } else { $out.='_:'.$r->getLabel(); } @@ -323,13 +330,17 @@ $out.=' , '; } else { if ($lastp!='') { - $out.=' ; '; + if ($this->stylePretty) { + $out .= ";\n "; + } else { + $out .= ' ; '; + } } $this->doURI($p, $out); - $lastp=$p; + $lastp = $p; } - $out.=' '; + $out .= ' '; $o = $t->getObject(); @@ -364,8 +375,9 @@ } if ($compress) { - $out .= ' ] '; + $out .= ' ]'; }; + $this->resourcetext[$r->getURI()]=$out; return true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cw...@us...> - 2007-08-13 11:32:22
|
Revision: 509 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=509&view=rev Author: cweiske Date: 2007-08-13 04:32:20 -0700 (Mon, 13 Aug 2007) Log Message: ----------- Prettify N3Serializer::doResource to enhance readability 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-08-13 11:13:15 UTC (rev 508) +++ trunk/rdfapi-php/api/syntax/N3Serializer.php 2007-08-13 11:32:20 UTC (rev 509) @@ -44,6 +44,7 @@ var $anon; var $styleCompress = false; + var $stylePretty = false; /** * Constructor @@ -211,6 +212,16 @@ $this->styleCompress = $compress; } + + + /** + * Enables pretty printing in semicolon delimited sentences. + */ + function setPrettyPrint($prettyPrint) + { + $this->stylePretty = $prettyPrint; + } + /* ==================== Private Methods from here ==================== */ @@ -251,121 +262,115 @@ } } -/** - * Fill in $resourcetext for a single resource. - * Will recurse into Objects of triples, but should never look ? (really?) - * @access private - * @param object Resource $r - * @returns boolean - **/ + /** + * Fill in $resourcetext for a single resource. + * Will recurse into Objects of triples, but should never look ? (really?) + * @access private + * @param object Resource $r + * @returns boolean + **/ + function doResource(&$r) + { + // print $r->getURI(); - function doResource(&$r) { - // print $r->getURI(); + $ts=$this->model->find($r, null, null); + if (count($ts->triples)==0) { + return; + } - $ts=$this->model->find($r, null, null); - if (count($ts->triples)==0) return; + $out = ''; - $out=""; + if (isset($this->done[$r->getURI()]) && $this->done[$r->getURI()]) { + if (is_a($r, 'BlankNode')) { + if ($this->resourcetext_taken[$r->getURI()] == 1) { + //Oh bother, we must use the _:blah construct. + $a=$this->resourcetext[$r->getURI()]; + $this->resourcetext[$r->getURI()]='_:anon'.$this->anon; + $this->resourcetext['_:anon'.$this->anon]=$this->fixAnon($a, '_:anon'.$this->anon); + $this->resourcetext_taken[$r->getURI()]=2; + $this->anon++; + } + } + return false; + } - if ( isset($this->done[$r->getURI()]) && $this->done[$r->getURI()] ) { - if ( is_a($r, 'BlankNode')) { + $this->done[$r->getURI()] = true; + $compress = false; - if ( $this->resourcetext_taken[$r->getURI()] == 1) { - //Oh bother, we must use the _:blah construct. - $a=$this->resourcetext[$r->getURI()]; - $this->resourcetext[$r->getURI()]='_:anon'.$this->anon; - $this->resourcetext['_:anon'.$this->anon]=$this->fixAnon($a, '_:anon'.$this->anon); - $this->resourcetext_taken[$r->getURI()]=2; - $this->anon++; - } + if (is_a($r, 'Resource')) { + if (is_a($r, 'BlankNode')) { + //test, if this blanknode is referenced somewhere + $rbn = $this->model->find(null, null, $r); + $compress = count($rbn->triples) == 0 && (N3SER_BNODE_SHORT || $this->styleCompress); + if ($compress) { + $out.='[ '; + } else { + $out.='_:'.$r->getLabel(); + } + } else { + $this->doURI($r, $out); + } + } - } - return false; - } + usort($ts->triples, 'statementsorter'); + $lastp = ''; + $out .= ' '; - $this->done[$r->getURI()]=TRUE; - $compress = false; + foreach ($ts->triples as $t) { + $p=$t->getPredicate(); - if ( is_a($r, 'Resource') ) { + if ($p == $lastp) { + $out.=' , '; + } else { + if ($lastp!='') { + $out.=' ; '; + } + $this->doURI($p, $out); + $lastp=$p; + } - if ( is_a($r, 'BlankNode') ) { + $out.=' '; - //test, if this blanknode is referenced somewhere - $rbn=$this->model->find(null, null, $r); - $compress = count($rbn->triples) == 0 && (N3SER_BNODE_SHORT || $this->styleCompress); - if ($compress) { - $out.='[ '; - } else { - $out.='_:'.$r->getLabel(); - }; - } else { + $o = $t->getObject(); - $this->doURI($r, $out); + if (is_a($o, 'Literal')) { + $l = $o->getLabel(); + if ( strpos($l, LINEFEED) === FALSE ) { + $out.="\"$l\""; + } else { + $out.="\"\"\"$l\"\"\""; + } + if ( $o->getLanguage()!='' ) { + $out.='@'.$o->getLanguage(); + } + if ( $o->getDatatype()!='' ) { + $out.='^^<'.$o->getDatatype().'>'; + } + } - }; - }; + if (is_a($o, 'Resource')) { + if ($this->debug) { + print 'Doing object: '.$o->getURI().LINEFEED; + } + if (is_a($o,'BlankNode')) { + // $this->doResource($o); + // $out.=MAGIC_STRING.$o->getURI().MAGIC_STRING; #$this->resourcetext[$o->getURI()]; + // $this->resourcetext_taken[$o->getURI()]=1; + $out .= '_:'.$o->getLabel(); + } else { + $this->doURI($o, $out); + } + } + } - usort($ts->triples, 'statementsorter'); - $lastp=''; + if ($compress) { + $out .= ' ] '; + }; + $this->resourcetext[$r->getURI()]=$out; - $out.=' '; - - foreach ($ts->triples as $t) { - - $p=$t->getPredicate(); - - if ($p == $lastp) { - $out.=' , '; - } else { - if ($lastp!='') $out.=' ; '; - $this->doURI($p, $out); - $lastp=$p; - } - - $out.=' '; - - $o=$t->getObject(); - - if ( is_a($o, 'Literal')) { - $l=$o->getLabel(); - if ( strpos($l, LINEFEED) === FALSE ) { - $out.="\"$l\""; - } else { - $out.="\"\"\"$l\"\"\""; - } - if ( $o->getLanguage()!='' ) { - $out.='@'.$o->getLanguage(); - } - if ( $o->getDatatype()!='' ) { - $out.='^^<'.$o->getDatatype().'>'; - } - - } - - if (is_a($o, 'Resource')) { - if ($this->debug) print 'Doing object: '.$o->getURI().LINEFEED; - if ( is_a($o,'BlankNode')) { - -// $this->doResource($o); -// $out.=MAGIC_STRING.$o->getURI().MAGIC_STRING; #$this->resourcetext[$o->getURI()]; -// $this->resourcetext_taken[$o->getURI()]=1; - - $out .='_:'.$o->getLabel(); - } else { - - $this->doURI($o, $out); - } - } + return true; } - if ($compress) { - $out .= ' ] '; - }; - $this->resourcetext[$r->getURI()]=$out; - - return TRUE; - } - /** * Format a single URI * @param string $s This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cw...@us...> - 2007-08-13 11:13:18
|
Revision: 508 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=508&view=rev Author: cweiske Date: 2007-08-13 04:13:15 -0700 (Mon, 13 Aug 2007) Log Message: ----------- Add N3Parser class option for output compression via [] 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-08-13 10:00:37 UTC (rev 507) +++ trunk/rdfapi-php/api/syntax/N3Serializer.php 2007-08-13 11:13:15 UTC (rev 508) @@ -43,6 +43,8 @@ var $res; var $anon; + var $styleCompress = false; + /** * Constructor * @@ -200,6 +202,14 @@ }; } + /** + * Set to true, if the N3 serializer should try to compress the blank node + * syntax using [] whereever possible. + */ + function setCompress($compress) + { + $this->styleCompress = $compress; + } /* ==================== Private Methods from here ==================== */ @@ -274,6 +284,7 @@ } $this->done[$r->getURI()]=TRUE; + $compress = false; if ( is_a($r, 'Resource') ) { @@ -281,11 +292,11 @@ //test, if this blanknode is referenced somewhere $rbn=$this->model->find(null, null, $r); - - if (count($rbn->triples)>0 | !N3SER_BNODE_SHORT) { + $compress = count($rbn->triples) == 0 && (N3SER_BNODE_SHORT || $this->styleCompress); + if ($compress) { + $out.='[ '; + } else { $out.='_:'.$r->getLabel(); - } else { - $out.='[ '; }; } else { @@ -347,7 +358,9 @@ } } - if (isset($rbn) && !count($rbn->triples)>0 && N3SER_BNODE_SHORT) {$out.=' ] ';}; + if ($compress) { + $out .= ' ] '; + }; $this->resourcetext[$r->getURI()]=$out; return TRUE; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cw...@us...> - 2007-08-13 10:00:39
|
Revision: 507 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=507&view=rev Author: cweiske Date: 2007-08-13 03:00:37 -0700 (Mon, 13 Aug 2007) Log Message: ----------- Remove debug statements 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-08-13 09:55:33 UTC (rev 506) +++ trunk/rdfapi-php/api/syntax/N3Serializer.php 2007-08-13 10:00:37 UTC (rev 507) @@ -89,7 +89,6 @@ $this->model=$m; $this->res=""; -var_dump($this->prefixes); // copy default namespaces global $default_prefixes; foreach($default_prefixes as $prefix => $namespace) @@ -101,7 +100,7 @@ $this->addNSPrefix($uri,$prefix); } } -var_dump($this->prefixes); + $namespaces=array(); $count=array(); $resources=array(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cw...@us...> - 2007-08-13 09:55:41
|
Revision: 506 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=506&view=rev Author: cweiske Date: 2007-08-13 02:55:33 -0700 (Mon, 13 Aug 2007) Log Message: ----------- Don't clear namespaces when serializing - this removes the option to add own prefixes 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-08-13 08:47:21 UTC (rev 505) +++ trunk/rdfapi-php/api/syntax/N3Serializer.php 2007-08-13 09:55:33 UTC (rev 506) @@ -5,25 +5,24 @@ // ---------------------------------------------------------------------------------- /** - * PHP Notation3 Serializer - * + * PHP Notation3 Serializer + * * This class serialises models to N3 Syntax. - * - * Supported N3 features: + * + * Supported N3 features: * <ul> - * <li>Using [ ] for blank nodes, or _: if nescessary</li> - * <li>Literal datytype- and xmlLanguageTag support</li> + * <li>Using [ ] for blank nodes, or _: if necessary</li> + * <li>Literal datatype- and xmlLanguageTag support</li> * </ul> - * - * Un-supported N3 Features include: + * + * Un-supported N3 Features include: * <ul> * <li>Reification</li> * </ul> * * - * TODO: * added namespace prefixes are persisent... - * - * @author Gunnar AA. Grimnes <ggr...@cs...>, Daniel Westphal <ma...@d-...> + * @author Gunnar AA. Grimnes <ggr...@cs...> + * @author Daniel Westphal <ma...@d-...> * @version $Id$ * @package syntax * @access public @@ -33,15 +32,15 @@ class N3Serializer extends Object { - var $debug; + var $debug; - var $prefixes; + var $prefixes; var $done; // keeps track of already serialized resources - var $resourcetext; - var $resourcetext_taken; + var $resourcetext; + var $resourcetext_taken; var $model; - var $res; + var $res; var $anon; /** @@ -49,120 +48,129 @@ * * @access public */ - function N3Serializer() { + function N3Serializer() { $this->debug=FALSE; } - /** - * Adds a new namespace prefix to use. - * Unknown namespaces will become ns0, ns1 etc. + /** + * Adds a new namespace prefix to use. + * Unknown namespaces will become ns0, ns1 etc. * @access public * @param string $s - * @returns void + * @returns void **/ - function addNSPrefix( $ns, $prefix) { - $this->prefixes[$ns]=$prefix; + function addNSPrefix( $ns, $prefix) { + $this->prefixes[$ns]=$prefix; } /** + * Clears all previously set namespace prefixes + */ + function clearNSPrefixes() + { + $this->prefixes = array(); + } + + /** * Serializes a model to N3 syntax. * * @param object Model $model * @return string * @access public */ - function & serialize(&$m) { + function & serialize(&$m) { - if (is_a($m, 'DbModel')) + if (is_a($m, 'DbModel')) $m=$m->getMemModel(); - + $this->reset(); $this->model=$m; - $this->res=""; - + $this->res=""; + +var_dump($this->prefixes); // copy default namespaces global $default_prefixes; foreach($default_prefixes as $prefix => $namespace) $this->addNSPrefix($namespace,$prefix); - - $nps= $this->model->getParsedNamespaces(); + + $nps= $this->model->getParsedNamespaces(); if($nps!=false){ foreach($nps as $uri => $prefix){ $this->addNSPrefix($uri,$prefix); } } - +var_dump($this->prefixes); $namespaces=array(); $count=array(); - $resources=array(); - foreach ($this->model->triples as $t) { + $resources=array(); + foreach ($this->model->triples as $t) { $s=$t->getSubject(); - if ( is_a($s, 'Resource')) + if ( is_a($s, 'Resource')) $namespaces[$s->getNamespace()]=1; $p=$t->getPredicate(); - if ( is_a($p, 'Resource')) + if ( is_a($p, 'Resource')) $namespaces[$p->getNamespace()]=1; $o=$t->getObject(); - if ( is_a($o, 'Resource')) + if ( is_a($o, 'Resource')) $namespaces[$o->getNamespace()]=1; - + $uri=$s->getURI(); - - if (isset($count[$uri])) { + + if (isset($count[$uri])) { $count[$uri]++; - } else { + } else { $count[$uri]=0; $resources[$uri]=$s; } } - if (!HIDE_ADVERTISE) + if (!HIDE_ADVERTISE) $this->res .= '# Generated by N3Serializer.php from RDF RAP.'.LINEFEED .'# http://www.wiwiss.fu-berlin.de/suhl/bizer/rdfapi/index.html' .LINEFEED.LINEFEED; - $this->doNamespaces($namespaces); + $this->doNamespaces($namespaces); $this->res.=LINEFEED.LINEFEED; arsort($count); - - foreach ( $count as $k=>$v) { - $this->doResource($resources[$k]); + + foreach ( $count as $k=>$v) { + $this->doResource($resources[$k]); // $this->res.=" .\n"; } $c=0; - foreach ( $this->resourcetext as $r=>$t) { + foreach ( $this->resourcetext as $r=>$t) { if ( preg_match_all('/'.MAGIC_STRING.'([^ ]+)'.MAGIC_STRING.'/', $t, $ms, PREG_SET_ORDER)) { - foreach($ms as $mseach) { + foreach($ms as $mseach) { $rp=$this->resourcetext[$mseach[1]]; $t=preg_replace('/'.MAGIC_STRING.$mseach[1].MAGIC_STRING.'/', $rp, $t); } } if ($this->debug) $this->res.=$c.': '; - if ( !( isset($this->resourcetext_taken[$r]) && $this->resourcetext_taken[$r]>0) ) - $this->res.=$t.' .'.LINEFEED; - else if ( $this->debug ) + if ( !( isset($this->resourcetext_taken[$r]) && $this->resourcetext_taken[$r]>0) ) + $this->res.=$t.' .'.LINEFEED; + else if ( $this->debug ) $this->res.=' Skipping : '.$t.LINEFEED; $c++; - } + } // $max=-1111; // $maxkey=""; -// foreach ($count as $k=>$c) { +// foreach ($count as $k=>$c) { // if ( $c>$max) { $maxkey=$k; $max=$c; } // } - -// if ($this->debug) { -// print "$maxkey is subject of most triples! ($max) \n"; + +// if ($this->debug) { +// print "$maxkey is subject of most triples! ($max) \n"; // } return $this->res; @@ -192,8 +200,8 @@ return FALSE; }; } - + /* ==================== Private Methods from here ==================== */ @@ -201,7 +209,7 @@ * Readies this object for serializing another model * @access private * @param void - * @returns void + * @returns void **/ function reset() { $this->anon=0; @@ -210,23 +218,22 @@ $this->resourcetext=array(); $this->res=''; $this->model=NULL; - unset($this->prefixes); } /** - * Makes ns0, ns1 etc. prefixes for unknown prefixes. - * Outputs @prefix lines. + * Makes ns0, ns1 etc. prefixes for unknown prefixes. + * Outputs @prefix lines. * @access private * @param array $n - * @returns void + * @returns void **/ - function doNamespaces(&$n) { + function doNamespaces(&$n) { $c=0; - foreach ($n as $ns => $nonsense) { - if ( !$ns ) continue; + foreach ($n as $ns => $nonsense) { + if ( !$ns ) continue; if ( isset($this->prefixes[$ns]) ) { $p=$this->prefixes[$ns]; - } else { + } else { $p='ns'.$c; $this->prefixes[$ns]=$p; $c++; @@ -236,42 +243,42 @@ } /** - * Fill in $resourcetext for a single resource. - * Will recurse into Objects of triples, but should never look ? (really?) + * Fill in $resourcetext for a single resource. + * Will recurse into Objects of triples, but should never look ? (really?) * @access private * @param object Resource $r * @returns boolean **/ - function doResource(&$r) { - // print $r->getURI(); + function doResource(&$r) { + // print $r->getURI(); $ts=$this->model->find($r, null, null); - if (count($ts->triples)==0) return; - + if (count($ts->triples)==0) return; + $out=""; if ( isset($this->done[$r->getURI()]) && $this->done[$r->getURI()] ) { - if ( is_a($r, 'BlankNode')) { - - if ( $this->resourcetext_taken[$r->getURI()] == 1) { - //Oh bother, we must use the _:blah construct. + if ( is_a($r, 'BlankNode')) { + + if ( $this->resourcetext_taken[$r->getURI()] == 1) { + //Oh bother, we must use the _:blah construct. $a=$this->resourcetext[$r->getURI()]; $this->resourcetext[$r->getURI()]='_:anon'.$this->anon; $this->resourcetext['_:anon'.$this->anon]=$this->fixAnon($a, '_:anon'.$this->anon); - $this->resourcetext_taken[$r->getURI()]=2; + $this->resourcetext_taken[$r->getURI()]=2; $this->anon++; } } - return false; + return false; } $this->done[$r->getURI()]=TRUE; if ( is_a($r, 'Resource') ) { - if ( is_a($r, 'BlankNode') ) { + if ( is_a($r, 'BlankNode') ) { //test, if this blanknode is referenced somewhere $rbn=$this->model->find(null, null, $r); @@ -280,51 +287,51 @@ $out.='_:'.$r->getLabel(); } else { $out.='[ '; - }; - } else { + }; + } else { $this->doURI($r, $out); }; }; - + usort($ts->triples, 'statementsorter'); $lastp=''; $out.=' '; - foreach ($ts->triples as $t) { - - $p=$t->getPredicate(); - + foreach ($ts->triples as $t) { + + $p=$t->getPredicate(); + if ($p == $lastp) { - $out.=' , '; - } else { - if ($lastp!='') $out.=' ; '; + $out.=' , '; + } else { + if ($lastp!='') $out.=' ; '; $this->doURI($p, $out); $lastp=$p; } $out.=' '; - + $o=$t->getObject(); - - if ( is_a($o, 'Literal')) { + + if ( is_a($o, 'Literal')) { $l=$o->getLabel(); - if ( strpos($l, LINEFEED) === FALSE ) { + if ( strpos($l, LINEFEED) === FALSE ) { $out.="\"$l\""; - } else { - $out.="\"\"\"$l\"\"\""; + } else { + $out.="\"\"\"$l\"\"\""; } - if ( $o->getLanguage()!='' ) { + if ( $o->getLanguage()!='' ) { $out.='@'.$o->getLanguage(); } - if ( $o->getDatatype()!='' ) { + if ( $o->getDatatype()!='' ) { $out.='^^<'.$o->getDatatype().'>'; } - - } - + + } + if (is_a($o, 'Resource')) { if ($this->debug) print 'Doing object: '.$o->getURI().LINEFEED; if ( is_a($o,'BlankNode')) { @@ -334,7 +341,7 @@ // $this->resourcetext_taken[$o->getURI()]=1; $out .='_:'.$o->getLabel(); - } else { + } else { $this->doURI($o, $out); } @@ -342,40 +349,40 @@ } if (isset($rbn) && !count($rbn->triples)>0 && N3SER_BNODE_SHORT) {$out.=' ] ';}; - $this->resourcetext[$r->getURI()]=$out; + $this->resourcetext[$r->getURI()]=$out; return TRUE; } - /** + /** * Format a single URI * @param string $s * @access private * @return void **/ - function doURI(&$r, &$out) { + function doURI(&$r, &$out) { if ( $r->getURI()=='http://www.w3.org/1999/02/22-rdf-syntax-ns#type') { $out.='a'; - return; + return; } if ($r->getNamespace()!='') { $out.=$this->prefixes[$r->getNamespace()].':'.$r->getLocalName(); - } else { - //Will this ever happen? + } else { + //Will this ever happen? $out.=$r->getURI(); } } - - /** + + /** * Fix the resourcetext for a blanknode where the _: construct was used * @param string $s * @param string $a * @access private * @return void **/ - function fixAnon($t,$a) { - $t=preg_replace("/( \] $|^\[ )/", '', $t); + function fixAnon($t,$a) { + $t=preg_replace("/( \] $|^\[ )/", '', $t); return $a.$t; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cw...@us...> - 2007-08-13 08:47:23
|
Revision: 505 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=505&view=rev Author: cweiske Date: 2007-08-13 01:47:21 -0700 (Mon, 13 Aug 2007) Log Message: ----------- load object 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-08-13 07:44:02 UTC (rev 504) +++ trunk/rdfapi-php/api/model/Model.php 2007-08-13 08:47:21 UTC (rev 505) @@ -1,4 +1,5 @@ <?php +require_once RDFAPI_INCLUDE_DIR . 'util/Object.php'; // ---------------------------------------------------------------------------------- // Class: Model This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cw...@us...> - 2007-08-13 07:44:06
|
Revision: 504 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=504&view=rev Author: cweiske Date: 2007-08-13 00:44:02 -0700 (Mon, 13 Aug 2007) Log Message: ----------- Allow checks on boolean values again (e.g. in ASK tests) Modified Paths: -------------- trunk/rdfapi-php/test/unit/Sparql/SparqlTestHelper.php Modified: trunk/rdfapi-php/test/unit/Sparql/SparqlTestHelper.php =================================================================== --- trunk/rdfapi-php/test/unit/Sparql/SparqlTestHelper.php 2007-08-13 07:35:42 UTC (rev 503) +++ trunk/rdfapi-php/test/unit/Sparql/SparqlTestHelper.php 2007-08-13 07:44:02 UTC (rev 504) @@ -16,6 +16,10 @@ */ public static function resultCheck($table, $result) { + if (!is_array($table) && !is_array($result)) { + return $table === $result; + } + $match = 0; $rows = 0; if (isset($result['rowcount'])) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cw...@us...> - 2007-08-13 07:35:43
|
Revision: 503 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=503&view=rev Author: cweiske Date: 2007-08-13 00:35:42 -0700 (Mon, 13 Aug 2007) Log Message: ----------- Move dawg syntax tests to SparqlParserTests Syntax test results: Test cases run: 1/1, Passes: 174, Failures: 52, Exceptions: 2 Query test results: Test cases run: 1/1, Passes: 202, Failures: 91, Exceptions: 3 Modified Paths: -------------- trunk/rdfapi-php/test/unit/Sparql/SparqlDbTests_test.php trunk/rdfapi-php/test/unit/Sparql/SparqlParserTests_test.php Modified: trunk/rdfapi-php/test/unit/Sparql/SparqlDbTests_test.php =================================================================== --- trunk/rdfapi-php/test/unit/Sparql/SparqlDbTests_test.php 2007-08-13 06:52:50 UTC (rev 502) +++ trunk/rdfapi-php/test/unit/Sparql/SparqlDbTests_test.php 2007-08-13 07:35:42 UTC (rev 503) @@ -37,6 +37,14 @@ //echo count($_SESSION[$arGroup['tests']]) . " tests\n"; foreach ($_SESSION[$arGroup['tests']] as $name) { + + if (isset($name['type']) && + ($name['type'] == 'syntax-negative' || $name['type'] == 'syntax-positive') + ) { + //skip syntax tests; they are run in SparqlParserTests + continue; + } + $checkfunc = $arGroup['checkfunc']; $fileData = null; $fileResult = null; @@ -129,13 +137,6 @@ } } - if (isset($name['type']) && - ($name['type'] == 'syntax-negative' || $name['type'] == 'syntax-positive') - ) { - $this->testQueryParse($qs, $parser, $name['type'], $title); - continue; - } - try { $q = $parser->parse($qs); } catch (Exception $e) { @@ -204,44 +205,6 @@ /** - * Runs a parser test - */ - protected function testQueryParse($strQuery, $parser, $strType, $title) - { -//echo $title . "\n"; - $bException = false; - try { - $parser->parse($strQuery); - } catch (Exception $e) { - $bException = true; - } - - if ($strType == 'syntax-negative') { - $this->assertTrue($bException, 'Query should fail to be parsed.'); - $bOk = $bException == true; - } else if ($strType == 'syntax-positive') { - $this->assertFalse($bException, 'Query should get parsed.'); - $bOk = $bException == false; - } - - if (!$bOk) { - if (!isset($GLOBALS['debugTests'])) { - echo ' ' . $title . "\n"; - } else { - echo Console_Color::convert('%RTest failed: ' . $title . "%n\n"); - if (isset($e)) { - echo $e->getMessage() . "\n"; - //var_dump($e); - } - echo $strQuery . "\n"; - die(); - } - } - }//protected function testQueryParse($strQuery, $parser, $strType) - - - - /** * Instantiates the database object and clears * any existing statements to have a fresh place * for a unit test. Modified: trunk/rdfapi-php/test/unit/Sparql/SparqlParserTests_test.php =================================================================== --- trunk/rdfapi-php/test/unit/Sparql/SparqlParserTests_test.php 2007-08-13 06:52:50 UTC (rev 502) +++ trunk/rdfapi-php/test/unit/Sparql/SparqlParserTests_test.php 2007-08-13 07:35:42 UTC (rev 503) @@ -2,10 +2,14 @@ require_once dirname(__FILE__) . '/../../config.php'; require_once dirname(__FILE__) . '/casesParserFilter.php'; require_once dirname(__FILE__) . '/casesParserNested.php'; +require_once dirname(__FILE__) . '/cases.php'; require_once dirname(__FILE__) . '/SparqlTestHelper.php'; require_once RDFAPI_INCLUDE_DIR . 'sparql/SparqlParser.php'; require_once RDFAPI_INCLUDE_DIR . 'sparql/SparqlEngineDb/QuerySimplifier.php'; +if (isset($GLOBALS['debugTests'])) { + require_once 'Console/Color.php'; +} /** * Test Sparql parser @@ -136,6 +140,76 @@ /** + * Runs the DAWG syntax tests + */ + function testDawg2SyntaxTests() + { + $parser = new SparqlParser(); + + foreach ($_SESSION['sparql_dawg2_tests'] as $test) { + //use syntax tests only + if (!isset($test['type']) || + ($test['type'] != 'syntax-positive' && + $test['type'] != 'syntax-negative') + ) { + continue; + } + if (in_array($test['title'], $_SESSION['testSparqlDbTestsIgnores'])) { + if (isset($GLOBALS['debugTests'])) { + echo Console_Color::convert('%y'); + echo ' ignoring ' . $test['title'] . "\n"; + echo Console_Color::convert('%n'); + } + continue; + } + + $qs = file_get_contents(SPARQL_TESTFILES . $test['query']); + + $this->runQueryParseTest($qs, $parser, $test['type'], $test['title']); + } + }//function testDawg2SyntaxTests() + + + + /** + * Runs a parser test + */ + protected function runQueryParseTest($strQuery, $parser, $strType, $title) + { +//echo $title . "\n"; + $bException = false; + try { + $parser->parse($strQuery); + } catch (Exception $e) { + $bException = true; + } + + if ($strType == 'syntax-negative') { + $this->assertTrue($bException, 'Query should fail to be parsed.'); + $bOk = $bException == true; + } else if ($strType == 'syntax-positive') { + $this->assertFalse($bException, 'Query should get parsed.'); + $bOk = $bException == false; + } + + if (!$bOk) { + if (!isset($GLOBALS['debugTests'])) { + echo ' ' . $title . "\n"; + } else { + echo Console_Color::convert('%RTest failed: ' . $title . "%n\n"); + if (isset($e)) { + echo $e->getMessage() . "\n"; + //var_dump($e); + } + echo $strQuery . "\n"; + die(); + } + } + }//protected function runQueryParseTest($strQuery, $parser, $strType) + + + + /** * Removes "level" keys from the tree array. * It is an implementation detail and should not taken into account */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cw...@us...> - 2007-08-13 06:52:51
|
Revision: 502 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=502&view=rev Author: cweiske Date: 2007-08-12 23:52:50 -0700 (Sun, 12 Aug 2007) Log Message: ----------- Add full support for the new DAWG tests. All test result formats should be supported by now (rdf xml, n3 [ttl,srx]). Current test status: Test cases run: 1/1, Passes: 345, Failures: 143, Exceptions: 5 Modified Paths: -------------- trunk/rdfapi-php/test/unit/Sparql/SparqlDbTests_test.php trunk/rdfapi-php/test/unit/Sparql/SparqlTestHelper.php trunk/rdfapi-php/test/unit/Sparql/cases.php trunk/rdfapi-php/test/unit/Sparql/cases_dawg2.php Modified: trunk/rdfapi-php/test/unit/Sparql/SparqlDbTests_test.php =================================================================== --- trunk/rdfapi-php/test/unit/Sparql/SparqlDbTests_test.php 2007-08-13 06:44:36 UTC (rev 501) +++ trunk/rdfapi-php/test/unit/Sparql/SparqlDbTests_test.php 2007-08-13 06:52:50 UTC (rev 502) @@ -9,6 +9,9 @@ require_once RDFAPI_INCLUDE_DIR . 'sparql/SparqlParser.php'; require_once RDFAPI_INCLUDE_DIR . 'sparql/SparqlEngine.php'; require_once RDFAPI_INCLUDE_DIR . 'dataset/NamedGraphMem.php'; +require_once RDFAPI_INCLUDE_DIR . 'syntax/SparqlResultParser.php'; +require_once RDFAPI_INCLUDE_DIR . 'syntax/N3Parser.php'; + if (isset($GLOBALS['debugTests'])) { require_once 'Console/Color.php'; } @@ -31,10 +34,10 @@ foreach ($_SESSION['sparqlTestGroups'] as $arGroup) { if (isset($arGroup['deact'])) continue; - $checkfunc = $arGroup['checkfunc']; //echo count($_SESSION[$arGroup['tests']]) . " tests\n"; foreach ($_SESSION[$arGroup['tests']] as $name) { + $checkfunc = $arGroup['checkfunc']; $fileData = null; $fileResult = null; $fileQuery = null; @@ -90,15 +93,40 @@ //re-use database if not changed list($database, $dbModel) = $this->prepareDatabase(); //import statements into database - $dbModel ->load(SPARQL_TESTFILES . $fileData); + $dbModel ->load(SPARQL_TESTFILES . $fileData, 'n3'); $strLastDataFile = $fileData; } $qs = file_get_contents(SPARQL_TESTFILES . $fileQuery); + if ($fileResult !== null) { $res = file_get_contents(SPARQL_TESTFILES . $fileResult); - unset($result); - eval($res); + + if (substr($fileResult, -4) == '.srx') { + //Sparql XML result + $resParser = new SparqlResultParser(); + $result = $resParser->parse($res); + } else if (substr($fileResult, -4) == '.rdf') { + //same format as .ttl, but serialized as xml + //rdf xml sorted + $resModel = new MemModel(); + $resModel->load(SPARQL_TESTFILES . $fileResult, 'rdf'); + $result = SparqlTestHelper::convertModelToResultArray($resModel); + unset($resModel); + $checkfunc = 'resultCheckSort'; + } else if (substr($fileResult, -4) == '.res') { + //our own php code + unset($result); + eval($res); + } else if (substr($fileResult, -4) == '.ttl') { + //N3 + $resModel = new MemModel(); + $resModel->load(SPARQL_TESTFILES . $fileResult, 'n3'); + $result = SparqlTestHelper::convertModelToResultArray($resModel); + unset($resModel); + } else { + throw new Exception('Unknown result format in ' . $fileResult); + } } if (isset($name['type']) && @@ -108,8 +136,25 @@ continue; } - $q = $parser->parse($qs); try { + $q = $parser->parse($qs); + } catch (Exception $e) { + //normal query failed to be parsed + $this->assertTrue(false, 'Query failed to be parsed'); + if (!isset($GLOBALS['debugTests'])) { + echo ' ' . $title . "\n"; + } else { + echo Console_Color::convert('%RTest failed: ' . $title . "%n\n"); + if (isset($e)) { + echo $e->getMessage() . "\n"; + //var_dump($e); + } + echo $strQuery . "\n"; + die(); + } + } + + try { $t = $dbModel->sparqlQuery($qs); if ($t instanceof MemModel) { @@ -136,6 +181,7 @@ if ($e != null) { echo get_class($e) . ': ' . $e->getMessage() . "\n"; } + echo ' Data: ' . $fileData . "\n"; echo 'Query string: ' . $qs . "\n"; echo "Expected:\n"; echo Console_Color::convert('%p'); @@ -188,6 +234,7 @@ //var_dump($e); } echo $strQuery . "\n"; + die(); } } }//protected function testQueryParse($strQuery, $parser, $strType) Modified: trunk/rdfapi-php/test/unit/Sparql/SparqlTestHelper.php =================================================================== --- trunk/rdfapi-php/test/unit/Sparql/SparqlTestHelper.php 2007-08-13 06:44:36 UTC (rev 501) +++ trunk/rdfapi-php/test/unit/Sparql/SparqlTestHelper.php 2007-08-13 06:52:50 UTC (rev 502) @@ -5,13 +5,28 @@ */ class SparqlTestHelper { + /** + * Compares calculated with expected result. + * Values can be at any position and do not need to be ordered. + * + * @param array $table Result calculated by the engine + * @param array $result Expected result + * + * @return boolean True if both arrays contain the same values + */ public static function resultCheck($table, $result) { $match = 0; $rows = 0; - $rowcount = $result['rowcount']; - $hits = $result['hits']; - $result = $result['part']; + if (isset($result['rowcount'])) { + $rowcount = $result['rowcount']; + $hits = $result['hits']; + $result = $result['part']; + } else { + //e.g. dawg2 tests pass a "table" as $result + $rowcount = count($result); + $hits = count($result); + } if ($rowcount == 0 && ($table == 'false' || $table == array())) { return true; @@ -56,8 +71,21 @@ + /** + * Compares calculated with expected result. + * Values need to be in the exact same order. + * + * @param array $table Result calculated by the engine + * @param array $result Expected result + * + * @return boolean True if both arrays contain the same values + */ public static function resultCheckSort($table, $result) { + if (count($result) != count($table)) { + return false; + } + foreach ($result as $key => $value) { foreach ($value as $varname => $varvalue) { if ($varvalue != $table[$key][$varname]) { @@ -129,5 +157,62 @@ return $s; }//static function renderResult($query) + + + /** + * Converts a MemModel into a query result array. + * Required for the DAWG test cases. + * + * @param Model $model Model object to extract data from + * @return array Result array + * + * @see http://www.w3.org/2001/sw/DataAccess/tests/README + * @see http://www.w3.org/2001/sw/DataAccess/tests/result-set.n3 + */ + static function convertModelToResultArray($model) + { + $graphset = ModelFactory::getDatasetMem('Dataset1'); + $graphset->setDefaultGraph($model); + $parser = new SparqlParser(); + $engine = SparqlEngine::factory($model); + + $strSparqlQuery = ' + PREFIX rs: <http://www.w3.org/2001/sw/DataAccess/tests/result-set#> + SELECT ?varname WHERE { ?x rs:resultVariable ?varname } + '; + $q = $parser->parse($strSparqlQuery); + $variables = $engine->queryModel($graphset, $q, false); + + $arVars = array(); + $strSparqlQueryPart = ''; + $nCount = 0; + foreach ($variables as $var) { + $varname = '?' . $var['?varname']->label; + $name = substr($varname, 1); + $arVars[] = $varname; + $strSparqlQueryPart .= + ' ?thing rs:binding ?binding' . $nCount . '. + ?binding' . $nCount . ' rs:value ' . $varname . '. + ?binding' . $nCount . ' rs:variable "' . $name . '".'; + ++$nCount; + } + + $strSparqlQuery = ' + PREFIX rs: <http://www.w3.org/2001/sw/DataAccess/tests/result-set#> + SELECT ' . implode($arVars, ' ') . ' + WHERE { + ?some rs:solution ?thing. + ' . $strSparqlQueryPart . ' + } + '; +//echo $strSparqlQuery; + $q = $parser->parse($strSparqlQuery); + $arResult = $engine->queryModel($graphset, $q, false); +//var_dump($arResult); +//die(); + + return $arResult; + }//static function convertModelToResultArray($model) + }//class SparqlTestHelper ?> \ No newline at end of file Modified: trunk/rdfapi-php/test/unit/Sparql/cases.php =================================================================== --- trunk/rdfapi-php/test/unit/Sparql/cases.php 2007-08-13 06:44:36 UTC (rev 501) +++ trunk/rdfapi-php/test/unit/Sparql/cases.php 2007-08-13 06:52:50 UTC (rev 502) @@ -62,6 +62,8 @@ //fatal error 'syntax-form-describe01.rq', 'syntax-form-describe02.rq', + //parse error + 'dawg-construct-identity' ); Modified: trunk/rdfapi-php/test/unit/Sparql/cases_dawg2.php =================================================================== --- trunk/rdfapi-php/test/unit/Sparql/cases_dawg2.php 2007-08-13 06:44:36 UTC (rev 501) +++ trunk/rdfapi-php/test/unit/Sparql/cases_dawg2.php 2007-08-13 06:52:50 UTC (rev 502) @@ -3,2174 +3,2174 @@ * automatically created by create-dawg2.php on 2007-08-12 16:52 */ $_SESSION['sparql_dawg2_tests'] = array ( - 0 => + 0 => array ( 'title' => 'Basic graph pattern - spoo', 'data' => 'w3c-dawg2/data-r2/basic/data-6.ttl', 'query' => 'w3c-dawg2/data-r2/basic/spoo-1.rq', 'result' => 'w3c-dawg2/data-r2/basic/spoo-1.srx', ), - 1 => + 1 => array ( 'title' => 'Basic - Prefix/Base 1', 'data' => 'w3c-dawg2/data-r2/basic/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/basic/base-prefix-1.rq', 'result' => 'w3c-dawg2/data-r2/basic/base-prefix-1.srx', ), - 2 => + 2 => array ( 'title' => 'Basic - Prefix/Base 2', 'data' => 'w3c-dawg2/data-r2/basic/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/basic/base-prefix-2.rq', 'result' => 'w3c-dawg2/data-r2/basic/base-prefix-2.srx', ), - 3 => + 3 => array ( 'title' => 'Basic - Prefix/Base 3', 'data' => 'w3c-dawg2/data-r2/basic/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/basic/base-prefix-3.rq', 'result' => 'w3c-dawg2/data-r2/basic/base-prefix-3.srx', ), - 4 => + 4 => array ( 'title' => 'Basic - Prefix/Base 4', 'data' => 'w3c-dawg2/data-r2/basic/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/basic/base-prefix-4.rq', 'result' => 'w3c-dawg2/data-r2/basic/base-prefix-4.srx', ), - 5 => + 5 => array ( 'title' => 'Basic - Prefix/Base 5', 'data' => 'w3c-dawg2/data-r2/basic/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/basic/base-prefix-5.rq', 'result' => 'w3c-dawg2/data-r2/basic/base-prefix-5.srx', ), - 6 => + 6 => array ( 'title' => 'Basic - List 1', 'data' => 'w3c-dawg2/data-r2/basic/data-2.ttl', 'query' => 'w3c-dawg2/data-r2/basic/list-1.rq', 'result' => 'w3c-dawg2/data-r2/basic/list-1.srx', ), - 7 => + 7 => array ( 'title' => 'Basic - List 2', 'data' => 'w3c-dawg2/data-r2/basic/data-2.ttl', 'query' => 'w3c-dawg2/data-r2/basic/list-2.rq', 'result' => 'w3c-dawg2/data-r2/basic/list-2.srx', ), - 8 => + 8 => array ( 'title' => 'Basic - List 3', 'data' => 'w3c-dawg2/data-r2/basic/data-2.ttl', 'query' => 'w3c-dawg2/data-r2/basic/list-3.rq', 'result' => 'w3c-dawg2/data-r2/basic/list-3.srx', ), - 9 => + 9 => array ( 'title' => 'Basic - List 4', 'data' => 'w3c-dawg2/data-r2/basic/data-2.ttl', 'query' => 'w3c-dawg2/data-r2/basic/list-4.rq', 'result' => 'w3c-dawg2/data-r2/basic/list-4.srx', ), - 10 => + 10 => array ( 'title' => 'Basic - Quotes 1', 'data' => 'w3c-dawg2/data-r2/basic/data-3.ttl', 'query' => 'w3c-dawg2/data-r2/basic/quotes-1.rq', 'result' => 'w3c-dawg2/data-r2/basic/quotes-1.srx', ), - 11 => + 11 => array ( 'title' => 'Basic - Quotes 2', 'data' => 'w3c-dawg2/data-r2/basic/data-3.ttl', 'query' => 'w3c-dawg2/data-r2/basic/quotes-2.rq', 'result' => 'w3c-dawg2/data-r2/basic/quotes-2.srx', ), - 12 => + 12 => array ( 'title' => 'Basic - Quotes 3', 'data' => 'w3c-dawg2/data-r2/basic/data-3.ttl', 'query' => 'w3c-dawg2/data-r2/basic/quotes-3.rq', 'result' => 'w3c-dawg2/data-r2/basic/quotes-3.srx', ), - 13 => + 13 => array ( 'title' => 'Basic - Quotes 4', 'data' => 'w3c-dawg2/data-r2/basic/data-3.ttl', 'query' => 'w3c-dawg2/data-r2/basic/quotes-4.rq', 'result' => 'w3c-dawg2/data-r2/basic/quotes-4.srx', ), - 14 => + 14 => array ( 'title' => 'Basic - Term 1', 'data' => 'w3c-dawg2/data-r2/basic/data-4.ttl', 'query' => 'w3c-dawg2/data-r2/basic/term-1.rq', 'result' => 'w3c-dawg2/data-r2/basic/term-1.srx', ), - 15 => + 15 => array ( 'title' => 'Basic - Term 2', 'data' => 'w3c-dawg2/data-r2/basic/data-4.ttl', 'query' => 'w3c-dawg2/data-r2/basic/term-2.rq', 'result' => 'w3c-dawg2/data-r2/basic/term-2.srx', ), - 16 => + 16 => array ( 'title' => 'Basic - Term 3', 'data' => 'w3c-dawg2/data-r2/basic/data-4.ttl', 'query' => 'w3c-dawg2/data-r2/basic/term-3.rq', 'result' => 'w3c-dawg2/data-r2/basic/term-3.srx', ), - 17 => + 17 => array ( 'title' => 'Basic - Term 4', 'data' => 'w3c-dawg2/data-r2/basic/data-4.ttl', 'query' => 'w3c-dawg2/data-r2/basic/term-4.rq', 'result' => 'w3c-dawg2/data-r2/basic/term-4.srx', ), - 18 => + 18 => array ( 'title' => 'Basic - Term 5', 'data' => 'w3c-dawg2/data-r2/basic/data-4.ttl', 'query' => 'w3c-dawg2/data-r2/basic/term-5.rq', 'result' => 'w3c-dawg2/data-r2/basic/term-5.srx', ), - 19 => + 19 => array ( 'title' => 'Basic - Term 6', 'data' => 'w3c-dawg2/data-r2/basic/data-4.ttl', 'query' => 'w3c-dawg2/data-r2/basic/term-6.rq', 'result' => 'w3c-dawg2/data-r2/basic/term-6.srx', ), - 20 => + 20 => array ( 'title' => 'Basic - Term 7', 'data' => 'w3c-dawg2/data-r2/basic/data-4.ttl', 'query' => 'w3c-dawg2/data-r2/basic/term-7.rq', 'result' => 'w3c-dawg2/data-r2/basic/term-7.srx', ), - 21 => + 21 => array ( 'title' => 'Basic - Term 8', 'data' => 'w3c-dawg2/data-r2/basic/data-4.ttl', 'query' => 'w3c-dawg2/data-r2/basic/term-8.rq', 'result' => 'w3c-dawg2/data-r2/basic/term-8.srx', ), - 22 => + 22 => array ( 'title' => 'Basic - Term 9', 'data' => 'w3c-dawg2/data-r2/basic/data-4.ttl', 'query' => 'w3c-dawg2/data-r2/basic/term-9.rq', 'result' => 'w3c-dawg2/data-r2/basic/term-9.srx', ), - 23 => + 23 => array ( 'title' => 'Basic - Var 1', 'data' => 'w3c-dawg2/data-r2/basic/data-5.ttl', 'query' => 'w3c-dawg2/data-r2/basic/var-1.rq', 'result' => 'w3c-dawg2/data-r2/basic/var-1.srx', ), - 24 => + 24 => array ( 'title' => 'Basic - Var 2', 'data' => 'w3c-dawg2/data-r2/basic/data-5.ttl', 'query' => 'w3c-dawg2/data-r2/basic/var-2.rq', 'result' => 'w3c-dawg2/data-r2/basic/var-2.srx', ), - 25 => + 25 => array ( 'title' => 'dawg-triple-pattern-001', 'data' => 'w3c-dawg2/data-r2/triple-match/data-01.ttl', 'query' => 'w3c-dawg2/data-r2/triple-match/dawg-tp-01.rq', 'result' => 'w3c-dawg2/data-r2/triple-match/result-tp-01.ttl', ), - 26 => + 26 => array ( 'title' => 'dawg-triple-pattern-002', 'data' => 'w3c-dawg2/data-r2/triple-match/data-01.ttl', 'query' => 'w3c-dawg2/data-r2/triple-match/dawg-tp-02.rq', 'result' => 'w3c-dawg2/data-r2/triple-match/result-tp-02.ttl', ), - 27 => + 27 => array ( 'title' => 'dawg-triple-pattern-003', 'data' => 'w3c-dawg2/data-r2/triple-match/data-02.ttl', 'query' => 'w3c-dawg2/data-r2/triple-match/dawg-tp-03.rq', 'result' => 'w3c-dawg2/data-r2/triple-match/result-tp-03.ttl', ), - 28 => + 28 => array ( 'title' => 'dawg-triple-pattern-004', 'data' => 'w3c-dawg2/data-r2/triple-match/dawg-data-01.ttl', 'query' => 'w3c-dawg2/data-r2/triple-match/dawg-tp-04.rq', 'result' => 'w3c-dawg2/data-r2/triple-match/result-tp-04.ttl', ), - 29 => + 29 => array ( 'title' => 'open-eq-01', 'data' => 'w3c-dawg2/data-r2/open-world/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/open-world/open-eq-01.rq', 'result' => 'w3c-dawg2/data-r2/open-world/open-eq-01-result.srx', ), - 30 => + 30 => array ( 'title' => 'open-eq-02', 'data' => 'w3c-dawg2/data-r2/open-world/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/open-world/open-eq-02.rq', 'result' => 'w3c-dawg2/data-r2/open-world/open-eq-02-result.srx', ), - 31 => + 31 => array ( 'title' => 'open-eq-03', 'data' => 'w3c-dawg2/data-r2/open-world/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/open-world/open-eq-03.rq', 'result' => 'w3c-dawg2/data-r2/open-world/open-eq-03-result.srx', ), - 32 => + 32 => array ( 'title' => 'open-eq-04', 'data' => 'w3c-dawg2/data-r2/open-world/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/open-world/open-eq-04.rq', 'result' => 'w3c-dawg2/data-r2/open-world/open-eq-04-result.srx', ), - 33 => + 33 => array ( 'title' => 'open-eq-05', 'data' => 'w3c-dawg2/data-r2/open-world/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/open-world/open-eq-05.rq', 'result' => 'w3c-dawg2/data-r2/open-world/open-eq-05-result.srx', ), - 34 => + 34 => array ( 'title' => 'open-eq-06', 'data' => 'w3c-dawg2/data-r2/open-world/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/open-world/open-eq-06.rq', 'result' => 'w3c-dawg2/data-r2/open-world/open-eq-06-result.srx', ), - 35 => + 35 => array ( 'title' => 'open-eq-07', 'data' => 'w3c-dawg2/data-r2/open-world/data-2.ttl', 'query' => 'w3c-dawg2/data-r2/open-world/open-eq-07.rq', 'result' => 'w3c-dawg2/data-r2/open-world/open-eq-07-result.srx', ), - 36 => + 36 => array ( 'title' => 'open-eq-08', 'data' => 'w3c-dawg2/data-r2/open-world/data-2.ttl', 'query' => 'w3c-dawg2/data-r2/open-world/open-eq-08.rq', 'result' => 'w3c-dawg2/data-r2/open-world/open-eq-08-result.srx', ), - 37 => + 37 => array ( 'title' => 'open-eq-09', 'data' => 'w3c-dawg2/data-r2/open-world/data-2.ttl', 'query' => 'w3c-dawg2/data-r2/open-world/open-eq-09.rq', 'result' => 'w3c-dawg2/data-r2/open-world/open-eq-09-result.srx', ), - 38 => + 38 => array ( 'title' => 'open-eq-10', 'data' => 'w3c-dawg2/data-r2/open-world/data-2.ttl', 'query' => 'w3c-dawg2/data-r2/open-world/open-eq-10.rq', 'result' => 'w3c-dawg2/data-r2/open-world/open-eq-10-result.srx', ), - 39 => + 39 => array ( 'title' => 'open-eq-11', 'data' => 'w3c-dawg2/data-r2/open-world/data-2.ttl', 'query' => 'w3c-dawg2/data-r2/open-world/open-eq-11.rq', 'result' => 'w3c-dawg2/data-r2/open-world/open-eq-11-result.srx', ), - 40 => + 40 => array ( 'title' => 'open-eq-12', 'data' => 'w3c-dawg2/data-r2/open-world/data-2.ttl', 'query' => 'w3c-dawg2/data-r2/open-world/open-eq-12.rq', 'result' => 'w3c-dawg2/data-r2/open-world/open-eq-12-result.srx', ), - 41 => + 41 => array ( 'title' => 'date-1', 'data' => 'w3c-dawg2/data-r2/open-world/data-3.ttl', 'query' => 'w3c-dawg2/data-r2/open-world/date-1.rq', 'result' => 'w3c-dawg2/data-r2/open-world/date-1-result.srx', ), - 42 => + 42 => array ( 'title' => 'date-2', 'data' => 'w3c-dawg2/data-r2/open-world/data-3.ttl', 'query' => 'w3c-dawg2/data-r2/open-world/date-2.rq', 'result' => 'w3c-dawg2/data-r2/open-world/date-2-result.srx', ), - 43 => + 43 => array ( 'title' => 'date-3', 'data' => 'w3c-dawg2/data-r2/open-world/data-3.ttl', 'query' => 'w3c-dawg2/data-r2/open-world/date-3.rq', 'result' => 'w3c-dawg2/data-r2/open-world/date-3-result.srx', ), - 44 => + 44 => array ( 'title' => 'date-4', 'data' => 'w3c-dawg2/data-r2/open-world/data-3.ttl', 'query' => 'w3c-dawg2/data-r2/open-world/date-4.rq', 'result' => 'w3c-dawg2/data-r2/open-world/date-4-result.srx', ), - 45 => + 45 => array ( 'title' => 'open-cmp-01', 'data' => 'w3c-dawg2/data-r2/open-world/data-4.ttl', 'query' => 'w3c-dawg2/data-r2/open-world/open-cmp-01.rq', 'result' => 'w3c-dawg2/data-r2/open-world/open-cmp-01-result.srx', ), - 46 => + 46 => array ( 'title' => 'open-cmp-02', 'data' => 'w3c-dawg2/data-r2/open-world/data-4.ttl', 'query' => 'w3c-dawg2/data-r2/open-world/open-cmp-02.rq', 'result' => 'w3c-dawg2/data-r2/open-world/open-cmp-02-result.srx', ), - 47 => + 47 => array ( 'title' => 'Nested Optionals - 1', 'data' => 'w3c-dawg2/data-r2/algebra/two-nested-opt.ttl', 'query' => 'w3c-dawg2/data-r2/algebra/two-nested-opt.rq', 'result' => 'w3c-dawg2/data-r2/algebra/two-nested-opt.srx', ), - 48 => + 48 => array ( 'title' => 'Nested Optionals - 2', 'data' => 'w3c-dawg2/data-r2/algebra/two-nested-opt.ttl', 'query' => 'w3c-dawg2/data-r2/algebra/two-nested-opt-alt.rq', 'result' => 'w3c-dawg2/data-r2/algebra/two-nested-opt-alt.srx', ), - 49 => + 49 => array ( 'title' => 'Optional-filter - 1', 'data' => 'w3c-dawg2/data-r2/algebra/opt-filter-1.ttl', 'query' => 'w3c-dawg2/data-r2/algebra/opt-filter-1.rq', 'result' => 'w3c-dawg2/data-r2/algebra/opt-filter-1.srx', ), - 50 => + 50 => array ( 'title' => 'Optional-filter - 2 filters', 'data' => 'w3c-dawg2/data-r2/algebra/opt-filter-2.ttl', 'query' => 'w3c-dawg2/data-r2/algebra/opt-filter-2.rq', 'result' => 'w3c-dawg2/data-r2/algebra/opt-filter-2.srx', ), - 51 => + 51 => array ( 'title' => 'Optional-filter - scope of variable', 'data' => 'w3c-dawg2/data-r2/algebra/opt-filter-3.ttl', 'query' => 'w3c-dawg2/data-r2/algebra/opt-filter-3.rq', 'result' => 'w3c-dawg2/data-r2/algebra/opt-filter-3.srx', ), - 52 => + 52 => array ( 'title' => 'Filter-placement - 1', 'data' => 'w3c-dawg2/data-r2/algebra/data-2.ttl', 'query' => 'w3c-dawg2/data-r2/algebra/filter-placement-1.rq', 'result' => 'w3c-dawg2/data-r2/algebra/filter-placement-1.srx', ), - 53 => + 53 => array ( 'title' => 'Filter-placement - 2', 'data' => 'w3c-dawg2/data-r2/algebra/data-2.ttl', 'query' => 'w3c-dawg2/data-r2/algebra/filter-placement-2.rq', 'result' => 'w3c-dawg2/data-r2/algebra/filter-placement-2.srx', ), - 54 => + 54 => array ( 'title' => 'Filter-placement - 3', 'data' => 'w3c-dawg2/data-r2/algebra/data-2.ttl', 'query' => 'w3c-dawg2/data-r2/algebra/filter-placement-3.rq', 'result' => 'w3c-dawg2/data-r2/algebra/filter-placement-3.srx', ), - 55 => + 55 => array ( 'title' => 'Filter-nested - 1', 'data' => 'w3c-dawg2/data-r2/algebra/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/algebra/filter-nested-1.rq', 'result' => 'w3c-dawg2/data-r2/algebra/filter-nested-1.srx', ), - 56 => + 56 => array ( 'title' => 'Filter-nested - 2', 'data' => 'w3c-dawg2/data-r2/algebra/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/algebra/filter-nested-2.rq', 'result' => 'w3c-dawg2/data-r2/algebra/filter-nested-2.srx', ), - 57 => + 57 => array ( 'title' => 'Filter-scope - 1', 'data' => 'w3c-dawg2/data-r2/algebra/data-2.ttl', 'query' => 'w3c-dawg2/data-r2/algebra/filter-scope-1.rq', 'result' => 'w3c-dawg2/data-r2/algebra/filter-scope-1.srx', ), - 58 => + 58 => array ( 'title' => 'Join scope - 1', 'data' => 'w3c-dawg2/data-r2/algebra/var-scope-join-1.ttl', 'query' => 'w3c-dawg2/data-r2/algebra/var-scope-join-1.rq', 'result' => 'w3c-dawg2/data-r2/algebra/var-scope-join-1.srx', ), - 59 => + 59 => array ( 'title' => 'dawg-bnode-coreference', 'data' => 'w3c-dawg2/data-r2/bnode-coreference/data.ttl', 'query' => 'w3c-dawg2/data-r2/bnode-coreference/query.rq', 'result' => 'w3c-dawg2/data-r2/bnode-coreference/result.ttl', ), - 60 => + 60 => array ( 'title' => 'One optional clause', 'data' => 'w3c-dawg2/data-r2/optional/data.ttl', 'query' => 'w3c-dawg2/data-r2/optional/q-opt-1.rq', 'result' => 'w3c-dawg2/data-r2/optional/result-opt-1.ttl', ), - 61 => + 61 => array ( 'title' => 'Two optional clauses', 'data' => 'w3c-dawg2/data-r2/optional/data.ttl', 'query' => 'w3c-dawg2/data-r2/optional/q-opt-2.rq', 'result' => 'w3c-dawg2/data-r2/optional/result-opt-2.ttl', ), - 62 => + 62 => array ( 'title' => 'Union is not optional', 'data' => 'w3c-dawg2/data-r2/optional/data.ttl', 'query' => 'w3c-dawg2/data-r2/optional/q-opt-3.rq', 'result' => 'w3c-dawg2/data-r2/optional/result-opt-3.ttl', ), - 63 => + 63 => array ( 'title' => 'OPTIONAL-FILTER', 'data' => 'w3c-dawg2/data-r2/optional-filter/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/optional-filter/expr-1.rq', 'result' => 'w3c-dawg2/data-r2/optional-filter/expr-1-result.ttl', ), - 64 => + 64 => array ( 'title' => 'OPTIONAL - Outer FILTER', 'data' => 'w3c-dawg2/data-r2/optional-filter/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/optional-filter/expr-2.rq', 'result' => 'w3c-dawg2/data-r2/optional-filter/expr-2-result.ttl', ), - 65 => + 65 => array ( 'title' => 'OPTIONAL - Outer FILTER with BOUND', 'data' => 'w3c-dawg2/data-r2/optional-filter/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/optional-filter/expr-3.rq', 'result' => 'w3c-dawg2/data-r2/optional-filter/expr-3-result.ttl', ), - 66 => + 66 => array ( 'title' => 'graph-01', 'data' => 'w3c-dawg2/data-r2/graph/data-g1.ttl', 'query' => 'w3c-dawg2/data-r2/graph/graph-01.rq', 'result' => 'w3c-dawg2/data-r2/graph/graph-01.ttl', ), - 67 => + 67 => array ( 'title' => 'graph-04', 'data' => 'w3c-dawg2/data-r2/graph/data-g1.ttl', 'query' => 'w3c-dawg2/data-r2/graph/graph-04.rq', 'result' => 'w3c-dawg2/data-r2/graph/graph-04.ttl', ), - 68 => + 68 => array ( 'title' => 'graph-05', 'data' => 'w3c-dawg2/data-r2/graph/data-g1.ttl', 'query' => 'w3c-dawg2/data-r2/graph/graph-05.rq', 'result' => 'w3c-dawg2/data-r2/graph/graph-05.ttl', ), - 69 => + 69 => array ( 'title' => 'graph-06', 'data' => 'w3c-dawg2/data-r2/graph/data-g1.ttl', 'query' => 'w3c-dawg2/data-r2/graph/graph-06.rq', 'result' => 'w3c-dawg2/data-r2/graph/graph-06.ttl', ), - 70 => + 70 => array ( 'title' => 'graph-07', 'data' => 'w3c-dawg2/data-r2/graph/data-g1.ttl', 'query' => 'w3c-dawg2/data-r2/graph/graph-07.rq', 'result' => 'w3c-dawg2/data-r2/graph/graph-07.ttl', ), - 71 => + 71 => array ( 'title' => 'graph-08', 'data' => 'w3c-dawg2/data-r2/graph/data-g1.ttl', 'query' => 'w3c-dawg2/data-r2/graph/graph-08.rq', 'result' => 'w3c-dawg2/data-r2/graph/graph-08.ttl', ), - 72 => + 72 => array ( 'title' => 'graph-09', 'data' => 'w3c-dawg2/data-r2/graph/data-g3.ttl', 'query' => 'w3c-dawg2/data-r2/graph/graph-09.rq', 'result' => 'w3c-dawg2/data-r2/graph/graph-09.ttl', ), - 73 => + 73 => array ( 'title' => 'graph-10', 'data' => 'w3c-dawg2/data-r2/graph/data-g3.ttl', 'query' => 'w3c-dawg2/data-r2/graph/graph-10.rq', 'result' => 'w3c-dawg2/data-r2/graph/graph-10.ttl', ), - 74 => + 74 => array ( 'title' => 'graph-11', 'data' => 'w3c-dawg2/data-r2/graph/data-g1.ttl', 'query' => 'w3c-dawg2/data-r2/graph/graph-11.rq', 'result' => 'w3c-dawg2/data-r2/graph/graph-11.ttl', ), - 75 => + 75 => array ( 'title' => 'Test \'boolean effective value\' - true', 'data' => 'w3c-dawg2/data-r2/boolean-effective-value/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/boolean-effective-value/query-bev-1.rq', 'result' => 'w3c-dawg2/data-r2/boolean-effective-value/result-bev-1.ttl', ), - 76 => + 76 => array ( 'title' => 'Test \'boolean effective value\' - false', 'data' => 'w3c-dawg2/data-r2/boolean-effective-value/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/boolean-effective-value/query-bev-2.rq', 'result' => 'w3c-dawg2/data-r2/boolean-effective-value/result-bev-2.ttl', ), - 77 => + 77 => array ( 'title' => 'Test \'boolean effective value\' - &&', 'data' => 'w3c-dawg2/data-r2/boolean-effective-value/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/boolean-effective-value/query-bev-3.rq', 'result' => 'w3c-dawg2/data-r2/boolean-effective-value/result-bev-3.ttl', ), - 78 => + 78 => array ( 'title' => 'Test \'boolean effective value\' - ||', 'data' => 'w3c-dawg2/data-r2/boolean-effective-value/data-1.ttl', 'query' => 'w3c-dawg2/data-r2/boolean-effective-value/query-bev-4.rq', 'result' => 'w3c-dawg2/data-r2/boolean-effective-value/result-bev-4.ttl', ), - 79 => + 79 => array ( 'title' => 'Test \'boolean effective value\' - optional', 'data' => 'w3c-dawg2/data-r2/boolean-effective-value/data-2.ttl', 'query' => 'w3c-dawg2/data-r2/boolean-effective-value/query-bev-5.rq', 'result' => 'w3c-dawg2/data-r2/boolean-effective-value/result-bev-5.ttl', ), - 80 => + 80 => array ( 'title' => 'Test \'boolean effective value\' - unknown types', 'data' => 'w3c-dawg2/data-r2/boolean-effective-value/data-2.ttl', 'query' => 'w3c-dawg2/data-r2/boolean-effective-value/query-bev-6.rq', 'result' => 'w3c-dawg2/data-r2/boolean-effective-value/result-bev-6.ttl', ), - 81 => + 81 => array ( 'title' => 'dawg-bound-query-001', 'data' => 'w3c-dawg2/data-r2/bound/data.ttl', 'query' => 'w3c-dawg2/data-r2/bound/bound1.rq', 'result' => 'w3c-dawg2/data-r2/bound/bound1-result.ttl', ), - 82 => + 82 => array ( 'title' => 'str-1', 'data' => 'w3c-dawg2/data-r2/expr-builtin/data-builtin-1.ttl', 'query' => 'w3c-dawg2/data-r2/expr-builtin/q-str-1.rq', 'result' => 'w3c-dawg2/data-r2/expr-builtin/result-str-1.ttl', ), - 83 => + 83 => array ( 'title' => 'str-2', 'data' => 'w3c-dawg2/data-r2/expr-builtin/data-builtin-1.ttl', 'query' => 'w3c-dawg2/data-r2/expr-builtin/q-str-2.rq', 'result' => 'w3c-dawg2/data-r2/expr-builtin/result-str-2.ttl', ), - 84 => + 84 => array ( 'title' => 'str-3', 'data' => 'w3c-dawg2/data-r2/expr-builtin/data-builtin-1.ttl', 'query' => 'w3c-dawg2/data-r2/expr-builtin/q-str-3.rq', 'result' => 'w3c-dawg2/data-r2/expr-builtin/result-str-3.ttl', ), - 85 => + 85 => array ( 'title' => 'str-4', 'data' => 'w3c-dawg2/data-r2/expr-builtin/data-builtin-1.ttl', 'query' => 'w3c-dawg2/data-r2/expr-builtin/q-str-4.rq', 'result' => 'w3c-dawg2/data-r2/expr-builtin/result-str-4.ttl', ), - 86 => + 86 => array ( 'title' => 'isBlank-1', 'data' => 'w3c-dawg2/data-r2/expr-builtin/data-builtin-1.ttl', 'query' => 'w3c-dawg2/data-r2/expr-builtin/q-blank-1.rq', 'result' => 'w3c-dawg2/data-r2/expr-builtin/result-blank-1.ttl', ), - 87 => + 87 => array ( 'title' => 'datatype-1', 'data' => 'w3c-dawg2/data-r2/expr-builtin/data-builtin-1.ttl', 'query' => 'w3c-dawg2/data-r2/expr-builtin/q-datatype-1.rq', 'result' => 'w3c-dawg2/data-r2/expr-builtin/result-datatype-1.ttl', ), - 88 => + 88 => array ( 'title' => 'datatype-2 : Literals with a datatype', 'data' => 'w3c-dawg2/data-r2/expr-builtin/data-builtin-2.ttl', 'query' => 'w3c-dawg2/data-r2/expr-builtin/q-datatype-2.rq', 'result' => 'w3c-dawg2/data-r2/expr-builtin/result-datatype-2.srx', ), - 89 => + 89 => array ( 'title' => 'datatype-3 : Literals with a datatype of xsd:string', 'data' => 'w3c-dawg2/data-r2/expr-builtin/data-builtin-2.ttl', 'query' => 'w3c-dawg2/data-r2/expr-builtin/q-datatype-3.rq', 'result' => 'w3c-dawg2/data-r2/expr-builtin/result-datatype-3.srx', ), - 90 => + 90 => array ( 'title' => 'lang-1 : Literals with a lang tag of some kind', 'data' => 'w3c-dawg2/data-r2/expr-builtin/data-builtin-2.ttl', 'query' => 'w3c-dawg2/data-r2/expr-builtin/q-lang-1.rq', 'result' => 'w3c-dawg2/data-r2/expr-builtin/result-lang-1.srx', ), - 91 => + 91 => array ( 'title' => 'lang-2 : Literals with a lang tag of \'\'', 'data' => 'w3c-dawg2/data-r2/expr-builtin/data-builtin-2.ttl', 'query' => 'w3c-dawg2/data-r2/expr-builtin/q-lang-2.rq', 'result' => 'w3c-dawg2/data-r2/expr-builtin/result-lang-2.srx', ), - 92 => + 92 => array ( 'title' => 'lang-3 : Graph matching with lang tag being a different case', 'data' => 'w3c-dawg2/data-r2/expr-builtin/data-builtin-2.ttl', 'query' => 'w3c-dawg2/data-r2/expr-builtin/q-lang-3.rq', 'result' => 'w3c-dawg2/data-r2/expr-builtin/result-lang-3.srx', ), - 93 => + 93 => array ( 'title' => 'isURI-1', 'data' => 'w3c-dawg2/data-r2/expr-builtin/data-builtin-1.ttl', 'query' => 'w3c-dawg2/data-r2/expr-builtin/q-uri-1.rq', 'result' => 'w3c-dawg2/data-r2/expr-builtin/result-uri-1.ttl', ), - 94 => + 94 => array ( 'title' => 'LangMatches-1', 'data' => 'w3c-dawg2/data-r2/expr-builtin/data-langMatches.ttl', 'query' => 'w3c-dawg2/data-r2/expr-builtin/q-langMatches-1.rq', 'result' => 'w3c-dawg2/data-r2/expr-builtin/result-langMatches-1.ttl', ), - 95 => + 95 => array ( 'title' => 'LangMatches-2', 'data' => 'w3c-dawg2/data-r2/expr-builtin/data-langMatches.ttl', 'query' => 'w3c-dawg2/data-r2/expr-builtin/q-langMatches-2.rq', 'result' => 'w3c-dawg2/data-r2/expr-builtin/result-langMatches-2.ttl', ), - 96 => + 96 => array ( 'title' => 'LangMatches-3', 'data' => 'w3c-dawg2/data-r2/expr-builtin/data-langMatches.ttl', 'query' => 'w3c-dawg2/data-r2/expr-builtin/q-langMatches-3.rq', 'result' => 'w3c-dawg2/data-r2/expr-builtin/result-langMatches-3.ttl', ), - 97 => + 97 => array ( 'title' => 'LangMatches-4', 'data' => 'w3c-dawg2/data-r2/expr-builtin/data-langMatches.ttl', 'query' => 'w3c-dawg2/data-r2/expr-builtin/q-langMatches-4.rq', 'result' => 'w3c-dawg2/data-r2/expr-builtin/result-langMatches-4.ttl', ), - 98 => + 98 => array ( 'title' => 'lang-case-insensitive-eq', 'data' => 'w3c-dawg2/data-r2/expr-builtin/lang-case-sensitivity.ttl', 'query' => 'w3c-dawg2/data-r2/expr-builtin/lang-case-sensitivity-eq.rq', 'result' => 'w3c-dawg2/data-r2/expr-builtin/lang-case-insensitive-eq.srx', ), - 99 => + 99 => array ( 'title' => 'lang-case-insensitive-ne', 'data' => 'w3c-dawg2/data-r2/expr-builtin/lang-case-sensitivity.ttl', 'query' => 'w3c-dawg2/data-r2/expr-builtin/lang-case-sensitivity-ne.rq', 'result' => 'w3c-dawg2/data-r2/expr-builtin/lang-case-insensitive-ne.srx', ), - 100 => + 100 => array ( 'title' => 'Equality 1-1', 'data' => 'w3c-dawg2/data-r2/expr-equals/data-eq.ttl', 'query' => 'w3c-dawg2/data-r2/expr-equals/query-eq-1.rq', 'result' => 'w3c-dawg2/data-r2/expr-equals/result-eq-1.ttl', ), - 101 => + 101 => array ( 'title' => 'Equality 1-2', 'data' => 'w3c-dawg2/data-r2/expr-equals/data-eq.ttl', 'query' => 'w3c-dawg2/data-r2/expr-equals/query-eq-2.rq', 'result' => 'w3c-dawg2/data-r2/expr-equals/result-eq-2.ttl', ), - 102 => + 102 => array ( 'title' => 'Equality 1-3', 'data' => 'w3c-dawg2/data-r2/expr-equals/data-eq.ttl', 'query' => 'w3c-dawg2/data-r2/expr-equals/query-eq-3.rq', 'result' => 'w3c-dawg2/data-r2/expr-equals/result-eq-3.ttl', ), - 103 => + 103 => array ( 'title' => 'Equality 1-4', 'data' => 'w3c-dawg2/data-r2/expr-equals/data-eq.ttl', 'query' => 'w3c-dawg2/data-r2/expr-equals/query-eq-4.rq', 'result' => 'w3c-dawg2/data-r2/expr-equals/result-eq-4.ttl', ), - 104 => + 104 => array ( 'title' => 'Equality 1-5', 'data' => 'w3c-dawg2/data-r2/expr-equals/data-eq.ttl', 'query' => 'w3c-dawg2/data-r2/expr-equals/query-eq-5.rq', 'result' => 'w3c-dawg2/data-r2/expr-equals/result-eq-5.ttl', ), - 105 => + 105 => array ( 'title' => 'Equality - 2 var - test equals', 'data' => 'w3c-dawg2/data-r2/expr-equals/data-eq.ttl', 'query' => 'w3c-dawg2/data-r2/expr-equals/query-eq2-1.rq', 'result' => 'w3c-dawg2/data-r2/expr-equals/result-eq2-1.ttl', ), - 106 => + 106 => array ( 'title' => 'Equality - 2 var - test not equals ', 'data' => 'w3c-dawg2/data-r2/expr-equals/data-eq.ttl', 'query' => 'w3c-dawg2/data-r2/expr-equals/query-eq2-1.rq', 'result' => 'w3c-dawg2/data-r2/expr-equals/result-eq2-1.ttl', ), - 107 => + 107 => array ( 'title' => 'Equality 1-1 -- graph', 'data' => 'w3c-dawg2/data-r2/expr-equals/data-eq.ttl', 'query' => 'w3c-dawg2/data-r2/expr-equals/query-eq-graph-1.rq', 'result' => 'w3c-dawg2/data-r2/expr-equals/result-eq-graph-1.ttl', ), - 108 => + 108 => array ( 'title' => 'Equality 1-2 -- graph', 'data' => 'w3c-dawg2/data-r2/expr-equals/data-eq.ttl', 'query' => 'w3c-dawg2/data-r2/expr-equals/query-eq-graph-2.rq', 'result' => 'w3c-dawg2/data-r2/expr-equals/result-eq-graph-2.ttl', ), - 109 => + 109 => array ( 'title' => 'Equality 1-3 -- graph', 'data' => 'w3c-dawg2/data-r2/expr-equals/data-eq.ttl', 'query' => 'w3c-dawg2/data-r2/expr-equals/query-eq-graph-3.rq', 'result' => 'w3c-dawg2/data-r2/expr-equals/result-eq-graph-3.ttl', ), - 110 => + 110 => array ( 'title' => 'Equality 1-4 -- graph', 'data' => 'w3c-dawg2/data-r2/expr-equals/data-eq.ttl', 'query' => 'w3c-dawg2/data-r2/expr-equals/query-eq-graph-4.rq', 'result' => 'w3c-dawg2/data-r2/expr-equals/result-eq-graph-4.ttl', ), - 111 => + 111 => array ( 'title' => 'Equality 1-5 -- graph', 'data' => 'w3c-dawg2/data-r2/expr-equals/data-eq.ttl', 'query' => 'w3c-dawg2/data-r2/expr-equals/query-eq-graph-5.rq', 'result' => 'w3c-dawg2/data-r2/expr-equals/result-eq-graph-5.ttl', ), - 112 => + 112 => array ( 'title' => 'regex-query-001', 'data' => 'w3c-dawg2/data-r2/regex/regex-data-01.ttl', 'query' => 'w3c-dawg2/data-r2/regex/regex-query-001.rq', 'result' => 'w3c-dawg2/data-r2/regex/regex-result-001.ttl', ), - 113 => + 113 => array ( 'title' => 'regex-query-002', 'data' => 'w3c-dawg2/data-r2/regex/regex-data-01.ttl', 'query' => 'w3c-dawg2/data-r2/regex/regex-query-002.rq', 'result' => 'w3c-dawg2/data-r2/regex/regex-result-002.ttl', ), - 114 => + 114 => array ( 'title' => 'regex-query-003', 'data' => 'w3c-dawg2/data-r2/regex/regex-data-01.ttl', 'query' => 'w3c-dawg2/data-r2/regex/regex-query-003.rq', 'result' => 'w3c-dawg2/data-r2/regex/regex-result-003.ttl', ), - 115 => + 115 => array ( 'title' => 'regex-query-004', 'data' => 'w3c-dawg2/data-r2/regex/regex-data-01.ttl', 'query' => 'w3c-dawg2/data-r2/regex/regex-query-004.rq', 'result' => 'w3c-dawg2/data-r2/regex/regex-result-004.ttl', ), - 116 => + 116 => array ( 'title' => 'dawg-construct-identity', 'data' => 'w3c-dawg2/data-r2/construct/data-ident.ttl', 'query' => 'w3c-dawg2/data-r2/construct/query-ident.rq', 'result' => 'w3c-dawg2/data-r2/construct/result-ident.ttl', ), - 117 => + 117 => array ( 'title' => 'ASK-1 (SPARQL XML results)', 'data' => 'w3c-dawg2/data-r2/ask/data.ttl', 'query' => 'w3c-dawg2/data-r2/ask/ask-1.rq', 'result' => 'w3c-dawg2/data-r2/ask/ask-1.srx', ), - 118 => + 118 => array ( 'title' => 'ASK-4 (SPARQL XML results)', 'data' => 'w3c-dawg2/data-r2/ask/data.ttl', 'query' => 'w3c-dawg2/data-r2/ask/ask-4.rq', 'result' => 'w3c-dawg2/data-r2/ask/ask-4.srx', ), - 119 => + 119 => array ( 'title' => 'ASK-7 (SPARQL XML results)', 'data' => 'w3c-dawg2/data-r2/ask/data.ttl', 'query' => 'w3c-dawg2/data-r2/ask/ask-7.rq', 'result' => 'w3c-dawg2/data-r2/ask/ask-7.srx', ), - 120 => + 120 => array ( 'title' => 'SELECT DISTINCT *', 'data' => 'w3c-dawg2/data-r2/distinct/data-star.ttl', 'query' => 'w3c-dawg2/data-r2/distinct/distinct-star-1.rq', 'result' => 'w3c-dawg2/data-r2/distinct/distinct-star-1.srx', ), - 121 => + 121 => array ( 'title' => 'Numbers: No distinct', 'data' => 'w3c-dawg2/data-r2/distinct/data-num.ttl', 'query' => 'w3c-dawg2/data-r2/distinct/no-distinct-1.rq', 'result' => 'w3c-dawg2/data-r2/distinct/no-distinct-num.srx', ), - 122 => + 122 => array ( 'title' => 'Numbers: Distinct', 'data' => 'w3c-dawg2/data-r2/distinct/data-num.ttl', 'query' => 'w3c-dawg2/data-r2/distinct/distinct-1.rq', 'result' => 'w3c-dawg2/data-r2/distinct/distinct-num.srx', ), - 123 => + 123 => array ( 'title' => 'Strings: No distinct', 'data' => 'w3c-dawg2/data-r2/distinct/data-str.ttl', 'query' => 'w3c-dawg2/data-r2/distinct/no-distinct-1.rq', 'result' => 'w3c-dawg2/data-r2/distinct/no-distinct-str.srx', ), - 124 => + 124 => array ( 'title' => 'Strings: Distinct', 'data' => 'w3c-dawg2/data-r2/distinct/data-str.ttl', 'query' => 'w3c-dawg2/data-r2/distinct/distinct-1.rq', 'result' => 'w3c-dawg2/data-r2/distinct/distinct-str.srx', ), - 125 => + 125 => array ( 'title' => 'Nodes: No distinct', 'data' => 'w3c-dawg2/data-r2/distinct/data-node.ttl', 'query' => 'w3c-dawg2/data-r2/distinct/no-distinct-1.rq', 'result' => 'w3c-dawg2/data-r2/distinct/no-distinct-node.srx', ), - 126 => + 126 => array ( 'title' => 'Nodes: Distinct', 'data' => 'w3c-dawg2/data-r2/distinct/data-node.ttl', 'query' => 'w3c-dawg2/data-r2/distinct/distinct-1.rq', 'result' => 'w3c-dawg2/data-r2/distinct/distinct-node.srx', ), - 127 => + 127 => array ( 'title' => 'Opt: No distinct', 'data' => 'w3c-dawg2/data-r2/distinct/data-opt.ttl', 'query' => 'w3c-dawg2/data-r2/distinct/no-distinct-2.rq', 'result' => 'w3c-dawg2/data-r2/distinct/no-distinct-opt.srx', ), - 128 => + 128 => array ( 'title' => 'Opt: Distinct', 'data' => 'w3c-dawg2/data-r2/distinct/data-opt.ttl', 'query' => 'w3c-dawg2/data-r2/distinct/distinct-2.rq', 'result' => 'w3c-dawg2/data-r2/distinct/distinct-opt.srx', ), - 129 => + 129 => array ( 'title' => 'All: No distinct', 'data' => 'w3c-dawg2/data-r2/distinct/data-all.ttl', 'query' => 'w3c-dawg2/data-r2/distinct/no-distinct-1.rq', 'result' => 'w3c-dawg2/data-r2/distinct/no-distinct-all.srx', ), - 130 => + 130 => array ( 'title' => 'All: Distinct', 'data' => 'w3c-dawg2/data-r2/distinct/data-all.ttl', 'query' => 'w3c-dawg2/data-r2/distinct/distinct-1.rq', 'result' => 'w3c-dawg2/data-r2/distinct/distinct-all.srx', ), - 131 => + 131 => array ( 'title' => 'sort-1', 'data' => 'w3c-dawg2/data-r2/sort/data-sort-1.ttl', 'query' => 'w3c-dawg2/data-r2/sort/query-sort-1.rq', 'result' => 'w3c-dawg2/data-r2/sort/result-sort-1.rdf', ), - 132 => + 132 => array ( 'title' => 'sort-2', 'data' => 'w3c-dawg2/data-r2/sort/data-sort-1.ttl', 'query' => 'w3c-dawg2/data-r2/sort/query-sort-2.rq', 'result' => 'w3c-dawg2/data-r2/sort/result-sort-2.rdf', ), - 133 => + 133 => array ( 'title' => 'sort-3', 'data' => 'w3c-dawg2/data-r2/sort/data-sort-3.ttl', 'query' => 'w3c-dawg2/data-r2/sort/query-sort-3.rq', 'result' => 'w3c-dawg2/data-r2/sort/result-sort-3.rdf', ), - 134 => + 134 => array ( 'title' => 'sort-4', 'data' => 'w3c-dawg2/data-r2/sort/data-sort-4.ttl', 'query' => 'w3c-dawg2/data-r2/sort/query-sort-4.rq', 'result' => 'w3c-dawg2/data-r2/sort/result-sort-4.rdf', ), - 135 => + 135 => array ( 'title' => 'sort-5', 'data' => 'w3c-dawg2/data-r2/sort/data-sort-4.ttl', 'query' => 'w3c-dawg2/data-r2/sort/query-sort-5.rq', 'result' => 'w3c-dawg2/data-r2/sort/result-sort-5.rdf', ), - 136 => + 136 => array ( 'title' => 'sort-6', 'data' => 'w3c-dawg2/data-r2/sort/data-sort-6.ttl', 'query' => 'w3c-dawg2/data-r2/sort/query-sort-6.rq', 'result' => 'w3c-dawg2/data-r2/sort/result-sort-6.rdf', ), - 137 => + 137 => array ( 'title' => 'sort-7', 'data' => 'w3c-dawg2/data-r2/sort/data-sort-7.ttl', 'query' => 'w3c-dawg2/data-r2/sort/query-sort-4.rq', 'result' => 'w3c-dawg2/data-r2/sort/result-sort-7.rdf', ), - 138 => + 138 => array ( 'title' => 'sort-8', 'data' => 'w3c-dawg2/data-r2/sort/data-sort-8.ttl', 'query' => 'w3c-dawg2/data-r2/sort/query-sort-4.rq', 'result' => 'w3c-dawg2/data-r2/sort/result-sort-8.rdf', ), - 139 => + 139 => array ( 'title' => 'sort-9', 'data' => 'w3c-dawg2/data-r2/sort/data-sort-9.ttl', 'query' => 'w3c-dawg2/data-r2/sort/query-sort-9.rq', 'result' => 'w3c-dawg2/data-r2/sort/result-sort-9.rdf', ), - 140 => + 140 => array ( 'title' => 'sort-10', 'data' => 'w3c-dawg2/data-r2/sort/data-sort-9.ttl', 'query' => 'w3c-dawg2/data-r2/sort/query-sort-10.rq', 'result' => 'w3c-dawg2/data-r2/sort/result-sort-10.rdf', ), - 141 => + 141 => array ( 'title' => 'syntax-basic-01.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-basic-01.rq', 'type' => 'syntax-positive', ), - 142 => + 142 => array ( 'title' => 'syntax-basic-02.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-basic-02.rq', 'type' => 'syntax-positive', ), - 143 => + 143 => array ( 'title' => 'syntax-basic-03.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-basic-03.rq', 'type' => 'syntax-positive', ), - 144 => + 144 => array ( 'title' => 'syntax-basic-04.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-basic-04.rq', 'type' => 'syntax-positive', ), - 145 => + 145 => array ( 'title' => 'syntax-basic-05.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-basic-05.rq', 'type' => 'syntax-positive', ), - 146 => + 146 => array ( 'title' => 'syntax-basic-06.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-basic-06.rq', 'type' => 'syntax-positive', ), - 147 => + 147 => array ( 'title' => 'syntax-qname-01.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-qname-01.rq', 'type' => 'syntax-positive', ), - 148 => + 148 => array ( 'title' => 'syntax-qname-02.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-qname-02.rq', 'type' => 'syntax-positive', ), - 149 => + 149 => array ( 'title' => 'syntax-qname-03.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-qname-03.rq', 'type' => 'syntax-positive', ), - 150 => + 150 => array ( 'title' => 'syntax-qname-04.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-qname-04.rq', 'type' => 'syntax-positive', ), - 151 => + 151 => array ( 'title' => 'syntax-qname-05.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-qname-05.rq', 'type' => 'syntax-positive', ), - 152 => + 152 => array ( 'title' => 'syntax-qname-06.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-qname-06.rq', 'type' => 'syntax-positive', ), - 153 => + 153 => array ( 'title' => 'syntax-qname-07.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-qname-07.rq', 'type' => 'syntax-positive', ), - 154 => + 154 => array ( 'title' => 'syntax-qname-08.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-qname-08.rq', 'type' => 'syntax-positive', ), - 155 => + 155 => array ( 'title' => 'syntax-lit-01.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-lit-01.rq', 'type' => 'syntax-positive', ), - 156 => + 156 => array ( 'title' => 'syntax-lit-02.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-lit-02.rq', 'type' => 'syntax-positive', ), - 157 => + 157 => array ( 'title' => 'syntax-lit-03.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-lit-03.rq', 'type' => 'syntax-positive', ), - 158 => + 158 => array ( 'title' => 'syntax-lit-04.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-lit-04.rq', 'type' => 'syntax-positive', ), - 159 => + 159 => array ( 'title' => 'syntax-lit-05.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-lit-05.rq', 'type' => 'syntax-positive', ), - 160 => + 160 => array ( 'title' => 'syntax-lit-06.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-lit-06.rq', 'type' => 'syntax-positive', ), - 161 => + 161 => array ( 'title' => 'syntax-lit-07.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-lit-07.rq', 'type' => 'syntax-positive', ), - 162 => + 162 => array ( 'title' => 'syntax-lit-08.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-lit-08.rq', 'type' => 'syntax-positive', ), - 163 => + 163 => array ( 'title' => 'syntax-lit-09.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-lit-09.rq', 'type' => 'syntax-positive', ), - 164 => + 164 => array ( 'title' => 'syntax-lit-10.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-lit-10.rq', 'type' => 'syntax-positive', ), - 165 => + 165 => array ( 'title' => 'syntax-lit-11.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-lit-11.rq', 'type' => 'syntax-positive', ), - 166 => + 166 => array ( 'title' => 'syntax-lit-12.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-lit-12.rq', 'type' => 'syntax-positive', ), - 167 => + 167 => array ( 'title' => 'syntax-lit-13.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-lit-13.rq', 'type' => 'syntax-positive', ), - 168 => + 168 => array ( 'title' => 'syntax-lit-14.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-lit-14.rq', 'type' => 'syntax-positive', ), - 169 => + 169 => array ( 'title' => 'syntax-lit-15.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-lit-15.rq', 'type' => 'syntax-positive', ), - 170 => + 170 => array ( 'title' => 'syntax-lit-16.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-lit-16.rq', 'type' => 'syntax-positive', ), - 171 => + 171 => array ( 'title' => 'syntax-lit-17.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-lit-17.rq', 'type' => 'syntax-positive', ), - 172 => + 172 => array ( 'title' => 'syntax-lit-18.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-lit-18.rq', 'type' => 'syntax-positive', ), - 173 => + 173 => array ( 'title' => 'syntax-lit-19.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-lit-19.rq', 'type' => 'syntax-positive', ), - 174 => + 174 => array ( 'title' => 'syntax-lit-20.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-lit-20.rq', 'type' => 'syntax-positive', ), - 175 => + 175 => array ( 'title' => 'syntax-struct-01.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-struct-01.rq', 'type' => 'syntax-positive', ), - 176 => + 176 => array ( 'title' => 'syntax-struct-02.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-struct-02.rq', 'type' => 'syntax-positive', ), - 177 => + 177 => array ( 'title' => 'syntax-struct-03.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-struct-03.rq', 'type' => 'syntax-positive', ), - 178 => + 178 => array ( 'title' => 'syntax-struct-05.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-struct-05.rq', 'type' => 'syntax-positive', ), - 179 => + 179 => array ( 'title' => 'syntax-struct-06.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-struct-06.rq', 'type' => 'syntax-positive', ), - 180 => + 180 => array ( 'title' => 'syntax-struct-07.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-struct-07.rq', 'type' => 'syntax-positive', ), - 181 => + 181 => array ( 'title' => 'syntax-struct-08.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-struct-08.rq', 'type' => 'syntax-positive', ), - 182 => + 182 => array ( 'title' => 'syntax-struct-09.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-struct-09.rq', 'type' => 'syntax-positive', ), - 183 => + 183 => array ( 'title' => 'syntax-struct-10.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-struct-10.rq', 'type' => 'syntax-positive', ), - 184 => + 184 => array ( 'title' => 'syntax-struct-11.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-struct-11.rq', 'type' => 'syntax-positive', ), - 185 => + 185 => array ( 'title' => 'syntax-struct-12.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-struct-12.rq', 'type' => 'syntax-positive', ), - 186 => + 186 => array ( 'title' => 'syntax-struct-13.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-struct-13.rq', 'type' => 'syntax-positive', ), - 187 => + 187 => array ( 'title' => 'syntax-struct-14.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-struct-14.rq', 'type' => 'syntax-positive', ), - 188 => + 188 => array ( 'title' => 'syntax-lists-01.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-lists-01.rq', 'type' => 'syntax-positive', ), - 189 => + 189 => array ( 'title' => 'syntax-lists-02.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-lists-02.rq', 'type' => 'syntax-positive', ), - 190 => + 190 => array ( 'title' => 'syntax-lists-03.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-lists-03.rq', 'type' => 'syntax-positive', ), - 191 => + 191 => array ( 'title' => 'syntax-lists-04.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-lists-04.rq', 'type' => 'syntax-positive', ), - 192 => + 192 => array ( 'title' => 'syntax-lists-05.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-lists-05.rq', 'type' => 'syntax-positive', ), - 193 => + 193 => array ( 'title' => 'syntax-bnodes-01.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-bnodes-01.rq', 'type' => 'syntax-positive', ), - 194 => + 194 => array ( 'title' => 'syntax-bnodes-02.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-bnodes-02.rq', 'type' => 'syntax-positive', ), - 195 => + 195 => array ( 'title' => 'syntax-bnodes-03.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-bnodes-03.rq', 'type' => 'syntax-positive', ), - 196 => + 196 => array ( 'title' => 'syntax-bnodes-04.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-bnodes-04.rq', 'type' => 'syntax-positive', ), - 197 => + 197 => array ( 'title' => 'syntax-bnodes-05.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-bnodes-05.rq', 'type' => 'syntax-positive', ), - 198 => + 198 => array ( 'title' => 'syntax-forms-01.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-forms-01.rq', 'type' => 'syntax-positive', ), - 199 => + 199 => array ( 'title' => 'syntax-forms-02.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-forms-02.rq', 'type' => 'syntax-positive', ), - 200 => + 200 => array ( 'title' => 'syntax-union-01.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-union-01.rq', 'type' => 'syntax-positive', ), - 201 => + 201 => array ( 'title' => 'syntax-union-02.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-union-02.rq', 'type' => 'syntax-positive', ), - 202 => + 202 => array ( 'title' => 'syntax-expr-01.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-expr-01.rq', 'type' => 'syntax-positive', ), - 203 => + 203 => array ( 'title' => 'syntax-expr-02.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-expr-02.rq', 'type' => 'syntax-positive', ), - 204 => + 204 => array ( 'title' => 'syntax-expr-03.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-expr-03.rq', 'type' => 'syntax-positive', ), - 205 => + 205 => array ( 'title' => 'syntax-expr-04.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-expr-04.rq', 'type' => 'syntax-positive', ), - 206 => + 206 => array ( 'title' => 'syntax-expr-05.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-expr-05.rq', 'type' => 'syntax-positive', ), - 207 => + 207 => array ( 'title' => 'syntax-order-01.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-order-01.rq', 'type' => 'syntax-positive', ), - 208 => + 208 => array ( 'title' => 'syntax-order-02.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-order-02.rq', 'type' => 'syntax-positive', ), - 209 => + 209 => array ( 'title' => 'syntax-order-03.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-order-03.rq', 'type' => 'syntax-positive', ), - 210 => + 210 => array ( 'title' => 'syntax-order-04.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-order-04.rq', 'type' => 'syntax-positive', ), - 211 => + 211 => array ( 'title' => 'syntax-order-05.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-order-05.rq', 'type' => 'syntax-positive', ), - 212 => + 212 => array ( 'title' => 'syntax-order-06.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-order-06.rq', 'type' => 'syntax-positive', ), - 213 => + 213 => array ( 'title' => 'syntax-order-07.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-order-07.rq', 'type' => 'syntax-positive', ), - 214 => + 214 => array ( 'title' => 'syntax-limit-offset-01.rq', 'query' => 'w3c-dawg2/data-r2/syntax-sparql1/syntax-limit-offset-01.rq', 'type' => 'syntax-positive', ), ... [truncated message content] |
From: <cw...@us...> - 2007-08-13 06:44:39
|
Revision: 501 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=501&view=rev Author: cweiske Date: 2007-08-12 23:44:36 -0700 (Sun, 12 Aug 2007) Log Message: ----------- Add single quote support to N3 parser, along with unit tests Modified Paths: -------------- trunk/rdfapi-php/api/syntax/N3Parser.php trunk/rdfapi-php/test/unit/Syntax/n3Parser_test.php Modified: trunk/rdfapi-php/api/syntax/N3Parser.php =================================================================== --- trunk/rdfapi-php/api/syntax/N3Parser.php 2007-08-13 06:14:37 UTC (rev 500) +++ trunk/rdfapi-php/api/syntax/N3Parser.php 2007-08-13 06:44:36 UTC (rev 501) @@ -76,7 +76,12 @@ $bNode = '_:'.$Name; $Univar = '\?'.$Name; $QName = '(?:[A-Za-z][A-Za-z0-9_@\.]*)?:'.$Name; - $Literal = '"(\\\"|[^"])*"'; # '"(?:\\"|[^"])*"' + $Literal = '(?:' + . '"(\\\"|[^"])*"' + . '|' + . "'(\\\'|[^'])*'" + . ')'; + # '"(?:\\"|[^"])*"' $Number = '[-+]?[0-9]+(\\.[0-9]+)?([eE][-+]?[0-9]+)?'; $Boolean = '@(?:true|false)'; // $Literal = '"[^"\\\\]*(?:\\.\\[^"\\]*)*"'; # '"(?:\\"|[^"])*"' @@ -84,7 +89,11 @@ $Datatype = '(\^\^)[^ ,\.;)]+'; $Datatype_URI = '(\^\^)'.$URI; // $LLiteral = '"""[^"\\\\]*(?:(?:.|"(?!""))[^"\\\\]*)*"""'; - $LLiteral = '"""[^"\\\\]*(?:(?:\\\\.|"(?!""))[^"\\\\]*)*"""'; + $LLiteral = '(?:' + . '"""[^"\\\\]*(?:(?:\\\\.|"(?!""))[^"\\\\]*)*"""' + . '|' + . "'''[^'\\\\]*(?:(?:\\\\.|'(?!''))[^\"\\\\]*)*'''" + . ')'; // '"""[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*"""' $Comment = '#.*$'; $Prefix = '(?:[A-Za-z][A-Za-z0-9_]*)?:'; @@ -576,7 +585,7 @@ //float or decimal // After conversion we cannot distinguish between both $list[$i] = floatval($list[$i]); - } else if ((!strstr('<_"?.;,{}[]()@', $list[$i]{0})) + } else if ((!strstr('<_"\'?.;,{}[]()@', $list[$i]{0})) && (substr($list[$i],0,3) != '^^<') ) { //prefix or unknown @@ -596,16 +605,28 @@ } } else { - if ($list[$i]{0} == '"') { // Congratulations - it's a literal! - if (substr($list[$i],0,3) == '"""') { - if (substr($list[$i],-3,3) == '"""') { // A big literal... + if ($list[$i]{0} == '"') { + $bLiteral = true; + $chBase = '"'; + } else if ($list[$i]{0} == '\'') { + $bLiteral = true; + $chBase = '\''; + } else { + $bLiteral = false; + } + if ($bLiteral) { + $tripleBase = $chBase . $chBase . $chBase; + // Congratulations - it's a literal! + if (substr($list[$i], 0, 3) == $tripleBase) { + if (substr($list[$i],-3,3) == $tripleBase) { + // A big literal... $lit = substr($list[$i],3,-3); // print "++$lit++"; $lit=str_replace('\n', '\\n',$lit); - $lit=ereg_replace("[^\\]\"", "\\\"", $lit); + $lit=ereg_replace("[^\\]" . $chBase, "\\" . $chBase, $lit); - $list[$i] = '"'.$lit.'"'; + $list[$i] = $chBase . $lit . $chBase; } else { die ('Incorrect string formatting: '.substr($list[$i],-3,3)); } @@ -1044,7 +1065,7 @@ function toRDFNode($s, $state) { $ins = substr($s, 1, -1); - if ($s{0} == '"') { + if ($s{0} == '"' || $s{0} == '\'') { $lang = NULL; if (count($state)>3) { Modified: trunk/rdfapi-php/test/unit/Syntax/n3Parser_test.php =================================================================== --- trunk/rdfapi-php/test/unit/Syntax/n3Parser_test.php 2007-08-13 06:14:37 UTC (rev 500) +++ trunk/rdfapi-php/test/unit/Syntax/n3Parser_test.php 2007-08-13 06:44:36 UTC (rev 501) @@ -37,16 +37,21 @@ } - function testIsMemmodel() { + + + function testIsMemmodel() + { // Import Package $n3pars= new N3Parser(); $model=$n3pars->parse2model($_SESSION['n3TestInput'],false); $this->assertIsA($model, 'memmodel'); } - function testParsing() { + + function testParsing() + { $n3pars= new N3Parser(); $model=$n3pars->parse2model($_SESSION['n3TestInput'],false); @@ -77,7 +82,62 @@ $this->assertTrue($model->containsAll($model2)); } - function testPrefixNotDeclared() { + + + /** + * Test different string quotation methods + */ + function testQuotes() + { + $n3 = <<<EOT +@prefix : <http://example.org/#> . + +# This file uses UNIX line end conventions. + +:x1 :p1 'x' . +:x2 :p2 '''x +y''' . + +:x3 :p3 """x +y"""^^:someType . + + +EOT; + $parser = &new N3Parser(); + $model = &$parser->parse2model($n3, false); + + $model2 = new MemModel(); + $model2->add( + new Statement( + new Resource("http://example.org/#x1"), + new Resource("http://example.org/#p1"), + new Literal('x') + ) + ); + $model2->add( + new Statement( + new Resource("http://example.org/#x2"), + new Resource("http://example.org/#p2"), + new Literal("x\ny") + ) + ); + $model2->add( + new Statement( + new Resource("http://example.org/#x3"), + new Resource("http://example.org/#p3"), + new Literal("x\ny", null, 'http://example.org/#someType') + ) + ); + + //var_dump($model->triples, $model2->triples); + $this->assertEqual(3, $model->size()); + $this->assertTrue($model->containsAll($model2)); + }//function testQuotes() + + + + function testPrefixNotDeclared() + { $rdfInput=' @prefix m: <http://www.example.org/meeting_organization#>. @@ -93,7 +153,10 @@ $this->assertErrorPattern('[Prefix not declared: p:]'); } - function testLoneSemicolon() { + + + function testLoneSemicolon() + { $n3 = '<a> <b> <c> ; .'; $parser = &new N3Parser(); $model = &$parser->parse2model($n3, false); @@ -101,7 +164,10 @@ $this->assertNoErrors(); } - function testTightClosingList() { + + + function testTightClosingList() + { $n3 = '@prefix : <http://www.w3.org/2001/sw/DataAccess/tests/data-r2/syntax-sparql4/manifest#> . @prefix mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> . <> mf:entries ( mf:syn-09) .'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |