pre-binding results in RDF::Query

Gregory Williams greg at evilfunhouse.com
Wed Jun 9 20:22:44 CEST 2010


On Jun 9, 2010, at 11:50 AM, Toby Inkster wrote:

> Greg, there seems to be support for something like this in RDF::Query:
> 
> 	$sparql = <<SPARQL;
> 	PREFIX foaf: <http://xmlns.com/foaf/0.1/>
> 	SELECT *
> 	WHERE { ?person foaf:name ?name . }
> 	SPARQL
> 	
> 	$query = RDF::Query->new($sparql);
> 	$result = $query->execute($model,
> 		bind => {
> 		  name => RDF::Trine::Node::Literal->new('Bob')
> 		});
> 
> It works, but I only discovered it by chance as it doesn't seem to be
> documented anywhere. Can this be documented as it's super awesome!

Yeah, I'll try to get some documentation in for that and some better tests. It's something I put in because it made testing easier, but never decided if it was a good/stable API. With the BINDINGS clause in SPARQL 1.1, though, it's likely that they should do the same thing and can use the same code path, so probably a good time to stabilize it.

.g



More information about the Dev mailing list