From: <tg...@us...> - 2008-05-06 19:52:01
|
Revision: 567 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=567&view=rev Author: tgauss Date: 2008-05-06 12:51:51 -0700 (Tue, 06 May 2008) Log Message: ----------- 'Subjects' added to the queries response group parameter Modified Paths: -------------- trunk/bookmashup/search.php Modified: trunk/bookmashup/search.php =================================================================== --- trunk/bookmashup/search.php 2008-03-03 14:56:08 UTC (rev 566) +++ trunk/bookmashup/search.php 2008-05-06 19:51:51 UTC (rev 567) @@ -20,7 +20,7 @@ . "&AssociateTag=" . AssocTag . "&Version=2006-09-11" . "&Operation=ItemSearch" - . "&ResponseGroup=Medium" + . "&ResponseGroup=Medium,Subjects" . "&SearchIndex=" . $this->search_index . "&Keywords=" . urlencode($this->search_term) . "&ItemPage=" . $this->page; @@ -35,6 +35,7 @@ 'isbn' => (string) @$item->ItemAttributes->ISBN, 'title' => (string) @$item->ItemAttributes->Title, 'authors' => array(), + 'subjects' => array(), 'uri' => BOOKMASHUP_BASE . "books/" . @$item->ItemAttributes->ISBN, 'image' => (string) @$item->SmallImage->URL, ); @@ -45,6 +46,10 @@ foreach($item->ItemAttributes->Creator as $creator){ $book['authors'][] = (string) $creator; } + foreach ($item->Subjects->Subject as $subject){ + $book['subjects'][] = (string) $subject; + } + $this->results[] = $book; } $this->total_pages = (int) $xml->Items->TotalPages; @@ -72,6 +77,7 @@ $rdf_type = new Resource(RDF_NAMESPACE_URI . "type"); $rdfs_label = new Resource(RDF_SCHEMA_URI . "label"); $dc_creator = new Resource(DC_NS . "creator"); + $dc_subject = new Resource(DC_NS . "subject"); $foaf_name = new Resource(FOAF_NS . "name"); $foaf_depiction = new Resource(FOAF_NS . "depiction"); $SearchResultPage = new Resource(SEARCH_NS . "SearchResultPage"); @@ -118,6 +124,11 @@ $model->add(new Statement($this_result, $dc_creator, $this_author)); $model->add(new Statement($this_author, $foaf_name, new Literal($author))); } + foreach ($book['subjects'] as $key => $subject) { + $this_subject = new BlankNode("result{$i}_subject" . ($key + 1)); + $model->add(new Statement($this_result, $dc_subject, $this_subject)); + $model->add(new Statement($this_subject, $foaf_name, new Literal($subject))); + } } header('Content-Type: application/rdf+xml; charset=utf-8'); include(RDFAPI_INCLUDE_DIR . PACKAGE_SYNTAX_RDF); @@ -236,4 +247,4 @@ <small><a href="<?php echo BOOKMASHUP_BASE; ?>">Back to RDF Book Mashup</a></small> </div> </body> -</html> +</html> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |