Hi Markus,
thank you for your bug report. The problem is in method
findInNamedGraphs($graphnode,$subject,$predicate,$object) of DatasetMem
and DatasetDb. The method of DatasetMem returns an iterator over all
matched triples OR quads depending on the value of $graphnode. The
method of DatasetDb returns always an iterator over all matched quads.
I fixed it and put it in our CVS.
Regards,
Tobias
> Hi again,
>
> i fixed the problem in ../rap/api/sparql/SparqlEngine.php in method
> _buildResultSet(). The problem was, that the value of $triple in the
> foreach loop is a Statement object if queried against the default
> graph and otherwise the value is a Quad object if queried against a
> named graph. I hope this fits to your needs and is a real bugfix
> without following a new bug!
>
> regards, markus
>
>
> /**
> * Builds the resultset.
> *
> * @param GraphPattern $pattern
> * @param Array $resmodel
> * @return Array
> */
> protected function _buildResultSet($pattern,$resmodel){
> // determine variables and their corresponding values
> $result = null;
> if(is_string($pattern->getSubject())){
> $n = 0;
> foreach($resmodel['trip'] as $key => $triple){
> if(isset($resmodel['graphvar'][$key]))
> $result[$n][$resmodel['graphvar'][$key]] =
> $resmodel['graph'][$key];
>
> // FIXED
> if(isset($triple->subj)) {
> $result[$n++][$pattern->getSubject()] = $triple->subj;
> } else {
> $result[$n++][$pattern->getSubject()] = $triple->statement->subj;
> }
> }
> }
> if(is_string($pattern->getPredicate())){
> $n = 0;
> foreach($resmodel['trip'] as $key => $triple){
> if(isset($resmodel['graphvar'][$key]))
> $result[$n][$resmodel['graphvar'][$key]] =
> $resmodel['graph'][$key];
>
> // FIXED
> if(isset($triple->pred)) {
> $result[$n++][$pattern->getPredicate()] = $triple->pred;
> } else {
> $result[$n++][$pattern->getPredicate()] =
> $triple->statement->pred;
> }
> }
> }
> if(is_string($pattern->getObject())){
> $n = 0;
> foreach($resmodel['trip'] as $key => $triple){
> if(isset($resmodel['graphvar'][$key]))
> $result[$n][$resmodel['graphvar'][$key]] =
> $resmodel['graph'][$key];
>
> // FIXED
> if(isset($triple->obj)) {
> $result[$n++][$pattern->getObject()] = $triple->obj;
> } else {
> $result[$n++][$pattern->getObject()] = $triple->statement->obj;
> }
> }
> }
>
> return $result;
> }
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting
> language
> that extends applications into web and mobile media. Attend the live
> webcast
> and join the prime developer group breaking into this new coding
> territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
> _______________________________________________
> Rdfapi-php-interest mailing list
> Rdf...@li...
> https://lists.sourceforge.net/lists/listinfo/rdfapi-php-interest
|