$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> "; }