protected function EasyRdf_Parser_Turtle::parsePredicate in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php \EasyRdf_Parser_Turtle::parsePredicate()
Parse a predicate [11] @ignore
1 call to EasyRdf_Parser_Turtle::parsePredicate()
- EasyRdf_Parser_Turtle::parsePredicateObjectList in vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Parser/ Turtle.php - Parse a predicateObjectList [7] @ignore
File
- vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Parser/ Turtle.php, line 344
Class
- EasyRdf_Parser_Turtle
- Class to parse Turtle with no external dependancies.
Code
protected function parsePredicate() {
// Check if the short-cut 'a' is used
$c1 = $this
->read();
if ($c1 == 'a') {
$c2 = $this
->read();
if (self::isWhitespace($c2)) {
// Short-cut is used, return the rdf:type URI
return array(
'type' => 'uri',
'value' => EasyRdf_Namespace::get('rdf') . 'type',
);
}
// Short-cut is not used, unread all characters
$this
->unread($c2);
}
$this
->unread($c1);
// Predicate is a normal resource
$predicate = $this
->parseValue();
if ($predicate['type'] == 'uri') {
return $predicate;
}
else {
throw new EasyRdf_Parser_Exception("Turtle Parse Error: Illegal predicate type: " . $predicate['type'], $this->line, $this->column);
}
}