[redland-dev] API wish - bind identifiers in queries

Dave Beckett dave at dajobe.org
Sat Jun 23 17:33:27 BST 2007


tobutaz at gmail.com wrote:
> I'm looking for easier ways to run SPARQL queries.
> For example, if I pass around a node instance in my code, I'd like a
> simple way to query what properties or neighbours it has in the graph.
> 
> I've also used rdflib for a while (writing in python), and it has a
> nice API for this.
> Besides graph.execute(SPARQLQuery('SELECT *')), you can add a bindings
> parameter and a namespaces parameter:
> 
> graph.execute(SPARQLQuery(
>  'SELECT ?friend WHERE { ?sam x:knows ?friend }'),
>  bindings={ 'sam': samNode }, namespaces={ 'x': nsNode })
> 
> When the query is run, ?sam and x:knows exist within the query.
> There is really no other way to do that without extra knowledge about
> samNode and rewriting the query.

Yes, bindings would be useful.  I have noted this email as a feature
request at http://bugs.librdf.org/mantis/view.php?id=208

> ...


Dave


More information about the redland-dev mailing list