function _rdfx_query_find_literal in RDF Extensions 7.2
2 calls to _rdfx_query_find_literal()
- _evoc_query_for_term_description in evoc/evoc.load_vocab.inc
- _rdfx_get_vocabulary_details in ./rdfx.terms.inc
File
- ./rdfx.query.inc, line 17
- Functions for querying with SPARQL or extracting triples from an ARC2-style
data structure.
Code
function _rdfx_query_find_literal(&$model, $queries) {
$literal = array();
foreach ($queries as $query) {
list($s, $p, $o) = $query;
$triples = _rdfx_query_find_all($model, $s, $p, $o);
foreach ($triples as $triple) {
if ($triple['o_lang'] !== '') {
if (preg_match('/(zh-hans)|(zh-hant)|(pt-pt)|(pt-br)/', $triple['o_lang'])) {
$langcode = $triple['o_lang'];
}
else {
$lang_array = explode('-', $triple['o_lang']);
$langcode = !empty($lang_array[0]) ? $lang_array[0] : $triple['o_lang'];
}
}
else {
$langcode = 'und';
}
$literal[$langcode] = $triple['o'];
}
}
return $literal;
}