本文整理汇总了PHP中ARC2::getParser方法的典型用法代码示例。如果您正苦于以下问题:PHP ARC2::getParser方法的具体用法?PHP ARC2::getParser怎么用?PHP ARC2::getParser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ARC2
的用法示例。
在下文中一共展示了ARC2::getParser方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parse
/**
* Parse an RDF document into an EasyRdf_Graph
*
* @param object EasyRdf_Graph $graph the graph to load the data into
* @param string $data the RDF document data
* @param string $format the format of the input data
* @param string $baseUri the base URI of the data being parsed
* @return boolean true if parsing was successful
*/
public function parse($graph, $data, $format, $baseUri)
{
parent::checkParseParams($graph, $data, $format, $baseUri);
if (array_key_exists($format, self::$_supportedTypes)) {
$className = self::$_supportedTypes[$format];
} else {
throw new EasyRdf_Exception("EasyRdf_Parser_Arc does not support: {$format}");
}
$parser = ARC2::getParser($className);
if ($parser) {
$parser->parse($baseUri, $data);
$rdfphp = $parser->getSimpleIndex(false);
return parent::parse($graph, $rdfphp, 'php', $baseUri);
} else {
throw new EasyRdf_Exception("ARC2 failed to get a {$className} parser.");
}
}
示例2: parse
/**
* Parse an RDF document
*
* @param string $uri the base URI of the data
* @param string $data the document data
* @param string $format the format of the input data
* @return array the parsed data
*/
public function parse($uri, $data, $format)
{
if (!is_string($uri) or $uri == null or $uri == '') {
throw new InvalidArgumentException("\$uri should be a string and cannot be null or empty");
}
if (!is_string($data) or $data == null or $data == '') {
throw new InvalidArgumentException("\$data should be a string and cannot be null or empty");
}
if (!is_string($format) or $format == null or $format == '') {
throw new InvalidArgumentException("\$format should be a string and cannot be null or empty");
}
if (array_key_exists($format, self::$_supportedTypes)) {
$className = self::$_supportedTypes[$format];
} else {
throw new EasyRdf_Exception("Parsing documents of type {$format} " . "is not supported by EasyRdf_Parser_Arc.");
}
$parser = ARC2::getParser($className);
if ($parser) {
$parser->parse($uri, $data);
return $parser->getSimpleIndex(false);
} else {
throw new EasyRdf_Exception("ARC2 failed to get a {$className} parser.");
}
}
示例3: getSPARQLScriptParser
function getSPARQLScriptParser($a = '')
{
return ARC2::getParser('SPARQLScript', $a);
}