本文整理汇总了PHP中ARC2::getSer方法的典型用法代码示例。如果您正苦于以下问题:PHP ARC2::getSer方法的具体用法?PHP ARC2::getSer怎么用?PHP ARC2::getSer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ARC2
的用法示例。
在下文中一共展示了ARC2::getSer方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: serialise
/**
* Serialise an EasyRdf\Graph into RDF format of choice.
*
* @param Graph $graph An EasyRdf\Graph object.
* @param string $format The name of the format to convert to.
* @param array $options
*
* @throws Exception
*
* @return string The RDF in the new desired format.
*/
public function serialise($graph, $format, array $options = array())
{
parent::checkSerialiseParams($graph, $format);
if (array_key_exists($format, self::$supportedTypes)) {
$className = self::$supportedTypes[$format];
} else {
throw new Exception("EasyRdf\\Serialiser\\Arc does not support: {$format}");
}
$serialiser = \ARC2::getSer($className);
if ($serialiser) {
return $serialiser->getSerializedIndex(parent::serialise($graph, 'php'));
} else {
throw new Exception("ARC2 failed to get a {$className} serialiser.");
}
}
示例2: serialise
/**
* Serialise an EasyRdf_Graph into RDF format of choice.
*
* @param string $graph An EasyRdf_Graph object.
* @param string $format The name of the format to convert to.
* @return string The RDF in the new desired format.
*/
public function serialise($graph, $format)
{
parent::checkSerialiseParams($graph, $format);
if (array_key_exists($format, self::$_supportedTypes)) {
$className = self::$_supportedTypes[$format];
} else {
throw new EasyRdf_Exception("Serialising documents to {$format} " . "is not supported by EasyRdf_Serialiser_Arc.");
}
$serialiser = ARC2::getSer($className);
if ($serialiser) {
return $serialiser->getSerializedIndex(parent::serialise($graph, 'php'));
} else {
throw new EasyRdf_Exception("ARC2 failed to get a {$className} serialiser.");
}
}
示例3: getPOSHRDFSerializer
function getPOSHRDFSerializer($a = '')
{
return ARC2::getSer('POSHRDF', $a);
}
示例4: getRSS10Serializer
function getRSS10Serializer($a = '')
{
return ARC2::getSer('RSS10', $a);
}
示例5: serialize
public function serialize($type = "RDFXML")
{
$serializer = ARC2::getSer($type, array("ns" => $this->g->ns));
return $serializer->getSerializedTriples($this->toArcTriples());
}
示例6: serialise
/**
* Serialise an EasyRdf_Graph into RDF format of choice.
*
* @param string $graph An EasyRdf_Graph object.
* @param string $format The name of the format to convert to.
* @return string The RDF in the new desired format.
*/
public function serialise($graph, $format)
{
if ($graph == null or !is_object($graph) or get_class($graph) != 'EasyRdf_Graph') {
throw new InvalidArgumentException("\$graph should be an EasyRdf_Graph object and cannot be null");
}
if ($format == null or !is_string($format) or $format == '') {
throw new InvalidArgumentException("\$format should be a string and cannot be null or empty");
}
$rdfphp = $this->to_rdfphp($graph);
if ($format == 'php') {
return $rdfphp;
}
if (array_key_exists($format, self::$_supportedTypes)) {
$className = self::$_supportedTypes[$format];
} else {
throw new EasyRdf_Exception("Serialising documents to {$format} " . "is not supported by EasyRdf_Serialiser_Arc.");
}
$serialiser = ARC2::getSer($className);
if ($serialiser) {
return $serialiser->getSerializedIndex($rdfphp);
} else {
throw new EasyRdf_Exception("ARC2 failed to get a {$className} serialiser.");
}
}
示例7: getJSONLDSerializer
static function getJSONLDSerializer($a = '')
{
return ARC2::getSer('JSONLD', $a);
}
示例8: serialize
/**
* Returns the serialization of the entire RDF graph in memory using one of Arc2's serializers. By default the RDF/XML serializer is used, but others (try passing "Turtle" or "NTriples") can be used - see the Arc2 documentation.
*/
public function serialize($type = "RDFXML")
{
$ns = $this->ns;
unset($ns["dct"]);
// use dcterms for preference. duplicates seem to cause
// bugs in the serialiser
$serializer = ARC2::getSer($type, array("ns" => $ns));
return $serializer->getSerializedTriples($this->toArcTriples());
}