Generated query:
SELECT ?var0 ?ayBnUcmPOJ ?JqJkDUbYJz ?yEGKzXBmeELabel ?wqKHjexIRiLabel ?JqJkDUbYJzLabel WHERE { ?yEGKzXBmeE wdt:P31 ?ayBnUcmPOJ . ?yEGKzXBmeE wdt:P31 ?kvuHNnvGIw . ?yEGKzXBmeE p:P39 ?zmNSDapQVj . ?kvuHNnvGIw wdt:P279* wd:Q622852 . ?zmNSDapQVj ps:P39 wd:Q30185 . ?zmNSDapQVj pq:P642 ?JqJkDUbYJz . SERVICE wikibase:label {bd:serviceParam wikibase:language "en".} . OPTIONAL { ?yEGKzXBmeE wdt:P18 ?var0 } }


Click to display print_r($query)
EasyRdf\Sparql\Result Object
(
    [type:EasyRdf\Sparql\Result:private] => bindings
    [boolean:EasyRdf\Sparql\Result:private] => 
    [fields:EasyRdf\Sparql\Result:private] => Array
        (
            [0] => var0
            [1] => ayBnUcmPOJ
            [2] => JqJkDUbYJz
            [3] => yEGKzXBmeELabel
            [4] => wqKHjexIRiLabel
            [5] => JqJkDUbYJzLabel
        )

    [parseState:EasyRdf\Sparql\Result:private] => Array
        (
        )

    [storage:ArrayIterator:private] => Array
        (
            [0] => stdClass Object
                (
                    [JqJkDUbYJz] => EasyRdf\Resource Object
                        (
                            [uri:protected] => http://www.wikidata.org/entity/Q2285949
                            [graph:protected] => 
                        )

                    [wdt:P31] => EasyRdf\Resource Object
                        (
                            [uri:protected] => http://www.wikidata.org/entity/Q144
                            [graph:protected] => 
                        )

                    [subject label] => EasyRdf\Literal Object
                        (
                            [value:protected] => Bosco the dog
                            [lang:protected] => en
                            [datatype:protected] => 
                        )

                    [JqJkDUbYJz label] => EasyRdf\Literal Object
                        (
                            [value:protected] => Sunol
                            [lang:protected] => en
                            [datatype:protected] => 
                        )

                )

            [1] => stdClass Object
                (
                    [JqJkDUbYJz] => EasyRdf\Resource Object
                        (
                            [uri:protected] => http://www.wikidata.org/entity/Q2285949
                            [graph:protected] => 
                        )

                    [wdt:P31] => EasyRdf\Resource Object
                        (
                            [uri:protected] => http://www.wikidata.org/entity/Q2740853
                            [graph:protected] => 
                        )

                    [subject label] => EasyRdf\Literal Object
                        (
                            [value:protected] => Bosco the dog
                            [lang:protected] => en
                            [datatype:protected] => 
                        )

                    [JqJkDUbYJz label] => EasyRdf\Literal Object
                        (
                            [value:protected] => Sunol
                            [lang:protected] => en
                            [datatype:protected] => 
                        )

                )

            [2] => stdClass Object
                (
                    [JqJkDUbYJz] => EasyRdf\Resource Object
                        (
                            [uri:protected] => http://www.wikidata.org/entity/Q1899902
                            [graph:protected] => 
                        )

                    [wdt:P31] => EasyRdf\Resource Object
                        (
                            [uri:protected] => http://www.wikidata.org/entity/Q144
                            [graph:protected] => 
                        )

                    [subject label] => EasyRdf\Literal Object
                        (
                            [value:protected] => Duke the Dog
                            [lang:protected] => en
                            [datatype:protected] => 
                        )

                    [JqJkDUbYJz label] => EasyRdf\Literal Object
                        (
                            [value:protected] => Cormorant Township
                            [lang:protected] => en
                            [datatype:protected] => 
                        )

                )

        )

)