I"m not sure which query module you're using, but with SPARQL, you would just get rid of the ?label term and use "City" instead.  In fact, whatever the query engine, you can probably just use sprintf or something similar to construct the query clause with "City" in place of ?label.

Something like

char keyword[]="City";
char query_string[BIGENOUGHBUFFER];

sprintf(query_string, "select ?comment from <C:/datafile.rdf> where (?x rdf:type rdfs:Class) (?x rdfs:label \"%s\") (?x rdfs:comment ?comment) using rdf for <http://www.w3.org/1999/02/22-rdf-syntax-ns#>, rdfs for <http://www.w3.org/2000/01/rdf-schema#>", keyword);

I won't address the potential unicode and buffer overrun problems. I prefer c++ classes to deal with the buffer issues and haven't yet settled completely on how I'm handling unicode.

-j

Joe Andrieu
[email protected]
+1 (805) 705-8651
http://www.switchbook.com

On 6/20/2010 4:11 AM, Jagdev Bhogal wrote:
Dear all
I have a c-program which currently parses an rdf file and retrieves all of the nodes using:
 
const char *query_string="select ?label, ?comment from <C:/datafile.rdf> where (?x rdf:type rdfs:Class) (?x rdfs:label ?label) (?x rdfs:comment ?comment) using rdf for <http://www.w3.org/1999/02/22-rdf-syntax-ns#>,rdfs for <http://www.w3.org/2000/01/rdf-schema#>";
Lets say I have a string defined as:
 
char keyword[]="City";
 
My question is can we have a where clause in the query, so that we only retrieve results where the strcmp(label, keyword) = 0 in other words only retrieve those results where the label is equal to the keyword which in this case is "City".
 
If further explanation is needed let me know.
Thank you
Jagdev
 
 
 
 
 
 

Through our significant contribution to the creative industries and the city's cultural and artistic life,
Birmingham City University is proud to support Birmingham's bid to be UK City of Culture in 2013

http://birminghamculture.org
http://www.bcu.ac.uk/about-us/excellent-arts

_______________________________________________ redland-dev mailing list [email protected] http://lists.librdf.org/mailman/listinfo/redland-dev


_______________________________________________
redland-dev mailing list
[email protected]
http://lists.librdf.org/mailman/listinfo/redland-dev

Reply via email to