I'm using EasyRDF to manage SPARL query to a remote data service. It works fine when I use a simple search box; I get a $return object and I can retrieve the separate results from that. However, I'd like to make the search box autocomplete and get the results in a dropdown as I type. The various resources I've read suggest that I need to build a piece of json and use that to populate the autocomplete list. However, I can't see how to make a json object out of the return from my program.
I've tried json_encode but that doesn't seem to work. Can anyone advise please? Any help much appreciated.
For information, here is the raw dump data that I get back from a typical search. This is just the first section and then the first array member. Apologies for any mangled formatting.
object(EasyRdf\Sparql\Result)#20 (4) {
["type":"EasyRdf\Sparql\Result":private]=>
string(8) "bindings"
["boolean":"EasyRdf\Sparql\Result":private]=>
NULL
["fields":"EasyRdf\Sparql\Result":private]=>
array(2) {
[0]=>
string(7) "concept"
[1]=>
string(11) "searchLabel"
}
["storage":"ArrayIterator":private]=>
array(5) {
[0]=>
object(stdClass)#33 (2) {
["concept"]=>
object(EasyRdf\Resource)#38 (2) {
["uri":protected]=>
["graph":protected]=>
NULL
}
["searchLabel"]=>
object(EasyRdf\Literal)#40 (3) {
["value":protected]=>
string(25) "Stomata and gas diffusion"
["lang":protected]=>
string(2) "en"
["datatype":protected]=>
NULL
}
}