本文整理汇总了PHP中MemModel::rdqlQueryasIterator方法的典型用法代码示例。如果您正苦于以下问题:PHP MemModel::rdqlQueryasIterator方法的具体用法?PHP MemModel::rdqlQueryasIterator怎么用?PHP MemModel::rdqlQueryasIterator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MemModel
的用法示例。
在下文中一共展示了MemModel::rdqlQueryasIterator方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: MemModel
$model = new MemModel();
// Load and parse document
$model->load($base);
// Show input model
//$model->writeAsHtmlTable();
echo "<p>";
echo "<BR>show the age of all employees ,using the RdqlResultIterator<BR>";
$rdql_query = '
SELECT ?givenName, ?age
WHERE (?x, v:age, ?age),
(?x, vcard:N, ?blank),
(?blank, vcard:Given, ?givenName)
USING vcard FOR <http://www.w3.org/2001/vcard-rdf/3.0#>
v FOR <http://sampleVocabulary.org/1.3/People#>';
//query model, get RDQLResultIterator
$rdqlIter = $model->rdqlQueryasIterator($rdql_query);
//get different Result labels as array
$result_labels = $rdqlIter->getResultLabels();
echo "<BR><b>Result Label Names:</b> ";
for ($i = 0; $i < count($result_labels); $i++) {
echo $result_labels[$i] . " ";
}
echo "<BR><B>Number of results:</B> " . $rdqlIter->countResults();
echo "<BR><B>Result objects, serialized to string:</B><BR>";
//serialize result to string
while ($rdqlIter->hasNext()) {
$curren_result = $rdqlIter->next();
echo "<BR>";
for ($j = 0; $j < count($result_labels); $j++) {
echo $curren_result[$result_labels[$j]]->toString() . "<BR> ";
}