You are here

function ARC_sparql_parser::parse_BlankNode in Taxonomy import/export via XML 6

Same name and namespace in other branches
  1. 5.2 arc/ARC_sparql_parser.php \ARC_sparql_parser::parse_BlankNode()
  2. 5 arc/ARC_sparql_parser.php \ARC_sparql_parser::parse_BlankNode()
  3. 6.2 arc/ARC_sparql_parser.php \ARC_sparql_parser::parse_BlankNode()
3 calls to ARC_sparql_parser::parse_BlankNode()
ARC_sparql_parser::parse_GraphGraphPattern in arc/ARC_sparql_parser.php
ARC_sparql_parser::parse_PrimaryExpression in arc/ARC_sparql_parser.php
ARC_sparql_parser::parse_Triples1 in arc/ARC_sparql_parser.php

File

arc/ARC_sparql_parser.php, line 1610

Class

ARC_sparql_parser

Code

function parse_BlankNode($val = "") {

  /* _:foo */
  if (preg_match("/^_\\:([a-z0-9\\.\\-\\_]*)(.*)\$/si", $val, $matches)) {
    if (!in_array("__" . $matches[1], $this->infos["vars"])) {
      $this->infos["vars"][] = "__" . $matches[1];
    }
    return array(
      "type" => "bnode",
      "val" => "_:" . $matches[1],
      "unparsed_val" => trim($matches[2]),
    );
  }

  /* [] */
  if (preg_match("/^\\[\\s*\\](.*)\$/s", $val, $matches)) {
    $id = $this
      ->get_next_bnode_id();
    if (!in_array(str_replace(":", "_", $id), $this->infos["vars"])) {
      $this->infos["vars"][] = str_replace(":", "_", $id);
    }
    return array(
      "type" => "bnode",
      "val" => $id,
      "unparsed_val" => trim($matches[1]),
    );
  }

  /* else */
  return false;
}