本文整理汇总了PHP中ARC2::getRDFJsonSerializer方法的典型用法代码示例。如果您正苦于以下问题:PHP ARC2::getRDFJsonSerializer方法的具体用法?PHP ARC2::getRDFJsonSerializer怎么用?PHP ARC2::getRDFJsonSerializer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ARC2
的用法示例。
在下文中一共展示了ARC2::getRDFJsonSerializer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRdf
/**
* getRdf get the full BIBO RDF serialization of the collection of entries
* @param $format the serialization format
* @throws Exception if PHP_ZOTERO_ENTRIES_ARC_PATH is not defined
*/
public function getRdf($format = 'rdf/xml')
{
if (!defined('PHP_ZOTERO_ENTRIES_ARC_PATH')) {
throw new Exception('PHP_ZOTERO_ENTRIES_ARC_PATH must be defined and valid to use RDF methods');
}
require_once PHP_ZOTERO_ENTRIES_ARC_PATH;
switch ($format) {
case 'rdf/xml':
$ser = ARC2::getRDFXMLSerializer($this->arcConf);
break;
case 'rdf/json':
$ser = ARC2::getRDFJsonSerializer($this->arcConf);
break;
case 'turtle':
$ser = ARC2::getTurtleSerializer($this->arcConf);
break;
case 'ntriples':
$ser = ARC2::getNTriplesSerializer($this->arcConf);
break;
}
return $ser->getSerializedIndex($this->getArcIndex());
}
示例2: getItemAsRdf
/**
* getItemAsRdf returns the BIBO RDF for the entire Zotero Item
* @param $format default 'rdf/xml' the rdf serialization to use
* @return string the RDF serialization
* @throw Exception if PHP_ZOTERO_ENTRIES_ARC_PATH is not defined
*/
public function getItemAsRdf($format = 'rdf/xml')
{
if (!defined('PHP_ZOTERO_ENTRIES_ARC_PATH')) {
throw new Exception('PHP_ZOTERO_ENTRIES_ARC_PATH must be defined and valid to use RDF methods');
}
if (!$this->arcIndex) {
$this->setRdf();
}
switch ($format) {
case 'rdf/xml':
$ser = ARC2::getRDFXMLSerializer($this->arcConf);
break;
case 'rdf/json':
$ser = ARC2::getRDFJsonSerializer($this->arcConf);
break;
case 'turtle':
$ser = ARC2::getTurtleSerializer($this->arcConf);
break;
case 'ntriples':
$ser = ARC2::getNTriplesSerializer($this->arcConf);
break;
}
return $ser->getSerializedIndex(array($this->itemUri => $this->arcIndex[$this->itemUri]));
}