You are here

function ARC_sparql_parser::parse_RDFLiteral in Taxonomy import/export via XML 6.2

Same name and namespace in other branches
  1. 5.2 arc/ARC_sparql_parser.php \ARC_sparql_parser::parse_RDFLiteral()
  2. 5 arc/ARC_sparql_parser.php \ARC_sparql_parser::parse_RDFLiteral()
  3. 6 arc/ARC_sparql_parser.php \ARC_sparql_parser::parse_RDFLiteral()
2 calls to ARC_sparql_parser::parse_RDFLiteral()
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 1545

Class

ARC_sparql_parser

Code

function parse_RDFLiteral($val = "") {
  if (preg_match("/^(_string_[0-9]+)/", $val, $matches)) {
    $result = array(
      "type" => "literal",
      "val" => $this->str_placeholders[$matches[1]]["val"],
      "delim_code" => $this->str_placeholders[$matches[1]]["delim_code"],
    );
    $unparsed_val = trim(substr($val, strlen($matches[0])));

    /* lang */
    if (preg_match("/^\\@([a-z]+)(\\-?)([a-z0-9]*)/i", $unparsed_val, $matches)) {
      $result["lang"] = $matches[1] . $matches[2] . $matches[3];
      $unparsed_val = trim(substr($unparsed_val, strlen($matches[0])));
    }
    elseif (preg_match("/^\\^\\^(.*)/s", $unparsed_val, $matches)) {
      if ($sub_result = $this
        ->parse_IRIref($matches[1])) {
        $result["dt"] = $sub_result["val"];
        $unparsed_val = trim($sub_result["unparsed_val"]);
      }
    }
    $result["unparsed_val"] = $unparsed_val;
    return $result;
  }
  return false;
}