function ARC_sparql_parser::parse_GraphPatternNotTriples in Taxonomy import/export via XML 5
Same name and namespace in other branches
- 5.2 arc/ARC_sparql_parser.php \ARC_sparql_parser::parse_GraphPatternNotTriples()
- 6.2 arc/ARC_sparql_parser.php \ARC_sparql_parser::parse_GraphPatternNotTriples()
- 6 arc/ARC_sparql_parser.php \ARC_sparql_parser::parse_GraphPatternNotTriples()
1 call to ARC_sparql_parser::parse_GraphPatternNotTriples()
File
- arc/
ARC_sparql_parser.php, line 757
Class
Code
function parse_GraphPatternNotTriples($val = "") {
/* optional */
if (preg_match("/^(OPTIONAL)(\\s*)(\\{.*)\$/is", $val, $matches)) {
$bracket_data = $this
->extract_bracket_data($matches[3]);
return array(
"type" => "optional",
"pattern" => $this
->parse_GroupGraphPattern("{" . trim($bracket_data) . "}"),
"unparsed_val" => trim(substr($val, strlen($matches[1] . $matches[2] . $bracket_data) + 2)),
);
}
/* group or union */
if (($sub_result = $this
->parse_GroupGraphPattern($val)) && $sub_result["type"]) {
$val = $sub_result["unparsed_val"];
$result = $sub_result;
/* union */
if (preg_match("/^UNION/i", $val)) {
unset($sub_result["unparsed_val"]);
$result = array(
"type" => "union",
"entries" => array(
$sub_result,
),
);
while (preg_match("/^UNION\\s*(.*)\$/s", $val, $matches)) {
$val = trim($matches[1]);
if (($sub_result = $this
->parse_GroupGraphPattern($val)) && $sub_result["type"]) {
$val = $sub_result["unparsed_val"];
unset($sub_result["unparsed_val"]);
$result["entries"][] = $sub_result;
}
}
$result["unparsed_val"] = $val;
}
return $result;
}
/* graph */
if ($sub_result = $this
->parse_GraphGraphPattern($val)) {
return $sub_result;
}
/* constraint */
if ($sub_result = $this
->parse_Constraint($val)) {
return $sub_result;
}
/* else */
return false;
}