protected function EasyRdf_Parser_RdfXml::startState1 in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/RdfXml.php \EasyRdf_Parser_RdfXml::startState1()
@ignore
3 calls to EasyRdf_Parser_RdfXml::startState1()
- EasyRdf_Parser_RdfXml::startElementHandler in vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Parser/ RdfXml.php - @ignore
- EasyRdf_Parser_RdfXml::startState0 in vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Parser/ RdfXml.php - @ignore
- EasyRdf_Parser_RdfXml::startState4 in vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Parser/ RdfXml.php - @ignore
File
- vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Parser/ RdfXml.php, line 281
Class
- EasyRdf_Parser_RdfXml
- A pure-php class to parse RDF/XML.
Code
protected function startState1($t, $a) {
$s = array(
'x_base' => $this
->getParentXBase(),
'x_lang' => $this
->getParentXLang(),
'li_count' => 0,
);
if (isset($a[$this->xml . 'base'])) {
$s['x_base'] = $this->xBase
->resolve($a[$this->xml . 'base']);
}
if (isset($a[$this->xml . 'lang'])) {
$s['x_lang'] = $a[$this->xml . 'lang'];
}
/* ID */
if (isset($a[$this->rdf . 'ID'])) {
$s['type'] = 'uri';
$s['value'] = $s['x_base']
->resolve('#' . $a[$this->rdf . 'ID']);
/* about */
}
elseif (isset($a[$this->rdf . 'about'])) {
$s['type'] = 'uri';
$s['value'] = $s['x_base']
->resolve($a[$this->rdf . 'about']);
/* bnode */
}
else {
$s['type'] = 'bnode';
if (isset($a[$this->rdf . 'nodeID'])) {
$s['value'] = $this
->remapBnode($a[$this->rdf . 'nodeID']);
}
else {
$s['value'] = $this->graph
->newBNodeId();
}
}
/* sub-node */
if ($this->state === 4) {
$supS = $this
->getParentS();
/* new collection */
if (isset($supS['o_is_coll']) && $supS['o_is_coll']) {
$coll = array(
'type' => 'bnode',
'value' => $this->graph
->newBNodeId(),
'is_coll' => true,
'x_base' => $s['x_base'],
'x_lang' => $s['x_lang'],
);
$this
->add($supS['value'], $supS['p'], $coll['value'], $supS['type'], $coll['type']);
$this
->add($coll['value'], $this->rdf . 'first', $s['value'], $coll['type'], $s['type']);
$this
->pushS($coll);
}
elseif (isset($supS['is_coll']) && $supS['is_coll']) {
/* new entry in existing coll */
$coll = array(
'type' => 'bnode',
'value' => $this->graph
->newBNodeId(),
'is_coll' => true,
'x_base' => $s['x_base'],
'x_lang' => $s['x_lang'],
);
$this
->add($supS['value'], $this->rdf . 'rest', $coll['value'], $supS['type'], $coll['type']);
$this
->add($coll['value'], $this->rdf . 'first', $s['value'], $coll['type'], $s['type']);
$this
->pushS($coll);
/* normal sub-node */
}
elseif (isset($supS['p']) && $supS['p']) {
$this
->add($supS['value'], $supS['p'], $s['value'], $supS['type'], $s['type']);
}
}
/* typed node */
if ($t !== $this->rdf . 'Description') {
$this
->add($s['value'], $this->rdf . 'type', $t, $s['type'], 'uri');
}
/* (additional) typing attr */
if (isset($a[$this->rdf . 'type'])) {
$this
->add($s['value'], $this->rdf . 'type', $a[$this->rdf . 'type'], $s['type'], 'uri');
}
/* Seq|Bag|Alt */
// if (in_array($t, array($this->rdf.'Seq', $this->rdf.'Bag', $this->rdf.'Alt'))) {
// # FIXME: what is this?
// $s['is_con'] = true;
// }
/* any other attrs (skip rdf and xml, except rdf:_, rdf:value, rdf:Seq) */
foreach ($a as $k => $v) {
if (strpos($k, $this->xml) === false && strpos($k, $this->rdf) === false || preg_match('/(\\_[0-9]+|value|Seq|Bag|Alt|Statement|Property|List)$/', $k)) {
if (strpos($k, ':')) {
$this
->add($s['value'], $k, $v, $s['type'], 'literal', null, $s['x_lang']);
}
}
}
$this
->pushS($s);
$this->state = 2;
}