本文整理汇总了PHP中ARC2::getRDFJSONSerializer方法的典型用法代码示例。如果您正苦于以下问题:PHP ARC2::getRDFJSONSerializer方法的具体用法?PHP ARC2::getRDFJSONSerializer怎么用?PHP ARC2::getRDFJSONSerializer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ARC2
的用法示例。
在下文中一共展示了ARC2::getRDFJSONSerializer方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: toRDFJSON
function toRDFJSON($asObject = false)
{
$index = $this->toIndex();
$ser = ARC2::getRDFJSONSerializer(array('ns' => $this->ns));
if ($asObject) {
return json_decode($ser->getSerializedIndex($index));
}
return $ser->getSerializedIndex($index);
}
示例2: printGraph
public function printGraph()
{
/* Serializer instantiation */
$ser = \ARC2::getRDFJSONSerializer();
foreach ($this->objectToPrint as $class => $prop) {
$triples = $prop->getTriples();
}
/* Serialize a triples array */
echo $ser->getSerializedTriples($triples);
}
示例3: getRDFJSONDescribeResultDoc
function getRDFJSONDescribeResultDoc($r)
{
$this->setHeader('content-type', 'Content-Type: application/json');
$index = $r['result'];
$ser = ARC2::getRDFJSONSerializer($this->a);
$dur = $r['query_time'];
$r = $ser->getSerializedIndex($index);
if (($v = $this->p('jsonp')) || ($v = $this->p('callback'))) {
$r = $v . '(' . $r . ')';
}
return $r;
}
示例4: serializeRdf
public static function serializeRdf($data, $extension = 'rdf')
{
global $conf;
global $lodspk;
$ser;
$dPointer;
$docs = Utils::travelTree($data);
require_once $conf['home'] . 'lib/arc2/ARC2.php';
$parser = ARC2::getRDFParser();
$triples = array();
foreach ($docs as $d) {
$parser->parse($conf['basedir'], $d);
$t = $parser->getTriples();
$triples = array_merge($triples, $t);
}
if ($lodspk['mirror_external_uris']) {
global $uri;
global $localUri;
$t = array();
$t['s'] = $localUri;
$t['s_type'] = 'uri';
$t['p'] = "http://www.w3.org/2002/07/owl#sameAs";
$t['o'] = $uri;
$t['o_type'] = 'uri';
array_push($triples, $t);
$t['p'] = "http://www.w3.org/2000/10/swap/pim/contact#preferredURI";
array_push($triples, $t);
}
switch ($extension) {
case 'ttl':
$ser = ARC2::getTurtleSerializer();
break;
case 'nt':
$ser = ARC2::getNTriplesSerializer();
break;
case 'json':
$ser = ARC2::getRDFJSONSerializer();
break;
case 'rdf':
$ser = ARC2::getRDFXMLSerializer();
break;
case 'html':
return array("content" => $triples, "serialized" => false);
break;
default:
$ser = null;
}
if ($ser != null) {
$doc = $ser->getSerializedTriples($triples);
} else {
$doc = var_export($data, true);
}
return array("content" => $doc, "serialized" => true);
}
示例5: header
break;
default:
$ser = ARC2::getTurtleSerializer(array('ns' => $ns));
break;
}
$output = "";
if ($outformat == "turtle") {
$output = $ser->getSerializedTriples($triples);
header("Content-Type: text/turtle");
} else {
if ($outformat == "rdfxml") {
$output = $ser->getSerializedTriples($triples);
header("Content-Type: application/rdf+xml");
} else {
if ($outformat == "json") {
$ser = ARC2::getRDFJSONSerializer(array('ns' => $ns));
$output = $ser->getSerializedTriples($triples);
} else {
if ($outformat == "ntriples") {
$output = $ser->getSerializedTriples($triples);
header("Content-Type: text/plain");
} else {
if ($outformat == "text") {
$output = getTextFromTriples($triples);
header("Content-Type: text/plain");
} else {
$output = $ser->getSerializedTriples($triples);
header("Content-Type: text/turtle");
}
}
}
示例6: toRDFJSON
function toRDFJSON()
{
$ser = ARC2::getRDFJSONSerializer(array('ns' => $this->ns));
return $ser->getSerializedIndex($this->index);
}